]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
merge latest quantum branch and resolve conflicts
authorYing Liu <yinliu2@cisco.com>
Wed, 24 Aug 2011 20:36:32 +0000 (13:36 -0700)
committerYing Liu <yinliu2@cisco.com>
Wed, 24 Aug 2011 20:36:32 +0000 (13:36 -0700)
1  2 
quantum/plugins/cisco/README
quantum/plugins/cisco/db/l2network_db.py
quantum/plugins/cisco/l2network_plugin.py
quantum/plugins/cisco/nexus/cisco_nexus_network_driver.py
quantum/plugins/cisco/tests/unit/test_l2networkApi.py
tests/unit/test_extensions.py

Simple merge
index 8f85afb55eda5a10302236f741e1749637394a02,1f015cd7993eecefe0d7cb92130133dfb8bddc7f..b19a94335e5183b7aa142035fa043f8177ffc617
@@@ -20,9 -20,8 +20,9 @@@ from sqlalchemy.orm import ex
  from quantum.common import exceptions as q_exc
  from quantum.plugins.cisco import l2network_plugin_configuration as conf
  from quantum.plugins.cisco.common import cisco_exceptions as c_exc
+ from quantum.plugins.cisco.db import l2network_models
  
- import l2network_models
 +import logging as LOG
  import quantum.plugins.cisco.db.api as db
  
  
@@@ -112,13 -106,11 +112,12 @@@ def delete_vlanid(vlan_id)
  
  def reserve_vlanid():
      """Reserves the first unused vlanid"""
 +    LOG.debug("reserve_vlanid() called")
      session = db.get_session()
      try:
-         vlanids = session.query(l2network_models.VlanID).\
+         rvlan = session.query(l2network_models.VlanID).\
           filter_by(vlan_used=False).\
-           all()
-         rvlan = vlanids[0]
+           first()
          rvlanid = session.query(l2network_models.VlanID).\
           filter_by(vlan_id=rvlan["vlan_id"]).\
            one()
index 71741935238fd5b5c9c7741e1fe5dbf668be18b3,4d2d00ee592b0a8c29c2b93b1cd4e4a96a1d038b..7039923f16fba78f90ede89a904a560475c41544
@@@ -353,141 -333,6 +353,126 @@@ class L2Network(QuantumPluginBase)
  
          cdb.remove_pp_binding(tenant_id, port_id, portprofile_id)
  
-     def create_default_portprofile(self, tenant_id, network_id, profile_name,
-                                     qos):
-         "Create default port profile"""
-         LOG.debug("create_default_portprofile() called\n")
-         portprofile = cdb.add_portprofile(tenant_id, profile_name,
-                                  const.NO_VLAN_ID, qos)
-         new_pp = self._make_portprofile_dict(tenant_id,
-                                              portprofile[const.UUID],
-                                              portprofile[const.PPNAME],
-                                              portprofile[const.PPQOS])
-         # TODO (Sumit): Need to check the following
-         port_id = None
-         cdb.add_pp_binding(tenant_id, port_id, portprofile[const.UUID], True)
-         return new_pp
 +    def get_all_qoss(self, tenant_id):
 +        """Get all QoS levels"""
 +        LOG.debug("get_all_qoss() called\n")
 +        return self._qos_levels.values()
 +
 +    def get_qos_details(self, tenant_id, qos_id):
 +        """Get QoS Details"""
 +        LOG.debug("get_qos_details() called\n")
 +        try:
 +            qos_level = self._get_qos_level(tenant_id, qos_id)
 +        except Exception, excp:
 +            raise cexc.QosNotFound(tenant_id=tenant_id,
 +                                        qos_id=qos_id)
 +        return qos_level
 +
 +    def create_qos(self, tenant_id, qos_name, qos_desc):
 +        """Create a QoS level"""
 +        LOG.debug("create_qos() called\n")
 +        qos_id = self._get_unique_qos_id(tenant_id)
 +        new_qos_level_dict = {const.QOS_LEVEL_ID: qos_id,
 +                              const.QOS_LEVEL_NAME: qos_name,
 +                              const.QOS_LEVEL_ASSOCIATIONS: [],
 +                              const.QOS_LEVEL_DESCRIPTION: qos_desc}
 +        self._qos_levels[qos_id] = new_qos_level_dict
 +        return new_qos_level_dict
 +
 +    def delete_qos(self, tenant_id, qos_id):
 +        """Delete a QoS level"""
 +        LOG.debug("delete_qos() called\n")
 +        try:
 +            qos_level = self._get_qos_level(tenant_id, qos_id)
 +        except Exception, excp:
 +            raise cexc.QosNotFound(tenant_id=tenant_id,
 +                                        qos_id=qos_id)
 +        associations = qos_level[const.QOS_LEVEL_ASSOCIATIONS]
 +        if len(associations) > 0:
 +            raise cexc.QoSLevelInvalidDelete(tenant_id=tenant_id,
 +                                             qos_id=qos_id)
 +        else:
 +            self._qos_levels.pop(qos_id)
 +
 +    def rename_qos(self, tenant_id, qos_id, new_name):
 +        """Rename QoS level"""
 +        LOG.debug("rename_qos() called\n")
 +        qos_level = self._get_qos_level(tenant_id, qos_id)
 +        try:
 +            qos_level = self._get_qos_level(tenant_id, qos_id)
 +        except Exception, excp:
 +            raise cexc.QosNotFound(tenant_id=tenant_id,
 +                                        qos_id=qos_id)
 +        qos_level[const.QOS_LEVEL_NAME] = new_name
 +        return qos_level
 +
 +    def get_all_credentials(self, tenant_id):
 +        """Get all credentials"""
 +        LOG.debug("get_all_credentials() called\n")
 +        return self._credentials.values()
 +
 +    def get_credential_details(self, tenant_id, credential_id):
 +        """Get a particular credential"""
 +        LOG.debug("get_credential_details() called\n")
 +        try:
 +            credential = self._get_credential(tenant_id, credential_id)
 +        except Exception, excp:
 +            raise cexc.CredentialNotFound(tenant_id=tenant_id,
 +                                          credential_id=credential_id)
 +        return credential
 +
 +    def create_credential(self, tenant_id, credential_name, user_name,
 +                          password):
 +        """Create a new credential"""
 +        LOG.debug("create_credential() called\n")
 +        credential_id = self._get_unique_credential_id(tenant_id)
 +        masked_password = const.MASKED_PASSWORD
 +        new_credential_dict = {const.CREDENTIAL_ID: credential_id,
 +                               const.CREDENTIAL_NAME: credential_name,
 +                               const.CREDENTIAL_USERNAME: user_name,
 +                               const.CREDENTIAL_PASSWORD: masked_password}
 +        self._credentials[credential_id] = new_credential_dict
 +        cred.Store.putCredential(credential_id, user_name, password)
 +        return new_credential_dict
 +
 +    def delete_credential(self, tenant_id, credential_id):
 +        """Delete a credential"""
 +        LOG.debug("delete_credential() called\n")
 +        try:
 +            credential = self._get_credential(tenant_id, credential_id)
 +        except Exception, excp:
 +            raise cexc.CredentialNotFound(tenant_id=tenant_id,
 +                                          credential_id=credential_id)
 +        self._credentials.pop(credential_id)
 +        cred.Store.deleteCredential(credential_id)
 +
 +    def rename_credential(self, tenant_id, credential_id, new_name):
 +        """Rename the particular credential resource"""
 +        LOG.debug("rename_credential() called\n")
 +        try:
 +            credential = self._get_credential(tenant_id, credential_id)
 +        except Exception, excp:
 +            raise cexc.CredentialNotFound(tenant_id=tenant_id,
 +                                          credential_id=credential_id)
 +
 +        credential[const.CREDENTIAL_NAME] = new_name
 +        return credential
 +
 +    def get_host(self, tenant_id, instance_id, instance_desc):
 +        """Provides the hostname on which a dynamic vnic is reserved"""
 +        LOG.debug("get_host() called\n")
 +        host_list = {const.HOST_LIST: {const.HOST_1: platform.node()}}
 +        return host_list
 +
 +    def get_instance_port(self, tenant_id, instance_id, instance_desc):
 +        """
 +        Get the portprofile name and the device namei for the dynamic vnic
 +        """
 +        LOG.debug("get_instance_port() called\n")
 +        vif_desc = {const.VIF_DESC:
 +                    {const.DEVICENAME: "eth2", const.UCSPROFILE: "default"}}
 +        return vif_desc
 +
      """
      Private functions
      """
Simple merge