Testing build ofdpa i19
diff --git a/accton/accton_util.py b/accton/accton_util.py
index 5823a65..85dec8b 100755
--- a/accton/accton_util.py
+++ b/accton/accton_util.py
@@ -257,7 +257,7 @@
if dst_mac is not None:
action.append(ofp.action.set_field(ofp.oxm.eth_dst(dst_mac)))
- action.append(ofp.action.set_field(ofp.oxm.vlan_vid(vlanid)))
+ action.append(ofp.action.set_field(ofp.oxm.vlan_vid(0x1000+vlanid)))
action.append(ofp.action.group(group_id))
@@ -452,7 +452,7 @@
instructions=[
ofp.instruction.apply_actions(
actions=[
- ofp.action.set_field(ofp.oxm.vlan_vid(vlan_id))
+ ofp.action.set_field(ofp.oxm.vlan_vid(0x1000+vlan_id))
]
),
ofp.instruction.goto_table(20)
@@ -473,7 +473,7 @@
instructions=[
ofp.instruction.apply_actions(
actions=[
- ofp.action.set_field(ofp.oxm.vlan_vid(vlan_id))
+ ofp.action.set_field(ofp.oxm.vlan_vid(0x1000+vlan_id))
]
),
ofp.instruction.goto_table(20)
@@ -606,7 +606,7 @@
if vrf!=0:
actions.append(ofp.action.set_field(ofp.oxm.exp2ByteValue(exp_type=1, value=vrf)))
- actions.append(ofp.action.set_field(ofp.oxm.vlan_vid(vlan_id)))
+ actions.append(ofp.action.set_field(ofp.oxm.vlan_vid(0x1000+vlan_id)))
request = ofp.message.flow_add(
table_id=10,
@@ -631,7 +631,7 @@
if vrf!=0:
actions.append(ofp.action.set_field(ofp.oxm.exp2ByteValue(exp_type=1, value=vrf)))
- actions.append(ofp.action.set_field(ofp.oxm.vlan_vid(value=vlan_id)))
+ actions.append(ofp.action.set_field(ofp.oxm.vlan_vid(value=0x1000+vlan_id)))
request = ofp.message.flow_add(
table_id=10,
@@ -745,27 +745,29 @@
return request
-def add_unicast_routing_flow(ctrl, eth_type, dst_ip, mask, action_group_id, vrf=0, send_barrier=False):
+def add_unicast_routing_flow(ctrl, eth_type, dst_ip, mask, action_group_id, vrf=0, send_ctrl=False, send_barrier=False):
match = ofp.match()
match.oxm_list.append(ofp.oxm.eth_type(eth_type))
if vrf != 0:
match.oxm_list.append(ofp.oxm.exp2ByteValue(ofp.oxm.OFDPA_EXP_TYPE_VRF, vrf))
-
- if mask!=0:
- match.oxm_list.append(ofp.oxm.ipv4_dst_masked(dst_ip, mask))
- else:
- match.oxm_list.append(ofp.oxm.ipv4_dst(dst_ip))
+ match.oxm_list.append(ofp.oxm.ipv4_dst_masked(dst_ip, mask))
+
+ instructions = []
+ instructions.append(ofp.instruction.goto_table(60))
+ if send_ctrl:
+ instructions.append(ofp.instruction.apply_actions(
+ actions=[ofp.action.output( port=ofp.OFPP_CONTROLLER,
+ max_len=ofp.OFPCML_NO_BUFFER)]))
+ else:
+ instructions.append(ofp.instruction.write_actions(
+ actions=[ofp.action.group(action_group_id)]))
request = ofp.message.flow_add(
table_id=30,
cookie=42,
match=match,
- instructions=[
- ofp.instruction.write_actions(
- actions=[ofp.action.group(action_group_id)]),
- ofp.instruction.goto_table(60)
- ],
+ instructions=instructions,
buffer_id=ofp.OFP_NO_BUFFER,
priority=1)
@@ -1226,7 +1228,7 @@
action=[]
action.append(ofp.action.set_field(ofp.oxm.eth_src(src_mac)))
action.append(ofp.action.set_field(ofp.oxm.eth_dst(dst_mac)))
- action.append(ofp.action.set_field(ofp.oxm.vlan_vid(vid)))
+ action.append(ofp.action.set_field(ofp.oxm.vlan_vid(0x1000+vid)))
action.append(ofp.action.group(ref_gid))
buckets = [ofp.bucket(actions=action)]
diff --git a/ofdpa/flows.py b/ofdpa/flows.py
index 38e5684..c3c3ee7 100644
--- a/ofdpa/flows.py
+++ b/ofdpa/flows.py
@@ -21,6 +21,7 @@
from oftest.testutils import *
from accton_util import *
+@disabled
class PacketInSrcMacMiss(base_tests.SimpleDataPlane):
"""
Test packet in function on a src-mac miss
@@ -96,6 +97,57 @@
verify_no_other_packets(self)
+@disabled
+class PacketInIPTable(base_tests.SimpleDataPlane):
+ """
+ Test packet in function on IPTABLE
+ 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
+ """
+
+ def runTest(self):
+ delete_all_flows(self.controller)
+ delete_all_groups(self.controller)
+
+ intf_src_mac=[0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc]
+ dst_mac=[0x00, 0x00, 0x00, 0x22, 0x22, 0x00]
+ dip=0xc0a80001
+ ports = sorted(config["port_map"].keys())
+ for port in ports:
+ #add l2 interface group
+ vlan_id=port
+ add_one_l2_interface_group(self.controller, port, vlan_id=vlan_id, is_tagged=True, send_barrier=False)
+ dst_mac[5]=vlan_id
+ 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 termination flow
+ add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
+ #add unicast routing flow
+ dst_ip = dip + (vlan_id<<8)
+ add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xfffffff0, l3_msg.group_id, send_ctrl=True)
+
+ do_barrier(self.controller)
+
+ switch_mac = ':'.join(['%02X' % x for x in intf_src_mac])
+ for in_port in ports:
+ mac_src='00:00:00:22:22:%02X' % in_port
+ ip_src='192.168.%02d.1' % in_port
+ for out_port in ports:
+ if in_port == out_port:
+ continue
+ ip_dst='192.168.%02d.1' % out_port
+ parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=in_port,
+ eth_dst=switch_mac, eth_src=mac_src, ip_ttl=64, ip_src=ip_src,
+ ip_dst=ip_dst)
+ pkt=str(parsed_pkt)
+ self.dataplane.send(in_port, pkt)
+ verify_packet_in(self, pkt, in_port, ofp.OFPR_ACTION)
+ #verify_no_other_packets(self)
+
+
+@disabled
class ArpNL2(base_tests.SimpleDataPlane):
def runTest(self):
delete_all_flows(self.controller)
@@ -389,7 +441,7 @@
verify_no_other_packets(self)
-
+@disabled
class Mtu4000(base_tests.SimpleDataPlane):
"""
Test output function for an exact-match flow
@@ -464,7 +516,7 @@
add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
#add unicast routing flow
dst_ip = dip + (vlan_id<<8)
- add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0, l3_msg.group_id)
+ add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffffff, l3_msg.group_id)
#add entries in the Bridging table to avoid packet-in from mac learning
group_id = encode_l2_interface_group_id(vlan_id, port)
add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True)
@@ -528,7 +580,7 @@
#add termination flow
add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
#add routing flow
- dst_ip = 0
+ dst_ip = dip + (vlan_id<<8)
#add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0, mpls_label_gid, vrf=2)
add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffff00, ecmp_msg.group_id, vrf=2)
#add entries in the Bridging table to avoid packet-in from mac learning
@@ -559,7 +611,7 @@
verify_packet(self, pkt, out_port)
verify_no_other_packets(self)
-
+@disabled
class L3VPN_32(base_tests.SimpleDataPlane):
"""
Insert IP packet
@@ -596,7 +648,7 @@
add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
#add routing flow
dst_ip = dip + (vlan_id<<8)
- add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0, mpls_gid, vrf=2)
+ add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffffff, mpls_gid, vrf=2)
#ecmp_msg.group_id, vrf=2)
#add entries in the Bridging table to avoid packet-in from mac learning
group_id = encode_l2_interface_group_id(vlan_id, port)
@@ -626,6 +678,7 @@
verify_packet(self, pkt, out_port)
verify_no_other_packets(self)
+@disabled
class MplsTermination(base_tests.SimpleDataPlane):
"""
Insert IP packet
@@ -692,6 +745,7 @@
verify_packet(self, pkt, out_port)
verify_no_other_packets(self)
+@disabled
class MPLSBUG(base_tests.SimpleDataPlane):
def runTest(self):
@@ -724,7 +778,7 @@
add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
#add unicast routing flow
dst_ip = dip + (vlan_id<<8)
- add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0, l3_msg.group_id)
+ add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffffff, l3_msg.group_id)
#add entries in the Bridging table to avoid packet-in from mac learning
group_id = encode_l2_interface_group_id(vlan_id, port)
@@ -769,6 +823,7 @@
verify_packet(self, pkt, out_port)
verify_no_other_packets(self)
+@disabled
class L3McastToL2(base_tests.SimpleDataPlane):
"""
Mcast routing to L2
@@ -835,6 +890,7 @@
verify_packet(self, pkt, port)
verify_no_other_packets(self)
+@disabled
class L3McastToL3(base_tests.SimpleDataPlane):
"""
Mcast routing
@@ -905,6 +961,7 @@
verify_packet(self, pkt, port3)
verify_no_other_packets(self)
+@disabled
class L3McastToVPN(base_tests.SimpleDataPlane):
"""
Mcast routing
@@ -1015,13 +1072,13 @@
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, flag=VLAN_TABLE_FLAG_ONLY_TAG)
+ add_one_vlan_table_flow(self.controller, port, 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)
#add routing flow
dst_ip = dip + (vlan_id<<8)
#add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffff00, mpls_label_gid, vrf=2)
- add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffff00, ecmp_msg.group_id, vrf=2)
+ add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0xffffff00, ecmp_msg.group_id)
#add entries in the Bridging table to avoid packet-in from mac learning
group_id = encode_l2_interface_group_id(vlan_id, port)
add_bridge_flow(self.controller, dst_mac, vlan_id, group_id, True)
@@ -1039,7 +1096,7 @@
#add routing flow
dst_ip = 0x0
#add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0x0, mpls_label_gid, vrf=2)
- add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0x0, ecmp_msg.group_id, vrf=2)
+ add_unicast_routing_flow(self.controller, 0x0800, dst_ip, 0x0, ecmp_msg.group_id)
do_barrier(self.controller)
@@ -1064,16 +1121,16 @@
pkt=str(exp_pkt)
verify_packet(self, pkt, out_port)
verify_no_other_packets(self)
- ip_dst='1.168.%02d.1' % out_port
+ ip_dst='1.168.%02d.1' % ports[0]
parsed_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=in_port,
eth_dst=switch_mac, eth_src=mac_src, ip_ttl=64, ip_src=ip_src, ip_dst=ip_dst)
pkt=str(parsed_pkt)
self.dataplane.send(in_port, pkt)
#build expect packet
- mac_dst='00:00:00:22:22:%02X' % out_port
- label = (out_port, 0, 1, 32)
- exp_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=out_port, ip_ttl=63, ip_src=ip_src,
+ mac_dst='00:00:00:22:22:%02X' % ports[0]
+ label = (ports[0], 0, 1, 32)
+ exp_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=ports[0], ip_ttl=63, ip_src=ip_src,
ip_dst=ip_dst, eth_dst=mac_dst, eth_src=switch_mac, label=[label])
pkt=str(exp_pkt)
- verify_packet(self, pkt, out_port)
+ verify_packet(self, pkt, ports[0])
verify_no_other_packets(self)