|
2 | 2 | import pytest
|
3 | 3 |
|
4 | 4 | from distutils.version import StrictVersion
|
5 |
| -from dvslib.dvs_common import PollingConfig |
| 5 | +from dvslib.dvs_common import PollingConfig, wait_for_result |
6 | 6 |
|
7 | 7 | @pytest.mark.usefixtures("testlog")
|
8 | 8 | @pytest.mark.usefixtures('dvs_vlan_manager')
|
@@ -436,6 +436,58 @@ def test_VlanHostIf(self, dvs):
|
436 | 436 | self.dvs_vlan.get_and_verify_vlan_ids(0)
|
437 | 437 | self.dvs_vlan.get_and_verify_vlan_hostif_ids(len(dvs.asic_db.hostif_name_map) - 1)
|
438 | 438 |
|
| 439 | + def test_VlanGratArp(self, dvs): |
| 440 | + def arp_accept_enabled(): |
| 441 | + rc, res = dvs.runcmd("cat /proc/sys/net/ipv4/conf/Vlan{}/arp_accept".format(vlan)) |
| 442 | + return (res.strip("\n") == "1", res) |
| 443 | + |
| 444 | + def arp_accept_disabled(): |
| 445 | + rc, res = dvs.runcmd("cat /proc/sys/net/ipv4/conf/Vlan{}/arp_accept".format(vlan)) |
| 446 | + return (res.strip("\n") == "0", res) |
| 447 | + |
| 448 | + vlan = "2" |
| 449 | + self.dvs_vlan.create_vlan(vlan) |
| 450 | + self.dvs_vlan.create_vlan_interface(vlan) |
| 451 | + self.dvs_vlan.set_vlan_intf_property(vlan, "grat_arp", "enabled") |
| 452 | + |
| 453 | + wait_for_result(arp_accept_enabled, PollingConfig(), "IPv4 arp_accept not enabled") |
| 454 | + |
| 455 | + # Not currently possible to test `accept_untracked_na` as it doesn't exist in the kernel for |
| 456 | + # our test VMs (only present in kernels 5.19 and above) |
| 457 | + |
| 458 | + self.dvs_vlan.set_vlan_intf_property(vlan, "grat_arp", "disabled") |
| 459 | + |
| 460 | + wait_for_result(arp_accept_disabled, PollingConfig(), "IPv4 arp_accept not disabled") |
| 461 | + |
| 462 | + self.dvs_vlan.remove_vlan(vlan) |
| 463 | + |
| 464 | + def test_VlanProxyArp(self, dvs): |
| 465 | + |
| 466 | + def proxy_arp_enabled(): |
| 467 | + rc, proxy_arp_res = dvs.runcmd("cat /proc/sys/net/ipv4/conf/Vlan{}/proxy_arp".format(vlan)) |
| 468 | + rc, pvlan_res = dvs.runcmd("cat /proc/sys/net/ipv4/conf/Vlan{}/proxy_arp_pvlan".format(vlan)) |
| 469 | + |
| 470 | + return (proxy_arp_res.strip("\n") == "1" and pvlan_res.strip("\n") == "1", (proxy_arp_res, pvlan_res)) |
| 471 | + |
| 472 | + def proxy_arp_disabled(): |
| 473 | + rc, proxy_arp_res = dvs.runcmd("cat /proc/sys/net/ipv4/conf/Vlan{}/proxy_arp".format(vlan)) |
| 474 | + rc, pvlan_res = dvs.runcmd("cat /proc/sys/net/ipv4/conf/Vlan{}/proxy_arp_pvlan".format(vlan)) |
| 475 | + |
| 476 | + return (proxy_arp_res.strip("\n") == "0" and pvlan_res.strip("\n") == "0", (proxy_arp_res, pvlan_res)) |
| 477 | + |
| 478 | + vlan = "2" |
| 479 | + self.dvs_vlan.create_vlan(vlan) |
| 480 | + self.dvs_vlan.create_vlan_interface(vlan) |
| 481 | + self.dvs_vlan.set_vlan_intf_property(vlan, "proxy_arp", "enabled") |
| 482 | + |
| 483 | + wait_for_result(proxy_arp_enabled, PollingConfig(), 'IPv4 proxy_arp or proxy_arp_pvlan not enabled') |
| 484 | + |
| 485 | + self.dvs_vlan.set_vlan_intf_property(vlan, "proxy_arp", "disabled") |
| 486 | + |
| 487 | + wait_for_result(proxy_arp_disabled, PollingConfig(), 'IPv4 proxy_arp or proxy_arp_pvlan not disabled') |
| 488 | + |
| 489 | + self.dvs_vlan.remove_vlan(vlan) |
| 490 | + |
439 | 491 | # Add Dummy always-pass test at end as workaroud
|
440 | 492 | # for issue when Flaky fail on final test it invokes module tear-down before retrying
|
441 | 493 | def test_nonflaky_dummy():
|
|
0 commit comments