** Ubuntu 11.10 or above
** Package: python-configobj-4.6.0-3.el6.noarch (or newer)
** Package: python-routes-1.12.3-2.el6.noarch (or newer)
+ ** Package: pip install mysql-python
If you are using a Nexus switch in your topology, you'll need the following
NX-OS version and packages to enable Nexus support:
1. All unit tests (needs environment setup as indicated in the pre-requisites):
- ./run_tests.sh -N quantum.plugins.cisco.tests.unit
-
- or by modifying the environment variable to point to the plugin directory
+ Modify the environment variable to point to the plugin directory
In bash : export PLUGIN_DIR=quantum/plugins/cisco
tcsh/csh : setenv PLUGIN_DIR quantum/plugins/cisco
- ./run_tests.sh -N
+ When no sub-plugins are configured(ucs or nexus plugins), execute only the l2networkApi unit tests.
+ Device-specific sub-plugins can be disabled by commenting out all the entries in:
+ etc/quantum/plugins/cisco/cisco_plugins.ini
+
+ Execute the l2networkApi tests only using:
+ ./run_tests.sh quantum.plugins.cisco.tests.unit.test_l2networkApi
- Another option is to execute the python script run_tests.py
+ If just the ucs or both ucs and the nexus plugins are configured then all the tests could be executed by
+ ./run_tests.sh
- python run_tests.py quantum.plugins.cisco.tests.unit
+ All the test execution steps listed below is for when the sub-plugins are configured.
2. Testing the core API (without UCS/Nexus/RHEL hardware, and can be run on
Ubuntu):
- Device-specific plugins can be disabled by commenting out the entries in:
- etc/quantum/plugins/cisco/cisco_plugins.ini
The Core API can be tested by initially disabling all device plugins, then
enabling just the UCS plugins, and finally enabling both the UCS and the
Nexus plugins.
+ Device-specific plugins can be disabled by commenting out the entries in:
+ etc/quantum/plugins/cisco/cisco_plugins.ini
Execute the test script as follows:
- ./run_tests.sh -N quantum.plugins.cisco.tests.unit.test_l2networkApi
+ ./run_tests.sh quantum.plugins.cisco.tests.unit.test_l2networkApi
or
3. Specific Plugin unit test (needs environment setup as indicated in the
pre-requisites):
- ./run_tests.sh -N quantum.plugins.cisco.tests.unit.<name_of_the_module>
+ ./run_tests.sh quantum.plugins.cisco.tests.unit.<name_of_the_module>
or
python run_tests.py quantum.plugins.cisco.tests.unit.test_ucs_plugin
To run specific tests, use the following:
+
+ ./run_tests.sh quantum.plugins.cisco.tests.unit.<name_of_the_module>:<ClassName>.<funcName>
+
+ or
+
python run_tests.py
quantum.plugins.cisco.tests.unit.<name_of_the_module>:<ClassName>.<funcName>
Location quantum/plugins/cisco/tests/unit/test_cisco_extension.py
The script can be executed by :
- ./run_tests.sh -N quantum.plugins.cisco.tests.unit.test_cisco_extension
+ ./run_tests.sh quantum.plugins.cisco.tests.unit.test_cisco_extension
or
instance_vif_desc = {'project_id': tenant_id,
'user_id': nova_user_id,
'vif_id': vif_id}
- vif_description = self._l2network_plugin.associate_port(
- instance_tenant_id, instance_id,
- instance_vif_desc)
-
+ if conf.PLUGINS[const.PLUGINS].keys():
+ vif_description = self._l2network_plugin.associate_port(
+ instance_tenant_id, instance_id, instance_vif_desc)
+ else:
+ db.port_set_attachment_by_id(port_dict[const.PORT_ID],
+ instance_vif_desc['vif_id'] +
+ const.UNPLUGGED)
self.assertRaises(exc.NetworkInUse,
self._l2network_plugin.delete_network, tenant_id,
new_net_dict[const.NET_ID])
"""
Tests deletion of Ports when port is in Use.
"""
-
LOG.debug("test_delete_portInUse - START")
new_net_dict = self._l2network_plugin.create_network(
tenant_id, self.network_name)
instance_vif_desc = {'project_id': tenant_id,
'user_id': nova_user_id,
'vif_id': vif_id}
- vif_description = self._l2network_plugin.associate_port(
- instance_tenant_id, instance_id,
- instance_vif_desc)
- self.assertRaises(exc.PortInUse,
- self._l2network_plugin.delete_port, tenant_id,
- new_net_dict[const.NET_ID], port_dict[const.PORT_ID])
+ if conf.PLUGINS[const.PLUGINS].keys():
+ vif_description = self._l2network_plugin.associate_port(
+ instance_tenant_id, instance_id, instance_vif_desc)
+ else:
+ db.port_set_attachment_by_id(port_dict[const.PORT_ID],
+ instance_vif_desc['vif_id'] +
+ const.UNPLUGGED)
+
+ self.assertRaises(exc.PortInUse, self._l2network_plugin.delete_port,
+ tenant_id, new_net_dict[const.NET_ID],
+ port_dict[const.PORT_ID])
self.tearDownNetworkPortInterface(
tenant_id, instance_tenant_id, instance_id, instance_vif_desc,
new_net_dict[const.NET_ID], port_dict[const.PORT_ID])
instance_vif_desc = {'project_id': tenant_id,
'user_id': nova_user_id,
'vif_id': vif_id}
- vif_description = self._l2network_plugin.associate_port(
- instance_tenant_id, instance_id,
- instance_vif_desc)
- self._l2network_plugin.plug_interface(
- tenant_id, new_net_dict[const.NET_ID],
- port_dict[const.PORT_ID], vif_id)
+ if conf.PLUGINS[const.PLUGINS].keys():
+ vif_description = self._l2network_plugin.associate_port(
+ instance_tenant_id, instance_id,
+ instance_vif_desc)
+ else:
+ db.port_set_attachment_by_id(port_dict[const.PORT_ID],
+ instance_vif_desc['vif_id'] +
+ const.UNPLUGGED)
+
+ self._l2network_plugin.plug_interface(tenant_id,
+ new_net_dict[const.NET_ID],
+ port_dict[const.PORT_ID], vif_id)
port = db.port_get(new_net_dict[const.NET_ID],
port_dict[const.PORT_ID])
self.assertEqual(port[const.INTERFACEID], vif_id)
"""
Tests attachment of interface port does not exist
"""
-
LOG.debug("test_plug_interface_portDNE - START")
new_net_dict = self._l2network_plugin.create_network(tenant_id,
self.network_name)
- self.assertRaises(
- exc.PortNotFound, self._l2network_plugin.plug_interface, tenant_id,
- new_net_dict[const.NET_ID], port_id, remote_interface)
+ self.assertRaises(exc.PortNotFound,
+ self._l2network_plugin.plug_interface,
+ tenant_id, new_net_dict[const.NET_ID], port_id,
+ remote_interface)
self.tearDownNetwork(tenant_id, new_net_dict[const.NET_ID])
LOG.debug("test_plug_interface_portDNE - END")
Tests attachment of new interface to the port when there is an
existing attachment
"""
-
LOG.debug("test_plug_interface_portInUse - START")
- new_net_dict = self._l2network_plugin.create_network(
- tenant_id, self.network_name)
+ new_net_dict = self._l2network_plugin.create_network(tenant_id,
+ self.network_name)
port_dict = self._l2network_plugin.create_port(
tenant_id, new_net_dict[const.NET_ID], self.state)
- instance_desc = {'project_id': tenant_id,
- 'user_id': nova_user_id}
+ instance_desc = {'project_id': tenant_id, 'user_id': nova_user_id}
host_list = self._l2network_plugin.schedule_host(instance_tenant_id,
instance_id,
instance_desc)
- instance_vif_desc = {'project_id': tenant_id,
- 'user_id': nova_user_id,
+ instance_vif_desc = {'project_id': tenant_id, 'user_id': nova_user_id,
'vif_id': vif_id}
- vif_description = self._l2network_plugin.associate_port(
- instance_tenant_id, instance_id,
- instance_vif_desc)
- self.assertRaises(exc.PortInUse,
- self._l2network_plugin.plug_interface, tenant_id,
- new_net_dict[const.NET_ID],
+ if conf.PLUGINS[const.PLUGINS].keys():
+ vif_description = self._l2network_plugin.associate_port(
+ instance_tenant_id, instance_id, instance_vif_desc)
+ else:
+ db.port_set_attachment_by_id(port_dict[const.PORT_ID],
+ instance_vif_desc['vif_id'] +
+ const.UNPLUGGED)
+
+ self.assertRaises(exc.PortInUse, self._l2network_plugin.plug_interface,
+ tenant_id, new_net_dict[const.NET_ID],
port_dict[const.PORT_ID], remote_interface)
- self.tearDownNetworkPortInterface(
- tenant_id, instance_tenant_id, instance_id, instance_vif_desc,
- new_net_dict[const.NET_ID], port_dict[const.PORT_ID])
+ self.tearDownNetworkPortInterface(tenant_id, instance_tenant_id,
+ instance_id, instance_vif_desc,
+ new_net_dict[const.NET_ID],
+ port_dict[const.PORT_ID])
LOG.debug("test_plug_interface_portInUse - END")
"""
Tests detaachment of an interface to a port
"""
-
LOG.debug("test_unplug_interface - START")
- new_net_dict = self._l2network_plugin.create_network(
- tenant_id, self.network_name)
+ new_net_dict = self._l2network_plugin.create_network(tenant_id,
+ self.network_name)
port_dict = self._l2network_plugin.create_port(
- tenant_id, new_net_dict[const.NET_ID],
- self.state)
+ tenant_id, new_net_dict[const.NET_ID], self.state)
instance_desc = {'project_id': tenant_id,
'user_id': nova_user_id}
host_list = self._l2network_plugin.schedule_host(instance_tenant_id,
instance_id,
instance_desc)
- instance_vif_desc = {'project_id': tenant_id,
- 'user_id': nova_user_id,
+ instance_vif_desc = {'project_id': tenant_id, 'user_id': nova_user_id,
'vif_id': vif_id}
- vif_description = self._l2network_plugin.associate_port(
- instance_tenant_id, instance_id,
- instance_vif_desc)
- self._l2network_plugin.plug_interface(
- tenant_id, new_net_dict[const.NET_ID],
- port_dict[const.PORT_ID], vif_id)
- self._l2network_plugin.unplug_interface(
- tenant_id, new_net_dict[const.NET_ID],
- port_dict[const.PORT_ID])
+ if conf.PLUGINS[const.PLUGINS].keys():
+ vif_description = self._l2network_plugin. associate_port(
+ instance_tenant_id,
+ instance_id,
+ instance_vif_desc)
+ else:
+ db.port_set_attachment_by_id(port_dict[const.PORT_ID],
+ instance_vif_desc['vif_id'] +
+ const.UNPLUGGED)
+
+ self._l2network_plugin.plug_interface(tenant_id,
+ new_net_dict[const.NET_ID],
+ port_dict[const.PORT_ID], vif_id)
+ self._l2network_plugin.unplug_interface(tenant_id,
+ new_net_dict[const.NET_ID],
+ port_dict[const.PORT_ID])
port = db.port_get(new_net_dict[const.NET_ID],
port_dict[const.PORT_ID])
vif_id_unplugged = vif_id + '(detached)'
self.assertEqual(port[const.INTERFACEID], vif_id_unplugged)
- self.tearDownNetworkPortInterface(
- tenant_id, instance_tenant_id, instance_id, instance_vif_desc,
- new_net_dict[const.NET_ID], port_dict[const.PORT_ID])
+ self.tearDownNetworkPortInterface(tenant_id, instance_tenant_id,
+ instance_id, instance_vif_desc,
+ new_net_dict[const.NET_ID],
+ port_dict[const.PORT_ID])
LOG.debug("test_unplug_interface - END")
"""
Tear down Network Port Interface
"""
- self._l2network_plugin.detach_port(instance_tenant_id, instance_id,
- instance_desc)
+ if not conf.PLUGINS[const.PLUGINS].keys():
+ db.port_unset_attachment_by_id(port_id)
+ else:
+ self._l2network_plugin.detach_port(instance_tenant_id, instance_id,
+ instance_desc)
self.tearDownNetworkPort(tenant_id, network_dict_id, port_id)
def tearDownPortProfile(self, tenant_id, port_profile_id):