[VOL-1034, VOL-1035, VOL-1037] This commit consists of:
1) Implementation of inter-adapter communication using flows
as proxy message between an ONU and its parent OLT.
2) Update the protos to reflect the inter-adapter message structure
3) Cleanup the ponsim adapters to removed unsued references and
general cleanup.
Change-Id: Ibe913a80a96d601fed946d9b9db55bb8d4f2c15a
diff --git a/adapters/interface.py b/adapters/interface.py
index d1ac455..b0390d8 100644
--- a/adapters/interface.py
+++ b/adapters/interface.py
@@ -259,209 +259,18 @@
:return: Proto Message (TBD)
"""
- # def start():
- # """
- # Called once after adapter instance is laoded. Can be used to async
- # initialization.
- # :return: (None or Deferred)
- # """
- #
- # def stop():
- # """
- # Called once before adapter is unloaded. It can be used to perform
- # any cleanup after the adapter.
- # :return: (None or Deferred)
- # """
- #
- # def receive_inter_adapter_message(msg):
- # """
- # Called when the adapter recieves a message that was sent to it directly
- # from another adapter. An adapter may register for these messages by calling
- # the register_for_inter_adapter_messages() method in the adapter agent.
- # Note that it is the responsibility of the sending and receiving
- # adapters to properly encode and decode the message.
- # :param msg: The message contents.
- # :return: None
- # """
- #
- # def send_proxied_message(proxy_address, msg):
- # """
- # Forward a msg to a child device of device, addressed by the given
- # proxy_address=Device.ProxyAddress().
- # :param proxy_address: Address info for the parent device
- # to route the message to the child device. This was given to the
- # child device by the parent device at the creation of the child
- # device.
- # :param msg: (str) The actual message to send.
- # :return: (Deferred(None) or None) The return of this method should
- # indicate that the message was successfully *sent*.
- # """
- #
- # def receive_proxied_message(proxy_address, msg):
- # """
- # Pass an async message (arrived via a proxy) to this device.
- # :param proxy_address: Address info for the parent device
- # to route the message to the child device. This was given to the
- # child device by the parent device at the creation of the child
- # device. Note this is the proxy_address with which the adapter
- # had to register prior to receiving proxied messages.
- # :param msg: (str) The actual message received.
- # :return: None
- # """
- #
- # def receive_packet_out(logical_device_id, egress_port_no, msg):
- # """
- # Pass a packet_out message content to adapter so that it can forward it
- # out to the device. This is only called on root devices.
- # :param logical_device_id:
- # :param egress_port: egress logical port number
- # :param msg: actual message
- # :return: None
- # """
- #
- # def change_master_state(master):
- # """
- # Called to indicate if plugin shall assume or lose master role. The
- # master role can be used to perform functions that must be performed
- # from a single point in the cluster. In single-node deployments of
- # Voltha, the plugins are always in master role.
- # :param master: (bool) True to indicate the mastership needs to be
- # assumed; False to indicate that mastership needs to be abandoned.
- # :return: (Deferred) which is fired by the adapter when mastership is
- # assumed/dropped, respectively.
- # """
+ def process_inter_adapter_message(msg):
+ """
+ Called when the adapter receives a message that was sent to it directly
+ from another adapter. An adapter is automatically registered for these
+ messages when creating the inter-container kafka proxy. Note that it is
+ the responsibility of the sending and receiving adapters to properly encode
+ and decode the message.
+ :param msg: Proto Message (any)
+ :return: Proto Message Response
+ """
-# class IAdapterAgent(Interface):
-# """
-# This object is passed in to the __init__ function of each adapter,
-# and can be used by the adapter implementation to initiate async calls
-# toward Voltha's CORE via the APIs defined here.
-# """
-#
-# def get_device(device_id):
-# # TODO add doc
-# """"""
-#
-# def add_device(device):
-# # TODO add doc
-# """"""
-#
-# def update_device(device):
-# # TODO add doc
-# """"""
-#
-# def add_port(device_id, port):
-# # TODO add doc
-# """"""
-#
-# def create_logical_device(logical_device):
-# # TODO add doc
-# """"""
-#
-# def add_logical_port(logical_device_id, port):
-# # TODO add doc
-# """"""
-#
-# def child_device_detected(parent_device_id,
-# parent_port_no,
-# child_device_type,
-# proxy_address,
-# admin_state,
-# **kw):
-# # TODO add doc
-# """"""
-#
-# def send_proxied_message(proxy_address, msg):
-# """
-# Forward a msg to a child device of device, addressed by the given
-# proxy_address=Device.ProxyAddress().
-# :param proxy_address: Address info for the parent device
-# to route the message to the child device. This was given to the
-# child device by the parent device at the creation of the child
-# device.
-# :param msg: (str) The actual message to send.
-# :return: (Deferred(None) or None) The return of this method should
-# indicate that the message was successfully *sent*.
-# """
-#
-# def receive_proxied_message(proxy_address, msg):
-# """
-# Pass an async message (arrived via a proxy) to this device.
-# :param proxy_address: Address info for the parent device
-# to route the message to the child device. This was given to the
-# child device by the parent device at the creation of the child
-# device. Note this is the proxy_address with which the adapter
-# had to register prior to receiving proxied messages.
-# :param msg: (str) The actual message received.
-# :return: None
-# """
-#
-# def register_for_proxied_messages(proxy_address):
-# """
-# A child device adapter can use this to indicate its intent to
-# receive async messages sent via a parent device. Example: an
-# ONU adapter can use this to register for OMCI messages received
-# via the OLT and the OLT adapter.
-# :param child_device_address: Address info that was given to the
-# child device by the parent device at the creation of the child
-# device. Its uniqueness acts as a router information for the
-# registration.
-# :return: None
-# """
-#
-# def unregister_for_proxied_messages(proxy_address):
-# """
-# Cancel a previous registration
-# :return:
-# """
-#
-# def send_packet_in(logical_device_id, logical_port_no, packet):
-# """
-# Forward given packet to the northbound toward an SDN controller.
-# :param device_id: logical device identifier
-# :param logical_port_no: logical port_no (as numbered in openflow)
-# :param packet: the actual packet; can be a serialized string or a scapy
-# Packet.
-# :return: None returned on success
-# """
-#
-# def submit_kpis(kpi_event_msg):
-# """
-# Submit KPI metrics on behalf of the OLT and its adapter. This can
-# include hardware related metrics, usage and utilization metrics, as
-# well as optional adapter specific metrics.
-# :param kpi_event_msg: A protobuf message of KpiEvent type.
-# :return: None
-# """
-#
-# def submit_alarm(device_id, alarm_event_msg):
-# """
-# Submit an alarm on behalf of the OLT and its adapter.
-# :param alarm_event_msg: A protobuf message of AlarmEvent type.
-# :return: None
-# """
-#
-# def register_for_onu_detect_state(proxy_address):
-# """
-#
-# :return: None
-# """
-#
-# def unregister_for_onu_detect_state(proxy_address):
-# """
-#
-# :return: None
-# """
-#
-# def forward_onu_detect_state(proxy_address, state):
-# """
-# Forward onu detect state to ONU adapter
-# :param proxy_address: ONU device address
-# :param state: ONU detect state (bool)
-# :return: None
-# """
-
class ICoreSouthBoundInterface(Interface):
"""
Represents a Voltha Core. This is used by an adapter to initiate async
@@ -520,7 +329,6 @@
:return: None
"""
-
def child_device_detected(parent_device_id,
parent_port_no,
child_device_type,
@@ -649,122 +457,3 @@
:param packet: The actual packet
:return: None
"""
-
- # def add_device(device):
- # # TODO add doc
- # """"""
-
- # def update_device(device):
- # # TODO add doc
- # """"""
-
- # def add_port(device_id, port):
- # # TODO add doc
- # """"""
-
- # def create_logical_device(logical_device):
- # # TODO add doc
- # """"""
- #
- # def add_logical_port(logical_device_id, port):
- # # TODO add doc
- # """"""
-
- # def child_device_detected(parent_device_id,
- # parent_port_no,
- # child_device_type,
- # proxy_address,
- # admin_state,
- # **kw):
- # # TODO add doc
- # """"""
-
- # def send_proxied_message(proxy_address, msg):
- # """
- # Forward a msg to a child device of device, addressed by the given
- # proxy_address=Device.ProxyAddress().
- # :param proxy_address: Address info for the parent device
- # to route the message to the child device. This was given to the
- # child device by the parent device at the creation of the child
- # device.
- # :param msg: (str) The actual message to send.
- # :return: (Deferred(None) or None) The return of this method should
- # indicate that the message was successfully *sent*.
- # """
- #
- # def receive_proxied_message(proxy_address, msg):
- # """
- # Pass an async message (arrived via a proxy) to this device.
- # :param proxy_address: Address info for the parent device
- # to route the message to the child device. This was given to the
- # child device by the parent device at the creation of the child
- # device. Note this is the proxy_address with which the adapter
- # had to register prior to receiving proxied messages.
- # :param msg: (str) The actual message received.
- # :return: None
- # """
- #
- # def register_for_proxied_messages(proxy_address):
- # """
- # A child device adapter can use this to indicate its intent to
- # receive async messages sent via a parent device. Example: an
- # ONU adapter can use this to register for OMCI messages received
- # via the OLT and the OLT adapter.
- # :param child_device_address: Address info that was given to the
- # child device by the parent device at the creation of the child
- # device. Its uniqueness acts as a router information for the
- # registration.
- # :return: None
- # """
- #
- # def unregister_for_proxied_messages(proxy_address):
- # """
- # Cancel a previous registration
- # :return:
- # """
- #
- # def submit_kpis(kpi_event_msg):
- # """
- # Submit KPI metrics on behalf of the OLT and its adapter. This can
- # include hardware related metrics, usage and utilization metrics, as
- # well as optional adapter specific metrics.
- # :param kpi_event_msg: A protobuf message of KpiEvent type.
- # :return: None
- # """
- #
- # def submit_alarm(device_id, alarm_event_msg):
- # """
- # Submit an alarm on behalf of the OLT and its adapter.
- # :param alarm_event_msg: A protobuf message of AlarmEvent type.
- # :return: None
- # """
-
- # def register_for_onu_detect_state(proxy_address):
- # """
- #
- # :return: None
- # """
- #
- # def unregister_for_onu_detect_state(proxy_address):
- # """
- #
- # :return: None
- # """
- #
- # def forward_onu_detect_state(proxy_address, state):
- # """
- # Forward onu detect state to ONU adapter
- # :param proxy_address: ONU device address
- # :param state: ONU detect state (bool)
- # :return: None
- # """
- #
- # def send_packet_in(logical_device_id, logical_port_no, packet):
- # """
- # Forward given packet to the northbound toward an SDN controller.
- # :param device_id: logical device identifier
- # :param logical_port_no: logical port_no (as numbered in openflow)
- # :param packet: the actual packet; can be a serialized string or a
- # scapy Packet.
- # :return: None returned on success
- # """