Asfvolt16 - OMCI send and receive message changes
Change-Id: I56c54b0d5dbd39f9f9563270ffcc578685a4e355
diff --git a/voltha/adapters/asfvolt16_olt/asfvolt16_device_handler.py b/voltha/adapters/asfvolt16_olt/asfvolt16_device_handler.py
index 60ca65e..7233ac7 100644
--- a/voltha/adapters/asfvolt16_olt/asfvolt16_device_handler.py
+++ b/voltha/adapters/asfvolt16_olt/asfvolt16_device_handler.py
@@ -37,6 +37,10 @@
ChannelgroupConfig, ChannelpartitionConfig, ChannelpairConfig, \
ChannelterminationConfig, OntaniConfig, VOntaniConfig, VEnetConfig
+ASFVOLT_NNI_PORT = 50
+# ASFVOLT_NNI_PORT needs to be other than pon port value.
+# Edgecore OLT assigns PONport between 0 to 15, hence
+# having a value 50 for NNI port to avoid collision.
# TODO: VLAN ID needs to come from some sort of configuration.
PACKET_IN_VLAN = 4091
is_inband_frame = BpfProgramFilter('(ether[14:2] & 0xfff) = 0x{:03x}'.format(
@@ -76,7 +80,7 @@
device.serial_number = device.host_and_port
self.adapter_agent.update_device(device)
- self.add_port(port_no=1, port_type=Port.ETHERNET_NNI,
+ self.add_port(port_no=ASFVOLT_NNI_PORT, port_type=Port.ETHERNET_NNI,
label='NNI facing Ethernet port')
self.logical_device_id = \
self.add_logical_device(device_id=device.id)
@@ -273,6 +277,19 @@
self.log.exception('', exc=str(e))
return
+ def handle_omci_ind(self, ind_info):
+ child_device = self.adapter_agent.get_child_device(self.device_id,
+ onu_id=ind_info['onu_id'])
+ if child_device is None:
+ self.log.info('Onu is not configured',onu_id=ind_info['onu_id'])
+ return
+ try:
+ self.adapter_agent.receive_proxied_message(child_device.proxy_address,
+ ind_info['packet'])
+ except Exception as e:
+ self.log.exception('', exc=str(e))
+ return
+
def create_interface(self, data):
try:
if isinstance(data, ChannelterminationConfig):
diff --git a/voltha/adapters/asfvolt16_olt/asfvolt16_rx_handler.py b/voltha/adapters/asfvolt16_olt/asfvolt16_rx_handler.py
index 6722bc6..61dfd15 100644
--- a/voltha/adapters/asfvolt16_olt/asfvolt16_rx_handler.py
+++ b/voltha/adapters/asfvolt16_olt/asfvolt16_rx_handler.py
@@ -317,15 +317,16 @@
ind_info = dict()
ind_info['_object_type'] = 'packet_in_indication'
ind_info['_sub_group_type'] = 'omci_message'
+ ind_info['_device_id'] = device_id
packet_data = request.balOmciResp.key.packet_send_dest
- proxy_address = Device.ProxyAddress(
- device_id=device_id,
- channel_id=packet_data.itu_omci_channel.sub_term_id,
- onu_id=packet_data.itu_omci_channel.sub_term_id,
- onu_session_id=packet_data.itu_omci_channel.sub_term_id
- )
- self.adapter_agent.receive_proxied_message(proxy_address,
- request.balOmciResp.data.pkt.val)
+ ind_info['onu_id'] = packet_data.itu_omci_channel.sub_term_id
+ ind_info['packet'] = request.balOmciResp.data.pkt.val
+ self.log.info('ONU Id is',
+ onu_id=packet_data.itu_omci_channel.sub_term_id)
+
+ reactor.callLater(0,
+ self.adapter.devices_handlers[device_id].handle_omci_ind,
+ ind_info)
bal_err = bal_pb2.BalErr()
bal_err.err = bal_errno_pb2.BAL_ERR_OK
return bal_err
diff --git a/voltha/adapters/asfvolt16_olt/bal.py b/voltha/adapters/asfvolt16_olt/bal.py
index 95f389c..d8bccac 100644
--- a/voltha/adapters/asfvolt16_olt/bal.py
+++ b/voltha/adapters/asfvolt16_olt/bal.py
@@ -69,6 +69,8 @@
obj.interface.key.intf_id = pon_port
obj.interface.key.intf_type = bal_model_types_pb2.BAL_INTF_TYPE_PON
obj.interface.data.admin_state = bal_model_types_pb2.BAL_STATE_UP
+ obj.interface.data.transceiver_type = \
+ bal_model_types_pb2.BAL_TRX_TYPE_XGPON_LTH_7226_PC
yield self.stub.BalCfgSet(obj)
except Exception as e:
self.log.info('activating-pon-port in olt-exception', exc=str(e))
@@ -88,8 +90,9 @@
obj.packet.key.packet_send_dest.type = \
bal_model_types_pb2.BAL_DEST_TYPE_ITU_OMCI_CHANNEL
obj.packet.key.packet_send_dest.itu_omci_channel.sub_term_id = \
+ proxy_address.onu_id
+ obj.packet.key.packet_send_dest.itu_omci_channel.int_id = \
proxy_address.channel_id
- obj.packet.key.packet_send_dest.itu_omci_channel.int_id = 0
obj.packet.data.pkt = msg
yield self.stub.BalCfgSet(obj)
except Exception as e:
diff --git a/voltha/adapters/asfvolt16_olt/protos/bal_model_ids.proto b/voltha/adapters/asfvolt16_olt/protos/bal_model_ids.proto
index f8152b0..2c44b3c 100644
--- a/voltha/adapters/asfvolt16_olt/protos/bal_model_ids.proto
+++ b/voltha/adapters/asfvolt16_olt/protos/bal_model_ids.proto
@@ -466,15 +466,14 @@
*/
enum BalObjId
{
- BAL_OBJ_ID_INVALID = 0; /**< INVALID */
- BAL_OBJ_ID_ACCESS_TERMINAL = 1; /**< BAL Access Terminal */
- BAL_OBJ_ID_FLOW = 2; /**< BAL Flow */
- BAL_OBJ_ID_GROUP = 3; /**< BAL Group */
- BAL_OBJ_ID_INTERFACE = 4; /**< BAL Interface */
- BAL_OBJ_ID_PACKET = 5; /**< packet */
- BAL_OBJ_ID_SUBSCRIBER_TERMINAL = 6; /**< BAL Subscriber Terminal */
- BAL_OBJ_ID_TM_QUEUE = 7; /**< tm_queue */
- BAL_OBJ_ID_TM_SCHED = 8; /**< tm_sched */
+ BAL_OBJ_ID_ACCESS_TERMINAL = 0; /**< BAL Access Terminal */
+ BAL_OBJ_ID_FLOW = 1; /**< BAL Flow */
+ BAL_OBJ_ID_GROUP = 2; /**< BAL Group */
+ BAL_OBJ_ID_INTERFACE = 3; /**< BAL Interface */
+ BAL_OBJ_ID_PACKET = 4; /**< packet */
+ BAL_OBJ_ID_SUBSCRIBER_TERMINAL = 5; /**< BAL Subscriber Terminal */
+ BAL_OBJ_ID_TM_QUEUE = 6; /**< tm_queue */
+ BAL_OBJ_ID_TM_SCHED = 7; /**< tm_sched */
}
/** Identifiers for all possible groups under all objects in the system.
diff --git a/voltha/adapters/asfvolt16_olt/protos/bal_model_types.proto b/voltha/adapters/asfvolt16_olt/protos/bal_model_types.proto
index a56ff04..11a97aa 100644
--- a/voltha/adapters/asfvolt16_olt/protos/bal_model_types.proto
+++ b/voltha/adapters/asfvolt16_olt/protos/bal_model_types.proto
@@ -1091,7 +1091,7 @@
*/
message BalPacketIeeeOamChannelRxData
{
- BalIdList pkt = 1; /**< Packet Data. */
+ bytes pkt = 1; /**< Packet Data. */
}
/** Transport message definition for "ieee_oam_channel_rx" group of "packet"
@@ -1111,7 +1111,7 @@
*/
message BalPacketItuOmciChannelRxData
{
- BalIdList pkt = 1; /**< Packet Data. */
+ bytes pkt = 1; /**< Packet Data. */
}
/** Transport message definition for "itu_omci_channel_rx" group of "packet" object.