summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-08-15 21:40:47 +0200
committerChristian Poessinger <christian@poessinger.com>2020-08-15 22:29:56 +0200
commit9455ae27d5ea9517867c2dff3142db31873cbfb4 (patch)
tree08e236b7a453354ac5a6016c5b00ab1f31c00329
parent743627b9df6f7e8e34b544270ece4bc64a90b438 (diff)
downloadvyos-1x-9455ae27d5ea9517867c2dff3142db31873cbfb4.tar.gz
vyos-1x-9455ae27d5ea9517867c2dff3142db31873cbfb4.zip
ethernet: check interface disable state
-rwxr-xr-xscripts/cli/test_interfaces_ethernet.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/cli/test_interfaces_ethernet.py b/scripts/cli/test_interfaces_ethernet.py
index c31a606da..761ec7506 100755
--- a/scripts/cli/test_interfaces_ethernet.py
+++ b/scripts/cli/test_interfaces_ethernet.py
@@ -42,5 +42,27 @@ class EthernetInterfaceTest(BasicInterfaceTest.BaseTest):
if not '.' in tmp:
self._interfaces.append(tmp)
+ def test_dhcp_disable(self):
+ """
+ When interface is configured as admin down, it must be admin down even
+ """
+ for interface in self._interfaces:
+ self.session.set(self._base_path + [interface, 'disable'])
+ for option in self._options.get(interface, []):
+ self.session.set(self._base_path + [interface] + option.split())
+
+ # Also enable DHCP (ISC DHCP always places interface in admin up
+ # state so we check that we do not start DHCP client.
+ # https://phabricator.vyos.net/T2767
+ self.session.set(self._base_path + [interface, 'address', 'dhcp'])
+
+ self.session.commit()
+
+ # Validate interface state
+ for interface in self._interfaces:
+ with open(f'/sys/class/net/{interface}/flags', 'r') as f:
+ flags = f.read()
+ self.assertEqual(int(flags, 16) & 1, 0)
+
if __name__ == '__main__':
unittest.main()