Browse Source

Updating multiblade create_network test

changes/68/468/1
Tyler Smith 11 years ago
parent
commit
438514e9c1
  1. 11
      quantum/plugins/cisco/models/l2network_multi_blade.py
  2. 36
      quantum/plugins/cisco/tests/unit/test_l2network_multi_blade.py

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

@ -108,10 +108,13 @@ class L2NetworkMultiBlade(L2NetworkModelBase):
def create_network(self, args):
"""Support for the Quantum core API call"""
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))
ucs_output = self._invoke_plugin_per_device(const.UCS_PLUGIN,
self._func_name(), args)
nexus_output = self._invoke_plugin_per_device(const.NEXUS_PLUGIN,
self._func_name(), args)
output.extend(ucs_output or [])
output.extend(nexus_output or [])
return output
def delete_network(self, args):
"""Support for the Quantum core API call"""

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

@ -51,8 +51,11 @@ class Test_L2NetworkMultiBlade(unittest.TestCase):
_inventory = {}
def setUp(self):
# Initialize cdb and credentials
cdb.initialize()
creds.Store.initialize()
# Set some data to use in tests
self.tenant_id = "shubh"
self.net_name = "TestNetwork1"
self.profile_name = "test_tenant_port_profile"
@ -63,35 +66,38 @@ class Test_L2NetworkMultiBlade(unittest.TestCase):
self.vlan_name = "q-" + str(self.net_id) + "vlan"
self.vlan_id = 102
self.new_net_name="New_test_network"
self._l2network_multiblade = l2network_multi_blade.\
L2NetworkMultiBlade()
self.plugin_key = "quantum.plugins.cisco.ucs.cisco_ucs_plugin"+\
".UCSVICPlugin"
self.test_device_ip = "172.18.117.45"
for key in conf.PLUGINS[const.PLUGINS].keys():
self._inventory[key] = utils.import_object(
conf.PLUGINS[const.INVENTORY][key])
self.ucs_count = self._inventory['ucs_plugin'].\
_inventory.__len__()
print 'asdfasdfasdfasdfasdf'
print self._inventory['ucs_plugin']._inventory
def test_create_network(self):
"""Support for the Quantum core API call"""
LOG.debug("test_create_network - START")
network = self._l2network_multiblade.create_network([self.tenant_id,
networks = 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])
#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.assertEqual(networks.__len__(), self.ucs_count)
for network in networks:
self.assertEqual(network[const.NET_ID], self.net_id)
self.assertEqual(network[const.NET_NAME], self.net_name)
self.tearDownNetwork(self.tenant_id, self.net_id)
LOG.debug("test_create_network - END")

Loading…
Cancel
Save