LowCbfConnector

The LowCbfConnector is a Tango device server for monitoring and control of registers in the Low.CBF P4 switch. Tofino-based in-network processors require two compulsory components, the P4 program that will be compiled and run on the switch and the compiler/SDE to compile this code.

In addition, software is required to be able to process runtime commands via a series of API (i.e. gRPC, gNMI), for this part, SKA leverages the Barefoot Runtime gRPCs. These gRPCs are used being the scene in the Tango devices, through multiple classes centralised in the Connector class, to configure and monitor a given switch.

In terms of Tango device usability, the Connector offers standard operations with:

  • attributes representing both states of the tango device itself and the health and monitoring of the P4 switch

  • commands to control both tango device and the switch including routing configuration and telemetry.

Low CBF Connector Attributes

All attributes listed below are read accessible via the read_<attribute> method.

speadUnicastRoutingTable = attribute(
    dtype="DevString",
    label="SPEAD Unicast Routing Table",
    doc="JSON String encoding the current routing configuration",
)
psrRoutingTable = attribute(
    dtype="DevString",
    label="PSR Routing Table",
    doc="JSON String encoding the current PSR routing configuration",
)
speadMultiplierRoutingTable = attribute(
    dtype="DevString",
    label="SPEAD Multiplier Routing Table",
    doc="JSON String encoding the current SPEAD Multiplier routing configuration",
)
arpRoutingTable = attribute(
    dtype="DevString",
    label="ARP Routing Table",
    doc="JSON String encoding the current ARP routing configuration",
)
basicRoutingTable = attribute(
    dtype="DevString",
    label="Basic Routing Table",
    doc="JSON String encoding the current Basic routing configuration",
)
speadUnicastCounterTotal = attribute(
    dtype="DevString",
    label="Packet Count",
    doc="Counter for the Spead unicast table",
)
speadMultiplierCounterTotal = attribute(
    dtype="DevString",
    label="Total Data",
    unit="B",
    doc="per physical port and protocol",
)
packetRate = attribute(
    dtype="DevDouble",
    label="Packet Rate",
    unit="/s",
)
byteRate = attribute(
    dtype="DevDouble",
    label="Data Rate",
    unit="B/s",
)
portStatus = attribute(
    dtype="DevString",
    label="Port Status on the switch",
    doc="Various information related to the active ports on the switch",
)
# TODO
packetsLost = attribute(
    dtype="DevString",
    label="Lost Packets",
    doc="SPEAD packets lost per frequency channel",
)
# TODO
packetLossRate = attribute(
    dtype="DevString",
    label="Packet Loss Rate",
    doc="SPEAD packets lost as a proportion of all SPEAD packets (lost+received)",
)
ipAddressToMacAndPort = attribute(
    dtype="DevString",
    label="SDP IP address and their associated mac and port",
    doc="Json string containing IP@ to MAC@ and port for SDP routing",
)

Low CBF Connector Commands (Methods)

def AddSpeadUnicastEntry(self, argin):
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"spead": [{"src": {"frequency": 123, "beam": 12, "sub_array": 1 }, "dst": {"port": "12/0"}}]}'
    We assume src is am engineering subarray and dst is a port.
    :return:None
    """
def UpdateSpeadUnicastEntry(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.AddRoutes) ENABLED START #
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"spead": [{"src": {"frequency": 123, "beam": 12, "sub_array": 1 }, "dst": {"port": "12/0"}}]}'
    We assume src is am engineering subarray and dst is a port.
    :return:None
    """
def ClearSpeadUnicastTable(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.DelRoutes) ENABLED START #
    """
    :param argin: 'DevString'
        JSON String describing one or more routing rules to delete.
        If a route is partially specified, all matching routes will be deleted.
    :return:None
    """
def AddMultiplierUnicastEntry(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.AddRoutes) ENABLED START #
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"spead": [{"src": {"frequency": 123, "beam": 12, "sub_array": 1 }, "dst": {"port_bf": "12/0", "port_corr": "13/0"}}]}'
    We assume src is am engineering subarray and dst is a port.
    :return:None
    """
    handler = self.get_command_object("AddSpeadMultiplierEntry")
    result_code, message = handler(argin)
    return [result_code], [message]
def UpdateMultiplierUnicastEntry(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.AddRoutes) ENABLED START #
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"spead": [{"src": {"frequency": 123, "beam": 12, "sub_array": 1 }, "dst": {"port": "12/0"}}]}'
    We assume src is am engineering subarray and dst is a port.
    :return:None
    """
def ClearSpeadMultiplierTable(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.DelRoutes) ENABLED START #
    """
    :param argin: 'DevString'
        JSON String describing one or more routing rules to delete.
        If a route is partially specified, all matching routes will be deleted.
    :return:None
    """
def AddPSREntry(self, argin):
     # PROTECTED REGION ID(LowCbfConnector.AddRoutes) ENABLED START #
     """
     :param argin: 'DevString'
     JSON String describing one or more routing rules to add.
     e.g. '{"psr": [{"src": {"beam": 12 }, "dst": {"port": "12/0"}}]}'
     We assume src is am engineering subarray and dst is a port.
     :return:None
     """
def UpdatePSREntry(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.AddRoutes) ENABLED START #
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"psr": [{"src": {"beam": 12 }, "dst": {"port": "12/0"}}]}'
    We assume src is am engineering subarray and dst is a port.
    :return:None
    """
def ClearPSRTable(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.DelRoutes) ENABLED START #
    """
    :param argin: 'DevString'
        JSON String describing one or more routing rules to delete.
        If a route is partially specified, all matching routes will be deleted.
    :return:None
    """
def AddARPEntry(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.AddRoutes) ENABLED START #
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"arp": [{"ip": {"address": "192.168.1.1"}, "mac": {"address": "aa:bb:cc:dd:ee:ff"}}]}'
    We assume src is am engineering subarray and dst is a port.
    :return:None
    """
def UpdateARPEntry(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.AddRoutes) ENABLED START #
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"arp": [{"ip": {"address": "192.168.1.1"}, "mac": {"address": "aa:bb:cc:dd:ee:ff"}}]}'
    We assume src is am engineering subarray and dst is a port.
    :return:None
    """
def ClearARPTable(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.DelRoutes) ENABLED START #
    """
    :param argin: 'DevString'
        JSON String describing one or more routing rules to delete.
        If a route is partially specified, all matching routes will be deleted.
    :return:None
    """
def AddBasicEntry(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.AddRoutes) ENABLED START #
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"basic": [{"src": {"port": "1/0"}, "dst": {"port": "2/0"}}]}'
    We assume src is am engineering subarray and dst is a port.
    :return:None
    """
def UpdateBasicEntry(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.AddRoutes) ENABLED START #
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"basic": [{"src": {"port": "1/0"}, "dst": {"port": "2/0"}}]}'
    We assume src is am engineering subarray and dst is a port.
    :return:None
    """
def ClearBasicTable(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.DelRoutes) ENABLED START #
    """
    :param argin: 'DevString'
        JSON String describing one or more routing rules to delete.
        If a route is partially specified, all matching routes will be deleted.
    :return:None
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more Port connected to the SDP network",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def AddPortsToSDPARP(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.AddPortsToSDPARP) ENABLED START #
    """
    :param argin: 'DevString'
        JSON String describing one or more IP Addresses to ARP resolve.
        e.g. '{"SDP": [{"port": "10/0"}]}'
    :return:None
    """
    handler = self.get_command_object("AddPortsToSDPARP")
    result_code, message = handler(argin)
    return [result_code], [message]
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more IP Addresses to ARP resolve..",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def AddIPToResolve(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.AddIPToResolve) ENABLED START #
    """
    :param argin: 'DevString'
        JSON String describing one or more IP Addresses to ARP resolve.
        e.g. '{"IP": [{"address": "192.168.1.1"}]}'
    :return:None
    """
    handler = self.get_command_object("AddIPToResolve")
    result_code, message = handler(argin)
    return [result_code], [message]
@command(
    dtype_in="DevString",
    doc_in="JSON String describing the switch_d agent address",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def ConnectToSwitch(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.AddPortsToSDPARP) ENABLED START #
    """
    :param argin: 'DevString'
        JSON String describing the address to connect to.
        e.g. '{"Switch": "202.9.15.135:50052"}'
    """
    handler = self.get_command_object("ConnectToSwitch")
    result_code, message = handler(argin)
    return [result_code], [message]
@command(
    dtype_in="DevString",
    doc_in="JSON String describing the allocator address",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def RegisterCallbackAllocator(self, argin):
    # PROTECTED REGION ID(LowCbfConnector.AddPortsToSDPARP) ENABLED START #
    """
    :param argin: 'DevString'
        JSON String describing one or more ports connected to SDP.
        e.g. '{"Allocator": "low-cbf/allocator/0"}'
    """
    handler = self.get_command_object("RegisterCallbackAllocator")
    result_code, message = handler(argin)
    return [result_code], [message]
@command(
    dtype_in="DevString",
    doc_in="JSON String describing how to configure physical ports",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def LoadPorts(self, argin):
@command(
    dtype_in="DevString",
    doc_in="JSON String describing the physical ports to remove.",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def RemovePorts(self, argin):
@command(
    dtype_out="DevVarLongStringArray",
)
def ResetPortStatistics(self):
    """Reset all port statistics counters"""
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more spead rules to add.",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def AddPTPEntry(self, argin):
    """
    :param argin: 'DevString'
    JSON String describing one or more PTP routing rules to add.
    e.g. '{"ptp": [{"src": {"port": "1/0"}, "dst": {"port": "2/0"}}]}'
    :return:None
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more spead rules to add.",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def UpdatePTPEntry(self, argin):
    """
    :param argin: 'DevString'
    JSON String describing one or more PTP routing rules to add.
    e.g. '{"ptp": [{"src": {"port": "1/0"}, "dst": {"port": "2/0"}}]}'
    :return:None
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more routing rules to delete."
    "If a route is partially specified, all matching routes will be deleted.",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def ClearPTPTable(self, argin):
    """
    :param argin: 'DevString'
        JSON String describing one or more PTP routing rules to delete.
        If a route is partially specified, all matching routes will be deleted.
    :return:None
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more Alveo ports connected to the PTP network ",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def AddPortsToPTP(self, argin):
    """
    :param argin: 'DevString'
        JSON String describing one or more ports connected to PTP.
        e.g. '{"PTPMulti": [{"port": "10/0"}, {"port": "11/0"}]}'
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more Alveo ports connected to the PTP network ",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def AddPTPClockPort(self, argin):
    """
    :param argin: 'DevString'
        JSON String describing one or more ports connected to PTP.
        e.g. '{"PTPClock": [{"port": "1/0"}]}'
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more spead rules to add.",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def AddSDPIPEntry(self, argin):
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"sdp_ip": [{"src": {"ip": "192.168.1.1" }, "dst": {"port": "12/0"}}]}'
    :return:None
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more psr rules to remove.",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def RemoveSDPIPEntry(self, argin):
    """
    :param argin: 'DevString'
    JSON String describing one or more psr rules to remove.
    e.g. '{"sdp_ip": [{"src": {"ip": "192.168.1.1" } }]}'
    :return:None
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more spead rules to add.",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def UpdateSDPIPEntry(self, argin):
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"sdp_ip": [{"src": {"ip": "192.168.1.1" }, "dst": {"port": "12/0"}}]}'
    :return:None
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more routing rules to delete."
    "If a route is partially specified, all matching routes will be deleted.",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def ClearSDPIPTable(self, argin):
    """
    :param argin: 'DevString'
        JSON String describing one or more routing rules to delete.
        If a route is partially specified, all matching routes will be deleted.
    :return:None
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more spead rules to add.",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def AddSDPMACEntry(self, argin):
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"sdp_mac": [{"src": {"ip": "192.168.1.1" }, "dst": {"mac": "aa:bb:cc:dd:ee:ff"}}]}'
    :return:None
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more psr rules to remove.",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def RemoveSDPMACEntry(self, argin):
    """
    :param argin: 'DevString'
    JSON String describing one or more psr rules to remove.
    e.g. '{"sdp_mac": [{"src": {"ip": "192.168.1.1" }}]}'
    :return:None
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more spead rules to add.",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def UpdateSDPMACEntry(self, argin):
    """
    :param argin: 'DevString'
    JSON String describing one or more routing rules to add.
    e.g. '{"sdp_mac": [{"src": {"ip": "192.168.1.1" }, "dst": {"mac": "aa:bb:cc:dd:ee:ff"}}]}'
    :return:None
    """
@command(
    dtype_in="DevString",
    doc_in="JSON String describing one or more routing rules to delete."
    "If a route is partially specified, all matching routes will be deleted.",
    dtype_out="DevVarLongStringArray",
    doc_out="Information-only string",
)
def ClearSDPMACTable(self, argin):
    """
    :param argin: 'DevString'
        JSON String describing one or more routing rules to delete.
        If a route is partially specified, all matching routes will be deleted.
    :return:None
    """