Add missing unit-test for IbInterface ethtool opts
This commit adds missing unit tests for IbInterface Change-Id: I62b278e1c64252cfd9698f2b3d5ba2ab095587cb (cherry picked from commitafc7a8fc63
) (cherry picked from commitaa7e497777
)
This commit is contained in:
parent
580cce3cd8
commit
683650abeb
|
@ -1099,6 +1099,21 @@ ETHTOOL_OPTS=\"speed 1000 duplex full\"
|
|||
"""
|
||||
self.assertEqual(em1_config, self.get_interface_config('em1'))
|
||||
|
||||
def test_ib_interface_ethtool_opts(self):
|
||||
ifc = objects.IbInterface('ib0', ethtool_opts='speed 1000 duplex full')
|
||||
self.provider.add_interface(ifc)
|
||||
ib_config = """# This file is autogenerated by os-net-config
|
||||
DEVICE=ib0
|
||||
ONBOOT=yes
|
||||
HOTPLUG=no
|
||||
NM_CONTROLLED=no
|
||||
PEERDNS=no
|
||||
TYPE=Infiniband
|
||||
ETHTOOL_OPTS=\"speed 1000 duplex full\"
|
||||
BOOTPROTO=none
|
||||
"""
|
||||
self.assertEqual(ib_config, self.get_interface_config('ib0'))
|
||||
|
||||
def test_interface_single_dns_server(self):
|
||||
interface1 = objects.Interface('em1', dns_servers=['1.2.3.4'])
|
||||
self.provider.add_interface(interface1)
|
||||
|
|
|
@ -1322,6 +1322,7 @@ class TestIbInterface(base.TestCase):
|
|||
data = '{"type": "ib_interface", "name": "ib0", "use_dhcp": true}'
|
||||
ib_interface = objects.object_from_json(json.loads(data))
|
||||
self.assertEqual("ib0", ib_interface.name)
|
||||
self.assertIsNone(ib_interface.ethtool_opts)
|
||||
self.assertTrue(ib_interface.use_dhcp)
|
||||
|
||||
def test_from_json_defroute(self):
|
||||
|
@ -1338,6 +1339,15 @@ class TestIbInterface(base.TestCase):
|
|||
self.assertTrue(ib_interface1.defroute)
|
||||
self.assertFalse(ib_interface2.defroute)
|
||||
|
||||
def test_from_json_ethtool_opts(self):
|
||||
data = """{
|
||||
"type": "ib_interface",
|
||||
"name": "ib0",
|
||||
"ethtool_opts": "speed 1000 duplex full"
|
||||
}"""
|
||||
ib_ifc = objects.object_from_json(json.loads(data))
|
||||
self.assertEqual("speed 1000 duplex full", ib_ifc.ethtool_opts)
|
||||
|
||||
def test_from_json_dhclient_args(self):
|
||||
data = """{
|
||||
"type": "ib_interface",
|
||||
|
|
Loading…
Reference in New Issue