Set MAC address on "Save Settings"

Make a REST call to set the MAC address when the
"Save Settings" button is pressed.

Tested: Verified the MAC Address is set.
Change-Id: I39f6d4688842b3453fd219795d07f819ba4ba481
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/configuration/controllers/network-controller.js b/app/configuration/controllers/network-controller.js
index e764de8..b3d33f9 100644
--- a/app/configuration/controllers/network-controller.js
+++ b/app/configuration/controllers/network-controller.js
@@ -17,12 +17,32 @@
       $scope.interface = {};
       $scope.networkDevice = false;
       $scope.hostname = '';
+      $scope.set_network_error = '';
+      $scope.set_network_success = false;
+      $scope.selectedInterface = '';
 
       $scope.selectInterface = function(interfaceId) {
         $scope.interface = $scope.network.interfaces[interfaceId];
         $scope.selectedInterface = interfaceId;
         $scope.networkDevice = false;
       };
+      $scope.setNetworkSettings = function() {
+        $scope.set_network_error = '';
+        $scope.set_network_success = false;
+        // TODO openbmc/openbmc#3165: check if the network settings
+        // changed before setting
+        APIUtils
+            .setMACAddress(
+                $scope.selectedInterface, $scope.interface.MACAddress)
+            .then(
+                function(data) {
+                  $scope.set_network_success = true;
+                },
+                function(error) {
+                  console.log(error);
+                  $scope.set_network_error = 'MAC Address';
+                });
+      };
       APIUtils.getNetworkInfo().then(function(data) {
         $scope.network = data.formatted_data;
         $scope.hostname = data.hostname;