of-test clean-up for EA4
Change-Id: I2212e2c51674baa3f662d01396b4c92f2675dc61
diff --git a/ofdpa/flows.py b/ofdpa/flows.py
index 53e0edd..b888105 100755
--- a/ofdpa/flows.py
+++ b/ofdpa/flows.py
@@ -143,7 +143,7 @@
class PacketInIPTable( base_tests.SimpleDataPlane ):
"""
- Verify Packet-in message from IP table when controller action is used
+ Verify Packet-in message from IP table when controller action is used
Send a packet to each dataplane port and verify that a packet
in message is received from the controller for each
#todo verify you stop receiving after adding rule
@@ -327,7 +327,7 @@
vlan_id = 18
for port in ports:
L2gid, msg = add_one_l2_interface_group( self.controller, port, vlan_id, True, False )
- add_one_vlan_table_flow( self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
Groups.put( L2gid )
add_bridge_flow( self.controller, [ 0x00, 0x12, 0x34, 0x56, 0x78, port ], vlan_id, L2gid,
True )
@@ -378,7 +378,7 @@
l3_msg = add_l3_unicast_group( self.controller, port, vlanid=vlan_id, id=vlan_id,
src_mac=intf_src_mac, dst_mac=dst_mac )
# add vlan flow table
- add_one_vlan_table_flow( self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
# add termination flow
add_termination_flow( self.controller, port, 0x0800, intf_src_mac, vlan_id )
# add unicast routing flow
@@ -445,7 +445,7 @@
# ecmp_msg=add_l3_ecmp_group(self.controller, vlan_id, [mpls_label_gid])
do_barrier( self.controller )
# add vlan flow table
- add_one_vlan_table_flow( self.controller, port, vlan_id, vrf=2,
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, vrf=2,
flag=VLAN_TABLE_FLAG_ONLY_TAG )
# add termination flow
add_termination_flow( self.controller, port, 0x0800, intf_src_mac, vlan_id )
@@ -513,7 +513,7 @@
ecmp_msg = add_l3_ecmp_group( self.controller, vlan_id, [ mpls_label_gid ] )
do_barrier( self.controller )
# add vlan flow table
- add_one_vlan_table_flow( self.controller, port, vlan_id, vrf=0,
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, vrf=0,
flag=VLAN_TABLE_FLAG_ONLY_TAG )
# add termination flow
add_termination_flow( self.controller, port, 0x0800, intf_src_mac, vlan_id )
@@ -578,7 +578,7 @@
src_mac=intf_src_mac, dst_mac=dst_mac )
ecmp_msg = add_l3_ecmp_group( self.controller, id, [ l3_msg.group_id ] )
# add vlan flow table
- add_one_vlan_table_flow( self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
# add termination flow
add_termination_flow( self.controller, port, 0x0800, intf_src_mac, vlan_id )
# add unicast routing flow
@@ -644,7 +644,7 @@
# ecmp_msg=add_l3_ecmp_group(self.controller, vlan_id, [mpls_label_gid])
do_barrier( self.controller )
# add vlan flow table
- add_one_vlan_table_flow( self.controller, port, vlan_id, vrf=0,
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, vrf=0,
flag=VLAN_TABLE_FLAG_ONLY_TAG )
# add termination flow
add_termination_flow( self.controller, port, 0x0800, intf_src_mac, vlan_id )
@@ -711,7 +711,7 @@
ecmp_msg = add_l3_ecmp_group( self.controller, id, [ mpls_label_gid ] )
do_barrier( self.controller )
# add vlan flow table
- add_one_vlan_table_flow( self.controller, port, vlan_id, vrf=0,
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, vrf=0,
flag=VLAN_TABLE_FLAG_ONLY_TAG )
# add termination flow
add_termination_flow( self.controller, port, 0x0800, intf_src_mac, vlan_id )
@@ -828,7 +828,7 @@
src_mac=intf_src_mac, dst_mac=dst_mac )
ecmp_msg = add_l3_ecmp_group( self.controller, id, [ l3_msg.group_id ] )
# add vlan flow table
- add_one_vlan_table_flow( self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
# add termination flow
add_termination_flow( self.controller, port, 0x0800, intf_src_mac, vlan_id )
# add unicast routing flow
@@ -1003,17 +1003,6 @@
verify_no_other_packets( self )
- parsed_pkt = simple_udp_packet( pktlen=100, dl_vlan_enable=True, vlan_vid=vlan_id,
- eth_dst=dst_mac_str, eth_src=port1_mac_str, ip_ttl=64, ip_src=src_ip_str,
- ip_dst=dst_ip_str )
- pkt = str( parsed_pkt )
- self.dataplane.send( port1, pkt )
- for port in config[ "port_map" ].keys( ):
- if port == port2 or port == port1:
- verify_no_packet( self, pkt, port )
- continue
- verify_packet( self, pkt, port )
- verify_no_other_packets( self )
finally:
delete_all_flows( self.controller )
delete_groups( self.controller, Groups )
@@ -1388,7 +1377,7 @@
ecmp_gid, ecmp_msg = add_mpls_forwarding_group( self.controller,
subtype=OFDPA_MPLS_GROUP_SUBTYPE_ECMP, index=id, ref_gids=[mpls_label_gid] )
# add vlan flow table
- add_one_vlan_table_flow( self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
# add termination flow
add_termination_flow( self.controller, port, 0x8847, intf_src_mac, vlan_id, goto_table=24 )
#add_mpls_flow( self.controller, ecmp_gid, port, goto_table=29 )
@@ -1462,7 +1451,7 @@
# add L3 ecmp group
ecmp_msg = add_l3_ecmp_group( self.controller, id, [ l3_msg.group_id ] )
# add vlan flow table
- add_one_vlan_table_flow( self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
# add termination flow
add_termination_flow( self.controller, port, 0x8847, intf_src_mac, vlan_id, goto_table=24 )
add_mpls_flow( self.controller, ecmp_msg.group_id, mpls_label )
@@ -1529,7 +1518,7 @@
l3_msg = add_l3_unicast_group( self.controller, port, vlanid=vlan_id, id=vlan_id,
src_mac=intf_src_mac, dst_mac=dst_mac )
# add vlan flow table
- add_one_vlan_table_flow( self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
# add termination flow
add_termination_flow( self.controller, port, 0x0800, intf_src_mac, vlan_id )
# add unicast routing flow
@@ -1589,7 +1578,7 @@
l3_msg = add_l3_unicast_group( self.controller, port, vlanid=vlan_id + 1, id=vlan_id,
src_mac=intf_src_mac, dst_mac=dst_mac )
# add vlan flow table
- add_one_vlan_table_flow( self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
# add termination flow
add_termination_flow( self.controller, port, 0x0800, intf_src_mac, vlan_id )
# add unicast routing flow
@@ -1802,7 +1791,7 @@
Groups._put( l3_msg.group_id )
ecmp_msg = add_l3_ecmp_group( self.controller, ports[ 0 ], [ l3_msg.group_id ] )
# add vlan flow table
- add_one_vlan_table_flow( self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
# add termination flow
add_termination_flow( self.controller, port, 0x0800, intf_src_mac, vlan_id )
# add unicast routing flow
@@ -1894,8 +1883,8 @@
ports = sorted( config[ "port_map" ].keys( ) )
for port in ports:
vlan_id = Untagged.MAX_INTERNAL_VLAN - port
- add_one_vlan_table_flow( self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
- add_one_vlan_table_flow( self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_UNTAG )
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_TAG )
+ add_one_vlan_table_flow( self.controller, port, 1, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_UNTAG )
for other_port in ports:
if other_port == port:
continue
diff --git a/ofdpa/ipv6_flows.py b/ofdpa/ipv6_flows.py
index a7161a5..a20b6d9 100644
--- a/ofdpa/ipv6_flows.py
+++ b/ofdpa/ipv6_flows.py
@@ -100,6 +100,7 @@
add_one_vlan_table_flow(
ctrl=self.controller,
of_port=in_port,
+ out_vlan_id=1,
vlan_id=vlan_id,
flag=VLAN_TABLE_FLAG_ONLY_TAG
)
@@ -217,7 +218,6 @@
)
tcpv6_pkt = str( parsed_tcpv6_pkt )
self.dataplane.send(in_port, tcpv6_pkt)
- print_port_stats(self, in_port)
parsed_tcpv6_pkt = simple_tcpv6_packet(
pktlen=100,
eth_dst=dst_mac_str,
@@ -226,8 +226,6 @@
ipv6_src=sip,
ipv6_hlim=63
)
- time.sleep(2)
- print_port_stats(self, in_port)
tcpv6_pkt = str( parsed_tcpv6_pkt )
verify_packet(self, tcpv6_pkt, out_port )
verify_no_packet(self, tcpv6_pkt, in_port )
@@ -352,7 +350,6 @@
)
tcpv6_pkt = str( parsed_tcpv6_pkt )
self.dataplane.send(in_port, tcpv6_pkt)
- print_port_stats(self, in_port)
parsed_mplsv6_pkt = mplsv6_packet(
pktlen=104,
eth_dst=dst_mac_str,
@@ -363,8 +360,6 @@
label=[ label ]
)
mplsv6_pkt = str( parsed_mplsv6_pkt )
- time.sleep(2)
- print_port_stats(self, in_port)
verify_packet(self, mplsv6_pkt, out_port )
verify_no_packet(self, mplsv6_pkt, in_port )
verify_no_other_packets(self)
@@ -377,7 +372,6 @@
class _128ECMPL3( base_tests.SimpleDataPlane ):
""" Verifies /128 IP routing and ECMP """
-
def runTest( self ):
try:
@@ -474,7 +468,6 @@
)
tcpv6_pkt = str( parsed_tcpv6_pkt )
self.dataplane.send(in_port, tcpv6_pkt)
- print_port_stats(self, in_port)
parsed_tcpv6_pkt = simple_tcpv6_packet(
pktlen=100,
eth_dst=dst_mac_str,
@@ -484,8 +477,6 @@
ipv6_hlim=63
)
tcpv6_pkt = str( parsed_tcpv6_pkt )
- time.sleep(2)
- print_port_stats(self, in_port)
verify_packet(self, tcpv6_pkt, out_port )
verify_no_packet(self, tcpv6_pkt, in_port )
verify_no_other_packets(self)
@@ -587,7 +578,6 @@
)
tcpv6_pkt = str( parsed_tcpv6_pkt )
self.dataplane.send(in_port, tcpv6_pkt)
- print_port_stats(self, in_port)
parsed_tcpv6_pkt = simple_tcpv6_packet(
pktlen=100,
eth_dst=dst_mac_str,
@@ -596,8 +586,6 @@
ipv6_src=sip,
ipv6_hlim=63
)
- time.sleep(2)
- print_port_stats(self, in_port)
tcpv6_pkt = str( parsed_tcpv6_pkt )
verify_packet(self, tcpv6_pkt, out_port )
verify_no_packet(self, tcpv6_pkt, in_port )
@@ -721,7 +709,6 @@
)
tcpv6_pkt = str( parsed_tcpv6_pkt )
self.dataplane.send(in_port, tcpv6_pkt)
- print_port_stats(self, in_port)
parsed_mplsv6_pkt = mplsv6_packet(
pktlen=104,
eth_dst=dst_mac_str,
@@ -732,8 +719,6 @@
label=[ label ]
)
mplsv6_pkt = str( parsed_mplsv6_pkt )
- time.sleep(2)
- print_port_stats(self, in_port)
verify_packet(self, mplsv6_pkt, out_port )
verify_no_packet(self, mplsv6_pkt, in_port )
verify_no_other_packets(self)
@@ -824,6 +809,7 @@
add_one_vlan_table_flow(
ctrl=self.controller,
of_port=in_port,
+ out_vlan_id=1,
vlan_id=vlan_id,
flag=VLAN_TABLE_FLAG_ONLY_TAG
)
@@ -831,6 +817,7 @@
add_one_vlan_table_flow(
ctrl=self.controller,
of_port=in_port,
+ out_vlan_id=1,
vlan_id=vlan_id,
flag=VLAN_TABLE_FLAG_ONLY_UNTAG
)
@@ -843,7 +830,6 @@
)
tcpv6_pkt = str( parsed_tcpv6_pkt )
self.dataplane.send(in_port, tcpv6_pkt)
- print_port_stats(self, in_port)
parsed_tcpv6_pkt = simple_tcpv6_packet(
pktlen=100,
eth_dst=dst_mac_str,
@@ -853,8 +839,6 @@
ipv6_hlim=63
)
tcpv6_pkt = str( parsed_tcpv6_pkt )
- time.sleep(2)
- print_port_stats(self, in_port)
verify_packet(self, tcpv6_pkt, out_port )
verify_no_packet(self, tcpv6_pkt, in_port )
verify_no_other_packets(self)
@@ -955,7 +939,6 @@
)
tcpv6_pkt = str( parsed_tcpv6_pkt )
self.dataplane.send(in_port, tcpv6_pkt)
- print_port_stats(self, in_port)
parsed_tcpv6_pkt = simple_tcpv6_packet(
pktlen=100,
eth_dst=dst_mac_str,
@@ -964,8 +947,6 @@
ipv6_src=sip,
ipv6_hlim=63
)
- time.sleep(2)
- print_port_stats(self, in_port)
tcpv6_pkt = str( parsed_tcpv6_pkt )
verify_packet(self, tcpv6_pkt, out_port )
verify_no_packet(self, tcpv6_pkt, in_port )
@@ -1075,7 +1056,6 @@
)
mplsv6_pkt = str( parsed_mplsv6_pkt )
self.dataplane.send(in_port, mplsv6_pkt)
- print_port_stats(self, in_port)
parsed_tcpv6_pkt = simple_tcpv6_packet(
pktlen=100,
eth_dst=dst_mac_str,
@@ -1085,8 +1065,6 @@
ipv6_hlim=63
)
tcpv6_pkt = str( parsed_tcpv6_pkt )
- time.sleep(2)
- print_port_stats(self, in_port)
verify_packet(self, tcpv6_pkt, out_port )
verify_no_packet(self, tcpv6_pkt, in_port )
verify_no_other_packets(self)
diff --git a/ofdpa/pw_flows.py b/ofdpa/pw_flows.py
index 564ca56..01fabb9 100644
--- a/ofdpa/pw_flows.py
+++ b/ofdpa/pw_flows.py
@@ -2,6 +2,7 @@
Check README file
"""
import Queue
+import time
from oftest import config
import inspect
@@ -1699,3 +1700,133 @@
delete_groups( self.controller, Groups )
delete_groups( self.controller, Groups2 )
delete_all_groups( self.controller )
+
+class BoSBug( base_tests.SimpleDataPlane ):
+ """
+ This test is meant to verify the forwarding of the default traffic
+ when the rule for the PW transport (BoS=0) has been installed in the
+ switch, together with the rule for the transport of default routing
+ traffic. There is a bug in OFDPA 3.0EA4, which requires BOS=0 flow
+ to be installed before BOS=1 flow to generate correct packets. Incoming
+ packet has 1 label, and there is no VLAN tag in the incoming packet.
+ The expected behvior is the Pop of the outer MPLS label and plain IP
+ packet should exit from the switch.
+ """
+ def runTest( self ):
+ Groups = Queue.LifoQueue( )
+ try:
+ if len( config[ "port_map" ] ) < 1:
+ logging.info( "Port count less than 1, can't run this case" )
+ assert (False)
+ return
+ ports = config[ "port_map" ].keys( )
+ in_port = ports[0]
+ out_port = ports[1]
+ out_vlan = 4094
+ src_mac = [ 0x00, 0x00, 0x00, 0x00, 0x11, 0x01 ]
+ src_mac_str = ':'.join( [ '%02X' % x for x in src_mac ] )
+ dst_mac = [ 0x00, 0x00, 0x00, 0x11, 0x11, 0x01 ]
+ dst_mac_str = ':'.join( [ '%02X' % x for x in dst_mac ] )
+ mpls_label = 100
+ # Add l2 interface group, we have to pop the VLAN;
+ l2_intf_gid, l2_intf_msg = add_one_l2_interface_group(
+ ctrl=self.controller,
+ port=out_port,
+ vlan_id=out_vlan,
+ is_tagged=False,
+ send_barrier=False
+ )
+ Groups._put( l2_intf_gid )
+ # add MPLS interface group
+ mpls_intf_gid, mpls_intf_msg = add_mpls_intf_group(
+ ctrl=self.controller,
+ ref_gid=l2_intf_gid,
+ dst_mac=dst_mac,
+ src_mac=src_mac,
+ vid=out_vlan,
+ index=in_port
+ )
+ Groups._put( mpls_intf_gid )
+ # Add L3 Unicast group
+ l3_msg = add_l3_unicast_group(
+ ctrl=self.controller,
+ port=out_port,
+ vlanid=out_vlan,
+ id=in_port,
+ src_mac=src_mac,
+ dst_mac=dst_mac
+ )
+ Groups._put( l3_msg.group_id )
+ # Add L3 ecmp group
+ ecmp_msg = add_l3_ecmp_group(
+ ctrl=self.controller,
+ id=in_port,
+ l3_ucast_groups=[ l3_msg.group_id ]
+ )
+ Groups._put( ecmp_msg.group_id )
+ # Add MPLS flow with BoS=1
+ add_mpls_flow(
+ ctrl=self.controller,
+ action_group_id=ecmp_msg.group_id,
+ label=mpls_label
+ )
+ # add MPLS flow with BoS=0
+ add_mpls_flow_pw(
+ ctrl=self.controller,
+ action_group_id=mpls_intf_gid,
+ label=mpls_label,
+ ethertype=0x8847,
+ tunnel_index=1,
+ bos=0
+ )
+ # add Termination flow
+ add_termination_flow(
+ ctrl=self.controller,
+ in_port=in_port,
+ eth_type=0x8847,
+ dst_mac=src_mac,
+ vlanid=out_vlan,
+ goto_table=23
+ )
+ # add VLAN flows
+ add_one_vlan_table_flow(
+ ctrl=self.controller,
+ of_port=in_port,
+ vlan_id=out_vlan,
+ flag=VLAN_TABLE_FLAG_ONLY_TAG,
+ )
+ add_one_vlan_table_flow(
+ ctrl=self.controller,
+ of_port=in_port,
+ vlan_id=out_vlan,
+ flag=VLAN_TABLE_FLAG_ONLY_UNTAG
+ )
+ # Packet generation with sleep
+ time.sleep(2)
+ label = (mpls_label, 0, 1, 32)
+ parsed_pkt = mpls_packet(
+ pktlen=104,
+ vlan_vid=out_vlan,
+ ip_ttl=63,
+ eth_dst=src_mac_str,
+ label=[ label]
+ )
+ pkt = str( parsed_pkt )
+ self.dataplane.send( in_port, pkt )
+ # we geneate the expected pw packet
+ parsed_pkt = simple_tcp_packet(
+ pktlen=100,
+ vlan_vid=out_vlan,
+ ip_ttl=31,
+ eth_dst=dst_mac_str,
+ eth_src=src_mac_str,
+ )
+ pkt = str( parsed_pkt )
+ # Assertions
+ verify_packet( self, pkt, out_port )
+ verify_no_packet( self, pkt, in_port )
+ verify_no_other_packets( self )
+ finally:
+ delete_all_flows( self.controller )
+ delete_groups( self.controller, Groups )
+ delete_all_groups( self.controller )
\ No newline at end of file
diff --git a/ofdpa/utils.py b/ofdpa/utils.py
index f4236a2..253c037 100644
--- a/ofdpa/utils.py
+++ b/ofdpa/utils.py
@@ -148,9 +148,9 @@
L2_Groups = []
# add vlan flows table
- add_one_vlan_table_flow( controller, in_port, port_to_in_vlan[in_port], flag=VLAN_TABLE_FLAG_ONLY_TAG )
+ add_one_vlan_table_flow( controller, in_port, 1, port_to_in_vlan[in_port], flag=VLAN_TABLE_FLAG_ONLY_TAG )
if not is_ingress_tagged:
- add_one_vlan_table_flow( controller, in_port, port_to_in_vlan[in_port], flag=VLAN_TABLE_FLAG_ONLY_UNTAG )
+ add_one_vlan_table_flow( controller, in_port, 1, port_to_in_vlan[in_port], flag=VLAN_TABLE_FLAG_ONLY_UNTAG )
elif is_vlan_translated:
add_one_vlan_table_flow_translation( controller, in_port, port_to_in_vlan[in_port], port_to_out_vlan[in_port], flag=VLAN_TABLE_FLAG_ONLY_TAG)
# add termination flow
@@ -279,7 +279,7 @@
# add termination flow
add_termination_flow( controller, port, 0x0800, switch_mac, port_to_in_vlan[port] )
# add vlan flow table
- add_one_vlan_table_flow( controller, port, port_to_in_vlan[port], flag=VLAN_TABLE_FLAG_ONLY_TAG )
+ add_one_vlan_table_flow( controller, port, 1, port_to_in_vlan[port], flag=VLAN_TABLE_FLAG_ONLY_TAG )
return (
port_to_in_vlan,