Browse Source

Starting making multi_blade model return data

Tyler Smith 10 years ago
parent
commit
3ab8659437
  1. 21
      quantum/plugins/cisco/models/l2network_multi_blade.py
  2. 31
      quantum/plugins/cisco/tests/unit/test_l2network_multi_blade.py

21
quantum/plugins/cisco/models/l2network_multi_blade.py

@ -73,14 +73,18 @@ class L2NetworkMultiBlade(L2NetworkModelBase):
args)
device_ips = device_params[const.DEVICE_IP]
if not device_ips:
self._invoke_plugin(plugin_key, function_name, args,
device_params)
# Return in a list
return [self._invoke_plugin(plugin_key, function_name, args,
device_params)]
else:
# Return a list of return values from each device
output = []
for device_ip in device_ips:
new_device_params = deepcopy(device_params)
new_device_params[const.DEVICE_IP] = device_ip
self._invoke_plugin(plugin_key, function_name, args,
new_device_params)
output.append(self._invoke_plugin(plugin_key, function_name,
args, new_device_params))
return output
def _invoke_inventory(self, plugin_key, function_name, args):
"""Invoke only the inventory implementation"""
@ -103,10 +107,11 @@ class L2NetworkMultiBlade(L2NetworkModelBase):
def create_network(self, args):
"""Support for the Quantum core API call"""
self._invoke_plugin_per_device(const.UCS_PLUGIN, self._func_name(),
args)
self._invoke_plugin_per_device(const.NEXUS_PLUGIN,
self._func_name(), args)
output = []
output.extend(self._invoke_plugin_per_device(const.UCS_PLUGIN,
self._func_name(), args))
output.extend(self._invoke_plugin_per_device(const.NEXUS_PLUGIN,
self._func_name(), args))
def delete_network(self, args):
"""Support for the Quantum core API call"""

31
quantum/plugins/cisco/tests/unit/test_l2network_multi_blade.py

@ -72,27 +72,26 @@ class Test_L2NetworkMultiBlade(unittest.TestCase):
def test_create_network(self):
"""Support for the Quantum core API call"""
LOG.debug("test_create_network - START")
self._l2network_multiblade.create_network([self.tenant_id,
network = self._l2network_multiblade.create_network([self.tenant_id,
self.net_name,
self.net_id,
self.vlan_name,
self.vlan_id])
device_params = self._l2network_multiblade._invoke_inventory(
self.plugin_key,
self._l2network_multiblade.create_network,
[self.tenant_id,
self.net_name,
self.net_id,
self.vlan_name,
self.vlan_id])
print device_params
print "asdfasdfasdfasdf"
device_ips = device_params[const.DEVICE_IP]
for device_ip in device_ips:
new_device_params[const.DEVICE_IP] = device_ip
self.assertEqual(self.test_device_ip,
new_device_params[const.DEVICE_IP])
#device_params = self._l2network_multiblade._invoke_inventory(
# self.plugin_key,
# self._l2network_multiblade.create_network,
# [self.tenant_id,
# self.net_name,
# self.net_id,
# self.vlan_name,
# self.vlan_id])
#device_ips = device_params[const.DEVICE_IP]
#for device_ip in device_ips:
# new_device_params[const.DEVICE_IP] = device_ip
# self.assertEqual(self.test_device_ip,
# new_device_params[const.DEVICE_IP])
self.tearDownNetwork(self.tenant_id, self.net_id)
LOG.debug("test_create_network - END")

Loading…
Cancel
Save