Small fixes identified during Phase 1 integration testing.
Broadcom ONU adapter: increase delay prior to sending OMCI
messages and fix construction of adapter hardware address
based on vlan id.
EOAM extension: fix construction of slow protocol packets
Change-Id: I4f259bb6081b63a8facb19833938bfd67afa3af5
diff --git a/voltha/adapters/broadcom_onu/broadcom_onu.py b/voltha/adapters/broadcom_onu/broadcom_onu.py
index 2d74946..512718f 100644
--- a/voltha/adapters/broadcom_onu/broadcom_onu.py
+++ b/voltha/adapters/broadcom_onu/broadcom_onu.py
@@ -193,7 +193,7 @@
id='uni-{}'.format(port_no),
ofp_port=ofp_port(
port_no=port_no,
- hw_addr=mac_str_to_tuple('00:00:00:00:00:%02x' % port_no),
+ hw_addr=mac_str_to_tuple('00:00:00:00:%02x:%02x' % ((port_no >> 8) & 0xff, port_no & 0xff)),
name='uni-{}'.format(port_no),
config=0,
state=OFPPS_LIVE,
@@ -207,7 +207,7 @@
device_port_no=uni_port.port_no
))
- reactor.callLater(5, self.message_exchange)
+ reactor.callLater(10, self.message_exchange)
device = self.adapter_agent.get_device(device.id)
device.oper_status = OperStatus.ACTIVE
diff --git a/voltha/extensions/eoam/EOAM.py b/voltha/extensions/eoam/EOAM.py
index 9b2c023..cd63eb5 100644
--- a/voltha/extensions/eoam/EOAM.py
+++ b/voltha/extensions/eoam/EOAM.py
@@ -62,7 +62,7 @@
print("sleep = %d" % self.sleep)
print("=== END Settings ============")
- def send_frame(self, frame_body):
+ def send_frame(self, frame_body, slow_protocol=True):
PACKET = Ether()
PACKET.dst = self.dst
PACKET.src = self.getHwAddr(self.interface)
@@ -76,7 +76,7 @@
PACKET/=Dot1Q(type=0x8100,vlan=int(self.stag))
PACKET/=Dot1Q(type=self.etype,vlan=int(self.ctag))
else:
- PACKET/=Dot1Q(type=self.etype,vlan=int(self.stag))
+ PACKET/=Dot1Q(prio=7,type=self.etype,vlan=int(self.stag))
else:
if self.ctag:
PACKET.type = 0x8100
@@ -84,9 +84,14 @@
else:
PACKET.type = self.etype
# PACKET/=Dot1Q(type=self.etype, vlan=int(self.ctag))
- PACKET/=SlowProtocolsSubtype()/FlagsBytes()/OAMPDU()
- PACKET/=frame_body
- PACKET/=EndOfPDU()
+ if slow_protocol:
+ PACKET /= SlowProtocolsSubtype()/FlagsBytes()/OAMPDU()
+ PACKET /= frame_body
+ PACKET /= EndOfPDU()
+ else:
+ PACKET.lastlayer().type = 0x9001
+ PACKET /= frame_body
+
if (self.verbose == True):
PACKET.show()
print '###[ Frame Length %d (before padding) ]###' % len(PACKET)
@@ -137,6 +142,15 @@
digits = [int(d) for d in ip.split('.')]
return '01:00:5e:%02x:%02x:%02x' % (digits[1] & 0x7f, digits[2] & 0xff, digits[3] & 0xff)
+
+class TBJSON(Packet):
+ """ TBJSON 'packet' layer. """
+ name = "TBJSON"
+ fields_desc = [StrField("data", default="")]
+
+bind_layers(Ether, TBJSON, type=0x9001)
+
+
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--dst', dest='dst', action='store', default=EOAM_MULTICAST_ADDRESS,
@@ -178,6 +192,8 @@
help='Run commands under test')
parser.add_argument('-tm', '--test_multicast', dest='test_multicast', action='store_true', default=False,
help='Run commands under test')
+ parser.add_argument('-tp', '--test_ping', dest='test_ping', action='store_true', default=False,
+ help='Issue a test ping to get JSON data on device version')
args = parser.parse_args()
@@ -205,7 +221,8 @@
and not args.test_dhcp
and not args.test_upstream
and not args.test_downstream
- and not args.test_multicast):
+ and not args.test_multicast
+ and not args.test_ping):
print 'WARNING: *** No frames sent, please specify \'test\' or \'critical\', etc. See --help'
@@ -441,3 +458,10 @@
PortIngressRuleResultDelete(fieldcode=Clause['C-VLAN Tag'])/
PortIngressRuleTerminator()/
DeletePortIngressRule())
+
+
+ if (args.test_ping == True):
+ json_operation_str = '{\"operation\":\"version\"}'
+ for i in range(10000):
+ eoam.send_frame(TBJSON(data='json %s' % json_operation_str), False)
+