VOL-1473:  adapter_agent swapped with core_proxy

This was only done places in the code confirmed to work.
Basically any existing references to adapter_agent are
untested and need to be moved to a core_proxy call
or removed.  Left as work TODO

Change-Id: I2d2cab7b64687f99e96f42f7f38dad6a4026de73
diff --git a/python/adapters/openolt/openolt.py b/python/adapters/openolt/openolt.py
index abc95c1..5d55e79 100644
--- a/python/adapters/openolt/openolt.py
+++ b/python/adapters/openolt/openolt.py
@@ -96,8 +96,8 @@
 
     # System Init Methods #
     def __init__(self, core_proxy, adapter_proxy, config):
+        self.core_proxy = core_proxy
         self.adapter_proxy = adapter_proxy
-        self.adapter_agent = core_proxy
         self.config = config
         self.descriptor = Adapter(
             id=self.name,
@@ -105,7 +105,7 @@
             version='0.1',
             config=AdapterConfig(log_level=LogLevel.INFO)
         )
-        log.debug('openolt.__init__', adapter_agent=adapter_proxy)
+        log.debug('openolt.__init__', core_proxy=core_proxy, adapter_proxy=adapter_proxy)
         self.devices = dict()  # device_id -> OpenoltDevice()
         self.interface = registry('main').get_args().interface
         self.logical_device_id_to_root_device_id = dict()
@@ -187,8 +187,8 @@
 
         kwargs = {
             'support_classes': OpenOltDefaults['support_classes'],
+            'core_proxy': self.core_proxy,
             'adapter_proxy': self.adapter_proxy,
-            'adapter_agent': self.adapter_agent,
             'device': device,
             'device_num': self.num_devices + 1
         }
@@ -206,7 +206,8 @@
         log.info('reconcile-device', device=device)
         kwargs = {
             'support_classes': OpenOltDefaults['support_classes'],
-            'adapter_agent': self.adapter_agent,
+            'core_proxy': self.core_proxy,
+            'adapter_proxy': self.adapter_proxy,
             'device': device,
             'device_num': self.num_devices + 1,
             'reconciliation': True
diff --git a/python/adapters/openolt/openolt_device.py b/python/adapters/openolt/openolt_device.py
index 55f2a54..4cba020 100644
--- a/python/adapters/openolt/openolt_device.py
+++ b/python/adapters/openolt/openolt_device.py
@@ -84,8 +84,8 @@
     def __init__(self, **kwargs):
         super(OpenoltDevice, self).__init__()
 
+        self.core_proxy = kwargs['core_proxy']
         self.adapter_proxy = kwargs['adapter_proxy']
-        self.adapter_agent = kwargs['adapter_agent']
         self.device_num = kwargs['device_num']
         device = kwargs['device']
 
@@ -240,7 +240,7 @@
     def do_state_connected(self, event):
         self.log.debug("do_state_connected")
         
-        device = yield self.adapter_agent.get_device(self.device_id)
+        device = yield self.core_proxy.get_device(self.device_id)
 
 
         self.stub = openolt_pb2_grpc.OpenoltStub(self.channel)
@@ -286,7 +286,7 @@
 
         device.connect_status = ConnectStatus.REACHABLE
         device.mac_address = "AA:BB:CC:DD:EE:FF"
-        yield self.adapter_agent.device_update(device)
+        yield self.core_proxy.device_update(device)
         
 
         self.resource_mgr = self.resource_mgr_class(self.device_id,
@@ -294,17 +294,17 @@
                                                     self.extra_args,
                                                     device_info)
         self.platform = self.platform_class(self.log, self.resource_mgr)
-        self.flow_mgr = self.flow_mgr_class(self.adapter_agent, self.log,
+        self.flow_mgr = self.flow_mgr_class(self.core_proxy, self.log,
                                             self.stub, self.device_id,
                                             self.logical_device_id,
                                             self.platform, self.resource_mgr)
 
-        self.alarm_mgr = self.alarm_mgr_class(self.log, self.adapter_agent,
+        self.alarm_mgr = self.alarm_mgr_class(self.log, self.core_proxy,
                                               self.device_id,
                                               self.logical_device_id,
                                               self.platform)
         self.stats_mgr = self.stats_mgr_class(self, self.log, self.platform)
-        self.bw_mgr = self.bw_mgr_class(self.log, self.adapter_agent)
+        self.bw_mgr = self.bw_mgr_class(self.log, self.core_proxy)
         
         self.connected = True
 
@@ -312,7 +312,7 @@
     def do_state_up(self, event):
         self.log.debug("do_state_up")
 
-        yield self.adapter_agent.device_state_update(self.device_id,
+        yield self.core_proxy.device_state_update(self.device_id,
                                                connect_status=ConnectStatus.REACHABLE,
                                                oper_status=OperStatus.ACTIVE)
         self.log.debug("done_state_up")
@@ -494,7 +494,7 @@
                                errmsg=disc_alarm_error.message)
             # continue for now.
 
-        onu_device = yield self.adapter_agent.get_child_device(
+        onu_device = yield self.core_proxy.get_child_device(
            self.device_id,
            serial_number=serial_number_str)
 
@@ -515,7 +515,7 @@
 
         else:
             if onu_device.connect_status != ConnectStatus.REACHABLE:
-                yield self.adapter_agent.device_state_update(onu_device.id, connect_status=ConnectStatus.REACHABLE)
+                yield self.core_proxy.device_state_update(onu_device.id, connect_status=ConnectStatus.REACHABLE)
 
             onu_id = onu_device.proxy_address.onu_id
             if onu_device.oper_status == OperStatus.DISCOVERED \
@@ -534,7 +534,7 @@
                               reboot probably, activate onu", intf_id=intf_id,
                               onu_id=onu_id, serial_number=serial_number_str)
 
-                yield self.adapter_agent.device_state_update(onu_device.id, oper_status=OperStatus.DISCOVERED)
+                yield self.core_proxy.device_state_update(onu_device.id, oper_status=OperStatus.DISCOVERED)
 
                 try:
                     self.activate_onu(intf_id, onu_id, serial_number,
@@ -560,11 +560,11 @@
             serial_number_str = None
 
         if serial_number_str is not None:
-            onu_device = yield self.adapter_agent.get_child_device(
+            onu_device = yield self.core_proxy.get_child_device(
                 self.device_id,
                 serial_number=serial_number_str)
         else:
-            onu_device = yield self.adapter_agent.get_child_device(
+            onu_device = yield self.core_proxy.get_child_device(
                 self.device_id,
                 parent_port_no=self.platform.intf_id_to_port_no(
                     onu_indication.intf_id, Port.PON_OLT),
@@ -613,13 +613,13 @@
         if onu_indication.oper_state == 'down':
 
             if onu_device.connect_status != ConnectStatus.UNREACHABLE:
-                yield self.adapter_agent.device_state_update(onu_device.id, connect_status=ConnectStatus.UNREACHABLE)
+                yield self.core_proxy.device_state_update(onu_device.id, connect_status=ConnectStatus.UNREACHABLE)
 
             # Move to discovered state
             self.log.debug('onu-oper-state-is-down')
 
             if onu_device.oper_status != OperStatus.DISCOVERED:
-                yield self.adapter_agent.device_state_update(onu_device.id, oper_status=OperStatus.DISCOVERED)
+                yield self.core_proxy.device_state_update(onu_device.id, oper_status=OperStatus.DISCOVERED)
 
             self.log.debug('inter-adapter-send-onu-ind', onu_indication=onu_indication)
 
@@ -635,7 +635,7 @@
         elif onu_indication.oper_state == 'up':
 
             if onu_device.connect_status != ConnectStatus.REACHABLE:
-                yield self.adapter_agent.device_state_update(onu_device.id, connect_status=ConnectStatus.REACHABLE)
+                yield self.core_proxy.device_state_update(onu_device.id, connect_status=ConnectStatus.REACHABLE)
 
             if onu_device.oper_status != OperStatus.DISCOVERED:
                 self.log.debug("ignore onu indication",
@@ -698,7 +698,7 @@
         self.log.debug("omci indication", intf_id=omci_indication.intf_id,
                        onu_id=omci_indication.onu_id)
 
-        onu_device = yield self.adapter_agent.get_child_device(
+        onu_device = yield self.core_proxy.get_child_device(
             self.device_id, onu_id=omci_indication.onu_id,
             parent_port_no=self.platform.intf_id_to_port_no(
                 omci_indication.intf_id, Port.PON_OLT), )
@@ -833,7 +833,7 @@
                 self.log.debug('inter-adapter-recv-omci', omci_msg=omci_msg)
 
                 onu_device_id = request.header.to_device_id
-                onu_device = yield self.adapter_agent.get_device(onu_device_id)
+                onu_device = yield self.core_proxy.get_device(onu_device_id)
                 self.send_proxied_message(onu_device, omci_msg.message)
 
             else:
@@ -866,7 +866,7 @@
         serial_number_str = self.stringify_serial_number(serial_number)
 
         # TODO NEW CORE dont hardcode child device type.  find some way of determining by vendor in serial number
-        yield self.adapter_agent.child_device_detected(
+        yield self.core_proxy.child_device_detected(
             parent_device_id=self.device_id,
             parent_port_no=port_no,
             child_device_type='brcm_openomci_onu',
@@ -935,7 +935,7 @@
         port = Port(port_no=port_no, label=label, type=port_type,
                     admin_state=AdminState.ENABLED, oper_status=oper_status)
 
-        yield self.adapter_agent.port_created(self.device_id, port)
+        yield self.core_proxy.port_created(self.device_id, port)
 
     def delete_logical_port(self, child_device):
         logical_ports = self.proxy.get('/logical_devices/{}/ports'.format(