Fixed MPLS testcase
diff --git a/accton/accton_util.py b/accton/accton_util.py
index 1eb2946..371a5ea 100755
--- a/accton/accton_util.py
+++ b/accton/accton_util.py
@@ -730,7 +730,7 @@
return request
-def add_mpls_flow(ctrl, action_group_id, label=100 ,ethertype=0x0800, bos=True, send_barrier=False):
+def add_mpls_flow(ctrl, action_group_id, label=100 ,ethertype=0x0800, bos=1, send_barrier=False):
match = ofp.match()
match.oxm_list.append(ofp.oxm.eth_type(0x8847))
match.oxm_list.append(ofp.oxm.mpls_label(label))
@@ -1324,4 +1324,4 @@
print "idle_timeout", obj.idle_timeout
print "hard_timeout", obj.hard_timeout
#obj.actions
- print "packet count: %lx"%obj.packet_count
\ No newline at end of file
+ print "packet count: %lx"%obj.packet_count
diff --git a/accton/group_test.py b/accton/group_test.py
index 84fbde4..8acb025 100755
--- a/accton/group_test.py
+++ b/accton/group_test.py
@@ -620,7 +620,7 @@
oam_lm_tx_count=False,
set_pri_from_table=False
)
- mpls_intf_msg.group_id
+
stats = get_stats(self, ofp.message.group_desc_stats_request())
verify_group_stats=[]
diff --git a/ofdpa/onos.py b/ofdpa/onos.py
index 608ae6f..cac61c1 100644
--- a/ofdpa/onos.py
+++ b/ofdpa/onos.py
@@ -11,21 +11,11 @@
"""
from oftest import config
+import logging
+import oftest.base_tests as base_tests
import ofp
from oftest.testutils import *
-from accton.accton_util import add_mpls_flow
from accton_util import *
-import src.python.oftest.testutils
-from src.python.oftest.testutils import do_barrier
-from src.python.oftest.testutils import delete_all_flows
-from src.python.oftest.testutils import delete_all_groups
-from src.python.oftest.testutils import simple_tcp_packet
-from src.python.oftest.testutils import verify_packet_in
-from src.python.oftest.testutils import verify_no_other_packets
-from src.python.oftest.testutils import verify_no_packet
-from src.python.oftest.testutils import verify_packets
-from src.python.oftest.testutils import verify_packet
-from src.python.oftest.testutils import mpls_packet
class PacketInSrcMacMiss(base_tests.SimpleDataPlane):
@@ -443,13 +433,15 @@
dst_mac[5]=vlan_id
#add L3 Unicast group
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 L3 ecmp group
+ ecmp_msg = add_l3_ecmp_group(self.controller, port, [l3_msg.group_id])
#add vlan flow table
add_one_vlan_table_flow(self.controller, port, vlan_id, flag=VLAN_TABLE_FLAG_ONLY_BOTH)
#add termination flow
- add_termination_flow(self.controller, port, 0x0800, intf_src_mac, vlan_id)
+ add_termination_flow(self.controller, port, 0x8847, intf_src_mac, vlan_id, goto_table=24)
#add routing flow
dst_ip = dip + (vlan_id<<8)
- add_mpls_flow(self.controller, l3_msg.group_id, port)
+ add_mpls_flow(self.controller, ecmp_msg.group_id, port)
#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)
@@ -464,16 +456,18 @@
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)
+
+ label = (out_port, 0, 1, 32)
+ parsed_pkt = mpls_packet(pktlen=104, dl_vlan_enable=True, vlan_vid=in_port, ip_src=ip_src,
+ ip_dst=ip_dst, eth_dst=switch_mac, eth_src=mac_src, label=[label])
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(dl_vlan_enable=True, vlan_vid=out_port, ip_ttl=64, ip_src=ip_src,
- ip_dst=ip_dst, eth_dst=mac_dst, eth_src=switch_mac, label=[label])
+ exp_pkt = simple_tcp_packet(pktlen=100, dl_vlan_enable=True, vlan_vid=out_port,
+ eth_dst=mac_dst, eth_src=switch_mac, ip_ttl=31, ip_src=ip_src, ip_dst=ip_dst)
pkt=str(exp_pkt)
verify_packet(self, pkt, out_port)
- verify_no_other_packets(self)
\ No newline at end of file
+ verify_no_other_packets(self)
+
diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index 7c6978b..c1fc58b 100755
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -409,7 +409,7 @@
ip_ihl=None,
ip_options=False,
label=None,
- inner_payload=None
+ inner_payload=True
):
if MINSIZE > pktlen:
pktlen = MINSIZE
@@ -431,6 +431,8 @@
pkt=pkt / \
scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
scapy.TCP(sport=tcp_sport, dport=tcp_dport, flags=tcp_flags)
+
+ pkt = pkt/("D" * (pktlen - len(pkt)))
return pkt