Set the environment variable PLUGIN_DIR to the location of the plugin \r
directory. This is manadatory if the run_tests.sh script is used.\r
\r
- export PLUGIN_DIR=quantum/plugins/cisco\r
+ In bash : export PLUGIN_DIR=quantum/plugins/cisco\r
+ tcsh/csh : setenv PLUGIN_DIR quantum/plugins/cisco\r
./run_tests.sh quantum.plugins.cisco.tests.unit.test_l2networkApi\r
\r
or\r
2. Specific Plugin unit test (needs environment setup as indicated in the \r
pre-requisites):\r
\r
- export PLUGIN_DIR=quantum/plugins/cisco\r
+ In bash : export PLUGIN_DIR=quantum/plugins/cisco\r
+ tcsh/csh : setenv PLUGIN_DIR quantum/plugins/cisco\r
./run_tests.sh quantum.plugins.cisco.tests.unit.<name_of_the file>\r
\r
or \r
\r
3. All unit tests (needs environment setup as indicated in the pre-requisites):\r
\r
- export PLUGIN_DIR=quantum/plugins/cisco\r
+ In bash : export PLUGIN_DIR=quantum/plugins/cisco\r
+ tcsh/csh : setenv PLUGIN_DIR quantum/plugins/cisco\r
+\r
./run_tests.sh quantum.plugins.cisco.tests.unit\r
\r
or \r
change later.\r
Location quantum/plugins/cisco/tests/unit/test_cisco_extension.py\r
\r
+ The script can be executed by :\r
+ ./run_tests.sh quantum.plugins.cisco.tests.unit.test_cisco_extension\r
+\r
+ or\r
+\r
+ python run_tests.py quantum.plugins.cisco.tests.unit.test_cisco_extension\r
+\r
Additional installation required on Nova Compute\r
------------------------------------------------\r
1. Create a table in the "nova" database for ports. This can be \r
bind_port = 9696
# Path to the extensions
-api_extensions_path = ../extensions
+api_extensions_path = ../../../../extensions
[pipeline:extensions_app_with_filter]
pipeline = extensions extensions_test_app
paste.filter_factory = quantum.common.extensions:plugin_aware_extension_middleware_factory
[app:extensions_test_app]
-paste.app_factory = tests.unit.test_cisco_extension:app_factory
+paste.app_factory = quantum.plugins.cisco.tests.unit.test_cisco_extension:app_factory
# @authors: Shweta Padubidri, Cisco Systems, Inc.
# Peter Strunk , Cisco Systems, Inc.
# Shubhangi Satras , Cisco Systems, Inc.
-import json
-import os.path
-import routes
import unittest
import logging
import webob
+import json
+import os.path
+import routes
from webtest import TestApp
from extensions import credential
from extensions import portprofile
from quantum.plugins.cisco import l2network_plugin
TEST_CONF_FILE = os.path.join(os.path.dirname(__file__), os.pardir,
- os.pardir, 'etc', 'quantum.conf.ciscoext')
-EXTENSIONS_PATH = os.path.join(os.path.dirname(__file__), os.pardir,
- os.pardir, "extensions")
+ os.pardir, 'conf', 'quantum.conf.ciscoext')
+EXTENSIONS_PATH = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
+ os.pardir, os.pardir, os.pardir, "extensions")
LOG = logging.getLogger('quantum.plugins.cisco.tests.test_cisco_extensions')
class PortprofileExtensionTest(unittest.TestCase):
def setUp(self):
+
+ """ Set up function """
+
parent_resource = dict(member_name="tenant",
collection_name="extensions/csco/tenants")
member_actions = {'associate_portprofile': "PUT",
def test_list_portprofile(self):
+ """ Test List Portprofile"""
+
LOG.debug("test_list_portprofile - START")
req_body1 = json.dumps(self.test_port_profile)
create_response1 = self.test_app.post(
def test_create_portprofile(self):
+ """ Test create Portprofile"""
+
LOG.debug("test_create_portprofile - START")
req_body = json.dumps(self.test_port_profile)
index_response = self.test_app.post(self.profile_path, req_body,
def test_create_portprofileBADRequest(self):
+ """ Test create Portprofile Bad Request"""
+
LOG.debug("test_create_portprofileBADRequest - START")
index_response = self.test_app.post(self.profile_path, 'BAD_REQUEST',
content_type=self.contenttype,
def test_show_portprofile(self):
+ """ Test show Portprofile """
+
LOG.debug("test_show_portprofile - START")
req_body = json.dumps(self.test_port_profile)
index_response = self.test_app.post(self.profile_path, req_body,
def test_show_portprofileDNE(self, portprofile_id='100'):
+ """ Test show Portprofile does not exist"""
+
LOG.debug("test_show_portprofileDNE - START")
show_path_temp = self.portprofile_path + portprofile_id
show_port_path = str(show_path_temp)
def test_update_portprofile(self):
+ """ Test update Portprofile"""
+
LOG.debug("test_update_portprofile - START")
req_body = json.dumps(self.test_port_profile)
index_response = self.test_app.post(
def test_update_portprofileBADRequest(self):
+ """ Test update Portprofile Bad Request"""
+
LOG.debug("test_update_portprofileBADRequest - START")
req_body = json.dumps(self.test_port_profile)
index_response = self.test_app.post(
def test_update_portprofileDNE(self, portprofile_id='100'):
+ """ Test update Portprofile does not exist"""
+
LOG.debug("test_update_portprofileiDNE - START")
rename_port_profile = {'portprofile':
{'portprofile_name': 'cisco_rename_portprofile',
def test_delete_portprofile(self):
+ """ Test delete Portprofile"""
+
LOG.debug("test_delete_portprofile - START")
req_body = json.dumps(self.test_port_profile)
index_response = self.test_app.post(
def test_delete_portprofileDNE(self, portprofile_id='100'):
+ """ Test delete Portprofile does not exist"""
+
LOG.debug("test_delete_portprofileDNE - START")
delete_path_temp = self.portprofile_path + portprofile_id
delete_path = str(delete_path_temp)
def create_request(self, path, body, content_type, method='GET'):
+ """ Test create request"""
+
LOG.debug("test_create_request - START")
req = webob.Request.blank(path)
req.method = method
def _create_network(self, name=None):
+ """ Test create network"""
+
LOG.debug("Creating network - START")
if name:
net_name = name
def _create_port(self, network_id, port_state):
+ """ Test create port"""
+
LOG.debug("Creating port for network %s - START", network_id)
port_path = "/tenants/tt/networks/%s/ports" % network_id
port_req_data = {'port': {'port-state': '%s' % port_state}}
def test_associate_portprofile(self):
+ """ Test associate portprofile"""
+
LOG.debug("test_associate_portprofile - START")
net_id = self._create_network()
port_id = self._create_port(net_id, "ACTIVE")
def test_associate_portprofileDNE(self, portprofile_id='100'):
+ """ Test associate portprofile does not exist"""
+
LOG.debug("test_associate_portprofileDNE - START")
test_port_assign_data = {'portprofile': {'network-id': '001',
'port-id': '1'}}
def test_disassociate_portprofile(self):
+ """ Test disassociate portprofile"""
+
LOG.debug("test_disassociate_portprofile - START")
net_id = self._create_network()
port_id = self._create_port(net_id, "ACTIVE")
LOG.debug("test_disassociate_portprofile - END")
def tear_down_profile(self, delete_profile_path):
+
+ """ Tear down profile"""
+
self.test_app.delete(delete_profile_path)
def tear_down_associate_profile(self, delete_profile_path,
dissociate_profile_path, req_body):
+
+ """ Tear down associate profile"""
+
self.test_app.post(dissociate_profile_path, req_body,
content_type=self.contenttype)
self.tear_down_profile(delete_profile_path)
def tearDown(self):
+
+ """ Tear down """
+
db.clear_db()
class NovatenantExtensionTest(unittest.TestCase):
def setUp(self):
+
+ """ Set up function"""
+
parent_resource = dict(member_name="tenant",
collection_name="extensions/csco/tenants")
member_actions = {'get_host': "PUT",
'key2': '2'}}}
def test_get_host(self):
+
+ """ Test get host"""
+
LOG.debug("test_get_host - START")
req_body = json.dumps(self.test_instance_data)
host_path = self.novatenants_path + "001/get_host"
LOG.debug("test_get_host - END")
def test_get_hostBADRequest(self):
+
+ """ Test get host bad request"""
+
LOG.debug("test_get_hostBADRequest - START")
host_path = self.novatenants_path + "001/get_host"
host_response = self.test_app.put(
LOG.debug("test_get_hostBADRequest - END")
def test_instance_port(self):
+
+ """ Test get instance port """
+
LOG.debug("test_instance_port - START")
req_body = json.dumps(self.test_instance_data)
instance_port_path = self.novatenants_path + "001/get_instance_port"
def setUp(self):
+ """ Set up function """
+
parent_resource = dict(member_name="tenant",
collection_name="extensions/csco/tenants")
controller = qos.QosController(QuantumManager.get_plugin())
def test_create_qos(self):
+ """ Test create qos """
+
LOG.debug("test_create_qos - START")
req_body = json.dumps(self.test_qos_data)
index_response = self.test_app.post(self.qos_path,
def test_create_qosBADRequest(self):
+ """ Test create qos bad request """
+
LOG.debug("test_create_qosBADRequest - START")
index_response = self.test_app.post(self.qos_path,
'BAD_REQUEST',
LOG.debug("test_create_qosBADRequest - END")
def test_list_qoss(self):
+
+ """ Test list qoss """
+
LOG.debug("test_list_qoss - START")
req_body1 = json.dumps(self.test_qos_data)
create_resp1 = self.test_app.post(self.qos_path, req_body1,
LOG.debug("test_list_qoss - END")
def test_show_qos(self):
+
+ """ Test show qos """
+
LOG.debug("test_show_qos - START")
req_body = json.dumps(self.test_qos_data)
index_response = self.test_app.post(self.qos_path, req_body,
LOG.debug("test_show_qos - END")
def test_show_qosDNE(self, qos_id='100'):
+
+ """ Test show qos does not exist"""
+
LOG.debug("test_show_qosDNE - START")
show_path_temp = self.qos_second_path + qos_id
show_qos_path = str(show_path_temp)
def test_update_qos(self):
+ """ Test update qos """
+
LOG.debug("test_update_qos - START")
req_body = json.dumps(self.test_qos_data)
index_response = self.test_app.post(self.qos_path, req_body,
LOG.debug("test_update_qos - END")
def test_update_qosDNE(self, qos_id='100'):
+
+ """ Test update qos does not exist """
+
LOG.debug("test_update_qosDNE - START")
rename_req_body = json.dumps({'qos': {'qos_name': 'cisco_rename_qos',
'qos_desc': {'PPS': 50, 'TTL': 5}}})
LOG.debug("test_update_qosDNE - END")
def test_update_qosBADRequest(self):
+
+ """ Test update qos bad request """
+
LOG.debug("test_update_qosBADRequest - START")
req_body = json.dumps(self.test_qos_data)
index_response = self.test_app.post(self.qos_path, req_body,
def test_delete_qos(self):
+ """ Test delte qos """
+
LOG.debug("test_delete_qos - START")
req_body = json.dumps({'qos': {'qos_name': 'cisco_test_qos',
'qos_desc': {'PPS': 50, 'TTL': 5}}})
LOG.debug("test_delete_qos - END")
def test_delete_qosDNE(self, qos_id='100'):
+
+ """ Test delte qos does not exist"""
+
LOG.debug("test_delete_qosDNE - START")
delete_path_temp = self.qos_second_path + qos_id
delete_path = str(delete_path_temp)
LOG.debug("test_delete_qosDNE - END")
def tearDownQos(self, delete_profile_path):
+
+ """ Tear Down Qos """
+
self.test_app.delete(delete_profile_path)
class CredentialExtensionTest(unittest.TestCase):
def setUp(self):
+
+ """ Set up function """
+
parent_resource = dict(member_name="tenant",
collection_name="extensions/csco/tenants")
controller = credential.CredentialController(
self.test_credential_data = {'credential':
{'credential_name': 'cred8',
'user_name': 'newUser2',
- 'password': 'newPasswd1'
- }}
+ 'password': 'newPasswd1'}}
def test_list_credentials(self):
+
+ """ Test list credentials """
+
#Create Credential before listing
LOG.debug("test_list_credentials - START")
req_body1 = json.dumps(self.test_credential_data)
req_body2 = json.dumps({'credential':
{'credential_name': 'cred9',
'user_name': 'newUser2',
- 'password': 'newPasswd2'
- }})
+ 'password': 'newPasswd2'}})
create_response2 = self.test_app.post(
self.credential_path, req_body2,
content_type=self.contenttype)
LOG.debug("test_list_credentials - END")
def test_create_credential(self):
+
+ """ Test create credential """
+
LOG.debug("test_create_credential - START")
req_body = json.dumps(self.test_credential_data)
index_response = self.test_app.post(
LOG.debug("test_create_credential - END")
def test_create_credentialBADRequest(self):
+
+ """ Test create credential bad request """
+
LOG.debug("test_create_credentialBADRequest - START")
index_response = self.test_app.post(
self.credential_path, 'BAD_REQUEST',
LOG.debug("test_create_credentialBADRequest - END")
def test_show_credential(self):
+
+ """ Test show credential """
+
LOG.debug("test_show_credential - START")
req_body = json.dumps(self.test_credential_data)
index_response = self.test_app.post(
LOG.debug("test_show_credential - END")
def test_show_credentialDNE(self, credential_id='100'):
+
+ """ Test show credential does not exist """
+
LOG.debug("test_show_credentialDNE - START")
show_path_temp = self.cred_second_path + credential_id
show_cred_path = str(show_path_temp)
LOG.debug("test_show_credentialDNE - END")
def test_update_credential(self):
+
+ """ Test update credential """
+
LOG.debug("test_update_credential - START")
req_body = json.dumps(self.test_credential_data)
rename_req_body = json.dumps({'credential':
{'credential_name': 'cred3',
'user_name': 'RenamedUser',
- 'password': 'Renamedpassword'
- }})
+ 'password': 'Renamedpassword'}})
rename_path_temp = self.cred_second_path +\
resp_body['credentials']['credential']['id']
rename_path = str(rename_path_temp)
LOG.debug("test_update_credential - END")
def test_update_credBADReq(self):
+
+ """ Test update credential bad request """
+
LOG.debug("test_update_credBADReq - START")
req_body = json.dumps(self.test_credential_data)
index_response = self.test_app.post(
LOG.debug("test_update_credBADReq - END")
def test_update_credentialDNE(self, credential_id='100'):
+
+ """ Test update credential does not exist"""
+
LOG.debug("test_update_credentialDNE - START")
rename_req_body = json.dumps({'credential':
{'credential_name': 'cred3',
'user_name': 'RenamedUser',
- 'password': 'Renamedpassword'
- }})
+ 'password': 'Renamedpassword'}})
rename_path_temp = self.cred_second_path + credential_id
rename_path = str(rename_path_temp)
rename_response = self.test_app.put(rename_path, rename_req_body,
LOG.debug("test_update_credentialDNE - END")
def test_delete_credential(self):
+
+ """ Test delete credential """
+
LOG.debug("test_delete_credential - START")
req_body = json.dumps(self.test_credential_data)
index_response = self.test_app.post(
LOG.debug("test_delete_credential - END")
def test_delete_credentialDNE(self, credential_id='100'):
+
+ """ Test delete credential does not exist """
+
LOG.debug("test_delete_credentialDNE - START")
delete_path_temp = self.cred_second_path + credential_id
delete_path = str(delete_path_temp)
import logging
import unittest
-#import time
from quantum.common import exceptions as exc
from quantum.plugins.cisco.common import cisco_constants as const
from quantum.plugins.cisco.common import cisco_exceptions as cexc
from quantum.plugins.cisco import l2network_plugin
from quantum.plugins.cisco import l2network_plugin_configuration as conf
-#from quantum.plugins.cisco.common import cisco_utils as utils
+from quantum.plugins.cisco.common import cisco_utils as utils
from quantum.plugins.cisco.db import api as db
from quantum.plugins.cisco.db import l2network_db as cdb
tenant_id, new_net_dict[const.NET_ID])
self.assertRaises(exc.NetworkNotFound, db.network_get,
new_net_dict[const.NET_ID])
- #self.assertEqual(net, None)
self.assertEqual(
new_net_dict[const.NET_ID], delete_net_dict[const.NET_ID])
LOG.debug("test_delete_network - END")
port_dict[const.PORT_ID])
self.assertRaises(exc.PortNotFound, db.port_get,
new_net_dict[const.NET_ID], port_dict[const.PORT_ID])
- #self.assertEqual(port, None)
- # self.assertEqual(delete_port_dict[const.PORT_STATE], port_state)
-# self.assertEqual(delete_port_dict[const.NET_ID], new_net_dict[NET_ID])
-# self.assertEqual(delete_port_dict[const.PORT_ID],
-# new_net_dict[PORT_ID])
self.tearDownNetwork(tenant_id, new_net_dict[const.NET_ID])
self.assertEqual(delete_port_dict[const.PORT_ID],
port_dict[const.PORT_ID])
port_dict[const.PORT_ID], remote_interface)
port = db.port_get(new_net_dict[const.NET_ID],
port_dict[const.PORT_ID])
- # self.assertEqual(
- # self._l2network_plugin._networks[new_net_dict[const.NET_ID]]
- # [const.NET_PORTS][port_dict[const.PORT_ID]]
- # [const.ATTACHMENT], remote_interface)
self.assertEqual(port[const.INTERFACEID], remote_interface)
self.tearDownNetworkPortInterface(
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])
- # self.assertEqual(self._l2network_plugin._networks
- # [new_net_dict[const.NET_ID]][const.NET_PORTS]
- # [port_dict[const.PORT_ID]][const.ATTACHMENT], None)
self.assertEqual(port[const.INTERFACEID], None)
self.tearDownNetworkPort(tenant_id, new_net_dict[const.NET_ID],
port_dict[const.PORT_ID])
port_profile = cdb.get_portprofile(tenant_id, port_profile_id)
self.assertEqual(port_profile[const.PPNAME], profile_name)
self.assertEqual(port_profile[const.PPQOS], qos)
- # self.assertEqual(
- # self._l2network_plugin._portprofiles[port_profile_id]['vlan-id'],
- # vlan_id)
- #self.assertEqual(
- # self._l2network_plugin._portprofiles[port_profile_id]
- # ['profile-name'], profile_name)
self.tearDownPortProfile(tenant_id, port_profile_id)
LOG.debug("test_create_portprofile - tenant id: %s - END",
net_tenant_id)
tenant_id, self.profile_name, self.qos)
port_profile_id = port_profile_dict['profile_id']
self._l2network_plugin.delete_portprofile(tenant_id, port_profile_id)
-# port_profile = cdb.get_portprofile(tenant_id, port_profile_id)
self.assertRaises(Exception, cdb.get_portprofile, port_profile_id)
-# self.assertEqual(port_profile, {})
-# self.assertEqual(self._l2network_plugin._portprofiles, {})
LOG.debug("test_delete_portprofile - tenant id: %s - END",
net_tenant_id)
new_pplist.append(new_pp)
self.assertTrue(new_pplist[0] in port_profile_list)
self.assertTrue(new_pplist[1] in port_profile_list)
-# self.assertEqual(self._l2network_plugin._portprofiles
- # [port_profile_id1]['vlan-id'], self.vlan_id)
- # self.assertEqual(self._l2network_plugin._portprofiles
- # [port_profile_id1]['profile-name'], self.profile_name)
- # self.assertEqual(self._l2network_plugin._portprofiles
- # [port_profile_id2]['vlan-id'], vlan_id2)
- # self.assertEqual(self._l2network_plugin._portprofiles
- # [port_profile_id2]['profile-name'], profile_name2)
self.tearDownPortProfile(tenant_id, port_profile_id1)
self.tearDownPortProfile(tenant_id, port_profile_id2)
port_profile_associate = cdb.get_pp_binding(tenant_id, port_profile_id)
self.assertEqual(port_profile_associate[const.PORTID],
port_dict[const.PORT_ID])
- #self.assertEqual(
- # self._l2network_plugin._portprofiles[port_profile_id]
- # [const.PROFILE_ASSOCIATIONS][0], port_id)
self.tearDownAssociatePortProfile(
tenant_id, new_net_dict[const.NET_ID],
port_dict[const.PORT_ID], port_profile_id)
port_dict[const.PORT_ID], port_profile_id)
port_profile_associate = cdb.get_pp_binding(tenant_id, port_profile_id)
self.assertEqual(port_profile_associate, [])
-# self.assertEqual(self._l2network_plugin._portprofiles
- # [port_profile_id][const.PROFILE_ASSOCIATIONS], [])
self.tearDownPortProfile(tenant_id, port_profile_id)
self.tearDownNetworkPort(
tenant_id, new_net_dict[const.NET_ID],
tenant_id, net_id, port_id, profile_id)
LOG.debug("test_disassociate_portprofileDNE - END")
-# def test_disassociate_portprofile_Unassociated
def test_get_vlan_name(self, net_tenant_id=None, vlan_id="NewVlan",
vlan_prefix=conf.VLAN_NAME_PREFIX):
"""
LOG.debug("test_validate_port_state - END")
def setUp(self):
+ """
+ Set up function
+ """
self.tenant_id = "test_tenant"
self.network_name = "test_network"
self.profile_name = "test_tenant_port_profile"
- # self.vlan_id = "test_tenant_vlanid300"
self.qos = "test_qos"
self.port_state = const.PORT_UP
self.net_id = '00005'
self.port_id = 'p0005'
self.remote_interface = 'new_interface'
- #sql_query = "drop database quantum_l2network"
- #sql_query_2 = "create database quantum_l2network"
- #self._utils = utils.DBUtils()
- #self._utils.execute_db_query(sql_query)
- #time.sleep(10)
- #self._utils.execute_db_query(sql_query_2)
- #time.sleep(10)
self._l2network_plugin = l2network_plugin.L2Network()
"""
db.clear_db()
def tearDownNetwork(self, tenant_id, network_dict_id):
+ """
+ Tear down the Network
+ """
self._l2network_plugin.delete_network(tenant_id, network_dict_id)
def tearDownPortOnly(self, tenant_id, network_dict_id, port_id):
+ """
+ Tear doen the port
+ """
self._l2network_plugin.delete_port(tenant_id, network_dict_id, port_id)
def tearDownNetworkPort(self, tenant_id, network_dict_id, port_id):
+ """
+ Tear down Network Port
+ """
self._l2network_plugin.delete_port(tenant_id, network_dict_id, port_id)
self.tearDownNetwork(tenant_id, network_dict_id)
def tearDownNetworkPortInterface(self, tenant_id, network_dict_id,
port_id):
+ """
+ Tear down Network Port Interface
+ """
self._l2network_plugin.unplug_interface(tenant_id,
network_dict_id, port_id)
self.tearDownNetworkPort(tenant_id, network_dict_id, port_id)
def tearDownPortProfile(self, tenant_id, port_profile_id):
+ """
+ Tear down Port Profile
+ """
self._l2network_plugin.delete_portprofile(tenant_id, port_profile_id)
def tearDownPortProfileBinding(self, tenant_id, port_profile_id):
+ """
+ Tear down port profile binding
+ """
self._l2network_plugin.delete_portprofile(tenant_id, port_profile_id)
def tearDownAssociatePortProfile(self, tenant_id, net_id, port_id,
port_profile_id):
+ """
+ Tear down associate port profile
+ """
self._l2network_plugin.disassociate_portprofile(
tenant_id, net_id, port_id, port_profile_id)
self.tearDownPortProfile(tenant_id, port_profile_id)
class TestNexusPlugin(unittest.TestCase):
def setUp(self):
+ """
+ Set up function
+ """
self.tenant_id = "test_tenant_cisco1"
self.net_name = "test_network_cisco1"
Clean up functions after the tests
"""
self._cisco_nexus_plugin.delete_network(tenant_id, network_dict_id)
-
-# def test_create_network(self):
-# _test_create_network(self._cisco_nexus_plugin)
-
-# def test_delete_network(self):
-# _test_delete_network(self._cisco_nexus_plugin)
-
-# def test_rename_network(self):
-# _test_rename_network(self._cisco_nexus_plugin)
-
-# def test_show_network(self):
-# _test_get_network_details(self._cisco_nexus_plugin)
-
-# def test_list_networks(self):
-# _test_list_all_networks(self._cisco_nexus_plugin)
class TestUCSDriver(unittest.TestCase):
def setUp(self):
+ """ Set up function"""
self.ucsm_driver = cisco_ucs_network_driver.CiscoUCSMDriver()
self.vlan_name = 'New Vlan'
self.vlan_id = '200'
"""
LOG.debug("test_create_profile_post_data - START")
- #profile_details = self.ucsm_driver._create_profile_post_data(
- # self.profile_name, self.vlan_name)
self.ucsm_driver._create_profile_post_data(
self.profile_name, self.vlan_name)
profile_delete_details = self.ucsm_driver._delete_profile_post_data(
class UCSVICTestPlugin(unittest.TestCase):
def setUp(self):
+ """
+ Set up function.
+ """
self.tenant_id = "test_tenant_cisco12"
self.net_name = "test_network_cisco12"
self.tearDownNetwork(self.tenant_id, self.net_id)
def test_rename_network(self):
+ """
+ Tests rename network.
+ """
self._test_rename_network("new_test_network1")
def _test_create_port(self, port_state):
self.tearDownNetworkPort(self.tenant_id, self.net_id, self.port_id)
def test_create_port(self):
+ """
+ Tests create port.
+ """
self._test_create_port(const.PORT_UP)
def _test_delete_port(self, port_state):
self.tearDownNetwork(self.tenant_id, self.net_id)
def test_delete_port(self):
+ """
+ Tests delete port.
+ """
self._test_delete_port(const.PORT_UP)
def _test_update_port(self, port_state):
self.tearDownNetworkPort(self.tenant_id, self.net_id, self.port_id)
def test_update_port_state_up(self):
+ """
+ Tests update port state up
+ """
self._test_update_port(const.PORT_UP)
def test_update_port_state_down(self):
+ """
+ Tests update port state down
+ """
self._test_update_port(const.PORT_DOWN)
def _test_get_port_details_state_up(self, port_state):
self.tearDownNetworkPort(self.tenant_id, self.net_id, self.port_id)
def test_get_port_details_state_up(self):
+ """
+ Tests get port details state up
+ """
self._test_get_port_details_state_up(const.PORT_UP)
def test_show_port_state_down(self):
+ """
+ Tests show port state down
+ """
self._test_show_port_state_down(const.PORT_DOWN)
def test_create_port_profile(self):
+ """
+ Tests create port profile
+ """
LOG.debug("UCSVICTestPlugin:test_create_port_profile() called\n")
new_port_profile = self._cisco_ucs_plugin._create_port_profile(
self.tenant_id, self.net_id, self.port_id,
self._cisco_ucs_plugin._delete_port_profile(self.port_id, profile_name)
def test_delete_port_profile(self):
+ """
+ Tests delete port profile
+ """
LOG.debug("UCSVICTestPlugin:test_delete_port_profile() called\n")
self._cisco_ucs_plugin._create_port_profile(
self.tenant_id, self.net_id, self.port_id, self.vlan_name,
self.tenant_id, self.net_id, self.port_id)
self.assertEqual(port[const.ATTACHMENT], remote_interface_id)
port_profile = port[const.PORT_PROFILE]
- #profile_name = port_profile[const.PROFILE_NAME]
new_vlan_name = self._cisco_ucs_plugin._get_vlan_name_for_network(
self.tenant_id, self.net_id)
new_vlan_id = self._cisco_ucs_plugin._get_vlan_id_for_network(
self.tearDownNetworkPortInterface(self.tenant_id, self.net_id,
self.port_id)
- def test_plug_interface(self):
+ def test_plug_interface(self):
+ """
+ Tests test plug interface
+ """
self._test_plug_interface("4")
def _test_unplug_interface(self, remote_interface_id):
self.tenant_id, self.net_id, self.port_id)
self.assertEqual(port[const.ATTACHMENT], None)
port_profile = port[const.PORT_PROFILE]
- #profile_name = port_profile[const.PROFILE_NAME]
self.assertEqual(port_profile[const.PROFILE_VLAN_NAME],
conf.DEFAULT_VLAN_NAME)
self.assertEqual(port_profile[const.PROFILE_VLAN_ID],
conf.DEFAULT_VLAN_ID)
self.tearDownNetworkPort(self.tenant_id, self.net_id, self.port_id)
- def test_unplug_interface(self):
+ def test_unplug_interface(self):
+ """
+ Tests unplug interface
+ """
self._test_unplug_interface("4")
def test_get_vlan_name_for_network(self):
+ """
+ Tests get vlan name for network
+ """
LOG.debug("UCSVICTestPlugin:test_get_vlan_name_for_network() called\n")
net = self._cisco_ucs_plugin.create_network(
self.tenant_id, self.net_name, self.net_id,
self.tearDownNetwork(self.tenant_id, self.net_id)
def test_get_vlan_id_for_network(self):
+ """
+ Tests get vlan id for network
+ """
LOG.debug("UCSVICTestPlugin:test_get_vlan_id_for_network() called\n")
net = self._cisco_ucs_plugin.create_network(
self.tenant_id, self.net_name, self.net_id, self.vlan_name,
self.tearDownNetwork(self.tenant_id, self.net_id)
def test_get_network(self):
+ """
+ Tests get network
+ """
LOG.debug("UCSVICTestPlugin:test_get_network() called\n")
net = self._cisco_ucs_plugin.create_network(
self.tenant_id, self.net_name, self.net_id, self.vlan_name,
self.tearDownNetwork(self.tenant_id, self.net_id)
def test_get_port(self):
+ """
+ Tests get port
+ """
LOG.debug("UCSVICTestPlugin:test_get_port() called\n")
self._cisco_ucs_plugin.create_network(self.tenant_id, self.net_name,
self.net_id, self.vlan_name,
self.tearDownNetworkPort(self.tenant_id, self.net_id, self.port_id)
def test_get_network_NetworkNotFound(self):
+ """
+ Tests get network not found
+ """
self.assertRaises(exc.NetworkNotFound,
self._cisco_ucs_plugin._get_network,
self.tenant_id, self.net_id)
def test_delete_network_NetworkNotFound(self):
+ """
+ Tests delete network not found
+ """
self.assertRaises(exc.NetworkNotFound,
self._cisco_ucs_plugin.delete_network,
self.tenant_id, self.net_id)
def test_delete_port_PortInUse(self):
+ """
+ Tests delete port in use
+ """
self._test_delete_port_PortInUse("4")
def _test_delete_port_PortInUse(self, remote_interface_id):
+ """
+ Tests delete port in use
+ """
self._cisco_ucs_plugin.create_network(self.tenant_id, self.net_name,
self.net_id, self.vlan_name,
self.vlan_id)
self.port_id)
def test_delete_port_PortNotFound(self):
+ """
+ Tests delete port not found
+ """
self._cisco_ucs_plugin.create_network(self.tenant_id, self.net_name,
self.net_id, self.vlan_name,
self.vlan_id)
self.tearDownNetwork(self.tenant_id, self.net_id)
def test_plug_interface_PortInUse(self):
+ """
+ Tests plug interface port in use
+ """
self._test_plug_interface_PortInUse("6", "5")
def _test_plug_interface_PortInUse(self, remote_interface_id1,
remote_interface_id2):
+ """
+ Tests plug interface port in use
+ """
LOG.debug("UCSVICTestPlugin:_test_plug_interface_PortInUse() called\n")
self._cisco_ucs_plugin.create_network(self.tenant_id, self.net_name,
self.net_id, self.vlan_name,
self.port_id)
def test_attachment_exists(self):
+ """
+ Tests attachment exists
+ """
LOG.debug("UCSVICTestPlugin:testValidateAttachmentAlreadyAttached")
self._test_attachment_exists("4")
def _test_attachment_exists(self, remote_interface_id):
+ """
+ Tests attachment exists
+ """
LOG.debug("UCSVICTestPlugin:_test_validate_attachmentAlreadyAttached")
self._cisco_ucs_plugin.create_network(self.tenant_id, self.net_name,
self.net_id, self.vlan_name,
self.port_id)
def tearDownNetwork(self, tenant_id, net_id):
+ """
+ Tear down network
+ """
self._cisco_ucs_plugin.delete_network(tenant_id, net_id)
def tearDownNetworkPort(self, tenant_id, net_id, port_id):
+ """
+ Tear down network port
+ """
self._cisco_ucs_plugin.delete_port(tenant_id, net_id,
port_id)
self.tearDownNetwork(tenant_id, net_id)
def tearDownNetworkPortInterface(self, tenant_id, net_id, port_id):
+ """
+ Tear down network port interface
+ """
self._cisco_ucs_plugin.unplug_interface(tenant_id, net_id,
port_id)
self.tearDownNetworkPort(tenant_id, net_id, port_id)