summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_static_arp.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_protocols_static_arp.py b/smoketest/scripts/cli/test_protocols_static_arp.py
index f89cdacbb..47b04a48a 100755
--- a/smoketest/scripts/cli/test_protocols_static_arp.py
+++ b/smoketest/scripts/cli/test_protocols_static_arp.py
@@ -86,5 +86,39 @@ class TestARP(VyOSUnitTestSHIM.TestCase):
print(entry)
self.assertTrue(found)
+ def test_static_arp_deletion(self):
+ # deleting the "protocols static arp" node must remove the
+ # previously installed PERMANENT ARP entry from the kernel
+ host = '192.0.2.10'
+ mac = '00:01:02:03:04:0a'
+
+ def get_static_arp_entry():
+ # Return our static (PERMANENT) neighbour, matched by dst + dev.
+ arp_table = json.loads(cmdl(['ip', '-j', '-4', 'neigh', 'show']))
+ for entry in arp_table:
+ if (
+ entry['dst'] == host
+ and entry['dev'] == interface
+ and 'PERMANENT' in entry.get('state', [])
+ ):
+ return entry
+ return None
+
+ self.cli_set(base_path + ['interface', interface, 'address', host, 'mac', mac])
+ self.cli_commit()
+
+ # the static PERMANENT entry must be present with all configured fields
+ entry = get_static_arp_entry()
+ self.assertIsNotNone(entry)
+ self.assertEqual(entry['dst'], host)
+ self.assertEqual(entry['lladdr'], mac)
+ self.assertEqual(entry['dev'], interface)
+
+ # delete the whole node and verify the static entry is gone
+ self.cli_delete(base_path)
+ self.cli_commit()
+
+ self.assertIsNone(get_static_arp_entry())
+
if __name__ == '__main__':
unittest.main(verbosity=2, failfast=VyOSUnitTestSHIM.TestCase.debug_on())