diff options
author | Brent Eagles <beagles@redhat.com> | 2016-11-07 17:57:02 -0330 |
---|---|---|
committer | Brent Eagles <beagles@redhat.com> | 2016-11-18 14:38:45 -0330 |
commit | 433a0f3cbe59fd5da183245bf7e6dcd4af4b8c88 (patch) | |
tree | a70bd0e53a3b73bb5c350982459b048d2dbc8c79 /os_net_config/tests/test_objects.py | |
parent | 9971eb3af988b1f7c003048af161489ab79b1b0c (diff) |
Add support for enabling hotplug on interfaces
This patch adds support for enabling hotplugging on interfaces (disabled
by default). This is useful for configuring SR-IOV root devices so that
they "return" to the system when no longer used by a VM.
Note: also updates an invalid value in the interface and ib_interface
sample files.
Partial-Bug: #1639901
Change-Id: Idfc17d6f20bb306271838895bc53f4b109dd664d
Diffstat (limited to 'os_net_config/tests/test_objects.py')
-rw-r--r-- | os_net_config/tests/test_objects.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/os_net_config/tests/test_objects.py b/os_net_config/tests/test_objects.py index ca2dd47..23a3bbe 100644 --- a/os_net_config/tests/test_objects.py +++ b/os_net_config/tests/test_objects.py @@ -98,6 +98,27 @@ class TestInterface(base.TestCase): self.assertEqual("em1", interface.name) self.assertTrue(interface.use_dhcp) + def test_from_json_hotplug(self): + data = """{ +"type": "interface", +"name": "em1", +"hotplug": true +} +""" + interface = objects.object_from_json(json.loads(data)) + self.assertEqual("em1", interface.name) + self.assertTrue(interface.hotplug) + + def test_from_json_hotplug_off_by_default(self): + data = """{ +"type": "interface", +"name": "em1" +} +""" + interface = objects.object_from_json(json.loads(data)) + self.assertEqual("em1", interface.name) + self.assertFalse(interface.hotplug) + def test_from_json_defroute(self): data = '{"type": "interface", "name": "em1", "use_dhcp": true}' interface1 = objects.object_from_json(json.loads(data)) |