Exemplo n.º 1
0
        public async void GetOrganizationSnmpSettingsAsync()
        {
            const string    organizationId  = "myOrg";
            SnmpGetSettings snmpGetSettings = new SnmpGetSettings
            {
                V2cEnabled           = false,
                V3Enabled            = true,
                V3AuthenticationMode = SnmpAuthenticationMode.Sha,
                V3PrivacyMode        = SnmpPrivacyMode.Aes128,
                Hostname             = "snmp.meraki.com",
                Port = 162
            };

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

            apiClientMock.Setup(apiClient => apiClient.GetAsync <SnmpGetSettings>($"v0/organizations/{organizationId}/snmp"))
            .Returns(Task.FromResult(snmpGetSettings));
            // apiClientMock.As<IDisposable>().Setup(apiClient => apiClient.Dispose());
            apiClientMock.Protected().Setup("Dispose", true);

            using (MerakiDashboardClient merakiDashboardClient = new MerakiDashboardClient(apiClientMock.Object))
            {
                SnmpGetSettings actualSnmpGetSettings = await merakiDashboardClient.GetOrganizationSnmpSettingsAsync(organizationId);

                Assert.Equal(snmpGetSettings, actualSnmpGetSettings);
            }

            apiClientMock.VerifyAll();
        }
Exemplo n.º 2
0
        private static async Task GetSnmpSettings(string organizationId, MerakiDashboardClient merakiDashboardClient)
        {
            SnmpGetSettings snmpGetSettings = await merakiDashboardClient.GetOrganizationSnmpSettingsAsync(organizationId);

            System.Console.Out.WriteLine(JsonConvert.SerializeObject(snmpGetSettings));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Is SNMP enabled on this Organization?
        /// </summary>
        /// <param name="merakiDashboardClient"></param>
        /// <param name="organizationId"></param>
        /// <returns></returns>
        private async Task Exercise3(MerakiDashboardClient merakiDashboardClient, string organizationId)
        {
            SnmpGetSettings snmpSettings = await merakiDashboardClient.GetOrganizationSnmpSettingsAsync(organizationId);

            await System.Console.Out.WriteLineAsync($"SNMP v2c enabled: {snmpSettings.V2cEnabled},  v3 enabled: {snmpSettings.V3Enabled}");
        }