Add and modify SNMP Managers
This allows the user to add and edit SNMP managers.
Tested: Added SNMP managers on a Witherspoon.
Change-Id: Iab8d6463b03de75928e4989135172d93ab0f28a3
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 7920291..9aecab8 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -57,6 +57,17 @@
return ip.match(
/\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/);
},
+ deleteObject: function(path) {
+ return $http({
+ method: 'POST',
+ url: DataService.getHost() + path + '/action/Delete',
+ withCredentials: true,
+ data: JSON.stringify({'data': []})
+ })
+ .then(function(response) {
+ return response.data;
+ });
+ },
getHostState: function() {
var deferred = $q.defer();
$http({
@@ -194,6 +205,41 @@
}
};
},
+ addSNMPManager: function(address, port) {
+ return $http({
+ method: 'POST',
+ url: DataService.getHost() +
+ '/xyz/openbmc_project/network/snmp/manager/action/Client',
+ withCredentials: true,
+ data: JSON.stringify({'data': [address, +port]})
+ })
+ .then(function(response) {
+ return response.data;
+ });
+ },
+ setSNMPManagerPort: function(snmpManagerPath, port) {
+ return $http({
+ method: 'PUT',
+ url: DataService.getHost() + snmpManagerPath + '/attr/Port',
+ withCredentials: true,
+ data: JSON.stringify({'data': +port})
+ })
+ .then(function(response) {
+ return response.data;
+ });
+ },
+ setSNMPManagerAddress: function(snmpManagerPath, address) {
+ return $http({
+ method: 'PUT',
+ url: DataService.getHost() + snmpManagerPath +
+ '/attr/Address',
+ withCredentials: true,
+ data: JSON.stringify({'data': address})
+ })
+ .then(function(response) {
+ return response.data;
+ });
+ },
getNetworkInfo: function() {
var deferred = $q.defer();
$http({