Add `get_node_network_data` method to NetworkInterface
Extends NetworkInterface with `get_node_network_data` method providing network configuration for node NICs in form of Nova network metadata structure (i.e. `network_data.json`). Network interface implementations would implement their own ways of gathering network configuration when possible. Ironic would eventually pass network configuration to the node being managed out-of-band. Change-Id: I4c956c08a695fb17ec32c3e2a17cbca55148eb79 Story: 2006691 Task: 36992
This commit is contained in:
parent
591fa1a3c6
commit
cf12521f70
|
@ -1543,6 +1543,26 @@ class NetworkInterface(BaseInterface):
|
|||
"""
|
||||
return False
|
||||
|
||||
def get_node_network_data(self, task):
|
||||
"""Return network configuration for node NICs.
|
||||
|
||||
Gather L2 and L3 network settings from ironic port/portgroups
|
||||
objects and underlying network provider, then put together
|
||||
collected data in form of Nova network metadata (`network_data.json`)
|
||||
dict.
|
||||
|
||||
Ironic would eventually pass network configuration to the node
|
||||
being managed out-of-band.
|
||||
|
||||
:param task: A TaskManager instance.
|
||||
:raises: InvalidParameterValue, if the network interface configuration
|
||||
is invalid.
|
||||
:raises: MissingParameterValue, if some parameters are missing.
|
||||
:returns: a dict holding network configuration information adhearing
|
||||
Nova network metadata layout (`network_data.json`).
|
||||
"""
|
||||
return {}
|
||||
|
||||
|
||||
class StorageInterface(BaseInterface, metaclass=abc.ABCMeta):
|
||||
"""Base class for storage interfaces."""
|
||||
|
|
|
@ -333,3 +333,9 @@ class TestFlatInterface(db_base.DbTestCase):
|
|||
with task_manager.acquire(self.context, self.node.id) as task:
|
||||
self.assertRaises(exception.UnsupportedDriverExtension,
|
||||
self.interface.validate_inspection, task)
|
||||
|
||||
def test_get_node_network_data(self):
|
||||
with task_manager.acquire(self.context, self.node.id) as task:
|
||||
network_data = self.interface.get_node_network_data(task)
|
||||
|
||||
self.assertEqual({}, network_data)
|
||||
|
|
|
@ -853,3 +853,9 @@ class NeutronInterfaceTestCase(db_base.DbTestCase):
|
|||
with task_manager.acquire(self.context, self.node.id) as task:
|
||||
self.assertRaises(exception.UnsupportedDriverExtension,
|
||||
self.interface.validate_inspection, task)
|
||||
|
||||
def test_get_node_network_data(self):
|
||||
with task_manager.acquire(self.context, self.node.id) as task:
|
||||
network_data = self.interface.get_node_network_data(task)
|
||||
|
||||
self.assertEqual({}, network_data)
|
||||
|
|
|
@ -94,3 +94,9 @@ class NoopInterfaceTestCase(db_base.DbTestCase):
|
|||
def test_remove_inspection_network(self):
|
||||
with task_manager.acquire(self.context, self.node.id) as task:
|
||||
self.interface.remove_inspection_network(task)
|
||||
|
||||
def test_get_node_network_data(self):
|
||||
with task_manager.acquire(self.context, self.node.id) as task:
|
||||
network_data = self.interface.get_node_network_data(task)
|
||||
|
||||
self.assertEqual({}, network_data)
|
||||
|
|
Loading…
Reference in New Issue