Set DHCP on "Save settings"

Set the DHCP enabled field when the user selects "Save settings"
and accepts the popup. Added a TODO for issue #3154, Rest server
should return a proper JSON bool.

Resolves openbmc/openbmc#3165

Tested: Set "Obtain an IP address automatically using DHCP"
on a Witherspoon.
Change-Id: I45c817e3ddd8bf9c4f582460b1f9230e38548ff8
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 9f1cc23..93b70e1 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -225,6 +225,23 @@
                 return response.data;
               });
         },
+        setDHCPEnabled: function(interfaceName, dhcpEnabled) {
+          return $http({
+                   method: 'PUT',
+                   url: DataService.getHost() +
+                       '/xyz/openbmc_project/network/' + interfaceName +
+                       '/attr/DHCPEnabled',
+                   headers: {
+                     'Accept': 'application/json',
+                     'Content-Type': 'application/json'
+                   },
+                   withCredentials: true,
+                   data: JSON.stringify({'data': dhcpEnabled})
+                 })
+              .then(function(response) {
+                return response.data;
+              });
+        },
         deleteIPV4: function(interfaceName, networkID) {
           return $http({
                    method: 'POST',