Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial testing for OF-DPA 2.0 #189

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.pyc
profiles/*.pyc
*~
.*.swp
9 changes: 9 additions & 0 deletions src/python/oftest/dataplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
else:
import pcap

MATCH_VERBOSE=False

def match_exp_pkt(exp_pkt, pkt):
"""
Compare the string value of pkt with the string value of exp_pkt,
Expand All @@ -43,6 +45,13 @@ def match_exp_pkt(exp_pkt, pkt):
p = str(pkt)
if len(e) < 60:
p = p[:len(e)]
if MATCH_VERBOSE and e != p:
i = 0
for i in range(0, min(len(e), len(p))):
if e[i] != p[i]:
break
logging.info("Ignoring packet that doesn't match on byte %d: expected is \'%s\' got \'%s\'"
% (i, hex(ord(e[i])), hex(ord(p[i]))))
return e == p


Expand Down
5 changes: 3 additions & 2 deletions src/python/oftest/oft12/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def simple_ipv6_packet(pktlen=100,
ip_src='fe80::2420:52ff:fe8f:5189',
ip_dst='fe80::2420:52ff:fe8f:5190',
ip_tos=0,
ip_ttl=64,
tcp_sport=0,
tcp_dport=0,
EH = False,
Expand Down Expand Up @@ -265,11 +266,11 @@ def simple_ipv6_packet(pktlen=100,
if (dl_vlan_enable):
pkt = Ether(dst=dl_dst, src=dl_src)/ \
Dot1Q(prio=dl_vlan_pcp, id=dl_vlan_cfi, vlan=dl_vlan)/ \
IPv6(src=ip_src, dst=ip_dst)
IPv6(src=ip_src, dst=ip_dst, hlim=ip_ttl)

else:
pkt = Ether(dst=dl_dst, src=dl_src)/ \
IPv6(src=ip_src, dst=ip_dst)
IPv6(src=ip_src, dst=ip_dst, hlim=ip_ttl)

# Add IPv6 Extension Headers
if EH:
Expand Down
Loading