Docstrings formatted according to pep257
Bug #1020184 quantum/plugins/cisco/* Change-Id: Ibb6a865a17de0ea4f1865972624e4c5da0e96b34
This commit is contained in:
parent
58d13eb351
commit
ee3bb94b24
@ -17,9 +17,7 @@
|
|||||||
# @author: Sumit Naiksatam, Cisco Systems, Inc.
|
# @author: Sumit Naiksatam, Cisco Systems, Inc.
|
||||||
# @author: Rohit Agarwalla, Cisco Systems, Inc.
|
# @author: Rohit Agarwalla, Cisco Systems, Inc.
|
||||||
|
|
||||||
"""
|
"""Exceptions used by the Cisco plugin."""
|
||||||
Exceptions used by the Cisco plugin
|
|
||||||
"""
|
|
||||||
|
|
||||||
from quantum.common import exceptions
|
from quantum.common import exceptions
|
||||||
|
|
||||||
|
@ -41,8 +41,9 @@ class Fault(webob.exc.HTTPException):
|
|||||||
|
|
||||||
@webob.dec.wsgify(RequestClass=wsgi.Request)
|
@webob.dec.wsgify(RequestClass=wsgi.Request)
|
||||||
def __call__(self, req):
|
def __call__(self, req):
|
||||||
"""Generate a WSGI response based on the
|
"""Generate a WSGI response.
|
||||||
exception passed to constructor.
|
|
||||||
|
Response is generated based on the exception passed to constructor.
|
||||||
"""
|
"""
|
||||||
# Replace the body with fault details.
|
# Replace the body with fault details.
|
||||||
code = self.wrapped_exc.status_int
|
code = self.wrapped_exc.status_int
|
||||||
@ -60,7 +61,8 @@ class Fault(webob.exc.HTTPException):
|
|||||||
|
|
||||||
|
|
||||||
class PortNotFound(webob.exc.HTTPClientError):
|
class PortNotFound(webob.exc.HTTPClientError):
|
||||||
"""
|
"""PortNotFound exception.
|
||||||
|
|
||||||
subclass of :class:`~HTTPClientError`
|
subclass of :class:`~HTTPClientError`
|
||||||
|
|
||||||
This indicates that the server did not find the port specified
|
This indicates that the server did not find the port specified
|
||||||
@ -74,7 +76,8 @@ class PortNotFound(webob.exc.HTTPClientError):
|
|||||||
|
|
||||||
|
|
||||||
class CredentialNotFound(webob.exc.HTTPClientError):
|
class CredentialNotFound(webob.exc.HTTPClientError):
|
||||||
"""
|
"""CredentialNotFound exception.
|
||||||
|
|
||||||
subclass of :class:`~HTTPClientError`
|
subclass of :class:`~HTTPClientError`
|
||||||
|
|
||||||
This indicates that the server did not find the Credential specified
|
This indicates that the server did not find the Credential specified
|
||||||
@ -89,7 +92,8 @@ class CredentialNotFound(webob.exc.HTTPClientError):
|
|||||||
|
|
||||||
|
|
||||||
class QosNotFound(webob.exc.HTTPClientError):
|
class QosNotFound(webob.exc.HTTPClientError):
|
||||||
"""
|
"""QosNotFound exception.
|
||||||
|
|
||||||
subclass of :class:`~HTTPClientError`
|
subclass of :class:`~HTTPClientError`
|
||||||
|
|
||||||
This indicates that the server did not find the QoS specified
|
This indicates that the server did not find the QoS specified
|
||||||
@ -104,7 +108,8 @@ class QosNotFound(webob.exc.HTTPClientError):
|
|||||||
|
|
||||||
|
|
||||||
class NovatenantNotFound(webob.exc.HTTPClientError):
|
class NovatenantNotFound(webob.exc.HTTPClientError):
|
||||||
"""
|
"""NovatenantNotFound exception.
|
||||||
|
|
||||||
subclass of :class:`~HTTPClientError`
|
subclass of :class:`~HTTPClientError`
|
||||||
|
|
||||||
This indicates that the server did not find the Novatenant specified
|
This indicates that the server did not find the Novatenant specified
|
||||||
@ -119,7 +124,8 @@ class NovatenantNotFound(webob.exc.HTTPClientError):
|
|||||||
|
|
||||||
|
|
||||||
class RequestedStateInvalid(webob.exc.HTTPClientError):
|
class RequestedStateInvalid(webob.exc.HTTPClientError):
|
||||||
"""
|
"""RequestedStateInvalid exception.
|
||||||
|
|
||||||
subclass of :class:`~HTTPClientError`
|
subclass of :class:`~HTTPClientError`
|
||||||
|
|
||||||
This indicates that the server could not update the port state to
|
This indicates that the server could not update the port state to
|
||||||
|
@ -26,9 +26,9 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def get16ByteUUID(uuid):
|
def get16ByteUUID(uuid):
|
||||||
"""
|
"""Return first 16 bytes of UUID.
|
||||||
Return a 16 byte has of the UUID, used when smaller unique
|
|
||||||
ID is required.
|
Used when smaller unique ID is required.
|
||||||
"""
|
"""
|
||||||
return hashlib.md5(uuid).hexdigest()[:16]
|
return hashlib.md5(uuid).hexdigest()[:16]
|
||||||
|
|
||||||
|
@ -88,13 +88,14 @@ nexus_dictionary = {}
|
|||||||
|
|
||||||
class CiscoConfigOptions():
|
class CiscoConfigOptions():
|
||||||
"""Cisco Configuration Options Class."""
|
"""Cisco Configuration Options Class."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._create_nexus_dictionary()
|
self._create_nexus_dictionary()
|
||||||
|
|
||||||
def _create_nexus_dictionary(self):
|
def _create_nexus_dictionary(self):
|
||||||
"""
|
"""Create the Nexus dictionary.
|
||||||
Create the Nexus dictionary from the cisco_plugins.ini
|
|
||||||
NEXUS_SWITCH section(s).
|
Reads data from cisco_plugins.ini NEXUS_SWITCH section(s).
|
||||||
"""
|
"""
|
||||||
for parsed_file in cfg.CONF._cparser.parsed:
|
for parsed_file in cfg.CONF._cparser.parsed:
|
||||||
for parsed_item in parsed_file.keys():
|
for parsed_item in parsed_file.keys():
|
||||||
|
@ -30,9 +30,10 @@ BASE = models.BASE
|
|||||||
|
|
||||||
|
|
||||||
def configure_db(options):
|
def configure_db(options):
|
||||||
"""
|
"""Configure database.
|
||||||
Establish the database, create an engine if needed, and
|
|
||||||
register the models.
|
Establish the database, create an engine if needed, and register the
|
||||||
|
models.
|
||||||
|
|
||||||
:param options: Mapping of configuration options
|
:param options: Mapping of configuration options
|
||||||
"""
|
"""
|
||||||
|
@ -24,6 +24,7 @@ from quantum.plugins.cisco.db.models import BASE
|
|||||||
|
|
||||||
class L2NetworkBase(object):
|
class L2NetworkBase(object):
|
||||||
"""Base class for L2Network Models."""
|
"""Base class for L2Network Models."""
|
||||||
|
|
||||||
__table_args__ = {'mysql_engine': 'InnoDB'}
|
__table_args__ = {'mysql_engine': 'InnoDB'}
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
@ -54,7 +55,8 @@ class L2NetworkBase(object):
|
|||||||
setattr(self, k, v)
|
setattr(self, k, v)
|
||||||
|
|
||||||
def iteritems(self):
|
def iteritems(self):
|
||||||
"""Make the model object behave like a dict"
|
"""Make the model object behave like a dict.
|
||||||
|
|
||||||
Includes attributes from joins.
|
Includes attributes from joins.
|
||||||
"""
|
"""
|
||||||
local = dict(self)
|
local = dict(self)
|
||||||
@ -66,6 +68,7 @@ class L2NetworkBase(object):
|
|||||||
|
|
||||||
class VlanID(BASE, L2NetworkBase):
|
class VlanID(BASE, L2NetworkBase):
|
||||||
"""Represents a vlan_id usage."""
|
"""Represents a vlan_id usage."""
|
||||||
|
|
||||||
__tablename__ = 'vlan_ids'
|
__tablename__ = 'vlan_ids'
|
||||||
|
|
||||||
vlan_id = Column(Integer, primary_key=True)
|
vlan_id = Column(Integer, primary_key=True)
|
||||||
@ -81,6 +84,7 @@ class VlanID(BASE, L2NetworkBase):
|
|||||||
|
|
||||||
class VlanBinding(BASE, L2NetworkBase):
|
class VlanBinding(BASE, L2NetworkBase):
|
||||||
"""Represents a binding of vlan_id to network_id."""
|
"""Represents a binding of vlan_id to network_id."""
|
||||||
|
|
||||||
__tablename__ = 'vlan_bindings'
|
__tablename__ = 'vlan_bindings'
|
||||||
|
|
||||||
vlan_id = Column(Integer, primary_key=True)
|
vlan_id = Column(Integer, primary_key=True)
|
||||||
@ -101,6 +105,7 @@ class VlanBinding(BASE, L2NetworkBase):
|
|||||||
|
|
||||||
class QoS(BASE, L2NetworkBase):
|
class QoS(BASE, L2NetworkBase):
|
||||||
"""Represents QoS for a tenant."""
|
"""Represents QoS for a tenant."""
|
||||||
|
|
||||||
__tablename__ = 'qoss'
|
__tablename__ = 'qoss'
|
||||||
|
|
||||||
qos_id = Column(String(255))
|
qos_id = Column(String(255))
|
||||||
@ -121,6 +126,7 @@ class QoS(BASE, L2NetworkBase):
|
|||||||
|
|
||||||
class Credential(BASE, L2NetworkBase):
|
class Credential(BASE, L2NetworkBase):
|
||||||
"""Represents credentials for a tenant."""
|
"""Represents credentials for a tenant."""
|
||||||
|
|
||||||
__tablename__ = 'credentials'
|
__tablename__ = 'credentials'
|
||||||
|
|
||||||
credential_id = Column(String(255))
|
credential_id = Column(String(255))
|
||||||
|
@ -30,6 +30,7 @@ BASE = declarative_base()
|
|||||||
|
|
||||||
class QuantumBase(object):
|
class QuantumBase(object):
|
||||||
"""Base class for Quantum Models."""
|
"""Base class for Quantum Models."""
|
||||||
|
|
||||||
__table_args__ = {'mysql_engine': 'InnoDB'}
|
__table_args__ = {'mysql_engine': 'InnoDB'}
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
@ -56,6 +57,7 @@ class QuantumBase(object):
|
|||||||
|
|
||||||
def iteritems(self):
|
def iteritems(self):
|
||||||
"""Make the model object behave like a dict.
|
"""Make the model object behave like a dict.
|
||||||
|
|
||||||
Includes attributes from joins.
|
Includes attributes from joins.
|
||||||
"""
|
"""
|
||||||
local = dict(self)
|
local = dict(self)
|
||||||
@ -67,6 +69,7 @@ class QuantumBase(object):
|
|||||||
|
|
||||||
class Port(BASE, QuantumBase):
|
class Port(BASE, QuantumBase):
|
||||||
"""Represents a port on a quantum network."""
|
"""Represents a port on a quantum network."""
|
||||||
|
|
||||||
__tablename__ = 'ports'
|
__tablename__ = 'ports'
|
||||||
|
|
||||||
uuid = Column(String(255), primary_key=True)
|
uuid = Column(String(255), primary_key=True)
|
||||||
@ -88,6 +91,7 @@ class Port(BASE, QuantumBase):
|
|||||||
|
|
||||||
class Network(BASE, QuantumBase):
|
class Network(BASE, QuantumBase):
|
||||||
"""Represents a quantum network."""
|
"""Represents a quantum network."""
|
||||||
|
|
||||||
__tablename__ = 'networks'
|
__tablename__ = 'networks'
|
||||||
|
|
||||||
uuid = Column(String(255), primary_key=True)
|
uuid = Column(String(255), primary_key=True)
|
||||||
|
@ -26,6 +26,7 @@ from quantum.openstack.common import uuidutils
|
|||||||
|
|
||||||
class L2NetworkBase(object):
|
class L2NetworkBase(object):
|
||||||
"""Base class for L2Network Models."""
|
"""Base class for L2Network Models."""
|
||||||
|
|
||||||
#__table_args__ = {'mysql_engine': 'InnoDB'}
|
#__table_args__ = {'mysql_engine': 'InnoDB'}
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
@ -56,7 +57,8 @@ class L2NetworkBase(object):
|
|||||||
setattr(self, k, v)
|
setattr(self, k, v)
|
||||||
|
|
||||||
def iteritems(self):
|
def iteritems(self):
|
||||||
"""Make the model object behave like a dict"
|
"""Make the model object behave like a dict.
|
||||||
|
|
||||||
Includes attributes from joins.
|
Includes attributes from joins.
|
||||||
"""
|
"""
|
||||||
local = dict(self)
|
local = dict(self)
|
||||||
@ -103,6 +105,7 @@ class Vlan_Binding(model_base.BASEV2, L2NetworkBase):
|
|||||||
|
|
||||||
class QoS(model_base.BASEV2, L2NetworkBase):
|
class QoS(model_base.BASEV2, L2NetworkBase):
|
||||||
"""Represents QoS for a tenant."""
|
"""Represents QoS for a tenant."""
|
||||||
|
|
||||||
__tablename__ = 'qoss'
|
__tablename__ = 'qoss'
|
||||||
|
|
||||||
qos_id = Column(String(255))
|
qos_id = Column(String(255))
|
||||||
@ -123,6 +126,7 @@ class QoS(model_base.BASEV2, L2NetworkBase):
|
|||||||
|
|
||||||
class Credential(model_base.BASEV2, L2NetworkBase):
|
class Credential(model_base.BASEV2, L2NetworkBase):
|
||||||
"""Represents credentials for a tenant."""
|
"""Represents credentials for a tenant."""
|
||||||
|
|
||||||
__tablename__ = 'credentials'
|
__tablename__ = 'credentials'
|
||||||
|
|
||||||
credential_id = Column(String(255))
|
credential_id = Column(String(255))
|
||||||
|
@ -23,6 +23,7 @@ from quantum.plugins.cisco.db.l2network_models import L2NetworkBase
|
|||||||
|
|
||||||
class NexusPortBinding(model_base.BASEV2, L2NetworkBase):
|
class NexusPortBinding(model_base.BASEV2, L2NetworkBase):
|
||||||
"""Represents a binding of VM's to nexus ports."""
|
"""Represents a binding of VM's to nexus ports."""
|
||||||
|
|
||||||
__tablename__ = "nexusport_bindings"
|
__tablename__ = "nexusport_bindings"
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
|
@ -19,18 +19,16 @@
|
|||||||
|
|
||||||
|
|
||||||
def get_view_builder(req):
|
def get_view_builder(req):
|
||||||
"""get view builder."""
|
|
||||||
base_url = req.application_url
|
base_url = req.application_url
|
||||||
return ViewBuilder(base_url)
|
return ViewBuilder(base_url)
|
||||||
|
|
||||||
|
|
||||||
class ViewBuilder(object):
|
class ViewBuilder(object):
|
||||||
"""
|
"""ViewBuilder for Credential, derived from quantum.views.networks."""
|
||||||
ViewBuilder for Credential,
|
|
||||||
derived from quantum.views.networks
|
|
||||||
"""
|
|
||||||
def __init__(self, base_url):
|
def __init__(self, base_url):
|
||||||
"""
|
"""Initialize builder.
|
||||||
|
|
||||||
:param base_url: url of the root wsgi application
|
:param base_url: url of the root wsgi application
|
||||||
"""
|
"""
|
||||||
self.base_url = base_url
|
self.base_url = base_url
|
||||||
|
@ -19,18 +19,16 @@
|
|||||||
|
|
||||||
|
|
||||||
def get_view_builder(req):
|
def get_view_builder(req):
|
||||||
"""get view builder."""
|
|
||||||
base_url = req.application_url
|
base_url = req.application_url
|
||||||
return ViewBuilder(base_url)
|
return ViewBuilder(base_url)
|
||||||
|
|
||||||
|
|
||||||
class ViewBuilder(object):
|
class ViewBuilder(object):
|
||||||
"""
|
"""ViewBuilder for QoS, derived from quantum.views.networks."""
|
||||||
ViewBuilder for QoS,
|
|
||||||
derived from quantum.views.networks
|
|
||||||
"""
|
|
||||||
def __init__(self, base_url):
|
def __init__(self, base_url):
|
||||||
"""
|
"""Initialize builder.
|
||||||
|
|
||||||
:param base_url: url of the root wsgi application
|
:param base_url: url of the root wsgi application
|
||||||
"""
|
"""
|
||||||
self.base_url = base_url
|
self.base_url = base_url
|
||||||
|
@ -31,7 +31,7 @@ from quantum import wsgi
|
|||||||
|
|
||||||
|
|
||||||
class Credential(extensions.ExtensionDescriptor):
|
class Credential(extensions.ExtensionDescriptor):
|
||||||
"""extension class Credential."""
|
"""Extension class Credential."""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_name(cls):
|
def get_name(cls):
|
||||||
|
@ -21,8 +21,8 @@ import inspect
|
|||||||
|
|
||||||
|
|
||||||
class L2DevicePluginBase(object):
|
class L2DevicePluginBase(object):
|
||||||
"""
|
"""Base class for a device-specific plugin.
|
||||||
Base class for a device-specific plugin.
|
|
||||||
An example of a device-specific plugin is a Nexus switch plugin.
|
An example of a device-specific plugin is a Nexus switch plugin.
|
||||||
The network model relies on device-category-specific plugins to perform
|
The network model relies on device-category-specific plugins to perform
|
||||||
the configuration on each device.
|
the configuration on each device.
|
||||||
@ -32,7 +32,8 @@ class L2DevicePluginBase(object):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_all_networks(self, tenant_id, **kwargs):
|
def get_all_networks(self, tenant_id, **kwargs):
|
||||||
"""
|
"""Get newtorks.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -41,7 +42,8 @@ class L2DevicePluginBase(object):
|
|||||||
@abstractmethod
|
@abstractmethod
|
||||||
def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id,
|
def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
"""
|
"""Create network.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -49,7 +51,8 @@ class L2DevicePluginBase(object):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def delete_network(self, tenant_id, net_id, **kwargs):
|
def delete_network(self, tenant_id, net_id, **kwargs):
|
||||||
"""
|
"""Delete network.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -57,7 +60,8 @@ class L2DevicePluginBase(object):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_network_details(self, tenant_id, net_id, **kwargs):
|
def get_network_details(self, tenant_id, net_id, **kwargs):
|
||||||
"""
|
"""Get network details.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -65,7 +69,8 @@ class L2DevicePluginBase(object):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def update_network(self, tenant_id, net_id, name, **kwargs):
|
def update_network(self, tenant_id, net_id, name, **kwargs):
|
||||||
"""
|
"""Update network.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -73,7 +78,8 @@ class L2DevicePluginBase(object):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_all_ports(self, tenant_id, net_id, **kwargs):
|
def get_all_ports(self, tenant_id, net_id, **kwargs):
|
||||||
"""
|
"""Get ports.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -81,7 +87,8 @@ class L2DevicePluginBase(object):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def create_port(self, tenant_id, net_id, port_state, port_id, **kwargs):
|
def create_port(self, tenant_id, net_id, port_state, port_id, **kwargs):
|
||||||
"""
|
"""Create port.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -89,7 +96,8 @@ class L2DevicePluginBase(object):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def delete_port(self, tenant_id, net_id, port_id, **kwargs):
|
def delete_port(self, tenant_id, net_id, port_id, **kwargs):
|
||||||
"""
|
"""Delete port.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -97,7 +105,8 @@ class L2DevicePluginBase(object):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def update_port(self, tenant_id, net_id, port_id, **kwargs):
|
def update_port(self, tenant_id, net_id, port_id, **kwargs):
|
||||||
"""
|
"""Update port.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -105,7 +114,8 @@ class L2DevicePluginBase(object):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_port_details(self, tenant_id, net_id, port_id, **kwargs):
|
def get_port_details(self, tenant_id, net_id, port_id, **kwargs):
|
||||||
"""
|
"""Get port details.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -114,7 +124,8 @@ class L2DevicePluginBase(object):
|
|||||||
@abstractmethod
|
@abstractmethod
|
||||||
def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id,
|
def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
"""
|
"""Plug interface.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -122,7 +133,8 @@ class L2DevicePluginBase(object):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def unplug_interface(self, tenant_id, net_id, port_id, **kwargs):
|
def unplug_interface(self, tenant_id, net_id, port_id, **kwargs):
|
||||||
"""
|
"""Unplug interface.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -130,35 +142,40 @@ class L2DevicePluginBase(object):
|
|||||||
|
|
||||||
def create_subnet(self, tenant_id, net_id, ip_version,
|
def create_subnet(self, tenant_id, net_id, ip_version,
|
||||||
subnet_cidr, **kwargs):
|
subnet_cidr, **kwargs):
|
||||||
"""
|
"""Create subnet.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_subnets(self, tenant_id, net_id, **kwargs):
|
def get_subnets(self, tenant_id, net_id, **kwargs):
|
||||||
"""
|
"""Get subnets.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_subnet(self, tenant_id, net_id, subnet_id, **kwargs):
|
def get_subnet(self, tenant_id, net_id, subnet_id, **kwargs):
|
||||||
"""
|
"""Get subnet.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def update_subnet(self, tenant_id, net_id, subnet_id, **kwargs):
|
def update_subnet(self, tenant_id, net_id, subnet_id, **kwargs):
|
||||||
"""
|
"""Update subnet.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def delete_subnet(self, tenant_id, net_id, subnet_id, **kwargs):
|
def delete_subnet(self, tenant_id, net_id, subnet_id, **kwargs):
|
||||||
"""
|
"""Delete subnet.
|
||||||
|
|
||||||
:returns:
|
:returns:
|
||||||
:raises:
|
:raises:
|
||||||
"""
|
"""
|
||||||
@ -166,7 +183,8 @@ class L2DevicePluginBase(object):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __subclasshook__(cls, klass):
|
def __subclasshook__(cls, klass):
|
||||||
"""
|
"""Check plugin class.
|
||||||
|
|
||||||
The __subclasshook__ method is a class method
|
The __subclasshook__ method is a class method
|
||||||
that will be called everytime a class is tested
|
that will be called everytime a class is tested
|
||||||
using issubclass(klass, Plugin).
|
using issubclass(klass, Plugin).
|
||||||
|
@ -40,7 +40,8 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
||||||
"""
|
"""Virtual Physical Switch Model.
|
||||||
|
|
||||||
This implementation works with OVS and Nexus plugin for the
|
This implementation works with OVS and Nexus plugin for the
|
||||||
following topology:
|
following topology:
|
||||||
One or more servers to a nexus switch.
|
One or more servers to a nexus switch.
|
||||||
@ -58,10 +59,10 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
'get_subnet', 'get_subnets', ]
|
'get_subnet', 'get_subnets', ]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""
|
"""Initialize the segmentation manager.
|
||||||
Initialize the segmentation manager, check which device plugins are
|
|
||||||
configured, and load the inventories those device plugins for which the
|
Checks which device plugins are configured, and load the inventories
|
||||||
inventory is configured
|
those device plugins for which the inventory is configured.
|
||||||
"""
|
"""
|
||||||
conf.CiscoConfigOptions()
|
conf.CiscoConfigOptions()
|
||||||
|
|
||||||
@ -90,7 +91,8 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
'name': self.__class__.__name__})
|
'name': self.__class__.__name__})
|
||||||
|
|
||||||
def __getattribute__(self, name):
|
def __getattribute__(self, name):
|
||||||
"""
|
"""Delegate calls to OVS sub-plugin.
|
||||||
|
|
||||||
This delegates the calls to the methods implemented only by the OVS
|
This delegates the calls to the methods implemented only by the OVS
|
||||||
sub-plugin. Note: Currently, bulking is handled by the caller
|
sub-plugin. Note: Currently, bulking is handled by the caller
|
||||||
(PluginV2), and this model class expects to receive only non-bulking
|
(PluginV2), and this model class expects to receive only non-bulking
|
||||||
@ -118,7 +120,8 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
return func_name
|
return func_name
|
||||||
|
|
||||||
def _invoke_plugin_per_device(self, plugin_key, function_name, args):
|
def _invoke_plugin_per_device(self, plugin_key, function_name, args):
|
||||||
"""
|
"""Invoke plugin per device.
|
||||||
|
|
||||||
Invokes a device plugin's relevant functions (based on the
|
Invokes a device plugin's relevant functions (based on the
|
||||||
plugin implementation) for completing this operation.
|
plugin implementation) for completing this operation.
|
||||||
"""
|
"""
|
||||||
@ -135,7 +138,8 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
device_params)]
|
device_params)]
|
||||||
|
|
||||||
def _invoke_plugin(self, plugin_key, function_name, args, kwargs):
|
def _invoke_plugin(self, plugin_key, function_name, args, kwargs):
|
||||||
"""
|
"""Invoke plugin.
|
||||||
|
|
||||||
Invokes the relevant function on a device plugin's
|
Invokes the relevant function on a device plugin's
|
||||||
implementation for completing this operation.
|
implementation for completing this operation.
|
||||||
"""
|
"""
|
||||||
@ -189,7 +193,8 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
return host
|
return host
|
||||||
|
|
||||||
def create_network(self, context, network):
|
def create_network(self, context, network):
|
||||||
"""
|
"""Create network.
|
||||||
|
|
||||||
Perform this operation in the context of the configured device
|
Perform this operation in the context of the configured device
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
@ -213,7 +218,8 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def update_network(self, context, id, network):
|
def update_network(self, context, id, network):
|
||||||
"""
|
"""Update network.
|
||||||
|
|
||||||
Perform this operation in the context of the configured device
|
Perform this operation in the context of the configured device
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
@ -235,7 +241,8 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
return ovs_output[0]
|
return ovs_output[0]
|
||||||
|
|
||||||
def delete_network(self, context, id):
|
def delete_network(self, context, id):
|
||||||
"""
|
"""Delete network.
|
||||||
|
|
||||||
Perform this operation in the context of the configured device
|
Perform this operation in the context of the configured device
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
@ -286,7 +293,8 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
return nexus_output
|
return nexus_output
|
||||||
|
|
||||||
def create_port(self, context, port):
|
def create_port(self, context, port):
|
||||||
"""
|
"""Create port.
|
||||||
|
|
||||||
Perform this operation in the context of the configured device
|
Perform this operation in the context of the configured device
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
@ -323,7 +331,8 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def update_port(self, context, id, port):
|
def update_port(self, context, id, port):
|
||||||
"""
|
"""Update port.
|
||||||
|
|
||||||
Perform this operation in the context of the configured device
|
Perform this operation in the context of the configured device
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
@ -354,7 +363,8 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def delete_port(self, context, id):
|
def delete_port(self, context, id):
|
||||||
"""
|
"""Delete port.
|
||||||
|
|
||||||
Perform this operation in the context of the configured device
|
Perform this operation in the context of the configured device
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
|
@ -34,9 +34,8 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
||||||
"""
|
"""Meta-Plugin with v2 API support for multiple sub-plugins."""
|
||||||
Meta-Plugin with v2 API support for multiple sub-plugins.
|
|
||||||
"""
|
|
||||||
supported_extension_aliases = ["Cisco Credential", "Cisco qos"]
|
supported_extension_aliases = ["Cisco Credential", "Cisco qos"]
|
||||||
_methods_to_delegate = ['create_network',
|
_methods_to_delegate = ['create_network',
|
||||||
'delete_network', 'update_network', 'get_network',
|
'delete_network', 'update_network', 'get_network',
|
||||||
@ -49,9 +48,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
_master = True
|
_master = True
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""
|
"""Load the model class."""
|
||||||
Loads the model class.
|
|
||||||
"""
|
|
||||||
self._model = importutils.import_object(config.CISCO.model_class)
|
self._model = importutils.import_object(config.CISCO.model_class)
|
||||||
if hasattr(self._model, "MANAGE_STATE") and self._model.MANAGE_STATE:
|
if hasattr(self._model, "MANAGE_STATE") and self._model.MANAGE_STATE:
|
||||||
self._master = False
|
self._master = False
|
||||||
@ -68,7 +65,8 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
LOG.debug(_("Plugin initialization complete"))
|
LOG.debug(_("Plugin initialization complete"))
|
||||||
|
|
||||||
def __getattribute__(self, name):
|
def __getattribute__(self, name):
|
||||||
"""
|
"""Delegate core API calls to the model class.
|
||||||
|
|
||||||
When the configured model class offers to manage the state of the
|
When the configured model class offers to manage the state of the
|
||||||
logical resources, we delegate the core API calls directly to it.
|
logical resources, we delegate the core API calls directly to it.
|
||||||
Note: Bulking calls will be handled by this class, and turned into
|
Note: Bulking calls will be handled by this class, and turned into
|
||||||
@ -83,7 +81,8 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
return object.__getattribute__(self, name)
|
return object.__getattribute__(self, name)
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
"""
|
"""Delegate calls to the extensions.
|
||||||
|
|
||||||
This delegates the calls to the extensions explicitly implemented by
|
This delegates the calls to the extensions explicitly implemented by
|
||||||
the model.
|
the model.
|
||||||
"""
|
"""
|
||||||
@ -99,10 +98,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
Core API implementation
|
Core API implementation
|
||||||
"""
|
"""
|
||||||
def create_network(self, context, network):
|
def create_network(self, context, network):
|
||||||
"""
|
"""Create new Virtual Network, and assigns it a symbolic name."""
|
||||||
Creates a new Virtual Network, and assigns it
|
|
||||||
a symbolic name.
|
|
||||||
"""
|
|
||||||
LOG.debug(_("create_network() called"))
|
LOG.debug(_("create_network() called"))
|
||||||
new_network = super(PluginV2, self).create_network(context,
|
new_network = super(PluginV2, self).create_network(context,
|
||||||
network)
|
network)
|
||||||
@ -116,9 +112,9 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def update_network(self, context, id, network):
|
def update_network(self, context, id, network):
|
||||||
"""
|
"""Update network.
|
||||||
Updates the symbolic name belonging to a particular
|
|
||||||
Virtual Network.
|
Updates the symbolic name belonging to a particular Virtual Network.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("update_network() called"))
|
LOG.debug(_("update_network() called"))
|
||||||
upd_net_dict = super(PluginV2, self).update_network(context, id,
|
upd_net_dict = super(PluginV2, self).update_network(context, id,
|
||||||
@ -128,7 +124,8 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
return upd_net_dict
|
return upd_net_dict
|
||||||
|
|
||||||
def delete_network(self, context, id):
|
def delete_network(self, context, id):
|
||||||
"""
|
"""Delete network.
|
||||||
|
|
||||||
Deletes the network with the specified network identifier
|
Deletes the network with the specified network identifier
|
||||||
belonging to the specified tenant.
|
belonging to the specified tenant.
|
||||||
"""
|
"""
|
||||||
@ -157,23 +154,17 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def get_network(self, context, id, fields=None):
|
def get_network(self, context, id, fields=None):
|
||||||
"""
|
"""Get a particular network."""
|
||||||
Gets a particular network
|
|
||||||
"""
|
|
||||||
LOG.debug(_("get_network() called"))
|
LOG.debug(_("get_network() called"))
|
||||||
return super(PluginV2, self).get_network(context, id, fields)
|
return super(PluginV2, self).get_network(context, id, fields)
|
||||||
|
|
||||||
def get_networks(self, context, filters=None, fields=None):
|
def get_networks(self, context, filters=None, fields=None):
|
||||||
"""
|
"""Get all networks."""
|
||||||
Gets all networks
|
|
||||||
"""
|
|
||||||
LOG.debug(_("get_networks() called"))
|
LOG.debug(_("get_networks() called"))
|
||||||
return super(PluginV2, self).get_networks(context, filters, fields)
|
return super(PluginV2, self).get_networks(context, filters, fields)
|
||||||
|
|
||||||
def create_port(self, context, port):
|
def create_port(self, context, port):
|
||||||
"""
|
"""Create a port on the specified Virtual Network."""
|
||||||
Creates a port on the specified Virtual Network.
|
|
||||||
"""
|
|
||||||
LOG.debug(_("create_port() called"))
|
LOG.debug(_("create_port() called"))
|
||||||
new_port = super(PluginV2, self).create_port(context, port)
|
new_port = super(PluginV2, self).create_port(context, port)
|
||||||
try:
|
try:
|
||||||
@ -184,18 +175,16 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def delete_port(self, context, id):
|
def delete_port(self, context, id):
|
||||||
"""
|
|
||||||
Deletes a port
|
|
||||||
"""
|
|
||||||
LOG.debug(_("delete_port() called"))
|
LOG.debug(_("delete_port() called"))
|
||||||
port = self._get_port(context, id)
|
port = self._get_port(context, id)
|
||||||
"""
|
"""Delete port.
|
||||||
|
|
||||||
TODO (Sumit): Disabling this check for now, check later
|
TODO (Sumit): Disabling this check for now, check later
|
||||||
#Allow deleting a port only if the administrative state is down,
|
Allow deleting a port only if the administrative state is down,
|
||||||
#and its operation status is also down
|
and its operation status is also down
|
||||||
if port['admin_state_up'] or port['status'] == 'ACTIVE':
|
#if port['admin_state_up'] or port['status'] == 'ACTIVE':
|
||||||
raise exc.PortInUse(port_id=id, net_id=port['network_id'],
|
# raise exc.PortInUse(port_id=id, net_id=port['network_id'],
|
||||||
att_id=port['device_id'])
|
# att_id=port['device_id'])
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
kwargs = {const.PORT: port}
|
kwargs = {const.PORT: port}
|
||||||
@ -207,9 +196,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def update_port(self, context, id, port):
|
def update_port(self, context, id, port):
|
||||||
"""
|
"""Update the state of a port and return the updated port."""
|
||||||
Updates the state of a port and returns the updated port
|
|
||||||
"""
|
|
||||||
LOG.debug(_("update_port() called"))
|
LOG.debug(_("update_port() called"))
|
||||||
try:
|
try:
|
||||||
self._invoke_device_plugins(self._func_name(), [context, id,
|
self._invoke_device_plugins(self._func_name(), [context, id,
|
||||||
@ -219,7 +206,8 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def create_subnet(self, context, subnet):
|
def create_subnet(self, context, subnet):
|
||||||
"""
|
"""Create subnet.
|
||||||
|
|
||||||
Create a subnet, which represents a range of IP addresses
|
Create a subnet, which represents a range of IP addresses
|
||||||
that can be allocated to devices.
|
that can be allocated to devices.
|
||||||
"""
|
"""
|
||||||
@ -234,9 +222,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def update_subnet(self, context, id, subnet):
|
def update_subnet(self, context, id, subnet):
|
||||||
"""
|
"""Updates the state of a subnet and returns the updated subnet."""
|
||||||
Updates the state of a subnet and returns the updated subnet
|
|
||||||
"""
|
|
||||||
LOG.debug(_("update_subnet() called"))
|
LOG.debug(_("update_subnet() called"))
|
||||||
try:
|
try:
|
||||||
self._invoke_device_plugins(self._func_name(), [context, id,
|
self._invoke_device_plugins(self._func_name(), [context, id,
|
||||||
@ -246,9 +232,6 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def delete_subnet(self, context, id):
|
def delete_subnet(self, context, id):
|
||||||
"""
|
|
||||||
Deletes a subnet
|
|
||||||
"""
|
|
||||||
LOG.debug(_("delete_subnet() called"))
|
LOG.debug(_("delete_subnet() called"))
|
||||||
with context.session.begin():
|
with context.session.begin():
|
||||||
subnet = self._get_subnet(context, id)
|
subnet = self._get_subnet(context, id)
|
||||||
@ -372,8 +355,9 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
return host_list
|
return host_list
|
||||||
|
|
||||||
def associate_port(self, tenant_id, instance_id, instance_desc):
|
def associate_port(self, tenant_id, instance_id, instance_desc):
|
||||||
"""
|
"""Associate port.
|
||||||
Get the portprofile name and the device name for the dynamic vnic
|
|
||||||
|
Get the portprofile name and the device name for the dynamic vnic.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("associate_port() called"))
|
LOG.debug(_("associate_port() called"))
|
||||||
return self._invoke_device_plugins(self._func_name(), [tenant_id,
|
return self._invoke_device_plugins(self._func_name(), [tenant_id,
|
||||||
@ -381,9 +365,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
instance_desc])
|
instance_desc])
|
||||||
|
|
||||||
def detach_port(self, tenant_id, instance_id, instance_desc):
|
def detach_port(self, tenant_id, instance_id, instance_desc):
|
||||||
"""
|
"""Remove the association of the VIF with the dynamic vnic."""
|
||||||
Remove the association of the VIF with the dynamic vnic
|
|
||||||
"""
|
|
||||||
LOG.debug(_("detach_port() called"))
|
LOG.debug(_("detach_port() called"))
|
||||||
return self._invoke_device_plugins(self._func_name(), [tenant_id,
|
return self._invoke_device_plugins(self._func_name(), [tenant_id,
|
||||||
instance_id,
|
instance_id,
|
||||||
@ -393,9 +375,9 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
|
|||||||
Private functions
|
Private functions
|
||||||
"""
|
"""
|
||||||
def _invoke_device_plugins(self, function_name, args):
|
def _invoke_device_plugins(self, function_name, args):
|
||||||
"""
|
"""Device-specific calls.
|
||||||
Device-specific calls including core API and extensions are
|
|
||||||
delegated to the model.
|
Including core API and extensions are delegated to the model.
|
||||||
"""
|
"""
|
||||||
if hasattr(self._model, function_name):
|
if hasattr(self._model, function_name):
|
||||||
return getattr(self._model, function_name)(*args)
|
return getattr(self._model, function_name)(*args)
|
||||||
|
@ -33,66 +33,56 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class CiscoNEXUSDriver():
|
class CiscoNEXUSDriver():
|
||||||
"""
|
"""Nexus Driver Main Class."""
|
||||||
Nexus Driver Main Class
|
|
||||||
"""
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def nxos_connect(self, nexus_host, nexus_ssh_port, nexus_user,
|
def nxos_connect(self, nexus_host, nexus_ssh_port, nexus_user,
|
||||||
nexus_password):
|
nexus_password):
|
||||||
"""
|
"""Make SSH connection to the Nexus Switch."""
|
||||||
Makes the SSH connection to the Nexus Switch
|
|
||||||
"""
|
|
||||||
man = manager.connect(host=nexus_host, port=nexus_ssh_port,
|
man = manager.connect(host=nexus_host, port=nexus_ssh_port,
|
||||||
username=nexus_user, password=nexus_password)
|
username=nexus_user, password=nexus_password)
|
||||||
return man
|
return man
|
||||||
|
|
||||||
def create_xml_snippet(self, cutomized_config):
|
def create_xml_snippet(self, cutomized_config):
|
||||||
"""
|
"""Create XML snippet.
|
||||||
Creates the Proper XML structure for the Nexus Switch Configuration
|
|
||||||
|
Creates the Proper XML structure for the Nexus Switch Configuration.
|
||||||
"""
|
"""
|
||||||
conf_xml_snippet = snipp.EXEC_CONF_SNIPPET % (cutomized_config)
|
conf_xml_snippet = snipp.EXEC_CONF_SNIPPET % (cutomized_config)
|
||||||
return conf_xml_snippet
|
return conf_xml_snippet
|
||||||
|
|
||||||
def enable_vlan(self, mgr, vlanid, vlanname):
|
def enable_vlan(self, mgr, vlanid, vlanname):
|
||||||
"""
|
"""Creates a VLAN on Nexus Switch given the VLAN ID and Name."""
|
||||||
Creates a VLAN on Nexus Switch given the VLAN ID and Name
|
|
||||||
"""
|
|
||||||
confstr = snipp.CMD_VLAN_CONF_SNIPPET % (vlanid, vlanname)
|
confstr = snipp.CMD_VLAN_CONF_SNIPPET % (vlanid, vlanname)
|
||||||
confstr = self.create_xml_snippet(confstr)
|
confstr = self.create_xml_snippet(confstr)
|
||||||
mgr.edit_config(target='running', config=confstr)
|
mgr.edit_config(target='running', config=confstr)
|
||||||
|
|
||||||
def disable_vlan(self, mgr, vlanid):
|
def disable_vlan(self, mgr, vlanid):
|
||||||
"""
|
"""Delete a VLAN on Nexus Switch given the VLAN ID."""
|
||||||
Delete a VLAN on Nexus Switch given the VLAN ID
|
|
||||||
"""
|
|
||||||
confstr = snipp.CMD_NO_VLAN_CONF_SNIPPET % vlanid
|
confstr = snipp.CMD_NO_VLAN_CONF_SNIPPET % vlanid
|
||||||
confstr = self.create_xml_snippet(confstr)
|
confstr = self.create_xml_snippet(confstr)
|
||||||
mgr.edit_config(target='running', config=confstr)
|
mgr.edit_config(target='running', config=confstr)
|
||||||
|
|
||||||
def enable_port_trunk(self, mgr, interface):
|
def enable_port_trunk(self, mgr, interface):
|
||||||
"""
|
"""Enable trunk mode an interface on Nexus Switch."""
|
||||||
Enables trunk mode an interface on Nexus Switch
|
|
||||||
"""
|
|
||||||
confstr = snipp.CMD_PORT_TRUNK % (interface)
|
confstr = snipp.CMD_PORT_TRUNK % (interface)
|
||||||
confstr = self.create_xml_snippet(confstr)
|
confstr = self.create_xml_snippet(confstr)
|
||||||
LOG.debug(_("NexusDriver: %s"), confstr)
|
LOG.debug(_("NexusDriver: %s"), confstr)
|
||||||
mgr.edit_config(target='running', config=confstr)
|
mgr.edit_config(target='running', config=confstr)
|
||||||
|
|
||||||
def disable_switch_port(self, mgr, interface):
|
def disable_switch_port(self, mgr, interface):
|
||||||
"""
|
"""Disable trunk mode an interface on Nexus Switch."""
|
||||||
Disables trunk mode an interface on Nexus Switch
|
|
||||||
"""
|
|
||||||
confstr = snipp.CMD_NO_SWITCHPORT % (interface)
|
confstr = snipp.CMD_NO_SWITCHPORT % (interface)
|
||||||
confstr = self.create_xml_snippet(confstr)
|
confstr = self.create_xml_snippet(confstr)
|
||||||
LOG.debug(_("NexusDriver: %s"), confstr)
|
LOG.debug(_("NexusDriver: %s"), confstr)
|
||||||
mgr.edit_config(target='running', config=confstr)
|
mgr.edit_config(target='running', config=confstr)
|
||||||
|
|
||||||
def enable_vlan_on_trunk_int(self, mgr, interface, vlanid):
|
def enable_vlan_on_trunk_int(self, mgr, interface, vlanid):
|
||||||
"""
|
"""Enable vlan in trunk interface.
|
||||||
|
|
||||||
Enables trunk mode vlan access an interface on Nexus Switch given
|
Enables trunk mode vlan access an interface on Nexus Switch given
|
||||||
VLANID
|
VLANID.
|
||||||
"""
|
"""
|
||||||
confstr = snipp.CMD_VLAN_INT_SNIPPET % (interface, vlanid)
|
confstr = snipp.CMD_VLAN_INT_SNIPPET % (interface, vlanid)
|
||||||
confstr = self.create_xml_snippet(confstr)
|
confstr = self.create_xml_snippet(confstr)
|
||||||
@ -100,9 +90,10 @@ class CiscoNEXUSDriver():
|
|||||||
mgr.edit_config(target='running', config=confstr)
|
mgr.edit_config(target='running', config=confstr)
|
||||||
|
|
||||||
def disable_vlan_on_trunk_int(self, mgr, interface, vlanid):
|
def disable_vlan_on_trunk_int(self, mgr, interface, vlanid):
|
||||||
"""
|
"""Disable VLAN.
|
||||||
Enables trunk mode vlan access an interface on Nexus Switch given
|
|
||||||
VLANID
|
Disables trunk mode vlan access an interface on Nexus Switch given
|
||||||
|
VLANID.
|
||||||
"""
|
"""
|
||||||
confstr = snipp.CMD_NO_VLAN_INT_SNIPPET % (interface, vlanid)
|
confstr = snipp.CMD_NO_VLAN_INT_SNIPPET % (interface, vlanid)
|
||||||
confstr = self.create_xml_snippet(confstr)
|
confstr = self.create_xml_snippet(confstr)
|
||||||
@ -112,9 +103,10 @@ class CiscoNEXUSDriver():
|
|||||||
def create_vlan(self, vlan_name, vlan_id, nexus_host, nexus_user,
|
def create_vlan(self, vlan_name, vlan_id, nexus_host, nexus_user,
|
||||||
nexus_password, nexus_ports,
|
nexus_password, nexus_ports,
|
||||||
nexus_ssh_port, vlan_ids=None):
|
nexus_ssh_port, vlan_ids=None):
|
||||||
"""
|
"""Create VLAN and enablt in on the interface.
|
||||||
|
|
||||||
Creates a VLAN and Enable on trunk mode an interface on Nexus Switch
|
Creates a VLAN and Enable on trunk mode an interface on Nexus Switch
|
||||||
given the VLAN ID and Name and Interface Number
|
given the VLAN ID and Name and Interface Number.
|
||||||
"""
|
"""
|
||||||
man = self.nxos_connect(nexus_host, int(nexus_ssh_port),
|
man = self.nxos_connect(nexus_host, int(nexus_ssh_port),
|
||||||
nexus_user, nexus_password)
|
nexus_user, nexus_password)
|
||||||
@ -127,9 +119,10 @@ class CiscoNEXUSDriver():
|
|||||||
|
|
||||||
def delete_vlan(self, vlan_id, nexus_host, nexus_user, nexus_password,
|
def delete_vlan(self, vlan_id, nexus_host, nexus_user, nexus_password,
|
||||||
nexus_ports, nexus_ssh_port):
|
nexus_ports, nexus_ssh_port):
|
||||||
"""
|
"""Delete vlan.
|
||||||
|
|
||||||
Delete a VLAN and Disables trunk mode an interface on Nexus Switch
|
Delete a VLAN and Disables trunk mode an interface on Nexus Switch
|
||||||
given the VLAN ID and Interface Number
|
given the VLAN ID and Interface Number.
|
||||||
"""
|
"""
|
||||||
man = self.nxos_connect(nexus_host, int(nexus_ssh_port),
|
man = self.nxos_connect(nexus_host, int(nexus_ssh_port),
|
||||||
nexus_user, nexus_password)
|
nexus_user, nexus_password)
|
||||||
@ -138,9 +131,7 @@ class CiscoNEXUSDriver():
|
|||||||
self.disable_vlan_on_trunk_int(man, ports, vlan_id)
|
self.disable_vlan_on_trunk_int(man, ports, vlan_id)
|
||||||
|
|
||||||
def build_vlans_cmd(self):
|
def build_vlans_cmd(self):
|
||||||
"""
|
"""Builds a string with all the VLANs on the same Switch."""
|
||||||
Builds a string with all the VLANs on the same Switch
|
|
||||||
"""
|
|
||||||
assigned_vlan = cdb.get_all_vlanids_used()
|
assigned_vlan = cdb.get_all_vlanids_used()
|
||||||
vlans = ''
|
vlans = ''
|
||||||
for vlanid in assigned_vlan:
|
for vlanid in assigned_vlan:
|
||||||
@ -151,8 +142,9 @@ class CiscoNEXUSDriver():
|
|||||||
|
|
||||||
def add_vlan_int(self, vlan_id, nexus_host, nexus_user, nexus_password,
|
def add_vlan_int(self, vlan_id, nexus_host, nexus_user, nexus_password,
|
||||||
nexus_ports, nexus_ssh_port, vlan_ids=None):
|
nexus_ports, nexus_ssh_port, vlan_ids=None):
|
||||||
"""
|
"""Add vlan.
|
||||||
Adds a vlan from interfaces on the Nexus switch given the VLAN ID
|
|
||||||
|
Adds a vlan from interfaces on the Nexus switch given the VLAN ID.
|
||||||
"""
|
"""
|
||||||
man = self.nxos_connect(nexus_host, int(nexus_ssh_port),
|
man = self.nxos_connect(nexus_host, int(nexus_ssh_port),
|
||||||
nexus_user, nexus_password)
|
nexus_user, nexus_password)
|
||||||
@ -163,8 +155,9 @@ class CiscoNEXUSDriver():
|
|||||||
|
|
||||||
def remove_vlan_int(self, vlan_id, nexus_host, nexus_user, nexus_password,
|
def remove_vlan_int(self, vlan_id, nexus_host, nexus_user, nexus_password,
|
||||||
nexus_ports, nexus_ssh_port):
|
nexus_ports, nexus_ssh_port):
|
||||||
"""
|
"""Remove vlan.
|
||||||
Removes a vlan from interfaces on the Nexus switch given the VLAN ID
|
|
||||||
|
Removes a vlan from interfaces on the Nexus switch given the VLAN ID.
|
||||||
"""
|
"""
|
||||||
man = self.nxos_connect(nexus_host, int(nexus_ssh_port),
|
man = self.nxos_connect(nexus_host, int(nexus_ssh_port),
|
||||||
nexus_user, nexus_password)
|
nexus_user, nexus_password)
|
||||||
|
@ -40,15 +40,11 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class NexusPlugin(L2DevicePluginBase):
|
class NexusPlugin(L2DevicePluginBase):
|
||||||
"""
|
"""Nexus PlugIn Main Class."""
|
||||||
Nexus PLugIn Main Class
|
|
||||||
"""
|
|
||||||
_networks = {}
|
_networks = {}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""
|
"""Extract configuration parameters from the configuration file."""
|
||||||
Extracts the configuration parameters from the configuration file
|
|
||||||
"""
|
|
||||||
self._client = importutils.import_object(conf.CISCO.nexus_driver)
|
self._client = importutils.import_object(conf.CISCO.nexus_driver)
|
||||||
LOG.debug(_("Loaded driver %s"), conf.CISCO.nexus_driver)
|
LOG.debug(_("Loaded driver %s"), conf.CISCO.nexus_driver)
|
||||||
self._nexus_switches = conf.get_nexus_dictionary()
|
self._nexus_switches = conf.get_nexus_dictionary()
|
||||||
@ -65,9 +61,9 @@ class NexusPlugin(L2DevicePluginBase):
|
|||||||
return self.credentials[nexus_ip]
|
return self.credentials[nexus_ip]
|
||||||
|
|
||||||
def get_all_networks(self, tenant_id):
|
def get_all_networks(self, tenant_id):
|
||||||
"""
|
"""Get all networks.
|
||||||
Returns a dictionary containing all
|
|
||||||
<network_uuid, network_name> for
|
Returns a dictionary containing all <network_uuid, network_name> for
|
||||||
the specified tenant.
|
the specified tenant.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("NexusPlugin:get_all_networks() called"))
|
LOG.debug(_("NexusPlugin:get_all_networks() called"))
|
||||||
@ -75,10 +71,10 @@ class NexusPlugin(L2DevicePluginBase):
|
|||||||
|
|
||||||
def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id,
|
def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id,
|
||||||
host, instance):
|
host, instance):
|
||||||
"""
|
"""Create network.
|
||||||
Create a VLAN in the appropriate switch/port,
|
|
||||||
and configure the appropriate interfaces
|
Create a VLAN in the appropriate switch/port, and configure the
|
||||||
for this VLAN
|
appropriate interfaces for this VLAN.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("NexusPlugin:create_network() called"))
|
LOG.debug(_("NexusPlugin:create_network() called"))
|
||||||
# Grab the switch IP and port for this host
|
# Grab the switch IP and port for this host
|
||||||
@ -129,46 +125,44 @@ class NexusPlugin(L2DevicePluginBase):
|
|||||||
return new_net_dict
|
return new_net_dict
|
||||||
|
|
||||||
def delete_network(self, tenant_id, net_id, **kwargs):
|
def delete_network(self, tenant_id, net_id, **kwargs):
|
||||||
"""
|
"""Delete network.
|
||||||
|
|
||||||
Deletes the VLAN in all switches, and removes the VLAN configuration
|
Deletes the VLAN in all switches, and removes the VLAN configuration
|
||||||
from the relevant interfaces
|
from the relevant interfaces.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("NexusPlugin:delete_network() called"))
|
LOG.debug(_("NexusPlugin:delete_network() called"))
|
||||||
|
|
||||||
def get_network_details(self, tenant_id, net_id, **kwargs):
|
def get_network_details(self, tenant_id, net_id, **kwargs):
|
||||||
"""
|
"""Return the details of a particular network."""
|
||||||
Returns the details of a particular network
|
|
||||||
"""
|
|
||||||
LOG.debug(_("NexusPlugin:get_network_details() called"))
|
LOG.debug(_("NexusPlugin:get_network_details() called"))
|
||||||
network = self._get_network(tenant_id, net_id)
|
network = self._get_network(tenant_id, net_id)
|
||||||
return network
|
return network
|
||||||
|
|
||||||
def update_network(self, tenant_id, net_id, **kwargs):
|
def update_network(self, tenant_id, net_id, **kwargs):
|
||||||
"""
|
"""Update the properties of a particular Virtual Network."""
|
||||||
Updates the properties of a particular
|
|
||||||
Virtual Network.
|
|
||||||
"""
|
|
||||||
LOG.debug(_("NexusPlugin:update_network() called"))
|
LOG.debug(_("NexusPlugin:update_network() called"))
|
||||||
|
|
||||||
def get_all_ports(self, tenant_id, net_id, **kwargs):
|
def get_all_ports(self, tenant_id, net_id, **kwargs):
|
||||||
"""
|
"""Get all ports.
|
||||||
|
|
||||||
This is probably not applicable to the Nexus plugin.
|
This is probably not applicable to the Nexus plugin.
|
||||||
Delete if not required.
|
Delete if not required.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("NexusPlugin:get_all_ports() called"))
|
LOG.debug(_("NexusPlugin:get_all_ports() called"))
|
||||||
|
|
||||||
def create_port(self, tenant_id, net_id, port_state, port_id, **kwargs):
|
def create_port(self, tenant_id, net_id, port_state, port_id, **kwargs):
|
||||||
"""
|
"""Create port.
|
||||||
|
|
||||||
This is probably not applicable to the Nexus plugin.
|
This is probably not applicable to the Nexus plugin.
|
||||||
Delete if not required.
|
Delete if not required.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("NexusPlugin:create_port() called"))
|
LOG.debug(_("NexusPlugin:create_port() called"))
|
||||||
|
|
||||||
def delete_port(self, device_id, vlan_id):
|
def delete_port(self, device_id, vlan_id):
|
||||||
"""
|
"""Delete port.
|
||||||
Delete port bindings from the database and scan
|
|
||||||
whether the network is still required on
|
Delete port bindings from the database and scan whether the network
|
||||||
the interfaces trunked
|
is still required on the interfaces trunked.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("NexusPlugin:delete_port() called"))
|
LOG.debug(_("NexusPlugin:delete_port() called"))
|
||||||
# Delete DB row for this port
|
# Delete DB row for this port
|
||||||
@ -198,14 +192,16 @@ class NexusPlugin(L2DevicePluginBase):
|
|||||||
return row['instance_id']
|
return row['instance_id']
|
||||||
|
|
||||||
def update_port(self, tenant_id, net_id, port_id, port_state, **kwargs):
|
def update_port(self, tenant_id, net_id, port_id, port_state, **kwargs):
|
||||||
"""
|
"""Update port.
|
||||||
|
|
||||||
This is probably not applicable to the Nexus plugin.
|
This is probably not applicable to the Nexus plugin.
|
||||||
Delete if not required.
|
Delete if not required.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("NexusPlugin:update_port() called"))
|
LOG.debug(_("NexusPlugin:update_port() called"))
|
||||||
|
|
||||||
def get_port_details(self, tenant_id, net_id, port_id, **kwargs):
|
def get_port_details(self, tenant_id, net_id, port_id, **kwargs):
|
||||||
"""
|
"""Get port details.
|
||||||
|
|
||||||
This is probably not applicable to the Nexus plugin.
|
This is probably not applicable to the Nexus plugin.
|
||||||
Delete if not required.
|
Delete if not required.
|
||||||
"""
|
"""
|
||||||
@ -213,14 +209,16 @@ class NexusPlugin(L2DevicePluginBase):
|
|||||||
|
|
||||||
def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id,
|
def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
"""
|
"""Plug interfaces.
|
||||||
|
|
||||||
This is probably not applicable to the Nexus plugin.
|
This is probably not applicable to the Nexus plugin.
|
||||||
Delete if not required.
|
Delete if not required.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("NexusPlugin:plug_interface() called"))
|
LOG.debug(_("NexusPlugin:plug_interface() called"))
|
||||||
|
|
||||||
def unplug_interface(self, tenant_id, net_id, port_id, **kwargs):
|
def unplug_interface(self, tenant_id, net_id, port_id, **kwargs):
|
||||||
"""
|
"""Unplug interface.
|
||||||
|
|
||||||
This is probably not applicable to the Nexus plugin.
|
This is probably not applicable to the Nexus plugin.
|
||||||
Delete if not required.
|
Delete if not required.
|
||||||
"""
|
"""
|
||||||
@ -228,16 +226,12 @@ class NexusPlugin(L2DevicePluginBase):
|
|||||||
|
|
||||||
def _get_vlan_id_for_network(self, tenant_id, network_id, context,
|
def _get_vlan_id_for_network(self, tenant_id, network_id, context,
|
||||||
base_plugin_ref):
|
base_plugin_ref):
|
||||||
"""
|
"""Obtain the VLAN ID given the Network ID."""
|
||||||
Obtain the VLAN ID given the Network ID
|
|
||||||
"""
|
|
||||||
vlan = cdb.get_vlan_binding(network_id)
|
vlan = cdb.get_vlan_binding(network_id)
|
||||||
return vlan.vlan_id
|
return vlan.vlan_id
|
||||||
|
|
||||||
def _get_network(self, tenant_id, network_id, context, base_plugin_ref):
|
def _get_network(self, tenant_id, network_id, context, base_plugin_ref):
|
||||||
"""
|
"""Get the Network ID."""
|
||||||
Gets the NETWORK ID
|
|
||||||
"""
|
|
||||||
network = base_plugin_ref._get_network(context, network_id)
|
network = base_plugin_ref._get_network(context, network_id)
|
||||||
if not network:
|
if not network:
|
||||||
raise exc.NetworkNotFound(net_id=network_id)
|
raise exc.NetworkNotFound(net_id=network_id)
|
||||||
|
@ -74,7 +74,6 @@ class ExtensionsTestApp(wsgi.Router):
|
|||||||
super(ExtensionsTestApp, self).__init__(mapper)
|
super(ExtensionsTestApp, self).__init__(mapper)
|
||||||
|
|
||||||
def create_request(self, path, body, content_type, method='GET'):
|
def create_request(self, path, body, content_type, method='GET'):
|
||||||
|
|
||||||
"""Test create request."""
|
"""Test create request."""
|
||||||
|
|
||||||
LOG.debug("test_create_request - START")
|
LOG.debug("test_create_request - START")
|
||||||
@ -87,7 +86,6 @@ class ExtensionsTestApp(wsgi.Router):
|
|||||||
return req
|
return req
|
||||||
|
|
||||||
def _create_network(self, name=None):
|
def _create_network(self, name=None):
|
||||||
|
|
||||||
"""Test create network."""
|
"""Test create network."""
|
||||||
|
|
||||||
LOG.debug("Creating network - START")
|
LOG.debug("Creating network - START")
|
||||||
@ -107,7 +105,6 @@ class ExtensionsTestApp(wsgi.Router):
|
|||||||
return network_data['network']['id']
|
return network_data['network']['id']
|
||||||
|
|
||||||
def _create_port(self, network_id, port_state):
|
def _create_port(self, network_id, port_state):
|
||||||
|
|
||||||
"""Test create port."""
|
"""Test create port."""
|
||||||
|
|
||||||
LOG.debug("Creating port for network %s - START", network_id)
|
LOG.debug("Creating port for network %s - START", network_id)
|
||||||
@ -153,7 +150,6 @@ class ExtensionsTestApp(wsgi.Router):
|
|||||||
class QosExtensionTest(base.BaseTestCase):
|
class QosExtensionTest(base.BaseTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
||||||
"""Set up function."""
|
"""Set up function."""
|
||||||
|
|
||||||
super(QosExtensionTest, self).setUp()
|
super(QosExtensionTest, self).setUp()
|
||||||
@ -180,7 +176,6 @@ class QosExtensionTest(base.BaseTestCase):
|
|||||||
self._l2network_plugin = l2network_plugin.L2Network()
|
self._l2network_plugin = l2network_plugin.L2Network()
|
||||||
|
|
||||||
def test_create_qos(self):
|
def test_create_qos(self):
|
||||||
|
|
||||||
"""Test create qos."""
|
"""Test create qos."""
|
||||||
|
|
||||||
LOG.debug("test_create_qos - START")
|
LOG.debug("test_create_qos - START")
|
||||||
@ -199,7 +194,6 @@ class QosExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_create_qos - END")
|
LOG.debug("test_create_qos - END")
|
||||||
|
|
||||||
def test_create_qosBADRequest(self):
|
def test_create_qosBADRequest(self):
|
||||||
|
|
||||||
"""Test create qos bad request."""
|
"""Test create qos bad request."""
|
||||||
|
|
||||||
LOG.debug("test_create_qosBADRequest - START")
|
LOG.debug("test_create_qosBADRequest - START")
|
||||||
@ -211,7 +205,6 @@ class QosExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_create_qosBADRequest - END")
|
LOG.debug("test_create_qosBADRequest - END")
|
||||||
|
|
||||||
def test_list_qoss(self):
|
def test_list_qoss(self):
|
||||||
|
|
||||||
"""Test list qoss."""
|
"""Test list qoss."""
|
||||||
|
|
||||||
LOG.debug("test_list_qoss - START")
|
LOG.debug("test_list_qoss - START")
|
||||||
@ -251,7 +244,6 @@ class QosExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_list_qoss - END")
|
LOG.debug("test_list_qoss - END")
|
||||||
|
|
||||||
def test_show_qos(self):
|
def test_show_qos(self):
|
||||||
|
|
||||||
"""Test show qos."""
|
"""Test show qos."""
|
||||||
|
|
||||||
LOG.debug("test_show_qos - START")
|
LOG.debug("test_show_qos - START")
|
||||||
@ -275,7 +267,6 @@ class QosExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_show_qos - END")
|
LOG.debug("test_show_qos - END")
|
||||||
|
|
||||||
def test_show_qosDNE(self, qos_id='100'):
|
def test_show_qosDNE(self, qos_id='100'):
|
||||||
|
|
||||||
"""Test show qos does not exist."""
|
"""Test show qos does not exist."""
|
||||||
|
|
||||||
LOG.debug("test_show_qosDNE - START")
|
LOG.debug("test_show_qosDNE - START")
|
||||||
@ -286,7 +277,6 @@ class QosExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_show_qosDNE - END")
|
LOG.debug("test_show_qosDNE - END")
|
||||||
|
|
||||||
def test_update_qos(self):
|
def test_update_qos(self):
|
||||||
|
|
||||||
"""Test update qos."""
|
"""Test update qos."""
|
||||||
|
|
||||||
LOG.debug("test_update_qos - START")
|
LOG.debug("test_update_qos - START")
|
||||||
@ -318,7 +308,6 @@ class QosExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_update_qos - END")
|
LOG.debug("test_update_qos - END")
|
||||||
|
|
||||||
def test_update_qosDNE(self, qos_id='100'):
|
def test_update_qosDNE(self, qos_id='100'):
|
||||||
|
|
||||||
"""Test update qos does not exist."""
|
"""Test update qos does not exist."""
|
||||||
|
|
||||||
LOG.debug("test_update_qosDNE - START")
|
LOG.debug("test_update_qosDNE - START")
|
||||||
@ -340,7 +329,6 @@ class QosExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_update_qosDNE - END")
|
LOG.debug("test_update_qosDNE - END")
|
||||||
|
|
||||||
def test_update_qosBADRequest(self):
|
def test_update_qosBADRequest(self):
|
||||||
|
|
||||||
"""Test update qos bad request."""
|
"""Test update qos bad request."""
|
||||||
|
|
||||||
LOG.debug("test_update_qosBADRequest - START")
|
LOG.debug("test_update_qosBADRequest - START")
|
||||||
@ -361,7 +349,6 @@ class QosExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_update_qosBADRequest - END")
|
LOG.debug("test_update_qosBADRequest - END")
|
||||||
|
|
||||||
def test_delete_qos(self):
|
def test_delete_qos(self):
|
||||||
|
|
||||||
"""Test delte qos."""
|
"""Test delte qos."""
|
||||||
|
|
||||||
LOG.debug("test_delete_qos - START")
|
LOG.debug("test_delete_qos - START")
|
||||||
@ -386,7 +373,6 @@ class QosExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_delete_qos - END")
|
LOG.debug("test_delete_qos - END")
|
||||||
|
|
||||||
def test_delete_qosDNE(self, qos_id='100'):
|
def test_delete_qosDNE(self, qos_id='100'):
|
||||||
|
|
||||||
"""Test delte qos does not exist."""
|
"""Test delte qos does not exist."""
|
||||||
|
|
||||||
LOG.debug("test_delete_qosDNE - START")
|
LOG.debug("test_delete_qosDNE - START")
|
||||||
@ -397,7 +383,6 @@ class QosExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_delete_qosDNE - END")
|
LOG.debug("test_delete_qosDNE - END")
|
||||||
|
|
||||||
def tearDownQos(self, delete_profile_path):
|
def tearDownQos(self, delete_profile_path):
|
||||||
|
|
||||||
"""Tear Down Qos."""
|
"""Tear Down Qos."""
|
||||||
|
|
||||||
self.test_app.delete(delete_profile_path)
|
self.test_app.delete(delete_profile_path)
|
||||||
@ -409,7 +394,6 @@ class QosExtensionTest(base.BaseTestCase):
|
|||||||
class CredentialExtensionTest(base.BaseTestCase):
|
class CredentialExtensionTest(base.BaseTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
||||||
"""Set up function."""
|
"""Set up function."""
|
||||||
|
|
||||||
super(CredentialExtensionTest, self).setUp()
|
super(CredentialExtensionTest, self).setUp()
|
||||||
@ -434,7 +418,6 @@ class CredentialExtensionTest(base.BaseTestCase):
|
|||||||
self._l2network_plugin = l2network_plugin.L2Network()
|
self._l2network_plugin = l2network_plugin.L2Network()
|
||||||
|
|
||||||
def test_list_credentials(self):
|
def test_list_credentials(self):
|
||||||
|
|
||||||
"""Test list credentials."""
|
"""Test list credentials."""
|
||||||
|
|
||||||
#Create Credential before listing
|
#Create Credential before listing
|
||||||
@ -479,7 +462,6 @@ class CredentialExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_list_credentials - END")
|
LOG.debug("test_list_credentials - END")
|
||||||
|
|
||||||
def test_create_credential(self):
|
def test_create_credential(self):
|
||||||
|
|
||||||
"""Test create credential."""
|
"""Test create credential."""
|
||||||
|
|
||||||
LOG.debug("test_create_credential - START")
|
LOG.debug("test_create_credential - START")
|
||||||
@ -498,7 +480,6 @@ class CredentialExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_create_credential - END")
|
LOG.debug("test_create_credential - END")
|
||||||
|
|
||||||
def test_create_credentialBADRequest(self):
|
def test_create_credentialBADRequest(self):
|
||||||
|
|
||||||
"""Test create credential bad request."""
|
"""Test create credential bad request."""
|
||||||
|
|
||||||
LOG.debug("test_create_credentialBADRequest - START")
|
LOG.debug("test_create_credentialBADRequest - START")
|
||||||
@ -509,7 +490,6 @@ class CredentialExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_create_credentialBADRequest - END")
|
LOG.debug("test_create_credentialBADRequest - END")
|
||||||
|
|
||||||
def test_show_credential(self):
|
def test_show_credential(self):
|
||||||
|
|
||||||
"""Test show credential."""
|
"""Test show credential."""
|
||||||
|
|
||||||
LOG.debug("test_show_credential - START")
|
LOG.debug("test_show_credential - START")
|
||||||
@ -534,7 +514,6 @@ class CredentialExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_show_credential - END")
|
LOG.debug("test_show_credential - END")
|
||||||
|
|
||||||
def test_show_credentialDNE(self, credential_id='100'):
|
def test_show_credentialDNE(self, credential_id='100'):
|
||||||
|
|
||||||
"""Test show credential does not exist."""
|
"""Test show credential does not exist."""
|
||||||
|
|
||||||
LOG.debug("test_show_credentialDNE - START")
|
LOG.debug("test_show_credentialDNE - START")
|
||||||
@ -545,7 +524,6 @@ class CredentialExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_show_credentialDNE - END")
|
LOG.debug("test_show_credentialDNE - END")
|
||||||
|
|
||||||
def test_update_credential(self):
|
def test_update_credential(self):
|
||||||
|
|
||||||
"""Test update credential."""
|
"""Test update credential."""
|
||||||
|
|
||||||
LOG.debug("test_update_credential - START")
|
LOG.debug("test_update_credential - START")
|
||||||
@ -581,7 +559,6 @@ class CredentialExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_update_credential - END")
|
LOG.debug("test_update_credential - END")
|
||||||
|
|
||||||
def test_update_credBADReq(self):
|
def test_update_credBADReq(self):
|
||||||
|
|
||||||
"""Test update credential bad request."""
|
"""Test update credential bad request."""
|
||||||
|
|
||||||
LOG.debug("test_update_credBADReq - START")
|
LOG.debug("test_update_credBADReq - START")
|
||||||
@ -600,7 +577,6 @@ class CredentialExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_update_credBADReq - END")
|
LOG.debug("test_update_credBADReq - END")
|
||||||
|
|
||||||
def test_update_credentialDNE(self, credential_id='100'):
|
def test_update_credentialDNE(self, credential_id='100'):
|
||||||
|
|
||||||
"""Test update credential does not exist."""
|
"""Test update credential does not exist."""
|
||||||
|
|
||||||
LOG.debug("test_update_credentialDNE - START")
|
LOG.debug("test_update_credentialDNE - START")
|
||||||
@ -620,7 +596,6 @@ class CredentialExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_update_credentialDNE - END")
|
LOG.debug("test_update_credentialDNE - END")
|
||||||
|
|
||||||
def test_delete_credential(self):
|
def test_delete_credential(self):
|
||||||
|
|
||||||
"""Test delete credential."""
|
"""Test delete credential."""
|
||||||
|
|
||||||
LOG.debug("test_delete_credential - START")
|
LOG.debug("test_delete_credential - START")
|
||||||
@ -638,7 +613,6 @@ class CredentialExtensionTest(base.BaseTestCase):
|
|||||||
LOG.debug("test_delete_credential - END")
|
LOG.debug("test_delete_credential - END")
|
||||||
|
|
||||||
def test_delete_credentialDNE(self, credential_id='100'):
|
def test_delete_credentialDNE(self, credential_id='100'):
|
||||||
|
|
||||||
"""Test delete credential does not exist."""
|
"""Test delete credential does not exist."""
|
||||||
|
|
||||||
LOG.debug("test_delete_credentialDNE - START")
|
LOG.debug("test_delete_credentialDNE - START")
|
||||||
|
@ -32,8 +32,9 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class NexusDB(object):
|
class NexusDB(object):
|
||||||
"""Class consisting of methods to call nexus db methods."""
|
"""Class consisting of methods to call nexus db methods."""
|
||||||
|
|
||||||
def get_all_nexusportbindings(self):
|
def get_all_nexusportbindings(self):
|
||||||
"""get all nexus port bindings."""
|
"""Get all nexus port bindings."""
|
||||||
bindings = []
|
bindings = []
|
||||||
try:
|
try:
|
||||||
for bind in nexus_db.get_all_nexusport_bindings():
|
for bind in nexus_db.get_all_nexusport_bindings():
|
||||||
@ -47,7 +48,7 @@ class NexusDB(object):
|
|||||||
return bindings
|
return bindings
|
||||||
|
|
||||||
def get_nexusportbinding(self, vlan_id):
|
def get_nexusportbinding(self, vlan_id):
|
||||||
"""get nexus port binding."""
|
"""Get nexus port binding."""
|
||||||
binding = []
|
binding = []
|
||||||
try:
|
try:
|
||||||
for bind in nexus_db.get_nexusport_binding(vlan_id):
|
for bind in nexus_db.get_nexusport_binding(vlan_id):
|
||||||
@ -61,7 +62,7 @@ class NexusDB(object):
|
|||||||
return binding
|
return binding
|
||||||
|
|
||||||
def create_nexusportbinding(self, port_id, vlan_id):
|
def create_nexusportbinding(self, port_id, vlan_id):
|
||||||
"""create nexus port binding."""
|
"""Create nexus port binding."""
|
||||||
bind_dict = {}
|
bind_dict = {}
|
||||||
try:
|
try:
|
||||||
res = nexus_db.add_nexusport_binding(port_id, vlan_id)
|
res = nexus_db.add_nexusport_binding(port_id, vlan_id)
|
||||||
@ -73,7 +74,7 @@ class NexusDB(object):
|
|||||||
LOG.error("Failed to create nexus binding: %s" % str(exc))
|
LOG.error("Failed to create nexus binding: %s" % str(exc))
|
||||||
|
|
||||||
def delete_nexusportbinding(self, vlan_id):
|
def delete_nexusportbinding(self, vlan_id):
|
||||||
"""delete nexus port binding."""
|
"""Delete nexus port binding."""
|
||||||
bindings = []
|
bindings = []
|
||||||
try:
|
try:
|
||||||
bind = nexus_db.remove_nexusport_binding(vlan_id)
|
bind = nexus_db.remove_nexusport_binding(vlan_id)
|
||||||
@ -88,7 +89,7 @@ class NexusDB(object):
|
|||||||
% str(exc))
|
% str(exc))
|
||||||
|
|
||||||
def update_nexusport_binding(self, port_id, new_vlan_id):
|
def update_nexusport_binding(self, port_id, new_vlan_id):
|
||||||
"""update nexus port binding."""
|
"""Update nexus port binding."""
|
||||||
try:
|
try:
|
||||||
res = nexus_db.update_nexusport_binding(port_id, new_vlan_id)
|
res = nexus_db.update_nexusport_binding(port_id, new_vlan_id)
|
||||||
LOG.debug("Updating nexus port binding : %s" % res.port_id)
|
LOG.debug("Updating nexus port binding : %s" % res.port_id)
|
||||||
@ -354,13 +355,13 @@ class NexusDBTest(base.BaseTestCase):
|
|||||||
LOG.debug("Setup")
|
LOG.debug("Setup")
|
||||||
|
|
||||||
def testa_create_nexusportbinding(self):
|
def testa_create_nexusportbinding(self):
|
||||||
"""create nexus port binding."""
|
"""Create nexus port binding."""
|
||||||
binding1 = self.dbtest.create_nexusportbinding("port1", 10)
|
binding1 = self.dbtest.create_nexusportbinding("port1", 10)
|
||||||
self.assertTrue(binding1["port-id"] == "port1")
|
self.assertTrue(binding1["port-id"] == "port1")
|
||||||
self.tearDown_nexusportbinding()
|
self.tearDown_nexusportbinding()
|
||||||
|
|
||||||
def testb_getall_nexusportbindings(self):
|
def testb_getall_nexusportbindings(self):
|
||||||
"""get all nexus port binding."""
|
"""Get all nexus port bindings."""
|
||||||
self.dbtest.create_nexusportbinding("port1", 10)
|
self.dbtest.create_nexusportbinding("port1", 10)
|
||||||
self.dbtest.create_nexusportbinding("port2", 10)
|
self.dbtest.create_nexusportbinding("port2", 10)
|
||||||
bindings = self.dbtest.get_all_nexusportbindings()
|
bindings = self.dbtest.get_all_nexusportbindings()
|
||||||
@ -372,7 +373,7 @@ class NexusDBTest(base.BaseTestCase):
|
|||||||
self.tearDown_nexusportbinding()
|
self.tearDown_nexusportbinding()
|
||||||
|
|
||||||
def testc_delete_nexusportbinding(self):
|
def testc_delete_nexusportbinding(self):
|
||||||
"""delete nexus port binding."""
|
"""Delete nexus port binding."""
|
||||||
self.dbtest.create_nexusportbinding("port1", 10)
|
self.dbtest.create_nexusportbinding("port1", 10)
|
||||||
self.dbtest.delete_nexusportbinding(10)
|
self.dbtest.delete_nexusportbinding(10)
|
||||||
bindings = self.dbtest.get_all_nexusportbindings()
|
bindings = self.dbtest.get_all_nexusportbindings()
|
||||||
@ -384,7 +385,7 @@ class NexusDBTest(base.BaseTestCase):
|
|||||||
self.tearDown_nexusportbinding()
|
self.tearDown_nexusportbinding()
|
||||||
|
|
||||||
def testd_update_nexusportbinding(self):
|
def testd_update_nexusportbinding(self):
|
||||||
"""update nexus port binding."""
|
"""Update nexus port binding."""
|
||||||
binding1 = self.dbtest.create_nexusportbinding("port1", 10)
|
binding1 = self.dbtest.create_nexusportbinding("port1", 10)
|
||||||
binding1 = self.dbtest.update_nexusport_binding(binding1["port-id"],
|
binding1 = self.dbtest.update_nexusport_binding(binding1["port-id"],
|
||||||
20)
|
20)
|
||||||
@ -397,7 +398,7 @@ class NexusDBTest(base.BaseTestCase):
|
|||||||
self.tearDown_nexusportbinding()
|
self.tearDown_nexusportbinding()
|
||||||
|
|
||||||
def tearDown_nexusportbinding(self):
|
def tearDown_nexusportbinding(self):
|
||||||
"""tear down nexusport binding table."""
|
"""Tear down nexus port binding table."""
|
||||||
LOG.debug("Tearing Down Nexus port Bindings")
|
LOG.debug("Tearing Down Nexus port Bindings")
|
||||||
binds = self.dbtest.get_all_nexusportbindings()
|
binds = self.dbtest.get_all_nexusportbindings()
|
||||||
for bind in binds:
|
for bind in binds:
|
||||||
@ -417,7 +418,7 @@ class L2networkDBTest(base.BaseTestCase):
|
|||||||
LOG.debug("Setup")
|
LOG.debug("Setup")
|
||||||
|
|
||||||
def testa_create_vlanbinding(self):
|
def testa_create_vlanbinding(self):
|
||||||
"""test add vlan binding."""
|
"""Test add vlan binding."""
|
||||||
net1 = self.quantum.create_network("t1", "netid1")
|
net1 = self.quantum.create_network("t1", "netid1")
|
||||||
vlan1 = self.dbtest.create_vlan_binding(10, "vlan1", net1["net-id"])
|
vlan1 = self.dbtest.create_vlan_binding(10, "vlan1", net1["net-id"])
|
||||||
self.assertTrue(vlan1["vlan-id"] == "10")
|
self.assertTrue(vlan1["vlan-id"] == "10")
|
||||||
@ -425,7 +426,7 @@ class L2networkDBTest(base.BaseTestCase):
|
|||||||
self.teardown_network()
|
self.teardown_network()
|
||||||
|
|
||||||
def testb_getall_vlanbindings(self):
|
def testb_getall_vlanbindings(self):
|
||||||
"""test get all vlan binding."""
|
"""Test get all vlan bindings."""
|
||||||
net1 = self.quantum.create_network("t1", "netid1")
|
net1 = self.quantum.create_network("t1", "netid1")
|
||||||
net2 = self.quantum.create_network("t1", "netid2")
|
net2 = self.quantum.create_network("t1", "netid2")
|
||||||
vlan1 = self.dbtest.create_vlan_binding(10, "vlan1", net1["net-id"])
|
vlan1 = self.dbtest.create_vlan_binding(10, "vlan1", net1["net-id"])
|
||||||
@ -442,7 +443,7 @@ class L2networkDBTest(base.BaseTestCase):
|
|||||||
self.teardown_network()
|
self.teardown_network()
|
||||||
|
|
||||||
def testc_delete_vlanbinding(self):
|
def testc_delete_vlanbinding(self):
|
||||||
"""test delete vlan binding."""
|
"""Test delete vlan binding."""
|
||||||
net1 = self.quantum.create_network("t1", "netid1")
|
net1 = self.quantum.create_network("t1", "netid1")
|
||||||
vlan1 = self.dbtest.create_vlan_binding(10, "vlan1", net1["net-id"])
|
vlan1 = self.dbtest.create_vlan_binding(10, "vlan1", net1["net-id"])
|
||||||
self.assertTrue(vlan1["vlan-id"] == "10")
|
self.assertTrue(vlan1["vlan-id"] == "10")
|
||||||
@ -457,7 +458,7 @@ class L2networkDBTest(base.BaseTestCase):
|
|||||||
self.teardown_network()
|
self.teardown_network()
|
||||||
|
|
||||||
def testd_update_vlanbinding(self):
|
def testd_update_vlanbinding(self):
|
||||||
"""test update vlan binding."""
|
"""Test update vlan binding."""
|
||||||
net1 = self.quantum.create_network("t1", "netid1")
|
net1 = self.quantum.create_network("t1", "netid1")
|
||||||
vlan1 = self.dbtest.create_vlan_binding(10, "vlan1", net1["net-id"])
|
vlan1 = self.dbtest.create_vlan_binding(10, "vlan1", net1["net-id"])
|
||||||
self.assertTrue(vlan1["vlan-id"] == "10")
|
self.assertTrue(vlan1["vlan-id"] == "10")
|
||||||
@ -472,7 +473,7 @@ class L2networkDBTest(base.BaseTestCase):
|
|||||||
self.teardown_network()
|
self.teardown_network()
|
||||||
|
|
||||||
def testm_test_vlanids(self):
|
def testm_test_vlanids(self):
|
||||||
"""test vlanid methods."""
|
"""Test vlanid methods."""
|
||||||
l2network_db.create_vlanids()
|
l2network_db.create_vlanids()
|
||||||
vlanids = l2network_db.get_all_vlanids()
|
vlanids = l2network_db.get_all_vlanids()
|
||||||
self.assertTrue(len(vlanids) > 0)
|
self.assertTrue(len(vlanids) > 0)
|
||||||
@ -523,13 +524,13 @@ class QuantumDBTest(base.BaseTestCase):
|
|||||||
LOG.debug("Setup")
|
LOG.debug("Setup")
|
||||||
|
|
||||||
def testa_create_network(self):
|
def testa_create_network(self):
|
||||||
"""test to create network."""
|
"""Test to create network."""
|
||||||
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
||||||
self.assertTrue(net1["net-name"] == "plugin_test1")
|
self.assertTrue(net1["net-name"] == "plugin_test1")
|
||||||
self.teardown_network_port()
|
self.teardown_network_port()
|
||||||
|
|
||||||
def testb_get_networks(self):
|
def testb_get_networks(self):
|
||||||
"""test to get all networks."""
|
"""Test to get all networks."""
|
||||||
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
||||||
self.assertTrue(net1["net-name"] == "plugin_test1")
|
self.assertTrue(net1["net-name"] == "plugin_test1")
|
||||||
net2 = self.dbtest.create_network(self.tenant_id, "plugin_test2")
|
net2 = self.dbtest.create_network(self.tenant_id, "plugin_test2")
|
||||||
@ -543,7 +544,7 @@ class QuantumDBTest(base.BaseTestCase):
|
|||||||
self.teardown_network_port()
|
self.teardown_network_port()
|
||||||
|
|
||||||
def testc_delete_network(self):
|
def testc_delete_network(self):
|
||||||
"""test to delete network."""
|
"""Test to delete network."""
|
||||||
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
||||||
self.assertTrue(net1["net-name"] == "plugin_test1")
|
self.assertTrue(net1["net-name"] == "plugin_test1")
|
||||||
self.dbtest.delete_network(net1["net-id"])
|
self.dbtest.delete_network(net1["net-id"])
|
||||||
@ -556,7 +557,7 @@ class QuantumDBTest(base.BaseTestCase):
|
|||||||
self.teardown_network_port()
|
self.teardown_network_port()
|
||||||
|
|
||||||
def testd_update_network(self):
|
def testd_update_network(self):
|
||||||
"""test to update (rename) network."""
|
"""Test to update (rename) network."""
|
||||||
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
||||||
self.assertTrue(net1["net-name"] == "plugin_test1")
|
self.assertTrue(net1["net-name"] == "plugin_test1")
|
||||||
net = self.dbtest.update_network(self.tenant_id, net1["net-id"],
|
net = self.dbtest.update_network(self.tenant_id, net1["net-id"],
|
||||||
@ -565,7 +566,7 @@ class QuantumDBTest(base.BaseTestCase):
|
|||||||
self.teardown_network_port()
|
self.teardown_network_port()
|
||||||
|
|
||||||
def teste_create_port(self):
|
def teste_create_port(self):
|
||||||
"""test to create port."""
|
"""Test to create port."""
|
||||||
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
||||||
port = self.dbtest.create_port(net1["net-id"])
|
port = self.dbtest.create_port(net1["net-id"])
|
||||||
self.assertTrue(port["net-id"] == net1["net-id"])
|
self.assertTrue(port["net-id"] == net1["net-id"])
|
||||||
@ -577,7 +578,7 @@ class QuantumDBTest(base.BaseTestCase):
|
|||||||
self.teardown_network_port()
|
self.teardown_network_port()
|
||||||
|
|
||||||
def testf_delete_port(self):
|
def testf_delete_port(self):
|
||||||
"""test to delete port."""
|
"""Test to delete port."""
|
||||||
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
||||||
port = self.dbtest.create_port(net1["net-id"])
|
port = self.dbtest.create_port(net1["net-id"])
|
||||||
self.assertTrue(port["net-id"] == net1["net-id"])
|
self.assertTrue(port["net-id"] == net1["net-id"])
|
||||||
@ -596,7 +597,7 @@ class QuantumDBTest(base.BaseTestCase):
|
|||||||
self.teardown_network_port()
|
self.teardown_network_port()
|
||||||
|
|
||||||
def testg_plug_unplug_interface(self):
|
def testg_plug_unplug_interface(self):
|
||||||
"""test to plug/unplug interface."""
|
"""Test to plug/unplug interface."""
|
||||||
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
net1 = self.dbtest.create_network(self.tenant_id, "plugin_test1")
|
||||||
port1 = self.dbtest.create_port(net1["net-id"])
|
port1 = self.dbtest.create_port(net1["net-id"])
|
||||||
self.dbtest.plug_interface(net1["net-id"], port1["port-id"], "vif1.1")
|
self.dbtest.plug_interface(net1["net-id"], port1["port-id"], "vif1.1")
|
||||||
@ -608,7 +609,7 @@ class QuantumDBTest(base.BaseTestCase):
|
|||||||
self.teardown_network_port()
|
self.teardown_network_port()
|
||||||
|
|
||||||
def testh_joined_test(self):
|
def testh_joined_test(self):
|
||||||
"""test to get network and port."""
|
"""Test to get network and port."""
|
||||||
net1 = self.dbtest.create_network("t1", "net1")
|
net1 = self.dbtest.create_network("t1", "net1")
|
||||||
port1 = self.dbtest.create_port(net1["net-id"])
|
port1 = self.dbtest.create_port(net1["net-id"])
|
||||||
self.assertTrue(port1["net-id"] == net1["net-id"])
|
self.assertTrue(port1["net-id"] == net1["net-id"])
|
||||||
|
@ -19,95 +19,87 @@
|
|||||||
|
|
||||||
|
|
||||||
class CiscoNEXUSFakeDriver():
|
class CiscoNEXUSFakeDriver():
|
||||||
"""
|
"""Nexus Driver Fake Class."""
|
||||||
Nexus Driver Fake Class
|
|
||||||
"""
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def nxos_connect(self, nexus_host, nexus_ssh_port, nexus_user,
|
def nxos_connect(self, nexus_host, nexus_ssh_port, nexus_user,
|
||||||
nexus_password):
|
nexus_password):
|
||||||
"""
|
"""Make the fake connection to the Nexus Switch."""
|
||||||
Makes the fake connection to the Nexus Switch
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def create_xml_snippet(self, cutomized_config):
|
def create_xml_snippet(self, cutomized_config):
|
||||||
"""
|
"""Create XML snippet.
|
||||||
Creates the Proper XML structure for the Nexus Switch Configuration
|
|
||||||
|
Creates the Proper XML structure for the Nexus Switch
|
||||||
|
Configuration.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def enable_vlan(self, mgr, vlanid, vlanname):
|
def enable_vlan(self, mgr, vlanid, vlanname):
|
||||||
"""
|
"""Create a VLAN on Nexus Switch given the VLAN ID and Name."""
|
||||||
Creates a VLAN on Nexus Switch given the VLAN ID and Name
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def disable_vlan(self, mgr, vlanid):
|
def disable_vlan(self, mgr, vlanid):
|
||||||
"""
|
"""Delete a VLAN on Nexus Switch given the VLAN ID."""
|
||||||
Delete a VLAN on Nexus Switch given the VLAN ID
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def enable_port_trunk(self, mgr, interface):
|
def enable_port_trunk(self, mgr, interface):
|
||||||
"""
|
"""Enable trunk mode an interface on Nexus Switch."""
|
||||||
Enables trunk mode an interface on Nexus Switch
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def disable_switch_port(self, mgr, interface):
|
def disable_switch_port(self, mgr, interface):
|
||||||
"""
|
"""Disable trunk mode an interface on Nexus Switch."""
|
||||||
Disables trunk mode an interface on Nexus Switch
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def enable_vlan_on_trunk_int(self, mgr, interface, vlanid):
|
def enable_vlan_on_trunk_int(self, mgr, interface, vlanid):
|
||||||
"""
|
"""Enable vlan on trunk interface.
|
||||||
Enables trunk mode vlan access an interface on Nexus Switch given
|
|
||||||
VLANID
|
Enable trunk mode vlan access an interface on Nexus Switch given
|
||||||
|
VLANID.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def disable_vlan_on_trunk_int(self, mgr, interface, vlanid):
|
def disable_vlan_on_trunk_int(self, mgr, interface, vlanid):
|
||||||
"""
|
"""Disables vlan in trunk interface.
|
||||||
|
|
||||||
Enables trunk mode vlan access an interface on Nexus Switch given
|
Enables trunk mode vlan access an interface on Nexus Switch given
|
||||||
VLANID
|
VLANID.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def create_vlan(self, vlan_name, vlan_id, nexus_host, nexus_user,
|
def create_vlan(self, vlan_name, vlan_id, nexus_host, nexus_user,
|
||||||
nexus_password, nexus_ports, nexus_ssh_port, vlan_ids):
|
nexus_password, nexus_ports, nexus_ssh_port, vlan_ids):
|
||||||
"""
|
"""Create VLAN and enable it on interface.
|
||||||
|
|
||||||
Creates a VLAN and Enable on trunk mode an interface on Nexus Switch
|
Creates a VLAN and Enable on trunk mode an interface on Nexus Switch
|
||||||
given the VLAN ID and Name and Interface Number
|
given the VLAN ID and Name and Interface Number.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def delete_vlan(self, vlan_id, nexus_host, nexus_user, nexus_password,
|
def delete_vlan(self, vlan_id, nexus_host, nexus_user, nexus_password,
|
||||||
nexus_ports, nexus_ssh_port):
|
nexus_ports, nexus_ssh_port):
|
||||||
"""
|
"""Delete VLAN.
|
||||||
|
|
||||||
Delete a VLAN and Disables trunk mode an interface on Nexus Switch
|
Delete a VLAN and Disables trunk mode an interface on Nexus Switch
|
||||||
given the VLAN ID and Interface Number
|
given the VLAN ID and Interface Number.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def build_vlans_cmd(self):
|
def build_vlans_cmd(self):
|
||||||
"""
|
"""Build a string with all the VLANs on the same Switch."""
|
||||||
Builds a string with all the VLANs on the same Switch
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def add_vlan_int(self, vlan_id, nexus_host, nexus_user, nexus_password,
|
def add_vlan_int(self, vlan_id, nexus_host, nexus_user, nexus_password,
|
||||||
nexus_ports, nexus_ssh_port, vlan_ids=None):
|
nexus_ports, nexus_ssh_port, vlan_ids=None):
|
||||||
"""
|
"""Add a vlan from interfaces on the Nexus switch given the VLAN ID."""
|
||||||
Adds a vlan from interfaces on the Nexus switch given the VLAN ID
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def remove_vlan_int(self, vlan_id, nexus_host, nexus_user, nexus_password,
|
def remove_vlan_int(self, vlan_id, nexus_host, nexus_user, nexus_password,
|
||||||
nexus_ports, nexus_ssh_port):
|
nexus_ports, nexus_ssh_port):
|
||||||
"""
|
"""Remove vlan from interfaces.
|
||||||
Removes a vlan from interfaces on the Nexus switch given the VLAN ID
|
|
||||||
|
Removes a vlan from interfaces on the Nexus switch given the VLAN ID.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user