[CORD-3166] Enable ONUs in VOLTHA

Change-Id: I61deed5b5582a25e8c627a813683a0cec6e95cf5
diff --git a/xos/synchronizer/models/volt.xproto b/xos/synchronizer/models/volt.xproto
index 2824de3..c612952 100644
--- a/xos/synchronizer/models/volt.xproto
+++ b/xos/synchronizer/models/volt.xproto
@@ -74,7 +74,7 @@
     required string device_type = 4 [help_text = "Device Type", default = "asfvolt16_olt", max_length = 254, null = False, db_index = False, blank = False];
 
     optional string device_id = 5 [max_length = 254, null = True, db_index = False, blank = False, feedback_state = True];
-    optional string admin_state = 6 [help_text = "admin_state", null = True, db_index = False, blank = False, feedback_state = True];
+    optional string admin_state = 6 [choices = "(('DISABLED', 'DISABLED'), ('ENABLED', 'ENABLED'))", default="ENABLED", help_text = "admin_state", null = True, db_index = False, blank = False];
     optional string oper_status = 7 [help_text = "oper_status", null = True, db_index = False, blank = False, feedback_state = True];
     optional string connect_status = 8 [help_text = "connect_status", null = True, db_index = False, blank = False, feedback_state = True];
 }
diff --git a/xos/synchronizer/steps/sync_onu_device.py b/xos/synchronizer/steps/sync_onu_device.py
index 579c13e..611496b 100644
--- a/xos/synchronizer/steps/sync_onu_device.py
+++ b/xos/synchronizer/steps/sync_onu_device.py
@@ -31,14 +31,29 @@
 
     observes = ONUDevice
 
+    def disable_onu(self, o):
+        volt_service = o.pon_port.olt_device.volt_service
+        voltha = Helpers.get_voltha_info(volt_service)
+
+        log.info("Disabling device %s in voltha" % o.device_id)
+        request = requests.post("%s:%d/api/v1/devices/%s/disable" % (voltha['url'], voltha['port'], o.device_id))
+
+        if request.status_code != 200:
+            raise Exception("Failed to disable ONU device %s: %s" % (o.serial_number, request.text))
+
+    def enable_onu(self, o):
+        volt_service = o.pon_port.olt_device.volt_service
+        voltha = Helpers.get_voltha_info(volt_service)
+
+        log.info("Enabling device %s in voltha" % o.device_id)
+        request = requests.post("%s:%d/api/v1/devices/%s/enable" % (voltha['url'], voltha['port'], o.device_id))
+
+        if request.status_code != 200:
+            raise Exception("Failed to enable ONU device %s: %s" % (o.serial_number, request.text))
+
     def sync_record(self, o):
 
         if o.admin_state == "DISABLED":
-            volt_service = o.pon_port.olt_device.volt_service
-            voltha = Helpers.get_voltha_info(volt_service)
-
-            log.info("Disabling device %s in voltha" % o.device_id)
-            request = requests.post("%s:%d/api/v1/devices/%s/disable" % (voltha['url'], voltha['port'], o.device_id))
-
-            if request.status_code != 200:
-                raise Exception("Failed to disable ONU device: %s" % request.text)
\ No newline at end of file
+            self.disable_onu(o)
+        if o.admin_state == "ENABLED":
+            self.enable_onu(o)
\ No newline at end of file
diff --git a/xos/synchronizer/steps/test_sync_onu_device.py b/xos/synchronizer/steps/test_sync_onu_device.py
index 85a4021..3cf1062 100644
--- a/xos/synchronizer/steps/test_sync_onu_device.py
+++ b/xos/synchronizer/steps/test_sync_onu_device.py
@@ -87,10 +87,12 @@
         sys.path = self.sys_path_save
 
     @requests_mock.Mocker()
-    def test_do_nothing(self, m):
+    def test_enable(self, m):
+        m.post("http://voltha_url:1234/api/v1/devices/test_id/enable")
+
         self.o.admin_state = "ENABLED"
         self.sync_step().sync_record(self.o)
-        self.assertFalse(m.called)
+        self.assertTrue(m.called)
 
     @requests_mock.Mocker()
     def test_disable(self, m):