Beispiel #1
0
        public async void PutOrganizationSnmpSettingsAsync()
        {
            const string    organizationId  = "myOrg";
            SnmpPutSettings snmpPutSettings = new SnmpPutSettings
            {
                V2cEnabled               = false,
                V3Enabled                = true,
                V3AuthenticationMode     = SnmpAuthenticationMode.Sha,
                V3AuthenticationPassword = "******",
                V3PrivacyMode            = SnmpPrivacyMode.Aes128,
                V3PrivacyPassword        = "******",
                PeerIps = new [] { IPAddress.Parse("192.168.0.1"), IPAddress.Parse("10.1.1.1") }
            };

            Mock <MerakiHttpApiClient> apiClientMock = new Mock <MerakiHttpApiClient>(MockBehavior.Strict, "apiKey");
            HttpStatusCode             statusCode    = HttpStatusCode.OK;

            apiClientMock.Setup(apiClient =>
                                apiClient.SendAsync(HttpMethod.Put, $"v0/organizations/{organizationId}/snmp", snmpPutSettings))
            .Returns(Task.FromResult(statusCode));
            // apiClientMock.As<IDisposable>().Setup(apiClient => apiClient.Dispose());
            apiClientMock.Protected().Setup("Dispose", true);

            using (MerakiDashboardClient merakiDashboardClient = new MerakiDashboardClient(apiClientMock.Object))
            {
                HttpStatusCode actualResponse =
                    await merakiDashboardClient.PutOrganizationSnmpSettingsAsync(organizationId, snmpPutSettings);

                Assert.Equal(statusCode, actualResponse);
            }

            apiClientMock.VerifyAll();
        }
Beispiel #2
0
        private static async Task PutSnmpSettings(string organizationId, MerakiDashboardClient merakiDashboardClient)
        {
            SnmpPutSettings snmpPutSettings = new SnmpPutSettings
            {
                V2cEnabled               = false,
                V3Enabled                = true,
                V3AuthenticationMode     = SnmpAuthenticationMode.Sha,
                V3AuthenticationPassword = "******",
                V3PrivacyMode            = SnmpPrivacyMode.Aes128,
                V3PrivacyPassword        = "******",
                PeerIps = new[] { IPAddress.Parse("8.8.8.8") }
            };

            System.Console.Out.WriteLine(await merakiDashboardClient.PutOrganizationSnmpSettingsAsync(organizationId, snmpPutSettings));
        }