Skip to content

Commit

Permalink
[test_vrf][fib_test] ip options other then False support (#5611)
Browse files Browse the repository at this point in the history
Summary:
Adds ability to pass IP option to ptf
Fixes vrf test cases - fix typo and add ip option

Approach
What is the motivation for this PR?
To pass test_vrf1_drop_pkts_with_ip_opt

How did you do it?
How did you verify/test it?
Run test_vrf1_drop_pkts_with_ip_opt

Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com>
  • Loading branch information
vboykox authored May 16, 2022
1 parent a42ea63 commit 57e5b17
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
9 changes: 8 additions & 1 deletion ansible/roles/test/files/ptftests/fib_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ def setUp(self):

self.pkt_action = self.test_params.get('pkt_action', self.ACTION_FWD)
self.ttl = self.test_params.get('ttl', 64)
self.ip_options = self.test_params.get('ip_options', False)

self.ip_options = False
ip_options_list = self.test_params.get('ip_options', False)
if isinstance(ip_options_list, list) and ip_options_list:
self.ip_options = scapy.IPOption(ip_options_list[0])
for opt in ip_options_list[1:]:
self.ip_options /= scapy.IPOption(opt)

self.src_vid = self.test_params.get('src_vid', None)
self.dst_vid = self.test_params.get('dst_vid', None)

Expand Down
12 changes: 6 additions & 6 deletions tests/vrf/test_vrf_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,34 +154,34 @@ def setup_vrf_attr_ip_opt_action(self, duthosts, rand_one_dut_hostname, ptfhost)
duthost.shell("config load -y /tmp/vrf_restore.json")

def test_vrf1_drop_pkts_with_ip_opt(self, partial_ptf_runner):
# verify packets in Vrf1 with ip_option should be drop
# verify packets in Vrf1 with ip_options should be drop
partial_ptf_runner(
testname='vrf_test.FwdTest',
pkt_action='drop',
fib_info_files=['/tmp/vrf1_neigh.txt'],
ip_option=True,
ip_options=[b'\x94\x04\x00\x00'], # router alert
ipv4=True,
ipv6=False,
src_ports=g_vars['vrf_intf_member_port_indices']['Vrf1']['Vlan1000']
)

def test_vrf1_fwd_pkts_without_ip_opt(self, partial_ptf_runner):
# verify packets in Vrf1 without ip_option should be forward
# verify packets in Vrf1 without ip_options should be forward
partial_ptf_runner(
testname='vrf_test.FwdTest',
fib_info_files=['/tmp/vrf1_neigh.txt'],
ip_option=False,
ip_options=False,
ipv4=True,
ipv6=False,
src_ports=g_vars['vrf_intf_member_port_indices']['Vrf1']['Vlan1000']
)

def test_vrf2_fwd_pkts_with_ip_opt(self, partial_ptf_runner):
# verify packets in Vrf2 with ip_option should be forward
# verify packets in Vrf2 with ip_options should be forward
partial_ptf_runner(
testname='vrf_test.FwdTest',
fib_info_files=['/tmp/vrf2_neigh.txt'],
ip_option=True,
ip_options=[b'\x94\x04\x00\x00'], # router alert
ipv4=True,
ipv6=False,
src_ports=g_vars['vrf_intf_member_port_indices']['Vrf2']['Vlan2000']
Expand Down

0 comments on commit 57e5b17

Please sign in to comment.