Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions ansible/roles/test/files/ptftests/vxlan-decap.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def generate_ArpResponderConfig(self):
config = {}
for test in self.tests:
for port in test['acc_ports']:
if port == 0 or port == 1:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we skip ports indexes 0 and 1?

continue
config['eth%d' % port] = [test['vlan_ip_prefix'] % port]

with open('/tmp/vxlan_arpresponder.conf', 'w') as fp:
Expand Down Expand Up @@ -166,10 +168,13 @@ def runTest(self):
print test['name']
res_v = self.Vxlan(test)
print " Vxlan = ", res_v

res_f = self.RegularLAGtoVLAN(test)
print " RegularLAGtoVLAN = ", res_f

res_t = self.RegularVLANtoLAG(test)
print " RegularVLANtoLAG = ", res_t

print
if self.vxlan_enabled:
self.assertTrue(res_v, "VxlanTest failed")
Expand All @@ -179,29 +184,34 @@ def runTest(self):
self.assertTrue(res_t, "RegularVLANtoLAG test failed")

def Vxlan(self, test):
rv = True
for n in self.net_ports:
for a in test['acc_ports']:
if a == 0 or a == 1:
continue
res = self.checkVxlan(a, n, test)
rv = rv and res
if not res: return False

return rv
return True

def RegularLAGtoVLAN(self, test):
rv = True
for n in self.net_ports:
for a in test['acc_ports']:
if a == 0 or a == 1:
continue
res = self.checkRegularRegularLAGtoVLAN(a, n, test)
rv = rv and res
return rv
if not res: return False

return True

def RegularVLANtoLAG(self, test):
rv = True
for dst, ports in self.pc_info:
for a in test['acc_ports']:
if a == 0 or a == 1:
continue
res = self.checkRegularRegularVLANtoLAG(a, ports, dst, test)
rv = rv and res
return rv
if not res: return False

return True

def checkRegularRegularVLANtoLAG(self, acc_port, pc_ports, dst_ip, test):
rv = True
Expand All @@ -228,8 +238,10 @@ def checkRegularRegularVLANtoLAG(self, acc_port, pc_ports, dst_ip, test):

for i in xrange(self.nr):
testutils.send_packet(self, acc_port, packet)
nr_rcvd = testutils.count_matched_packets_all_ports(self, exp_packet, pc_ports, timeout=0.1)
rv = rv and (nr_rcvd == self.nr)
if self.nr == 1:
rv = rv and verify_packet_any_port(self, exp_packet, pc_ports)
else:
rv = rv and self.nr == testutils.count_matched_packets_all_ports(self, exp_packet, pc_ports, timeout=0.1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this change?

return rv


Expand Down Expand Up @@ -257,8 +269,10 @@ def checkRegularRegularLAGtoVLAN(self, acc_port, net_port, test):

for i in xrange(self.nr):
testutils.send_packet(self, net_port, packet)
nr_rcvd = testutils.count_matched_packets(self, exp_packet, acc_port, timeout=0.1)
rv = rv and (nr_rcvd == self.nr)
if self.nr == 1:
rv = rv and verify_packet_any_port(self, exp_packet, [acc_port])
else:
rv = rv and self.nr == testutils.count_matched_packets(self, exp_packet, acc_port, timeout=0.1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this change?

return rv

def checkVxlan(self, acc_port, net_port, test):
Expand Down
2 changes: 2 additions & 0 deletions ansible/roles/test/tasks/vxlan-decap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
- vxlan_enabled=False
- config_file='/tmp/vxlan_decap.json'
- repetitions=1
ptf_extra_options: "--relax"

- name: Configure vxlan decap for {{ item }}
shell: sonic-cfggen -j /tmp/vxlan_db.{{ item }}.json --write-to-db
Expand All @@ -71,3 +72,4 @@
- vxlan_enabled=True
- config_file='/tmp/vxlan_decap.json'
- count=1
ptf_extra_options: "--relax"