예제 #1
0
        /// <summary>
        /// Sets the site SNMP.
        /// </summary>
        /// <param name="setting">The setting.</param>
        /// <param name="siteName">Name of the site.</param>
        /// <returns>returns <c>true</c> on success.</returns>
        public async Task <BoolResponse> SetSiteSnmpAsync(SnmpSetting setting, string siteName = null)
        {
            var path        = $"api/s/{(siteName ?? Site)}/rest/setting/snmp/";
            var oJsonObject = JObject.FromObject(setting);

            return(await ExecuteBoolCommandAsync(path, oJsonObject, "PUT"));
        }
예제 #2
0
        /// <summary>
        /// Sets the site SNMP.
        /// </summary>
        /// <param name="snmpId">The SNMP identifier.</param>
        /// <param name="setting">The setting.</param>
        /// <param name="siteName">Name of the site.</param>
        /// <returns>returns <c>true</c> on success.</returns>
        public async Task <BoolResponse> SetSiteSnmp(string snmpId, SnmpSetting setting, string siteName = null)
        {
            //TODO: Check if this is really needed. SetSiteSnmp will update the setting without the snmpId
            var path        = $"api/s/{(siteName ?? Site)}/rest/setting/snmp/{snmpId}";
            var oJsonObject = JObject.FromObject(setting);

            return(await ExecuteBoolCommandAsync(path, oJsonObject, "PUT"));
        }
예제 #3
0
        public async Task ShouldBeAbleToSetSnmp()
        {
            using (var unifiClient = new Client(_url, null, true))
            {
                var loginResult = await unifiClient.LoginAsync(_user, _pass);

                loginResult.Result.ShouldBeTrue();

                var site = await unifiClient.GetSiteDetailAsync();

                var snmpSetting = new SnmpSetting
                {
                    Community = "SetSnmp",
                    Enabled   = true,
                    SiteId    = site.Id
                };
                var result = await unifiClient.SetSiteSnmpAsync(snmpSetting);

                result.Result.ShouldBe(true);
            }
        }