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_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(