VOL-577:asfvolt16: add support for reporting XGPON registration ID from ONU

Change-Id: I2ed786da17698c47529d4b557cd6b7a1390d1f3f
(cherry picked from commit 021e0bde11fd4794e2a5234d3bc714e9907487d6)
diff --git a/voltha/adapters/asfvolt16_olt/asfvolt16_device_handler.py b/voltha/adapters/asfvolt16_olt/asfvolt16_device_handler.py
index 851dd11..1539246 100644
--- a/voltha/adapters/asfvolt16_olt/asfvolt16_device_handler.py
+++ b/voltha/adapters/asfvolt16_olt/asfvolt16_device_handler.py
@@ -927,10 +927,22 @@
             msg = {'proxy_address': child_device.proxy_address,
                    'event': 'activation-completed', 'event_data': ind_info}
 
+            balSubTermInd = {}
+            serial_number=(ind_info['_vendor_id'] +
+                           ind_info['_vendor_specific'])
+            balSubTermInd["serial_number"] = serial_number.__str__()
+            balSubTermInd["registration_id"] = ind_info['registration_id'].__str__()
+            self.log.info('onu_activated:registration_id',balSubTermInd["registration_id"])
+            balSubTermInd["device_id"] = (self.device_id).__str__()
+
             # Send the event message to the ONU adapter
             self.adapter_agent.publish_inter_adapter_message(child_device.id,
                                                              msg)
             if ind_info['activation_successful'] is True:
+                self.handle_alarms(self.device_id,"onu",\
+                       ind_info['_pon_id'],\
+                       "ONU_ACTIVATED",1,"high",\
+                       balSubTermInd)
                 for key, v_ont_ani in self.v_ont_anis.items():
                     if v_ont_ani.v_ont_ani.data.onu_id == \
                             child_device.proxy_address.onu_id:
@@ -960,13 +972,22 @@
     }
 
     def handle_sub_term_ind(self, ind_info):
+        serial_number=(ind_info['_vendor_id'] +
+                           ind_info['_vendor_specific'])
         child_device = self.adapter_agent.get_child_device(
             self.device_id,
-            serial_number=(ind_info['_vendor_id'] +
-                           ind_info['_vendor_specific']))
+            serial_number=serial_number)
         if child_device is None:
             self.log.info('Onu-is-not-configured', olt_id=self.olt_id,
                           pon_ni=ind_info['_pon_id'], onu_data=ind_info)
+            if ind_info['_sub_group_type'] == 'onu_discovery':
+                balSubTermDisc = {}
+                balSubTermDisc["serial_number"] = serial_number.__str__()
+                balSubTermDisc["device_id"] = (self.device_id).__str__()
+                self.handle_alarms(self.device_id,"onu",\
+                               ind_info['_pon_id'],\
+                               "ONU_DISCOVERED",1,"high",\
+                               balSubTermDisc)
             return
 
         handler = self.onu_handlers.get(child_device.oper_status)
diff --git a/voltha/adapters/asfvolt16_olt/asfvolt16_ind_handler.py b/voltha/adapters/asfvolt16_olt/asfvolt16_ind_handler.py
old mode 100755
new mode 100644
index 2ffa2d2..826ff4f
--- a/voltha/adapters/asfvolt16_olt/asfvolt16_ind_handler.py
+++ b/voltha/adapters/asfvolt16_olt/asfvolt16_ind_handler.py
@@ -42,8 +42,10 @@
         ind_info = dict()
         ind_info['_object_type'] = 'access_terminal_indication'
         ind_info['_sub_group_type'] = 'access_terminal_indication'
-        if indication.access_term_ind.data.admin_state == \
-                bal_model_types_pb2.BAL_STATE_UP:
+        if ((indication.access_term_ind.data.admin_state == \
+                bal_model_types_pb2.BAL_STATE_UP) and \
+                (indication.access_term_ind.data.oper_status == \
+                bal_model_types_pb2.BAL_STATUS_UP)):
             ind_info['activation_successful'] = True
         else:
             ind_info['activation_successful'] = False
@@ -242,10 +244,15 @@
         ind_info['_vendor_id'] = onu_data.data.serial_number.vendor_id
         ind_info['_vendor_specific'] = \
             onu_data.data.serial_number.vendor_specific
-        if ((bal_model_types_pb2.BAL_STATE_DOWN == onu_data.data.admin_state)\
-            or (bal_model_types_pb2.BAL_STATUS_UP != onu_data.data.oper_status)):
+        self.log.info('registration-id-in-bal-subs-term-ind-is',\
+                       registration_id=onu_data.data.registration_id[:36])
+        ind_info['registration_id'] = onu_data.data.registration_id[:36]
+        ind_info['activation_successful'] = None
+        if (bal_model_types_pb2.BAL_STATE_DOWN == onu_data.data.admin_state or
+            bal_model_types_pb2.BAL_STATUS_UP != onu_data.data.oper_status):
             ind_info['activation_successful'] = False
-        elif (bal_model_types_pb2.BAL_STATE_UP == onu_data.data.admin_state):
+        elif (bal_model_types_pb2.BAL_STATE_UP == onu_data.data.admin_state and
+            bal_model_types_pb2.BAL_STATUS_UP == onu_data.data.oper_status):
             ind_info['activation_successful'] = True
 
         reactor.callLater(0,
diff --git a/voltha/adapters/asfvolt16_olt/asfvolt16_olt.py b/voltha/adapters/asfvolt16_olt/asfvolt16_olt.py
index 1f4c8b1..aaa1699 100644
--- a/voltha/adapters/asfvolt16_olt/asfvolt16_olt.py
+++ b/voltha/adapters/asfvolt16_olt/asfvolt16_olt.py
@@ -33,7 +33,7 @@
                                                device_handler_class=Asfvolt16Handler,
                                                name='asfvolt16_olt',
                                                vendor='Edgecore',
-                                               version='0.96',
+                                               version='0.97',
                                                device_type='asfvolt16_olt')
         # register for adapter messages
         self.port = 60001