summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/dhcp
diff options
context:
space:
mode:
authorVladyslav Drok <vdrok@mirantis.com>2016-07-06 20:32:15 +0300
committerVladyslav Drok <vdrok@mirantis.com>2016-07-07 19:56:13 +0300
commit0a5bb693efe6a5b417c5ba9a912292b498438f84 (patch)
tree0565bf921cd8d687d6a46fab40d53523bd09d0a1 /ironic/tests/unit/dhcp
parent22aba527fb045af58fa876f394c2bb923ed949c4 (diff)
downloadironic-0a5bb693efe6a5b417c5ba9a912292b498438f84.tar.gz
Add internal_info field to ports and portgroups
In case of ports, it is also added to the API, as a readonly field. It will be used for any port-specific internal information ironic needs to store inside the port object. In this change we start using it to store UUIDs of the cleaning ports that ironic creates, instead of fiddling with port.extra['vif_port_id'], as extra is intended for operator use only. Partial-bug: #1526403 Change-Id: Ib62c3e32305619d0c55f8ec7e45b067f0f0b32d4
Diffstat (limited to 'ironic/tests/unit/dhcp')
-rw-r--r--ironic/tests/unit/dhcp/test_neutron.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/ironic/tests/unit/dhcp/test_neutron.py b/ironic/tests/unit/dhcp/test_neutron.py
index 658d33497..df576022f 100644
--- a/ironic/tests/unit/dhcp/test_neutron.py
+++ b/ironic/tests/unit/dhcp/test_neutron.py
@@ -342,6 +342,22 @@ class TestNeutron(db_base.DbTestCase):
mock_gfia.assert_called_once_with('test-vif-A', mock.sentinel.client)
@mock.patch('ironic.dhcp.neutron.NeutronDHCPApi._get_fixed_ip_address')
+ def test__get_port_ip_address_cleaning(self, mock_gfia):
+ expected = "192.168.1.3"
+ port = object_utils.create_test_port(
+ self.context, node_id=self.node.id, address='aa:bb:cc:dd:ee:ff',
+ uuid=uuidutils.generate_uuid(),
+ internal_info={'cleaning_vif_port_id': 'test-vif-A'})
+ mock_gfia.return_value = expected
+ with task_manager.acquire(self.context,
+ self.node.uuid) as task:
+ api = dhcp_factory.DHCPFactory().provider
+ result = api._get_port_ip_address(task, port,
+ mock.sentinel.client)
+ self.assertEqual(expected, result)
+ mock_gfia.assert_called_once_with('test-vif-A', mock.sentinel.client)
+
+ @mock.patch('ironic.dhcp.neutron.NeutronDHCPApi._get_fixed_ip_address')
def test__get_port_ip_address_for_portgroup(self, mock_gfia):
expected = "192.168.1.3"
pg = object_utils.create_test_portgroup(self.context,