diff options
author | Laura Moore <laura.moore@sap.com> | 2015-07-27 17:33:22 -0400 |
---|---|---|
committer | vsaienko <vsaienko@mirantis.com> | 2016-02-04 22:40:54 +0200 |
commit | e5c5ddbdc8b015221b2656270a2f3f21414a055f (patch) | |
tree | 3107a2e62e3a5c44cc8853763469720b94b66e44 /ironic/tests/unit/common/test_network.py | |
parent | a603e3c12c62e29e12e45283d8602f9aa5acfc0f (diff) | |
download | ironic-e5c5ddbdc8b015221b2656270a2f3f21414a055f.tar.gz |
Add portgroups to support LAG interfaces - net
Ironic should be able to provide the requisite connectivity
information to the Neutron ML2 plugin to allow drivers to
provision the top-of-rack switch for the bare metal server.
The addition of portgroups in Ironic allows the concept of
link aggregation to be handled in Ironic in order to provide
support for cases where multiple interfaces on the bare metal
server connect to switch ports of a single LAG.
This commit includes changes to:
- the port vif mapping to also use portgroups
Partial-bug: #1526403
DocImpact
Co-Authored-By: Jenny Moorehead (jenny.moorehead@sap.com)
Co-Authored-By: Will Stevenson (will.stevenson@sap.com)
Co-Authored-By: Vasyl Saienko (vsaienko@mirantis.com)
Change-Id: I7f1cba65275078da750aa49ae83ba7345d6fd5e0
Diffstat (limited to 'ironic/tests/unit/common/test_network.py')
-rw-r--r-- | ironic/tests/unit/common/test_network.py | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/ironic/tests/unit/common/test_network.py b/ironic/tests/unit/common/test_network.py index 3be34006d..8a318f2b8 100644 --- a/ironic/tests/unit/common/test_network.py +++ b/ironic/tests/unit/common/test_network.py @@ -30,8 +30,9 @@ class TestNetwork(db_base.DbTestCase): mgr_utils.mock_the_extension_manager(driver='fake') self.node = object_utils.create_test_node(self.context) - def test_get_node_vif_ids_no_ports(self): - expected = {} + def test_get_node_vif_ids_no_ports_no_portgroups(self): + expected = {'portgroups': {}, + 'ports': {}} with task_manager.acquire(self.context, self.node.uuid) as task: result = network.get_node_vif_ids(task) self.assertEqual(expected, result) @@ -42,7 +43,19 @@ class TestNetwork(db_base.DbTestCase): uuid=uuidutils.generate_uuid(), extra={'vif_port_id': 'test-vif-A'}, driver='fake') - expected = {port1.uuid: 'test-vif-A'} + expected = {'portgroups': {}, + 'ports': {port1.uuid: 'test-vif-A'}} + with task_manager.acquire(self.context, self.node.uuid) as task: + result = network.get_node_vif_ids(task) + self.assertEqual(expected, result) + + def test_get_node_vif_ids_one_portgroup(self): + pg1 = db_utils.create_test_portgroup( + node_id=self.node.id, + extra={'vif_port_id': 'test-vif-A'}) + + expected = {'portgroups': {pg1.uuid: 'test-vif-A'}, + 'ports': {}} with task_manager.acquire(self.context, self.node.uuid) as task: result = network.get_node_vif_ids(task) self.assertEqual(expected, result) @@ -58,7 +71,26 @@ class TestNetwork(db_base.DbTestCase): uuid=uuidutils.generate_uuid(), extra={'vif_port_id': 'test-vif-B'}, driver='fake') - expected = {port1.uuid: 'test-vif-A', port2.uuid: 'test-vif-B'} + expected = {'portgroups': {}, + 'ports': {port1.uuid: 'test-vif-A', + port2.uuid: 'test-vif-B'}} + with task_manager.acquire(self.context, self.node.uuid) as task: + result = network.get_node_vif_ids(task) + self.assertEqual(expected, result) + + def test_get_node_vif_ids_two_portgroups(self): + pg1 = db_utils.create_test_portgroup( + node_id=self.node.id, + extra={'vif_port_id': 'test-vif-A'}) + pg2 = db_utils.create_test_portgroup( + uuid=uuidutils.generate_uuid(), + address='dd:ee:ff:aa:bb:cc', + node_id=self.node.id, + name='barname', + extra={'vif_port_id': 'test-vif-B'}) + expected = {'portgroups': {pg1.uuid: 'test-vif-A', + pg2.uuid: 'test-vif-B'}, + 'ports': {}} with task_manager.acquire(self.context, self.node.uuid) as task: result = network.get_node_vif_ids(task) self.assertEqual(expected, result) |