VOL-1165 Stop Brcm Openomci ONU state machine on openolt down

Change-Id: I9207dc89bce559295ede9b85f8a781f40ed9e3b4
diff --git a/voltha/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py b/voltha/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
index 5e2f7f3..4f95cb3 100644
--- a/voltha/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
+++ b/voltha/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
@@ -504,10 +504,11 @@
 
     def update_interface(self, data):
         self.log.debug('function-entry', data=data)
+        oper_state = data.get('oper_state', None)
 
         onu_device = self.adapter_agent.get_device(self.device_id)
 
-        if data.oper_state == 'down':
+        if oper_state == 'down':
             self.log.debug('stopping-openomci-statemachine')
             reactor.callLater(0, self._onu_omci_device.stop)
             self.disable_ports(onu_device)
diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index b2d5204..257ec3a 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -216,6 +216,15 @@
             uni_name = self.port_name(uni_no, Port.ETHERNET_UNI,
                                       serial_number=onu_device.serial_number)
 
+
+            if onu_device.adapter == 'brcm_openomci_onu':
+                self.log.debug('using-brcm_openomci_onu, update_interface '
+                               'down')
+                onu_adapter_agent = \
+                    registry('adapter_loader').get_agent(onu_device.adapter)
+                onu_adapter_agent.update_interface(onu_device,
+                                                   {'oper_state' :'down'})
+
             self.onu_ports_down(onu_device, uni_no, uni_name, oper_state)
         # Children devices
         self.adapter_agent.update_child_devices_state(
@@ -510,7 +519,8 @@
 
             if onu_device.adapter == 'brcm_openomci_onu':
                 self.log.debug('using-brcm_openomci_onu')
-                onu_adapter_agent.update_interface(onu_device, onu_indication)
+                onu_adapter_agent.update_interface(onu_device,
+                                               {'oper_state':'down'})
 
         elif onu_indication.oper_state == 'up':