summaryrefslogtreecommitdiffstats
path: root/app/common/services
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2018-05-30 16:18:45 -0500
committerGunnar Mills <gmills@us.ibm.com>2018-06-06 13:48:13 +0000
commita45c3852258dd1a468febdda0a5ff8f1c44de538 (patch)
treebb8d337cd256d060a0d2351add201eba2714f2a4 /app/common/services
parent659651e88cf8a4b38b11816da34399830fd335b5 (diff)
downloadphosphor-webui-a45c3852258dd1a468febdda0a5ff8f1c44de538.tar.gz
phosphor-webui-a45c3852258dd1a468febdda0a5ff8f1c44de538.zip
Set IPV4 interfaces
If a gateway, netmask, or IP address of an IPV4 interface changes on the page, when the user hits "Save changes" and confirms the popup, delete the old IPV4 interface and create a new one with the new values. After talking with Ratan, deleting then adding is the the correct way to change IPV4 interfaces. More information can be found in the network README up for review: https://gerrit.openbmc-project.xyz/#/c/6872/ Tested: Changed IPV4 interface properties on a Witherspoon. Also tested a Witherspoon in DHCP mode then moved over to a static IP. Change-Id: Idc0026aa01533ea327b53efc57e21147c4b68967 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Diffstat (limited to 'app/common/services')
-rw-r--r--app/common/services/api-utils.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index c8617d3..9f1cc23 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -225,6 +225,46 @@ window.angular && (function(angular) {
return response.data;
});
},
+ deleteIPV4: function(interfaceName, networkID) {
+ return $http({
+ method: 'POST',
+ url: DataService.getHost() +
+ '/xyz/openbmc_project/network/' + interfaceName +
+ '/ipv4/' + networkID + '/action/Delete',
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ withCredentials: true,
+ data: JSON.stringify({'data': []})
+ })
+ .then(function(response) {
+ return response.data;
+ });
+ },
+ addIPV4: function(
+ interfaceName, ipAddress, netmaskPrefixLength, gateway) {
+ return $http({
+ method: 'POST',
+ url: DataService.getHost() +
+ '/xyz/openbmc_project/network/' + interfaceName +
+ '/action/IP',
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ withCredentials: true,
+ data: JSON.stringify({
+ 'data': [
+ 'xyz.openbmc_project.Network.IP.Protocol.IPv4',
+ ipAddress, +netmaskPrefixLength, gateway
+ ]
+ })
+ })
+ .then(function(response) {
+ return response.data;
+ });
+ },
getLEDState: function() {
var deferred = $q.defer();
$http({
OpenPOWER on IntegriCloud