Bug #1013967 - Quantum is breaking on tests with pep 1.3
Fixing files 93/93 files fixed Change-Id: Ia30f2e2253806fa5f447d44208d13d2c0beba9cd
This commit is contained in:
parent
7b9a0b7147
commit
2fcb3ecacf
|
@ -87,8 +87,8 @@ class OVSBridge:
|
|||
is_delete_expr = kwargs.get('delete', False)
|
||||
print "kwargs = %s" % kwargs
|
||||
if not is_delete_expr:
|
||||
prefix = ("hard_timeout=%s,idle_timeout=%s,priority=%s"
|
||||
% (kwargs.get('hard_timeout', '0'),
|
||||
prefix = ("hard_timeout=%s,idle_timeout=%s,priority=%s" %
|
||||
(kwargs.get('hard_timeout', '0'),
|
||||
kwargs.get('idle_timeout', '0'),
|
||||
kwargs.get('priority', '1')))
|
||||
flow_expr_arr.append(prefix)
|
||||
|
|
|
@ -158,9 +158,9 @@ class Controller(object):
|
|||
if self._resource not in ['network', 'port']:
|
||||
return
|
||||
|
||||
if ('tenant_id' in res_dict and
|
||||
if (('tenant_id' in res_dict and
|
||||
res_dict['tenant_id'] != context.tenant_id and
|
||||
not context.is_admin):
|
||||
not context.is_admin)):
|
||||
msg = _("Specifying 'tenant_id' other than authenticated"
|
||||
"tenant in request requires admin privileges")
|
||||
raise webob.exc.HTTPBadRequest(msg)
|
||||
|
@ -242,13 +242,11 @@ def create_resource(collection, resource, plugin, conf, params):
|
|||
|
||||
# NOTE(jkoelker) To anyone wishing to add "proper" xml support
|
||||
# this is where you do it
|
||||
serializers = {
|
||||
serializers = {}
|
||||
# 'application/xml': wsgi.XMLDictSerializer(metadata, XML_NS_V20),
|
||||
}
|
||||
|
||||
deserializers = {
|
||||
deserializers = {}
|
||||
# 'application/xml': wsgi.XMLDeserializer(metadata),
|
||||
}
|
||||
|
||||
return wsgi_resource.Resource(controller, FAULT_MAP, deserializers,
|
||||
serializers)
|
||||
|
|
|
@ -95,13 +95,9 @@ class Index(wsgi.Application):
|
|||
|
||||
@webob.dec.wsgify(RequestClass=wsgi.Request)
|
||||
def __call__(self, req):
|
||||
metadata = {'application/xml': {
|
||||
'attributes': {
|
||||
metadata = {'application/xml': {'attributes': {
|
||||
'resource': ['name', 'collection'],
|
||||
'link': ['href', 'rel'],
|
||||
}
|
||||
}
|
||||
}
|
||||
'link': ['href', 'rel']}}}
|
||||
|
||||
layout = []
|
||||
for name, collection in self.resources.iteritems():
|
||||
|
|
|
@ -65,8 +65,8 @@ class Versions(object):
|
|||
}
|
||||
|
||||
content_type = req.best_match_content_type()
|
||||
body = wsgi.Serializer(metadata=metadata). \
|
||||
serialize(response, content_type)
|
||||
body = (wsgi.Serializer(metadata=metadata).
|
||||
serialize(response, content_type))
|
||||
|
||||
response = webob.Response()
|
||||
response.content_type = content_type
|
||||
|
|
|
@ -150,8 +150,7 @@ def filter_ports(ports, plugin, tenant_id, network_id, filter_opts):
|
|||
'attachment': _filter_port_by_interface}
|
||||
# port details are need for filtering
|
||||
ports = [plugin.get_port_details(tenant_id, network_id,
|
||||
port['port-id'])
|
||||
for port in ports]
|
||||
port['port-id']) for port in ports]
|
||||
# filter ports
|
||||
return _do_filtering(ports,
|
||||
filters,
|
||||
|
|
|
@ -53,7 +53,8 @@ class ViewBuilder11(ViewBuilder10):
|
|||
if port_details:
|
||||
port['port']['state'] = port_data['port-state']
|
||||
port['port']['op-status'] = port_data.get('port-op-status',
|
||||
OperationalStatus.UNKNOWN)
|
||||
OperationalStatus.
|
||||
UNKNOWN)
|
||||
if att_details and port_data['attachment']:
|
||||
port['port']['attachment'] = dict(id=port_data['attachment'])
|
||||
return port
|
||||
|
|
|
@ -237,10 +237,9 @@ def find_config_file(options, args, config_file='quantum.conf'):
|
|||
'/etc']
|
||||
|
||||
if 'plugin' in options:
|
||||
config_file_dirs = [
|
||||
os.path.join(x, 'quantum', 'plugins', options['plugin'])
|
||||
for x in config_file_dirs
|
||||
]
|
||||
config_file_dirs = [os.path.join(x, 'quantum',
|
||||
'plugins', options['plugin'])
|
||||
for x in config_file_dirs]
|
||||
|
||||
if os.path.exists(os.path.join(root, 'plugins')):
|
||||
plugins = [fix_path(os.path.join(root, 'plugins', p, 'etc'))
|
||||
|
|
|
@ -99,9 +99,9 @@ class _Win32Colorizer(object):
|
|||
See _AnsiColorizer docstring.
|
||||
"""
|
||||
def __init__(self, stream):
|
||||
from win32console import GetStdHandle, STD_OUT_HANDLE, \
|
||||
FOREGROUND_RED, FOREGROUND_BLUE, FOREGROUND_GREEN, \
|
||||
FOREGROUND_INTENSITY
|
||||
from win32console import GetStdHandle, STD_OUT_HANDLE
|
||||
from win32console import FOREGROUND_RED, FOREGROUND_BLUE
|
||||
from win32console import FOREGROUND_GREEN, FOREGROUND_INTENSITY
|
||||
red, green, blue, bold = (FOREGROUND_RED, FOREGROUND_GREEN,
|
||||
FOREGROUND_BLUE, FOREGROUND_INTENSITY)
|
||||
self.stream = stream
|
||||
|
|
|
@ -91,7 +91,8 @@ def execute(cmd, process_input=None, addl_env=None, check_exit_code=True):
|
|||
if addl_env:
|
||||
env.update(addl_env)
|
||||
obj = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
env=env)
|
||||
result = None
|
||||
if process_input is not None:
|
||||
result = obj.communicate(process_input)
|
||||
|
|
|
@ -42,8 +42,8 @@ class Context(object):
|
|||
*only* deleted records are visible.
|
||||
"""
|
||||
if kwargs:
|
||||
LOG.warn(_('Arguments dropped when creating context: %s') %
|
||||
str(kwargs))
|
||||
LOG.warn(_('Arguments dropped when creating '
|
||||
'context: %s') % str(kwargs))
|
||||
|
||||
self.user_id = user_id
|
||||
self.tenant_id = tenant_id
|
||||
|
|
|
@ -73,5 +73,5 @@ class Network(model_base.BASE):
|
|||
self.op_status = op_status
|
||||
|
||||
def __repr__(self):
|
||||
return "<Network(%s,%s,%s,%s)>" % \
|
||||
(self.uuid, self.name, self.op_status, self.tenant_id)
|
||||
return "<Network(%s,%s,%s,%s)>" % (self.uuid, self.name,
|
||||
self.op_status, self.tenant_id)
|
||||
|
|
|
@ -52,12 +52,10 @@ class ViewBuilder(object):
|
|||
return dict(portprofile=dict(
|
||||
id=portprofile_data['profile_id'],
|
||||
name=portprofile_data['profile_name'],
|
||||
qos_name=portprofile_data['qos_name'],
|
||||
))
|
||||
qos_name=portprofile_data['qos_name']))
|
||||
else:
|
||||
return dict(portprofile=dict(
|
||||
id=portprofile_data['profile_id'],
|
||||
name=portprofile_data['profile_name'],
|
||||
qos_name=portprofile_data['qos_name'],
|
||||
assignment=portprofile_data['assignment'],
|
||||
))
|
||||
assignment=portprofile_data['assignment']))
|
||||
|
|
|
@ -459,8 +459,8 @@ class ExtensionManager(object):
|
|||
LOG.warn(_('Loaded extension: %s'), alias)
|
||||
|
||||
if alias in self.extensions:
|
||||
raise exceptions.Error("Found duplicate extension: %s"
|
||||
% alias)
|
||||
raise exceptions.Error("Found duplicate extension: %s" %
|
||||
alias)
|
||||
self.extensions[alias] = ext
|
||||
|
||||
|
||||
|
|
|
@ -85,13 +85,15 @@ class PortprofilesController(common.QuantumController, wsgi.Controller):
|
|||
'param-name': 'qos_name',
|
||||
'required': True}, {
|
||||
'param-name': 'assignment',
|
||||
'required': False}]
|
||||
'required': False}
|
||||
]
|
||||
|
||||
self._assignprofile_ops_param_list = [{
|
||||
'param-name': 'network-id',
|
||||
'required': True}, {
|
||||
'param-name': 'port-id',
|
||||
'required': True}]
|
||||
'required': True}
|
||||
]
|
||||
|
||||
self._serialization_metadata = {
|
||||
"application/xml": {
|
||||
|
@ -117,8 +119,7 @@ class PortprofilesController(common.QuantumController, wsgi.Controller):
|
|||
def show(self, request, tenant_id, id):
|
||||
""" Returns portprofile details for the given portprofile id """
|
||||
try:
|
||||
portprofile = self._plugin.get_portprofile_details(
|
||||
tenant_id, id)
|
||||
portprofile = self._plugin.get_portprofile_details(tenant_id, id)
|
||||
builder = pprofiles_view.get_view_builder(request)
|
||||
#build response with details
|
||||
result = builder.build(portprofile, True)
|
||||
|
@ -137,8 +138,8 @@ class PortprofilesController(common.QuantumController, wsgi.Controller):
|
|||
req_params = req_body[self._resource_name]
|
||||
except exc.HTTPError as exp:
|
||||
return faults.Fault(exp)
|
||||
portprofile = self._plugin.\
|
||||
create_portprofile(tenant_id,
|
||||
portprofile = \
|
||||
self._plugin.create_portprofile(tenant_id,
|
||||
req_params['portprofile_name'],
|
||||
req_params['qos_name'])
|
||||
builder = pprofiles_view.get_view_builder(request)
|
||||
|
@ -156,9 +157,9 @@ class PortprofilesController(common.QuantumController, wsgi.Controller):
|
|||
except exc.HTTPError as exp:
|
||||
return faults.Fault(exp)
|
||||
try:
|
||||
portprofile = self._plugin.\
|
||||
rename_portprofile(tenant_id,
|
||||
id, req_params['portprofile_name'])
|
||||
portprofile = \
|
||||
self._plugin.rename_portprofile(tenant_id, id,
|
||||
req_params['portprofile_name'])
|
||||
|
||||
builder = pprofiles_view.get_view_builder(request)
|
||||
result = builder.build(portprofile, True)
|
||||
|
@ -212,8 +213,7 @@ class PortprofilesController(common.QuantumController, wsgi.Controller):
|
|||
net_id = req_params['network-id'].strip()
|
||||
port_id = req_params['port-id'].strip()
|
||||
try:
|
||||
self._plugin. \
|
||||
disassociate_portprofile(tenant_id,
|
||||
self._plugin.disassociate_portprofile(tenant_id,
|
||||
net_id, port_id, id)
|
||||
return exc.HTTPOk()
|
||||
except exception.PortProfileNotFound as exp:
|
||||
|
|
|
@ -69,9 +69,9 @@ class StatsController(wsgi.Controller):
|
|||
"application/xml": {
|
||||
"attributes": {
|
||||
"stats": ["rx_bytes", "rx_packets", "rx_errors",
|
||||
"tx_bytes", "tx_packets", "tx_errors"],
|
||||
},
|
||||
},
|
||||
"tx_bytes", "tx_packets", "tx_errors"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def __init__(self, plugin):
|
||||
|
|
|
@ -575,11 +575,9 @@ class Opt(object):
|
|||
dest = self.dest
|
||||
if group is not None:
|
||||
dest = group.name + '_' + dest
|
||||
kwargs.update({
|
||||
'dest': dest,
|
||||
kwargs.update({'dest': dest,
|
||||
'metavar': self.metavar,
|
||||
'help': self.help,
|
||||
})
|
||||
'help': self.help})
|
||||
return kwargs
|
||||
|
||||
def _get_optparse_prefix(self, prefix, group):
|
||||
|
@ -899,7 +897,7 @@ class ConfigOpts(collections.Mapping):
|
|||
'files can be specified, with values in later '
|
||||
'files taking precedence. The default files '
|
||||
' used are: %s' %
|
||||
(self.default_config_files, )),
|
||||
(self.default_config_files)),
|
||||
StrOpt('config-dir',
|
||||
metavar='DIR',
|
||||
help='Path to a config directory to pull *.conf '
|
||||
|
@ -1352,8 +1350,7 @@ class ConfigOpts(collections.Mapping):
|
|||
default, opt, override = [info[k] for k in sorted(info.keys())]
|
||||
|
||||
if opt.required:
|
||||
if (default is not None or
|
||||
override is not None):
|
||||
if (default is not None or override is not None):
|
||||
continue
|
||||
|
||||
if self._get(opt.name, group) is None:
|
||||
|
|
|
@ -147,7 +147,7 @@ COMMANDS = {
|
|||
"func": schedule_host,
|
||||
"args": ["tenant-id", "instance-id"],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -34,7 +34,8 @@ class Fault(webob.exc.HTTPException):
|
|||
453: "NovatenantNotFound",
|
||||
454: "MultiportNotFound",
|
||||
470: "serviceUnavailable",
|
||||
471: "pluginFault"}
|
||||
471: "pluginFault"
|
||||
}
|
||||
|
||||
def __init__(self, exception):
|
||||
"""Create a Fault for the given webob.exc.exception."""
|
||||
|
|
|
@ -49,8 +49,8 @@ def make_port_dict(port_id, port_state, net_id, attachment):
|
|||
return res
|
||||
|
||||
|
||||
def make_portprofile_dict(tenant_id, profile_id, profile_name,
|
||||
qos):
|
||||
def make_portprofile_dict(tenant_id, profile_id,
|
||||
profile_name, qos):
|
||||
"""Helper funciton"""
|
||||
profile_associations = make_portprofile_assc_list(tenant_id,
|
||||
profile_id)
|
||||
|
|
|
@ -88,19 +88,19 @@ def network_create(tenant_id, name):
|
|||
|
||||
def network_list(tenant_id):
|
||||
session = get_session()
|
||||
return session.query(models.Network).\
|
||||
options(joinedload(models.Network.ports)). \
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
all()
|
||||
return (session.query(models.Network).
|
||||
options(joinedload(models.Network.ports)).
|
||||
filter_by(tenant_id=tenant_id).
|
||||
all())
|
||||
|
||||
|
||||
def network_id(net_name):
|
||||
session = get_session()
|
||||
try:
|
||||
return session.query(models.Network).\
|
||||
options(joinedload(models.Network.ports)). \
|
||||
filter_by(name=net_name).\
|
||||
all()
|
||||
return (session.query(models.Network).
|
||||
options(joinedload(models.Network.ports)).
|
||||
filter_by(name=net_name).
|
||||
all())
|
||||
except exc.NoResultFound, e:
|
||||
raise q_exc.NetworkNotFound(net_name=net_name)
|
||||
|
||||
|
@ -129,9 +129,9 @@ def network_update(net_id, tenant_id, **kwargs):
|
|||
def network_destroy(net_id):
|
||||
session = get_session()
|
||||
try:
|
||||
net = session.query(models.Network).\
|
||||
filter_by(uuid=net_id).\
|
||||
one()
|
||||
net = (session.query(models.Network).
|
||||
filter_by(uuid=net_id).
|
||||
one())
|
||||
session.delete(net)
|
||||
session.flush()
|
||||
return net
|
||||
|
@ -142,10 +142,10 @@ def network_destroy(net_id):
|
|||
def validate_network_ownership(tenant_id, net_id):
|
||||
session = get_session()
|
||||
try:
|
||||
return session.query(models.Network).\
|
||||
filter_by(uuid=net_id).\
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
one()
|
||||
return (session.query(models.Network).
|
||||
filter_by(uuid=net_id).
|
||||
filter_by(tenant_id=tenant_id).
|
||||
one())
|
||||
except exc.NoResultFound, e:
|
||||
raise q_exc.NetworkNotFound(net_id=net_id)
|
||||
|
||||
|
@ -165,10 +165,10 @@ def port_create(net_id, state=None):
|
|||
|
||||
def port_list(net_id):
|
||||
session = get_session()
|
||||
return session.query(models.Port).\
|
||||
options(joinedload(models.Port.network)). \
|
||||
filter_by(network_id=net_id).\
|
||||
all()
|
||||
return (session.query(models.Port).
|
||||
options(joinedload(models.Port.network)).
|
||||
filter_by(network_id=net_id).
|
||||
all())
|
||||
|
||||
|
||||
def port_get(net_id, port_id):
|
||||
|
@ -176,10 +176,10 @@ def port_get(net_id, port_id):
|
|||
network_get(net_id)
|
||||
session = get_session()
|
||||
try:
|
||||
return session.query(models.Port).\
|
||||
filter_by(uuid=port_id).\
|
||||
filter_by(network_id=net_id).\
|
||||
one()
|
||||
return (session.query(models.Port).
|
||||
filter_by(uuid=port_id).
|
||||
filter_by(network_id=net_id).
|
||||
one())
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.PortNotFound(net_id=net_id, port_id=port_id)
|
||||
|
||||
|
@ -214,9 +214,9 @@ def port_set_attachment(net_id, port_id, new_interface_id):
|
|||
att_id=port['interface_id'])
|
||||
|
||||
try:
|
||||
port = session.query(models.Port).\
|
||||
filter_by(interface_id=new_interface_id).\
|
||||
one()
|
||||
port = (session.query(models.Port).
|
||||
filter_by(interface_id=new_interface_id).
|
||||
one())
|
||||
raise q_exc.AlreadyAttached(net_id=net_id,
|
||||
port_id=port_id,
|
||||
att_id=new_interface_id,
|
||||
|
@ -248,10 +248,10 @@ def port_destroy(net_id, port_id):
|
|||
|
||||
session = get_session()
|
||||
try:
|
||||
port = session.query(models.Port).\
|
||||
filter_by(uuid=port_id).\
|
||||
filter_by(network_id=net_id).\
|
||||
one()
|
||||
port = (session.query(models.Port).
|
||||
filter_by(uuid=port_id).
|
||||
filter_by(network_id=net_id).
|
||||
one())
|
||||
if port['interface_id']:
|
||||
raise q_exc.PortInUse(net_id=net_id, port_id=port_id,
|
||||
att_id=port['interface_id'])
|
||||
|
@ -266,8 +266,8 @@ def port_destroy(net_id, port_id):
|
|||
def port_get_by_id(port_id):
|
||||
session = get_session()
|
||||
try:
|
||||
return session.query(models.Port).\
|
||||
filter_by(uuid=port_id).one()
|
||||
return (session.query(models.Port).
|
||||
filter_by(uuid=port_id).one())
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.PortNotFound(port_id=port_id)
|
||||
|
||||
|
|
|
@ -38,8 +38,7 @@ def create_vlanids():
|
|||
LOG.debug("create_vlanids() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
vlanid = session.query(l2network_models.VlanID).\
|
||||
one()
|
||||
vlanid = session.query(l2network_models.VlanID).one()
|
||||
except exc.MultipleResultsFound:
|
||||
pass
|
||||
except exc.NoResultFound:
|
||||
|
@ -58,8 +57,7 @@ def get_all_vlanids():
|
|||
LOG.debug("get_all_vlanids() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
vlanids = session.query(l2network_models.VlanID).\
|
||||
all()
|
||||
vlanids = session.query(l2network_models.VlanID).all()
|
||||
return vlanids
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
@ -70,9 +68,8 @@ def is_vlanid_used(vlan_id):
|
|||
LOG.debug("is_vlanid_used() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
vlanid = session.query(l2network_models.VlanID).\
|
||||
filter_by(vlan_id=vlan_id).\
|
||||
one()
|
||||
vlanid = (session.query(l2network_models.VlanID).
|
||||
filter_by(vlan_id=vlan_id).one())
|
||||
return vlanid["vlan_used"]
|
||||
except exc.NoResultFound:
|
||||
raise c_exc.VlanIDNotFound(vlan_id=vlan_id)
|
||||
|
@ -83,9 +80,8 @@ def release_vlanid(vlan_id):
|
|||
LOG.debug("release_vlanid() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
vlanid = session.query(l2network_models.VlanID).\
|
||||
filter_by(vlan_id=vlan_id).\
|
||||
one()
|
||||
vlanid = (session.query(l2network_models.VlanID).
|
||||
filter_by(vlan_id=vlan_id).one())
|
||||
vlanid["vlan_used"] = False
|
||||
session.merge(vlanid)
|
||||
session.flush()
|
||||
|
@ -100,9 +96,8 @@ def delete_vlanid(vlan_id):
|
|||
LOG.debug("delete_vlanid() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
vlanid = session.query(l2network_models.VlanID).\
|
||||
filter_by(vlan_id=vlan_id).\
|
||||
one()
|
||||
vlanid = (session.query(l2network_models.VlanID).
|
||||
filter_by(vlan_id=vlan_id).one())
|
||||
session.delete(vlanid)
|
||||
session.flush()
|
||||
return vlanid
|
||||
|
@ -115,14 +110,12 @@ def reserve_vlanid():
|
|||
LOG.debug("reserve_vlanid() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
rvlan = session.query(l2network_models.VlanID).\
|
||||
filter_by(vlan_used=False).\
|
||||
first()
|
||||
rvlan = (session.query(l2network_models.VlanID).
|
||||
filter_by(vlan_used=False).first())
|
||||
if not rvlan:
|
||||
raise exc.NoResultFound
|
||||
rvlanid = session.query(l2network_models.VlanID).\
|
||||
filter_by(vlan_id=rvlan["vlan_id"]).\
|
||||
one()
|
||||
rvlanid = (session.query(l2network_models.VlanID).
|
||||
filter_by(vlan_id=rvlan["vlan_id"]).one())
|
||||
rvlanid["vlan_used"] = True
|
||||
session.merge(rvlanid)
|
||||
session.flush()
|
||||
|
@ -136,9 +129,8 @@ def get_all_vlanids_used():
|
|||
LOG.debug("get_all_vlanids() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
vlanids = session.query(l2network_models.VlanID).\
|
||||
filter_by(vlan_used=True).\
|
||||
all()
|
||||
vlanids = (session.query(l2network_models.VlanID).
|
||||
filter_by(vlan_used=True).all())
|
||||
return vlanids
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
@ -149,8 +141,7 @@ def get_all_vlan_bindings():
|
|||
LOG.debug("get_all_vlan_bindings() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
bindings = session.query(l2network_models.VlanBinding).\
|
||||
all()
|
||||
bindings = session.query(l2network_models.VlanBinding).all()
|
||||
return bindings
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
@ -161,9 +152,8 @@ def get_vlan_binding(netid):
|
|||
LOG.debug("get_vlan_binding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
binding = session.query(l2network_models.VlanBinding).\
|
||||
filter_by(network_id=netid).\
|
||||
one()
|
||||
binding = (session.query(l2network_models.VlanBinding).
|
||||
filter_by(network_id=netid).one())
|
||||
return binding
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.NetworkNotFound(net_id=netid)
|
||||
|
@ -174,9 +164,8 @@ def add_vlan_binding(vlanid, vlanname, netid):
|
|||
LOG.debug("add_vlan_binding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
binding = session.query(l2network_models.VlanBinding).\
|
||||
filter_by(vlan_id=vlanid).\
|
||||
one()
|
||||
binding = (session.query(l2network_models.VlanBinding).
|
||||
filter_by(vlan_id=vlanid).one())
|
||||
raise c_exc.NetworkVlanBindingAlreadyExists(vlan_id=vlanid,
|
||||
network_id=netid)
|
||||
except exc.NoResultFound:
|
||||
|
@ -191,9 +180,8 @@ def remove_vlan_binding(netid):
|
|||
LOG.debug("remove_vlan_binding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
binding = session.query(l2network_models.VlanBinding).\
|
||||
filter_by(network_id=netid).\
|
||||
one()
|
||||
binding = (session.query(l2network_models.VlanBinding).
|
||||
filter_by(network_id=netid).one())
|
||||
session.delete(binding)
|
||||
session.flush()
|
||||
return binding
|
||||
|
@ -206,9 +194,8 @@ def update_vlan_binding(netid, newvlanid=None, newvlanname=None):
|
|||
LOG.debug("update_vlan_binding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
binding = session.query(l2network_models.VlanBinding).\
|
||||
filter_by(network_id=netid).\
|
||||
one()
|
||||
binding = (session.query(l2network_models.VlanBinding).
|
||||
filter_by(network_id=netid).one())
|
||||
if newvlanid:
|
||||
binding["vlan_id"] = newvlanid
|
||||
if newvlanname:
|
||||
|
@ -225,8 +212,7 @@ def get_all_portprofiles():
|
|||
LOG.debug("get_all_portprofiles() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
pps = session.query(l2network_models.PortProfile).\
|
||||
all()
|
||||
pps = session.query(l2network_models.PortProfile).all()
|
||||
return pps
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
@ -237,9 +223,8 @@ def get_portprofile(tenantid, ppid):
|
|||
LOG.debug("get_portprofile() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
pp = session.query(l2network_models.PortProfile).\
|
||||
filter_by(uuid=ppid).\
|
||||
one()
|
||||
pp = (session.query(l2network_models.PortProfile).
|
||||
filter_by(uuid=ppid).one())
|
||||
return pp
|
||||
except exc.NoResultFound:
|
||||
raise c_exc.PortProfileNotFound(tenant_id=tenantid,
|
||||
|
@ -251,9 +236,8 @@ def add_portprofile(tenantid, ppname, vlanid, qos):
|
|||
LOG.debug("add_portprofile() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
pp = session.query(l2network_models.PortProfile).\
|
||||
filter_by(name=ppname).\
|
||||
one()
|
||||
pp = (session.query(l2network_models.PortProfile).
|
||||
filter_by(name=ppname).one())
|
||||
raise c_exc.PortProfileAlreadyExists(tenant_id=tenantid,
|
||||
pp_name=ppname)
|
||||
except exc.NoResultFound:
|
||||
|
@ -268,9 +252,8 @@ def remove_portprofile(tenantid, ppid):
|
|||
LOG.debug("remove_portprofile() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
pp = session.query(l2network_models.PortProfile).\
|
||||
filter_by(uuid=ppid).\
|
||||
one()
|
||||
pp = (session.query(l2network_models.PortProfile).
|
||||
filter_by(uuid=ppid).one())
|
||||
session.delete(pp)
|
||||
session.flush()
|
||||
return pp
|
||||
|
@ -284,9 +267,8 @@ def update_portprofile(tenantid, ppid, newppname=None, newvlanid=None,
|
|||
LOG.debug("update_portprofile() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
pp = session.query(l2network_models.PortProfile).\
|
||||
filter_by(uuid=ppid).\
|
||||
one()
|
||||
pp = (session.query(l2network_models.PortProfile).
|
||||
filter_by(uuid=ppid).one())
|
||||
if newppname:
|
||||
pp["name"] = newppname
|
||||
if newvlanid:
|
||||
|
@ -306,8 +288,7 @@ def get_all_pp_bindings():
|
|||
LOG.debug("get_all_pp_bindings() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
bindings = session.query(l2network_models.PortProfileBinding).\
|
||||
all()
|
||||
bindings = session.query(l2network_models.PortProfileBinding).all()
|
||||
return bindings
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
@ -318,9 +299,8 @@ def get_pp_binding(tenantid, ppid):
|
|||
LOG.debug("get_pp_binding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
binding = session.query(l2network_models.PortProfileBinding).\
|
||||
filter_by(portprofile_id=ppid).\
|
||||
one()
|
||||
binding = (session.query(l2network_models.PortProfileBinding).
|
||||
filter_by(portprofile_id=ppid).one())
|
||||
return binding
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
@ -331,9 +311,8 @@ def add_pp_binding(tenantid, portid, ppid, default):
|
|||
LOG.debug("add_pp_binding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
binding = session.query(l2network_models.PortProfileBinding).\
|
||||
filter_by(portprofile_id=ppid).\
|
||||
one()
|
||||
binding = (session.query(l2network_models.PortProfileBinding).
|
||||
filter_by(portprofile_id=ppid).one())
|
||||
raise c_exc.PortProfileBindingAlreadyExists(pp_id=ppid,
|
||||
port_id=portid)
|
||||
except exc.NoResultFound:
|
||||
|
@ -349,10 +328,9 @@ def remove_pp_binding(tenantid, portid, ppid):
|
|||
LOG.debug("remove_pp_binding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
binding = session.query(l2network_models.PortProfileBinding).\
|
||||
filter_by(portprofile_id=ppid).\
|
||||
filter_by(port_id=portid).\
|
||||
one()
|
||||
binding = (session.query(l2network_models.PortProfileBinding).
|
||||
filter_by(portprofile_id=ppid).filter_by(port_id=portid).
|
||||
one())
|
||||
session.delete(binding)
|
||||
session.flush()
|
||||
return binding
|
||||
|
@ -360,15 +338,14 @@ def remove_pp_binding(tenantid, portid, ppid):
|
|||
pass
|
||||
|
||||
|
||||
def update_pp_binding(tenantid, ppid, newtenantid=None, newportid=None,
|
||||
newdefault=None):
|
||||
def update_pp_binding(tenantid, ppid, newtenantid=None,
|
||||
newportid=None, newdefault=None):
|
||||
"""Updates port profile binding"""
|
||||
LOG.debug("update_pp_binding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
binding = session.query(l2network_models.PortProfileBinding).\
|
||||
filter_by(portprofile_id=ppid).\
|
||||
one()
|
||||
binding = (session.query(l2network_models.PortProfileBinding).
|
||||
filter_by(portprofile_id=ppid).one())
|
||||
if newtenantid:
|
||||
binding["tenant_id"] = newtenantid
|
||||
if newportid:
|
||||
|
@ -388,9 +365,8 @@ def get_all_qoss(tenant_id):
|
|||
LOG.debug("get_all_qoss() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
qoss = session.query(l2network_models.QoS).\
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
all()
|
||||
qoss = (session.query(l2network_models.QoS).
|
||||
filter_by(tenant_id=tenant_id).all())
|
||||
return qoss
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
@ -401,10 +377,9 @@ def get_qos(tenant_id, qos_id):
|
|||
LOG.debug("get_qos() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
qos = session.query(l2network_models.QoS).\
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
filter_by(qos_id=qos_id).\
|
||||
one()
|
||||
qos = (session.query(l2network_models.QoS).
|
||||
filter_by(tenant_id=tenant_id).
|
||||
filter_by(qos_id=qos_id).one())
|
||||
return qos
|
||||
except exc.NoResultFound:
|
||||
raise c_exc.QosNotFound(qos_id=qos_id,
|
||||
|
@ -416,10 +391,9 @@ def add_qos(tenant_id, qos_name, qos_desc):
|
|||
LOG.debug("add_qos() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
qos = session.query(l2network_models.QoS).\
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
filter_by(qos_name=qos_name).\
|
||||
one()
|
||||
qos = (session.query(l2network_models.QoS).
|
||||
filter_by(tenant_id=tenant_id).
|
||||
filter_by(qos_name=qos_name).one())
|
||||
raise c_exc.QosNameAlreadyExists(qos_name=qos_name,
|
||||
tenant_id=tenant_id)
|
||||
except exc.NoResultFound:
|
||||
|
@ -433,10 +407,9 @@ def remove_qos(tenant_id, qos_id):
|
|||
"""Removes a qos to tenant association"""
|
||||
session = db.get_session()
|
||||
try:
|
||||
qos = session.query(l2network_models.QoS).\
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
filter_by(qos_id=qos_id).\
|
||||
one()
|
||||
qos = (session.query(l2network_models.QoS).
|
||||
filter_by(tenant_id=tenant_id).
|
||||
filter_by(qos_id=qos_id).one())
|
||||
session.delete(qos)
|
||||
session.flush()
|
||||
return qos
|
||||
|
@ -448,10 +421,9 @@ def update_qos(tenant_id, qos_id, new_qos_name=None):
|
|||
"""Updates a qos to tenant association"""
|
||||
session = db.get_session()
|
||||
try:
|
||||
qos = session.query(l2network_models.QoS).\
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
filter_by(qos_id=qos_id).\
|
||||
one()
|
||||
qos = (session.query(l2network_models.QoS).
|
||||
filter_by(tenant_id=tenant_id).
|
||||
filter_by(qos_id=qos_id).one())
|
||||
if new_qos_name:
|
||||
qos["qos_name"] = new_qos_name
|
||||
session.merge(qos)
|
||||
|
@ -466,9 +438,8 @@ def get_all_credentials(tenant_id):
|
|||
"""Lists all the creds for a tenant"""
|
||||
session = db.get_session()
|
||||
try:
|
||||
creds = session.query(l2network_models.Credential).\
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
all()
|
||||
creds = (session.query(l2network_models.Credential).
|
||||
filter_by(tenant_id=tenant_id).all())
|
||||
return creds
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
@ -478,10 +449,9 @@ def get_credential(tenant_id, credential_id):
|
|||
"""Lists the creds for given a cred_id and tenant_id"""
|
||||
session = db.get_session()
|
||||
try:
|
||||
cred = session.query(l2network_models.Credential).\
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
filter_by(credential_id=credential_id).\
|
||||
one()
|
||||
cred = (session.query(l2network_models.Credential).
|
||||
filter_by(tenant_id=tenant_id).
|
||||
filter_by(credential_id=credential_id).one())
|
||||
return cred
|
||||
except exc.NoResultFound:
|
||||
raise c_exc.CredentialNotFound(credential_id=credential_id,
|
||||
|
@ -492,10 +462,9 @@ def get_credential_name(tenant_id, credential_name):
|
|||
"""Lists the creds for given a cred_name and tenant_id"""
|
||||
session = db.get_session()
|
||||
try:
|
||||
cred = session.query(l2network_models.Credential).\
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
filter_by(credential_name=credential_name).\
|
||||
one()
|
||||
cred = (session.query(l2network_models.Credential).
|
||||
filter_by(tenant_id=tenant_id).
|
||||
filter_by(credential_name=credential_name).one())
|
||||
return cred
|
||||
except exc.NoResultFound:
|
||||
raise c_exc.CredentialNameNotFound(credential_name=credential_name,
|
||||
|
@ -506,15 +475,14 @@ def add_credential(tenant_id, credential_name, user_name, password):
|
|||
"""Adds a qos to tenant association"""
|
||||
session = db.get_session()
|
||||
try:
|
||||
cred = session.query(l2network_models.Credential).\
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
filter_by(credential_name=credential_name).\
|
||||
one()
|
||||
cred = (session.query(l2network_models.Credential).
|
||||
filter_by(tenant_id=tenant_id).
|
||||
filter_by(credential_name=credential_name).one())
|
||||
raise c_exc.CredentialAlreadyExists(credential_name=credential_name,
|
||||
tenant_id=tenant_id)
|
||||
except exc.NoResultFound:
|
||||
cred = l2network_models.Credential(tenant_id,
|
||||
credential_name, user_name, password)
|
||||
cred = l2network_models.Credential(tenant_id, credential_name,
|
||||
user_name, password)
|
||||
session.add(cred)
|
||||
session.flush()
|
||||
return cred
|
||||
|
@ -524,10 +492,9 @@ def remove_credential(tenant_id, credential_id):
|
|||
"""Removes a credential from a tenant"""
|
||||
session = db.get_session()
|
||||
try:
|
||||
cred = session.query(l2network_models.Credential).\
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
filter_by(credential_id=credential_id).\
|
||||
one()
|
||||
cred = (session.query(l2network_models.Credential).
|
||||
filter_by(tenant_id=tenant_id).
|
||||
filter_by(credential_id=credential_id).one())
|
||||
session.delete(cred)
|
||||
session.flush()
|
||||
return cred
|
||||
|
@ -540,10 +507,9 @@ def update_credential(tenant_id, credential_id,
|
|||
"""Updates a credential for a tenant"""
|
||||
session = db.get_session()
|
||||
try:
|
||||
cred = session.query(l2network_models.Credential).\
|
||||
filter_by(tenant_id=tenant_id).\
|
||||
filter_by(credential_id=credential_id).\
|
||||
one()
|
||||
cred = (session.query(l2network_models.Credential).
|
||||
filter_by(tenant_id=tenant_id).
|
||||
filter_by(credential_id=credential_id).one())
|
||||
if new_user_name:
|
||||
cred["user_name"] = new_user_name
|
||||
if new_password:
|
||||
|
|
|
@ -77,8 +77,7 @@ class VlanID(BASE, L2NetworkBase):
|
|||
self.vlan_used = False
|
||||
|
||||
def __repr__(self):
|
||||
return "<VlanID(%d,%s)>" % \
|
||||
(self.vlan_id, self.vlan_used)
|
||||
return "<VlanID(%d,%s)>" % (self.vlan_id, self.vlan_used)
|
||||
|
||||
|
||||
class VlanBinding(BASE, L2NetworkBase):
|
||||
|
@ -96,8 +95,9 @@ class VlanBinding(BASE, L2NetworkBase):
|
|||
self.network_id = network_id
|
||||
|
||||
def __repr__(self):
|
||||
return "<VlanBinding(%d,%s,%s)>" % \
|
||||
(self.vlan_id, self.vlan_name, self.network_id)
|
||||
return "<VlanBinding(%d,%s,%s)>" % (self.vlan_id,
|
||||
self.vlan_name,
|
||||
self.network_id)
|
||||
|
||||
|
||||
class PortProfile(BASE, L2NetworkBase):
|
||||
|
@ -116,8 +116,10 @@ class PortProfile(BASE, L2NetworkBase):
|
|||
self.qos = qos
|
||||
|
||||
def __repr__(self):
|
||||
return "<PortProfile(%s,%s,%d,%s)>" % \
|
||||
(self.uuid, self.name, self.vlan_id, self.qos)
|
||||
return "<PortProfile(%s,%s,%d,%s)>" % (self.uuid,
|
||||
self.name,
|
||||
self.vlan_id,
|
||||
self.qos)
|
||||
|
||||
|
||||
class PortProfileBinding(BASE, L2NetworkBase):
|
||||
|
@ -127,8 +129,7 @@ class PortProfileBinding(BASE, L2NetworkBase):
|
|||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
tenant_id = Column(String(255))
|
||||
|
||||
port_id = Column(String(255), ForeignKey("ports.uuid"),
|
||||
nullable=False)
|
||||
port_id = Column(String(255), ForeignKey("ports.uuid"), nullable=False)
|
||||
portprofile_id = Column(String(255), ForeignKey("portprofiles.uuid"),
|
||||
nullable=False)
|
||||
default = Column(Boolean)
|
||||
|
@ -142,8 +143,10 @@ class PortProfileBinding(BASE, L2NetworkBase):
|
|||
self.default = default
|
||||
|
||||
def __repr__(self):
|
||||
return "<PortProfile Binding(%s,%s,%s,%s)>" % \
|
||||
(self.tenant_id, self.port_id, self.portprofile_id, self.default)
|
||||
return "<PortProfile Binding(%s,%s,%s,%s)>" % (self.tenant_id,
|
||||
self.port_id,
|
||||
self.portprofile_id,
|
||||
self.default)
|
||||
|
||||
|
||||
class QoS(BASE, L2NetworkBase):
|
||||
|
@ -162,8 +165,8 @@ class QoS(BASE, L2NetworkBase):
|
|||
self.qos_desc = qos_desc
|
||||
|
||||
def __repr__(self):
|
||||
return "<QoS(%s,%s,%s,%s)>" % \
|
||||
(self.qos_id, self.tenant_id, self.qos_name, self.qos_desc)
|
||||
return "<QoS(%s,%s,%s,%s)>" % (self.qos_id, self.tenant_id,
|
||||
self.qos_name, self.qos_desc)
|
||||
|
||||
|
||||
class Credential(BASE, L2NetworkBase):
|
||||
|
@ -184,6 +187,8 @@ class Credential(BASE, L2NetworkBase):
|
|||
self.password = password
|
||||
|
||||
def __repr__(self):
|
||||
return "<Credentials(%s,%s,%s,%s,%s)>" % \
|
||||
(self.credential_id, self.tenant_id, self.credential_name,
|
||||
self.user_name, self.password)
|
||||
return "<Credentials(%s,%s,%s,%s,%s)>" % (self.credential_id,
|
||||
self.tenant_id,
|
||||
self.credential_name,
|
||||
self.user_name,
|
||||
self.password)
|
||||
|
|
|
@ -98,5 +98,4 @@ class Network(BASE, QuantumBase):
|
|||
self.name = name
|
||||
|
||||
def __repr__(self):
|
||||
return "<Network(%s,%s,%s)>" % \
|
||||
(self.uuid, self.name, self.tenant_id)
|
||||
return "<Network(%s,%s,%s)>" % (self.uuid, self.name, self.tenant_id)
|
||||
|
|
|
@ -30,8 +30,7 @@ def get_all_nexusport_bindings():
|
|||
LOG.debug("get_all_nexusport_bindings() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
bindings = session.query(nexus_models.NexusPortBinding).\
|
||||
all()
|
||||
bindings = session.query(nexus_models.NexusPortBinding).all()
|
||||
return bindings
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
@ -42,9 +41,8 @@ def get_nexusport_binding(vlan_id):
|
|||
LOG.debug("get_nexusport_binding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
binding = session.query(nexus_models.NexusPortBinding).\
|
||||
filter_by(vlan_id=vlan_id).\
|
||||
all()
|
||||
binding = (session.query(nexus_models.NexusPortBinding).
|
||||
filter_by(vlan_id=vlan_id).all())
|
||||
return binding
|
||||
except exc.NoResultFound:
|
||||
raise c_exc.NexusPortBindingNotFound(vlan_id=vlan_id)
|
||||
|
@ -65,9 +63,8 @@ def remove_nexusport_binding(vlan_id):
|
|||
LOG.debug("remove_nexusport_binding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
binding = session.query(nexus_models.NexusPortBinding).\
|
||||
filter_by(vlan_id=vlan_id).\
|
||||
all()
|
||||
binding = (session.query(nexus_models.NexusPortBinding).
|
||||
filter_by(vlan_id=vlan_id).all())
|
||||
for bind in binding:
|
||||
session.delete(bind)
|
||||
session.flush()
|
||||
|
@ -81,9 +78,8 @@ def update_nexusport_binding(port_id, new_vlan_id):
|
|||
LOG.debug("update_nexusport_binding called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
binding = session.query(nexus_models.NexusPortBinding).\
|
||||
filter_by(port_id=port_id).\
|
||||
one()
|
||||
binding = (session.query(nexus_models.NexusPortBinding).
|
||||
filter_by(port_id=port_id).one())
|
||||
if new_vlan_id:
|
||||
binding["vlan_id"] = new_vlan_id
|
||||
session.merge(binding)
|
||||
|
|
|
@ -34,5 +34,4 @@ class NexusPortBinding(BASE, L2NetworkBase):
|
|||
self.vlan_id = vlan_id
|
||||
|
||||
def __repr__(self):
|
||||
return "<NexusPortBinding (%s,%d)>" % \
|
||||
(self.port_id, self.vlan_id)
|
||||
return "<NexusPortBinding (%s,%d)>" % (self.port_id, self.vlan_id)
|
||||
|
|
|
@ -30,8 +30,7 @@ def get_all_services_bindings():
|
|||
LOG.debug("get_all_services_bindings() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
bindings = session.query(services_models.ServicesBinding).\
|
||||
all()
|
||||
bindings = session.query(services_models.ServicesBinding).all()
|
||||
return bindings
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
@ -42,9 +41,8 @@ def get_service_bindings(service_id):
|
|||
LOG.debug("get_service_bindings() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
bindings = session.query(services_models.ServicesBinding).\
|
||||
filter_by(service_id=service_id).\
|
||||
one()
|
||||
bindings = (session.query(services_models.ServicesBinding).
|
||||
filter_by(service_id=service_id).one())
|
||||
return bindings
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
@ -66,9 +64,8 @@ def remove_services_binding(service_id):
|
|||
LOG.debug("remove_services_binding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
binding = session.query(services_models.ServicesBinding).\
|
||||
filter_by(service_id=service_id).\
|
||||
all()
|
||||
binding = (session.query(services_models.ServicesBinding).
|
||||
filter_by(service_id=service_id).all())
|
||||
for bind in binding:
|
||||
session.delete(bind)
|
||||
session.flush()
|
||||
|
|
|
@ -38,5 +38,5 @@ class ServicesBinding(BASE, L2NetworkBase):
|
|||
self.sbnet_id = sbnet_id
|
||||
|
||||
def __repr__(self):
|
||||
return "<ServicesBinding (%s,%d)>" % \
|
||||
(self.service_id, self.mngnet_id, self.nbnet_id, self.sbnet_id)
|
||||
return "<ServicesBinding (%s,%d)>" % (self.service_id, self.mngnet_id,
|
||||
self.nbnet_id, self.sbnet_id)
|
||||
|
|
|
@ -30,8 +30,7 @@ def get_all_portbindings():
|
|||
LOG.debug("db get_all_portbindings() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
port_bindings = session.query(ucs_models.PortBinding).\
|
||||
all()
|
||||
port_bindings = session.query(ucs_models.PortBinding).all()
|
||||
return port_bindings
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
@ -42,9 +41,8 @@ def get_portbinding(port_id):
|
|||
LOG.debug("get_portbinding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
port_binding = session.query(ucs_models.PortBinding).\
|
||||
filter_by(port_id=port_id).\
|
||||
one()
|
||||
port_binding = (session.query(ucs_models.PortBinding).
|
||||
filter_by(port_id=port_id).one())
|
||||
return port_binding
|
||||
except exc.NoResultFound:
|
||||
raise c_exc.PortVnicNotFound(port_id=port_id)
|
||||
|
@ -56,9 +54,8 @@ def add_portbinding(port_id, blade_intf_dn, portprofile_name,
|
|||
LOG.debug("add_portbinding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
port_binding = session.query(ucs_models.PortBinding).\
|
||||
filter_by(port_id=port_id).\
|
||||
one()
|
||||
port_binding = (session.query(ucs_models.PortBinding).
|
||||
filter_by(port_id=port_id).one())
|
||||
raise c_exc.PortVnicBindingAlreadyExists(port_id=port_id)
|
||||
except exc.NoResultFound:
|
||||
port_binding = ucs_models.PortBinding(port_id, blade_intf_dn,
|
||||
|
@ -74,9 +71,8 @@ def remove_portbinding(port_id):
|
|||
LOG.debug("db remove_portbinding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
port_binding = session.query(ucs_models.PortBinding).\
|
||||
filter_by(port_id=port_id).\
|
||||
one()
|
||||
port_binding = (session.query(ucs_models.PortBinding).
|
||||
filter_by(port_id=port_id).one())
|
||||
session.delete(port_binding)
|
||||
session.flush()
|
||||
return port_binding
|
||||
|
@ -92,9 +88,8 @@ def update_portbinding(port_id, blade_intf_dn=None, portprofile_name=None,
|
|||
LOG.debug("db update_portbinding() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
port_binding = session.query(ucs_models.PortBinding).\
|
||||
filter_by(port_id=port_id).\
|
||||
one()
|
||||
port_binding = (session.query(ucs_models.PortBinding).
|
||||
filter_by(port_id=port_id).one())
|
||||
if blade_intf_dn:
|
||||
port_binding.blade_intf_dn = blade_intf_dn
|
||||
if portprofile_name:
|
||||
|
@ -123,9 +118,8 @@ def update_portbinding_instance_id(port_id, instance_id):
|
|||
LOG.debug("db update_portbinding_instance_id() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
port_binding = session.query(ucs_models.PortBinding).\
|
||||
filter_by(port_id=port_id).\
|
||||
one()
|
||||
port_binding = (session.query(ucs_models.PortBinding).
|
||||
filter_by(port_id=port_id).one())
|
||||
port_binding.instance_id = instance_id
|
||||
session.merge(port_binding)
|
||||
session.flush()
|
||||
|
@ -139,9 +133,8 @@ def update_portbinding_vif_id(port_id, vif_id):
|
|||
LOG.debug("db update_portbinding_vif_id() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
port_binding = session.query(ucs_models.PortBinding).\
|
||||
filter_by(port_id=port_id).\
|
||||
one()
|
||||
port_binding = (session.query(ucs_models.PortBinding).
|
||||
filter_by(port_id=port_id).one())
|
||||
port_binding.vif_id = vif_id
|
||||
session.merge(port_binding)
|
||||
session.flush()
|
||||
|
@ -155,9 +148,8 @@ def get_portbinding_dn(blade_intf_dn):
|
|||
LOG.debug("get_portbinding_dn() called")
|
||||
session = db.get_session()
|
||||
try:
|
||||
port_binding = session.query(ucs_models.PortBinding).\
|
||||
filter_by(blade_intf_dn=blade_intf_dn).\
|
||||
one()
|
||||
port_binding = (session.query(ucs_models.PortBinding).
|
||||
filter_by(blade_intf_dn=blade_intf_dn).one())
|
||||
return port_binding
|
||||
except exc.NoResultFound:
|
||||
return []
|
||||
|
|
|
@ -50,6 +50,6 @@ class PortBinding(BASE, L2NetworkBase):
|
|||
self.qos = qos
|
||||
|
||||
def __repr__(self):
|
||||
return "<PortProfile Binding(%s,%s,%s,%s,%s,%s)>" % \
|
||||
(self.port_id, self.blade_intf_dn, self.portprofile_name,
|
||||
return "<PortProfile Binding(%s,%s,%s,%s,%s,%s)>" % (
|
||||
self.port_id, self.blade_intf_dn, self.portprofile_name,
|
||||
self.vlan_name, self.vlan_id, self.qos)
|
||||
|
|
|
@ -89,8 +89,8 @@ class L2NetworkSingleBlade(L2NetworkModelBase):
|
|||
if args and isinstance(args[-1], dict):
|
||||
kwargs.update(args.pop())
|
||||
|
||||
return getattr(self._plugins[plugin_key], function_name)(*args,
|
||||
**kwargs)
|
||||
return getattr(self._plugins[plugin_key],
|
||||
function_name)(*args, **kwargs)
|
||||
|
||||
def get_all_networks(self, args):
|
||||
"""Not implemented for this model"""
|
||||
|
|
|
@ -43,7 +43,7 @@ quantum_opts = [
|
|||
cfg.StrOpt('quantum_default_tenant_id',
|
||||
default="default",
|
||||
help='Default tenant id when creating quantum networks'),
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
|
|
|
@ -39,7 +39,7 @@ quantum_opts = [
|
|||
cfg.StrOpt('quantum_default_tenant_id',
|
||||
default="default",
|
||||
help='Default tenant id when creating quantum networks'),
|
||||
]
|
||||
]
|
||||
|
||||
FLAGS = flags.FLAGS
|
||||
FLAGS.register_opts(quantum_opts)
|
||||
|
|
|
@ -23,7 +23,7 @@ from quantum.plugins.cisco.common import cisco_constants as const
|
|||
from quantum.plugins.cisco.db import l2network_db as cdb
|
||||
from quantum.plugins.cisco.l2network_segmentation_base import (
|
||||
L2NetworkSegmentationMgrBase,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
|
@ -283,7 +283,7 @@ SERVICE_COMMANDS = {
|
|||
"func": disconnect_vm,
|
||||
"args": ["vm_instance_id"],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -35,11 +35,11 @@ from quantum.extensions import (
|
|||
novatenant,
|
||||
portprofile,
|
||||
qos,
|
||||
)
|
||||
)
|
||||
from quantum.extensions.extensions import (
|
||||
ExtensionMiddleware,
|
||||
PluginAwareExtensionManager,
|
||||
)
|
||||
)
|
||||
from quantum.manager import QuantumManager
|
||||
from quantum.openstack.common import jsonutils
|
||||
from quantum.plugins.cisco.db import api as db
|
||||
|
@ -111,7 +111,8 @@ class PortprofileExtensionTest(unittest.TestCase):
|
|||
req_body1 = jsonutils.dumps(self.test_port_profile)
|
||||
create_response1 = self.test_app.post(
|
||||
self.profile_path, req_body1,
|
||||
content_type=self.contenttype)
|
||||
content_type=self.contenttype
|
||||
)
|
||||
req_body2 = jsonutils.dumps({
|
||||
'portprofile': {
|
||||
'portprofile_name': 'cisco_test_portprofile2',
|
||||
|
@ -778,8 +779,7 @@ class QosExtensionTest(unittest.TestCase):
|
|||
self.assertEqual(200, rename_response.status_int)
|
||||
rename_resp_dict = wsgi.Serializer().deserialize(rename_response.body,
|
||||
self.contenttype)
|
||||
self.assertEqual(
|
||||
rename_resp_dict['qoss']['qos']['name'],
|
||||
self.assertEqual(rename_resp_dict['qoss']['qos']['name'],
|
||||
'cisco_rename_qos')
|
||||
self.tearDownQos(rename_path)
|
||||
LOG.debug("test_update_qos - END")
|
||||
|
@ -881,12 +881,12 @@ class CredentialExtensionTest(unittest.TestCase):
|
|||
|
||||
parent_resource = dict(member_name="tenant",
|
||||
collection_name="extensions/csco/tenants")
|
||||
controller = credential.CredentialController(
|
||||
QuantumManager.get_plugin())
|
||||
controller = credential.CredentialController(QuantumManager.
|
||||
get_plugin())
|
||||
res_ext = extensions.ResourceExtension('credentials', controller,
|
||||
parent=parent_resource)
|
||||
self.test_app = setup_extensions_test_app(
|
||||
SimpleExtensionManager(res_ext))
|
||||
self.test_app = setup_extensions_test_app(SimpleExtensionManager(
|
||||
res_ext))
|
||||
self.contenttype = 'application/json'
|
||||
self.credential_path = '/extensions/csco/tenants/tt/credentials'
|
||||
self.cred_second_path = '/extensions/csco/tenants/tt/credentials/'
|
||||
|
|
|
@ -90,10 +90,11 @@ class CoreAPITestFunc(unittest.TestCase):
|
|||
tenant_id, net_id)
|
||||
LOG.debug("test_delete_network_not_found - END")
|
||||
|
||||
def test_delete_networkInUse(
|
||||
self, tenant_id='test_tenant', instance_tenant_id='nova',
|
||||
def test_delete_networkInUse(self, tenant_id='test_tenant',
|
||||
instance_tenant_id='nova',
|
||||
nova_user_id='novaadmin', instance_id=10,
|
||||
vif_id='fe701ddf-26a2-42ea-b9e6-7313d1c522cc'):
|
||||
vif_id='fe701ddf-26a2-'
|
||||
'42ea-b9e6-7313d1c522cc'):
|
||||
|
||||
"""
|
||||
Tests deletion of a Virtual Network when Network is in Use.
|
||||
|
@ -492,10 +493,11 @@ class CoreAPITestFunc(unittest.TestCase):
|
|||
"""
|
||||
|
||||
LOG.debug("test_plug_interface - START")
|
||||
new_net_dict = self._l2network_plugin.create_network(
|
||||
tenant_id, self.network_name)
|
||||
port_dict = self._l2network_plugin.create_port(
|
||||
tenant_id, new_net_dict[const.NET_ID], self.state)
|
||||
new_net_dict = self._l2network_plugin.create_network(tenant_id,
|
||||
self.network_name)
|
||||
port_dict = self._l2network_plugin.create_port(tenant_id,
|
||||
new_net_dict[const.
|
||||
NET_ID], self.state)
|
||||
instance_desc = {'project_id': tenant_id,
|
||||
'user_id': nova_user_id}
|
||||
host_list = self._l2network_plugin.schedule_host(instance_tenant_id,
|
||||
|
@ -551,10 +553,12 @@ class CoreAPITestFunc(unittest.TestCase):
|
|||
self.tearDownNetwork(tenant_id, new_net_dict[const.NET_ID])
|
||||
LOG.debug("test_plug_interface_portDNE - END")
|
||||
|
||||
def test_plug_interface_portInUse(
|
||||
self, tenant_id='test_tenant', instance_tenant_id='nova',
|
||||
nova_user_id='novaadmin', instance_id=10,
|
||||
vif_id='fe701ddf-26a2-42ea-b9e6-7313d1c522cc',
|
||||
def test_plug_interface_portInUse(self, tenant_id='test_tenant',
|
||||
instance_tenant_id='nova',
|
||||
nova_user_id='novaadmin',
|
||||
instance_id=10,
|
||||
vif_id='fe701ddf-26a2-42ea-'
|
||||
'b9e6-7313d1c522cc',
|
||||
remote_interface='new_interface'):
|
||||
"""
|
||||
Tests attachment of new interface to the port when there is an
|
||||
|
@ -588,8 +592,8 @@ class CoreAPITestFunc(unittest.TestCase):
|
|||
|
||||
LOG.debug("test_plug_interface_portInUse - END")
|
||||
|
||||
def test_unplug_interface(
|
||||
self, tenant_id='test_tenant', instance_tenant_id='nova',
|
||||
def test_unplug_interface(self, tenant_id='test_tenant',
|
||||
instance_tenant_id='nova',
|
||||
nova_user_id='novaadmin', instance_id=10,
|
||||
vif_id='fe701ddf-26a2-42ea-b9e6-7313d1c522cc'):
|
||||
"""
|
||||
|
@ -730,8 +734,8 @@ class CoreAPITestFunc(unittest.TestCase):
|
|||
port_profile_dict = self._l2network_plugin.create_portprofile(
|
||||
tenant_id, self.profile_name, self.qos)
|
||||
port_profile_id = port_profile_dict['profile_id']
|
||||
new_net_dict = self._l2network_plugin.create_network(
|
||||
tenant_id, 'test_network')
|
||||
new_net_dict = self._l2network_plugin.create_network(tenant_id,
|
||||
'test_network')
|
||||
port_dict = self._l2network_plugin.create_port(
|
||||
tenant_id, new_net_dict[const.NET_ID],
|
||||
const.PORT_UP)
|
||||
|
@ -919,7 +923,8 @@ class CoreAPITestFunc(unittest.TestCase):
|
|||
LOG.debug("test_disassociate_portprofile - END")
|
||||
|
||||
def test_disassociate_portprofileDNE(self, tenant_id='test_tenant',
|
||||
net_id='0005', port_id='p00005', profile_id='pr0005'):
|
||||
net_id='0005', port_id='p00005',
|
||||
profile_id='pr0005'):
|
||||
"""
|
||||
Tests disassociation of a port-profile when network does not exist
|
||||
"""
|
||||
|
@ -1010,8 +1015,8 @@ class CoreAPITestFunc(unittest.TestCase):
|
|||
self.tearDownNetwork(tenant_id, network_dict_id)
|
||||
|
||||
def tearDownNetworkPortInterface(self, tenant_id, instance_tenant_id,
|
||||
instance_id, instance_desc, network_dict_id,
|
||||
port_id):
|
||||
instance_id, instance_desc,
|
||||
network_dict_id, port_id):
|
||||
"""
|
||||
Tear down Network Port Interface
|
||||
"""
|
||||
|
|
|
@ -26,50 +26,63 @@ from quantum.plugins.cisco.ucs import cisco_ucs_network_driver
|
|||
LOG = logging.getLogger('quantum.tests.test_ucs_driver')
|
||||
|
||||
|
||||
CREATE_VLAN_OUTPUT = ("<configConfMos cookie=\"cookie_placeholder\" "
|
||||
"inHierarchical=\"true\"> <inConfigs><pair key=\"fabric/lan/net-New Vlan\"> "
|
||||
"<fabricVlan defaultNet=\"no\" dn=\"fabric/lan/net-New Vlan\" id=\"200\" "
|
||||
"name=\"New Vlan\" status=\"created\"></fabricVlan> </pair> </inConfigs> "
|
||||
"</configConfMos>")
|
||||
CREATE_VLAN_OUTPUT = ('<configConfMos cookie="cookie_placeholder" '
|
||||
'inHierarchical="true"> <inConfigs><pair '
|
||||
'key="fabric/lan/net-New Vlan"> '
|
||||
'<fabricVlan defaultNet="no" '
|
||||
'dn="fabric/lan/net-New Vlan" id="200" '
|
||||
'name="New Vlan" status="created"></fabricVlan> '
|
||||
'</pair> </inConfigs> </configConfMos>')
|
||||
|
||||
CREATE_PROFILE_OUTPUT = ("<configConfMos cookie=\"cookie_placeholder\" "
|
||||
"inHierarchical=\"true\"> <inConfigs><pair key=\"fabric/lan/profiles/vnic-"
|
||||
"New Profile\"> <vnicProfile descr=\"Profile created by Cisco OpenStack "
|
||||
"Quantum Plugin\" dn=\"fabric/lan/profiles/vnic-New Profile\" maxPorts="
|
||||
"\"64\" name=\"New Profile\" nwCtrlPolicyName=\"\" pinToGroupName=\"\" "
|
||||
"qosPolicyName=\"\" status=\"created\"> <vnicEtherIf defaultNet=\"yes\" "
|
||||
"name=\"New Vlan\" rn=\"if-New Vlan\" > </vnicEtherIf> </vnicProfile> "
|
||||
"</pair> </inConfigs> </configConfMos>")
|
||||
CREATE_PROFILE_OUTPUT = ('<configConfMos cookie="cookie_placeholder" '
|
||||
'inHierarchical="true"> <inConfigs><pair '
|
||||
'key="fabric/lan/profiles/vnic-'
|
||||
'New Profile"> <vnicProfile descr="Profile created '
|
||||
'by Cisco OpenStack Quantum Plugin" '
|
||||
'dn="fabric/lan/profiles/vnic-New Profile" maxPorts='
|
||||
'"64" name="New Profile" nwCtrlPolicyName="" '
|
||||
'pinToGroupName="" qosPolicyName="" status="created">'
|
||||
' <vnicEtherIf defaultNet="yes" name="New Vlan" '
|
||||
'rn="if-New Vlan" > </vnicEtherIf> </vnicProfile> '
|
||||
'</pair> </inConfigs> </configConfMos>')
|
||||
|
||||
CHANGE_VLAN_OUTPUT = ("<configConfMos cookie=\"cookie_placeholder\" "
|
||||
"inHierarchical=\"true\"> <inConfigs><pair key=\""
|
||||
"fabric/lan/profiles/vnic-New Profile\"> <vnicProfile descr=\"Profile "
|
||||
"created by Cisco OpenStack Quantum Plugin\" "
|
||||
"dn=\"fabric/lan/profiles/vnic-New Profile\" maxPorts=\"64\" "
|
||||
"name=\"New Profile\" nwCtrlPolicyName=\"\" pinToGroupName=\"\" "
|
||||
"qosPolicyName=\"\" status=\"created,modified\"><vnicEtherIf "
|
||||
"rn=\"if-Old Vlan\" status=\"deleted\"> </vnicEtherIf> "
|
||||
"<vnicEtherIf defaultNet=\"yes\" name=\"New Vlan\" rn=\"if-New Vlan\" > "
|
||||
"</vnicEtherIf> </vnicProfile> </pair></inConfigs> </configConfMos>")
|
||||
CHANGE_VLAN_OUTPUT = ('<configConfMos cookie="cookie_placeholder" '
|
||||
'inHierarchical="true"> <inConfigs><pair key="'
|
||||
'fabric/lan/profiles/vnic-New Profile"> '
|
||||
'<vnicProfile descr="Profile '
|
||||
'created by Cisco OpenStack Quantum Plugin" '
|
||||
'dn="fabric/lan/profiles/vnic-New Profile" maxPorts="64"'
|
||||
' name="New Profile" nwCtrlPolicyName="" '
|
||||
'pinToGroupName="" qosPolicyName="" '
|
||||
'status="created,modified"><vnicEtherIf '
|
||||
'rn="if-Old Vlan" status="deleted"> </vnicEtherIf> '
|
||||
'<vnicEtherIf defaultNet="yes" name="New Vlan" '
|
||||
'rn="if-New Vlan" > </vnicEtherIf> </vnicProfile> '
|
||||
'</pair></inConfigs> </configConfMos>')
|
||||
|
||||
DELETE_VLAN_OUTPUT = ("<configConfMos cookie=\"cookie_placeholder\" "
|
||||
"inHierarchical=\"true\"> <inConfigs><pair key=\"fabric/lan/net-New Vlan\"> "
|
||||
"<fabricVlan dn=\"fabric/lan/net-New Vlan\" status=\"deleted\"> "
|
||||
"</fabricVlan> </pair> </inConfigs></configConfMos>")
|
||||
DELETE_VLAN_OUTPUT = ('<configConfMos cookie="cookie_placeholder" '
|
||||
'inHierarchical="true"> <inConfigs><pair '
|
||||
'key="fabric/lan/net-New Vlan"> '
|
||||
'<fabricVlan dn="fabric/lan/net-New Vlan" '
|
||||
'status="deleted"> </fabricVlan> '
|
||||
'</pair> </inConfigs></configConfMos>')
|
||||
|
||||
DELETE_PROFILE_OUTPUT = ("<configConfMos cookie=\"cookie_placeholder\" "
|
||||
"inHierarchical=\"false\"> <inConfigs><pair key=\""
|
||||
"fabric/lan/profiles/vnic-New Profile\"> <vnicProfile "
|
||||
"dn=\"fabric/lan/profiles/vnic-New Profile\" status=\"deleted\"> "
|
||||
"</vnicProfile></pair> </inConfigs> </configConfMos>")
|
||||
DELETE_PROFILE_OUTPUT = ('<configConfMos cookie="cookie_placeholder" '
|
||||
'inHierarchical="false"> <inConfigs><pair key="'
|
||||
'fabric/lan/profiles/vnic-New Profile"> <vnicProfile '
|
||||
'dn="fabric/lan/profiles/vnic-New Profile" '
|
||||
'status="deleted"> </vnicProfile></pair> '
|
||||
'</inConfigs> </configConfMos>')
|
||||
|
||||
ASSOCIATE_PROFILE_OUTPUT = ("<configConfMos cookie=\"cookie_placeholder\" "
|
||||
"inHierarchical=\"true\"> <inConfigs> <pair key="
|
||||
"\"fabric/lan/profiles/vnic-New Profile/cl-New Profile Client\">"
|
||||
" <vmVnicProfCl dcName=\".*\" descr=\"\" dn=\"fabric/lan/profiles/vnic-"
|
||||
"New Profile/cl-New Profile Client\"name=\"New Profile Client\" "
|
||||
"orgPath=\".*\" status=\"created\" swName=\"default$\"> </vmVnicProfCl>"
|
||||
"</pair> </inConfigs> </configConfMos>")
|
||||
ASSOCIATE_PROFILE_OUTPUT = ('<configConfMos cookie="cookie_placeholder" '
|
||||
'inHierarchical="true"> <inConfigs> <pair key='
|
||||
'"fabric/lan/profiles/vnic-New Profile/cl-New '
|
||||
'Profile Client"> <vmVnicProfCl dcName=".*" '
|
||||
'descr="" dn="fabric/lan/profiles/vnic-'
|
||||
'New Profile/cl-New Profile Client"name="New '
|
||||
'Profile Client" orgPath=".*" status="created" '
|
||||
'swName="default$"> </vmVnicProfCl>'
|
||||
'</pair> </inConfigs> </configConfMos>')
|
||||
|
||||
|
||||
class TestUCSDriver(unittest.TestCase):
|
||||
|
@ -94,8 +107,8 @@ class TestUCSDriver(unittest.TestCase):
|
|||
self.assertEqual(vlan_details, expected_output)
|
||||
LOG.debug("test_create_vlan - END")
|
||||
|
||||
def test_create_profile_post_data(
|
||||
self, expected_output=CREATE_PROFILE_OUTPUT):
|
||||
def test_create_profile_post_data(self,
|
||||
expected_output=CREATE_PROFILE_OUTPUT):
|
||||
"""
|
||||
Tests creation of profile post Data
|
||||
"""
|
||||
|
@ -106,8 +119,8 @@ class TestUCSDriver(unittest.TestCase):
|
|||
self.assertEqual(profile_details, expected_output)
|
||||
LOG.debug("test_create_profile_post - END")
|
||||
|
||||
def test_change_vlan_profile_data(
|
||||
self, expected_output=CHANGE_VLAN_OUTPUT):
|
||||
def test_change_vlan_profile_data(self,
|
||||
expected_output=CHANGE_VLAN_OUTPUT):
|
||||
"""
|
||||
Tests creation of change vlan in profile post Data
|
||||
"""
|
||||
|
@ -146,8 +159,9 @@ class TestUCSDriver(unittest.TestCase):
|
|||
self.assertEqual(profile_delete_details, expected_output)
|
||||
LOG.debug("test_create_profile_post - END")
|
||||
|
||||
def test_create_profile_client_data(
|
||||
self, expected_output=ASSOCIATE_PROFILE_OUTPUT):
|
||||
def test_create_profile_client_data(self,
|
||||
expected_output=
|
||||
ASSOCIATE_PROFILE_OUTPUT):
|
||||
"""
|
||||
Tests creation of profile client post Data
|
||||
"""
|
||||
|
|
|
@ -27,7 +27,7 @@ from quantum.plugins.cisco.db import l2network_db as cdb
|
|||
from quantum.plugins.cisco import l2network_plugin_configuration as conf
|
||||
from quantum.plugins.cisco.segmentation.l2network_vlan_mgr import (
|
||||
L2NetworkVLANMgr,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.WARN)
|
||||
|
|
|
@ -66,7 +66,7 @@ import logging
|
|||
from quantum.common import exceptions as exc
|
||||
from quantum.plugins.cisco.l2device_inventory_base import (
|
||||
L2NetworkDeviceInventoryBase,
|
||||
)
|
||||
)
|
||||
from quantum.plugins.cisco.common import cisco_constants as const
|
||||
from quantum.plugins.cisco.common import cisco_credentials as cred
|
||||
from quantum.plugins.cisco.common import cisco_exceptions as cexc
|
||||
|
@ -74,7 +74,7 @@ from quantum.plugins.cisco.db import api as db
|
|||
from quantum.plugins.cisco.db import ucs_db as udb
|
||||
from quantum.plugins.cisco.ucs import (
|
||||
cisco_ucs_inventory_configuration as conf,
|
||||
)
|
||||
)
|
||||
from quantum.plugins.cisco.ucs import cisco_ucs_network_driver
|
||||
|
||||
|
||||
|
@ -198,8 +198,8 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
|
|||
# need to change it, and also load the state from the DB for
|
||||
# other associations
|
||||
intf_data = blade_intf_data[blade_intf]
|
||||
if (intf_data[const.BLADE_INTF_RESERVATION] ==
|
||||
const.BLADE_INTF_UNRESERVED):
|
||||
if ((intf_data[const.BLADE_INTF_RESERVATION] == const.
|
||||
BLADE_INTF_UNRESERVED)):
|
||||
unreserved_counter -= 1
|
||||
intf_data[const.BLADE_INTF_RESERVATION] = (
|
||||
const.BLADE_INTF_RESERVED)
|
||||
|
@ -398,8 +398,8 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
|
|||
blade_data = ucsm[chassis_id][blade_id]
|
||||
blade_intf_data = blade_data[const.BLADE_INTF_DATA]
|
||||
for blade_intf in blade_intf_data.keys():
|
||||
if (not blade_intf_data[blade_intf][const.PORTID] or
|
||||
not blade_intf_data[blade_intf][const.TENANTID]):
|
||||
if ((not blade_intf_data[blade_intf][const.PORTID] or
|
||||
not blade_intf_data[blade_intf][const.TENANTID])):
|
||||
continue
|
||||
intf_data = blade_intf_data[blade_intf]
|
||||
if (intf_data[const.BLADE_INTF_RESERVATION] ==
|
||||
|
@ -430,8 +430,8 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
|
|||
for chassis_id in ucsm.keys():
|
||||
for blade_id in ucsm[chassis_id]:
|
||||
blade_data = ucsm[chassis_id][blade_id]
|
||||
if (blade_data[const.BLADE_UNRESERVED_INTF_COUNT] >
|
||||
unreserved_interface_count):
|
||||
if ((blade_data[const.BLADE_UNRESERVED_INTF_COUNT] >
|
||||
unreserved_interface_count)):
|
||||
unreserved_interface_count = (
|
||||
blade_data[const.BLADE_UNRESERVED_INTF_COUNT])
|
||||
least_reserved_blade_ucsm = ucsm_ip
|
||||
|
|
|
@ -48,89 +48,90 @@ HEADERS = {"Content-Type": "text/xml"}
|
|||
METHOD = "POST"
|
||||
URL = "/nuova"
|
||||
|
||||
CREATE_VLAN = "<configConfMos cookie=\"" + COOKIE_VALUE + \
|
||||
"\" inHierarchical=\"true\"> <inConfigs>" \
|
||||
"<pair key=\"fabric/lan/net-" + VLAN_NAME + \
|
||||
"\"> <fabricVlan defaultNet=\"no\" " \
|
||||
"dn=\"fabric/lan/net-" + VLAN_NAME + \
|
||||
"\" id=\"" + VLAN_ID + "\" name=\"" + \
|
||||
VLAN_NAME + "\" status=\"created\">" \
|
||||
"</fabricVlan> </pair> </inConfigs> </configConfMos>"
|
||||
CREATE_VLAN = ('<configConfMos cookie="' + COOKIE_VALUE +
|
||||
'" inHierarchical="true"> <inConfigs>'
|
||||
'<pair key="fabric/lan/net-"' + VLAN_NAME +
|
||||
'"> <fabricVlan defaultNet="no" '
|
||||
'dn="fabric/lan/net-' + VLAN_NAME +
|
||||
'" id="' + VLAN_ID + '" name="' +
|
||||
VLAN_NAME + '" status="created">'
|
||||
'</fabricVlan> </pair> </inConfigs> </configConfMos>')
|
||||
|
||||
CREATE_PROFILE = "<configConfMos cookie=\"" + COOKIE_VALUE + \
|
||||
"\" inHierarchical=\"true\"> <inConfigs>" \
|
||||
"<pair key=\"fabric/lan/profiles/vnic-" + PROFILE_NAME + \
|
||||
"\"> <vnicProfile descr=\"Profile created by " \
|
||||
"Cisco OpenStack Quantum Plugin\" " \
|
||||
"dn=\"fabric/lan/profiles/vnic-" + PROFILE_NAME + \
|
||||
"\" maxPorts=\"64\" name=\"" + PROFILE_NAME + \
|
||||
"\" nwCtrlPolicyName=\"\" pinToGroupName=\"\" " \
|
||||
"qosPolicyName=\"\" status=\"created\"> " \
|
||||
"<vnicEtherIf defaultNet=\"yes\" name=\"" + VLAN_NAME + \
|
||||
"\" rn=\"if-" + VLAN_NAME + "\" > </vnicEtherIf> " \
|
||||
"</vnicProfile> </pair> </inConfigs> </configConfMos>"
|
||||
CREATE_PROFILE = ('<configConfMos cookie="' + COOKIE_VALUE +
|
||||
'" inHierarchical="true"> <inConfigs>'
|
||||
'<pair key="fabric/lan/profiles/vnic-' + PROFILE_NAME +
|
||||
'"> <vnicProfile descr="Profile created by '
|
||||
'Cisco OpenStack Quantum Plugin" '
|
||||
'dn="fabric/lan/profiles/vnic' + PROFILE_NAME +
|
||||
'" maxPorts="64" name="' + PROFILE_NAME +
|
||||
'" nwCtrlPolicyName="" pinToGroupName="" '
|
||||
'qosPolicyName="" status="created"> '
|
||||
'<vnicEtherIf defaultNet="yes" name="' + VLAN_NAME +
|
||||
'" rn="if' + VLAN_NAME + '" > </vnicEtherIf> '
|
||||
'</vnicProfile> </pair> </inConfigs> </configConfMos>')
|
||||
|
||||
ASSOCIATE_PROFILE = "<configConfMos cookie=\"" + COOKIE_VALUE + \
|
||||
"\" inHierarchical=\"true\"> <inConfigs> <pair " \
|
||||
"key=\"fabric/lan/profiles/vnic-" + PROFILE_NAME + \
|
||||
"/cl-" + PROFILE_CLIENT + "\"> <vmVnicProfCl dcName=\".*\" " \
|
||||
"descr=\"\" dn=\"fabric/lan/profiles/vnic-" + \
|
||||
PROFILE_NAME + "/cl-" + PROFILE_CLIENT + \
|
||||
"\"name=\"" + PROFILE_CLIENT + "\" orgPath=\".*\" " \
|
||||
"status=\"created\" swName=\"default$\"> </vmVnicProfCl>" \
|
||||
"</pair> </inConfigs> </configConfMos>"
|
||||
ASSOCIATE_PROFILE = ('<configConfMos cookie="' + COOKIE_VALUE +
|
||||
'" inHierarchical="true"> <inConfigs> <pair '
|
||||
'key="fabric/lan/profiles/vnic' + PROFILE_NAME +
|
||||
'/cl' + PROFILE_CLIENT + '"> <vmVnicProfCl dcName=".*" '
|
||||
'descr="" dn="fabric/lan/profiles/vnic' +
|
||||
PROFILE_NAME + '/cl' + PROFILE_CLIENT +
|
||||
'"name="' + PROFILE_CLIENT + '" orgPath=".*" '
|
||||
'status="created" swName="default$"> </vmVnicProfCl>'
|
||||
'</pair> </inConfigs> </configConfMos>')
|
||||
|
||||
CHANGE_VLAN_IN_PROFILE = "<configConfMos cookie=\"" + COOKIE_VALUE + \
|
||||
"\" inHierarchical=\"true\"> <inConfigs>" \
|
||||
"<pair key=\"fabric/lan/profiles/vnic-" + \
|
||||
PROFILE_NAME + "\"> <vnicProfile descr=\"Profile " \
|
||||
"created by Cisco OpenStack Quantum Plugin\" " \
|
||||
"dn=\"fabric/lan/profiles/vnic-" + \
|
||||
PROFILE_NAME + "\" maxPorts=\"64\" name=\"" + \
|
||||
PROFILE_NAME + "\" nwCtrlPolicyName=\"\" " \
|
||||
"pinToGroupName=\"\" qosPolicyName=\"\" " \
|
||||
"status=\"created,modified\">" \
|
||||
"<vnicEtherIf rn=\"if-" + OLD_VLAN_NAME + \
|
||||
"\" status=\"deleted\"> </vnicEtherIf> <vnicEtherIf " \
|
||||
"defaultNet=\"yes\" name=\"" + \
|
||||
VLAN_NAME + "\" rn=\"if-" + VLAN_NAME + \
|
||||
"\" > </vnicEtherIf> </vnicProfile> </pair>" \
|
||||
"</inConfigs> </configConfMos>"
|
||||
CHANGE_VLAN_IN_PROFILE = ('<configConfMos cookie="' + COOKIE_VALUE +
|
||||
'" inHierarchical="true"> <inConfigs'
|
||||
'<pair key="fabric/lan/profiles/vnic' +
|
||||
PROFILE_NAME + '"> <vnicProfile descr="Profile'
|
||||
'created by Cisco OpenStack Quantum Plugin"'
|
||||
'dn="fabric/lan/profiles/vnic' +
|
||||
PROFILE_NAME + '" maxPorts="64" name="' +
|
||||
PROFILE_NAME + '" nwCtrlPolicyName=""'
|
||||
'pinToGroupName="" qosPolicyName=""'
|
||||
'status="created,modified"'
|
||||
'<vnicEtherIf rn="if' + OLD_VLAN_NAME +
|
||||
'" status="deleted"> </vnicEtherIf> <vnicEtherIf'
|
||||
'defaultNet="yes" name="' +
|
||||
VLAN_NAME + '" rn="if' + VLAN_NAME +
|
||||
'" > </vnicEtherIf> </vnicProfile> </pair'
|
||||
'</inConfigs> </configConfMos>')
|
||||
|
||||
DELETE_VLAN = "<configConfMos cookie=\"" + COOKIE_VALUE + \
|
||||
"\" inHierarchical=\"true\"> <inConfigs>" \
|
||||
"<pair key=\"fabric/lan/net-" + VLAN_NAME + \
|
||||
"\"> <fabricVlan dn=\"fabric/lan/net-" + VLAN_NAME + \
|
||||
"\" status=\"deleted\"> </fabricVlan> </pair> </inConfigs>" \
|
||||
"</configConfMos>"
|
||||
DELETE_VLAN = ('<configConfMos cookie="' + COOKIE_VALUE +
|
||||
'" inHierarchical="true"> <inConfigs'
|
||||
'<pair key="fabric/lan/net' + VLAN_NAME +
|
||||
'"> <fabricVlan dn="fabric/lan/net' + VLAN_NAME +
|
||||
'" status="deleted"> </fabricVlan> </pair> </inConfigs'
|
||||
'</configConfMos')
|
||||
|
||||
DELETE_PROFILE = "<configConfMos cookie=\"" + COOKIE_VALUE + \
|
||||
"\" inHierarchical=\"false\"> <inConfigs>" \
|
||||
"<pair key=\"fabric/lan/profiles/vnic-" + PROFILE_NAME + \
|
||||
"\"> <vnicProfile dn=\"fabric/lan/profiles/vnic-" + \
|
||||
PROFILE_NAME + "\" status=\"deleted\"> </vnicProfile>" \
|
||||
"</pair> </inConfigs> </configConfMos>"
|
||||
DELETE_PROFILE = ('<configConfMos cookie="' + COOKIE_VALUE +
|
||||
'" inHierarchical="false"> <inConfigs'
|
||||
'<pair key="fabric/lan/profiles/vnic' + PROFILE_NAME +
|
||||
'"> <vnicProfile dn="fabric/lan/profiles/vnic' +
|
||||
PROFILE_NAME + '" status="deleted"> </vnicProfile'
|
||||
'</pair> </inConfigs> </configConfMos')
|
||||
|
||||
GET_BLADE_INTERFACE_STATE = "<configScope cookie=\"" + COOKIE_VALUE + \
|
||||
"\" dn=\"" + BLADE_DN_VALUE + "\" inClass=\"dcxVIf\" " + \
|
||||
"inHierarchical=\"false\" inRecursive=\"false\"> " + \
|
||||
"<inFilter> </inFilter> </configScope>"
|
||||
GET_BLADE_INTERFACE_STATE = ('<configScope cookie="' + COOKIE_VALUE +
|
||||
'" dn="' + BLADE_DN_VALUE + '" inClass="dcxVIf"' +
|
||||
'inHierarchical="false" inRecursive="false">' +
|
||||
'<inFilter> </inFilter> </configScope')
|
||||
|
||||
GET_BLADE_INTERFACE = "<configResolveClass cookie=\"" + COOKIE_VALUE + \
|
||||
"\" classId=\"vnicEther\"" + \
|
||||
" inHierarchical=\"false\">" + \
|
||||
" <inFilter> <eq class=\"vnicEther\" property=\"equipmentDn\"" + \
|
||||
" value=\"sys/chassis-" + CHASSIS_VALUE + "/blade-" + \
|
||||
BLADE_VALUE + "/adaptor-1/host-eth-?\"/> " + \
|
||||
"</inFilter> </configResolveClass>"
|
||||
GET_BLADE_INTERFACE = ('<configResolveClass cookie="' + COOKIE_VALUE +
|
||||
'" classId="vnicEther"' +
|
||||
' inHierarchical="false"' +
|
||||
' <inFilter> <eq class="vnicEther" ' +
|
||||
'property="equipmentDn"' +
|
||||
' value="sys/chassis' + CHASSIS_VALUE + '/blade' +
|
||||
BLADE_VALUE + '/adaptor-1/host-eth-?"/>' +
|
||||
'</inFilter> </configResolveClass')
|
||||
|
||||
# TODO (Sumit): Assumes "adaptor-1", check if this has to be discovered too
|
||||
GET_BLADE_INTERFACES = "<configResolveChildren cookie=\"" + \
|
||||
COOKIE_VALUE + "\" inDn=\"sys/chassis-" + \
|
||||
CHASSIS_VALUE + "/blade-" + BLADE_VALUE + \
|
||||
"/adaptor-1\"" + \
|
||||
" inHierarchical=\"false\"> <inFilter> </inFilter>" + \
|
||||
" </configResolveChildren>"
|
||||
GET_BLADE_INTERFACES = ('<configResolveChildren cookie="' +
|
||||
COOKIE_VALUE + '" inDn="sys/chassis' +
|
||||
CHASSIS_VALUE + '/blade' + BLADE_VALUE +
|
||||
'/adaptor-1"' +
|
||||
' inHierarchical="false"> <inFilter> </inFilter' +
|
||||
' </configResolveChildren')
|
||||
|
||||
|
||||
class CiscoUCSMDriver():
|
||||
|
@ -240,9 +241,8 @@ class CiscoUCSMDriver():
|
|||
def _get_blade_interface_state(self, blade_intf, ucsm_ip,
|
||||
ucsm_username, ucsm_password):
|
||||
"""Create command"""
|
||||
data = (
|
||||
self._get_blade_intf_st_post_data(blade_intf[const.BLADE_INTF_DN])
|
||||
)
|
||||
data = (self._get_blade_intf_st_post_data(
|
||||
blade_intf[const.BLADE_INTF_DN]))
|
||||
response = self._post_data(ucsm_ip, ucsm_username, ucsm_password, data)
|
||||
elements = et.XML(response).find("outConfigs").findall("dcxVIf")
|
||||
for element in elements:
|
||||
|
@ -295,8 +295,8 @@ class CiscoUCSMDriver():
|
|||
self._get_blade_interface_state(blade_interfaces[blade_intf],
|
||||
ucsm_ip, ucsm_username,
|
||||
ucsm_password)
|
||||
if blade_interfaces[blade_intf][const.BLADE_INTF_INST_TYPE] != \
|
||||
const.BLADE_INTF_DYNAMIC:
|
||||
if ((blade_interfaces[blade_intf][const.BLADE_INTF_INST_TYPE] !=
|
||||
const.BLADE_INTF_DYNAMIC)):
|
||||
blade_interfaces.pop(blade_intf)
|
||||
|
||||
return blade_interfaces
|
||||
|
|
|
@ -252,8 +252,8 @@ class UCSVICPlugin(L2DevicePluginBase):
|
|||
return udb.update_portbinding(port_id, vlan_name=new_vlan_name,
|
||||
vlan_id=conf.DEFAULT_VLAN_ID)
|
||||
|
||||
def create_multiport(self, tenant_id, net_id_list, ports_num, port_id_list,
|
||||
**kwargs):
|
||||
def create_multiport(self, tenant_id, net_id_list, ports_num,
|
||||
port_id_list, **kwargs):
|
||||
"""
|
||||
Creates a port on the specified Virtual Network.
|
||||
"""
|
||||
|
|
|
@ -463,7 +463,8 @@ def main():
|
|||
usagestr = "%prog [OPTIONS] <config file>"
|
||||
parser = OptionParser(usage=usagestr)
|
||||
parser.add_option("-v", "--verbose", dest="verbose",
|
||||
action="store_true", default=False, help="turn on verbose logging")
|
||||
action="store_true", default=False,
|
||||
help="turn on verbose logging")
|
||||
|
||||
options, args = parser.parse_args()
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@ def create_vlanids():
|
|||
start = CONF.VLANS.vlan_start
|
||||
end = CONF.VLANS.vlan_end
|
||||
try:
|
||||
vlanid = session.query(l2network_models.VlanID).\
|
||||
one()
|
||||
vlanid = session.query(l2network_models.VlanID).one()
|
||||
except exc.MultipleResultsFound:
|
||||
"""
|
||||
TODO (Sumit): Salvatore rightly points out that this will not handle
|
||||
|
|
|
@ -29,7 +29,7 @@ import quantum.db.api as db
|
|||
from quantum.plugins.linuxbridge import LinuxBridgePlugin
|
||||
from quantum.plugins.linuxbridge.agent import (
|
||||
linuxbridge_quantum_agent as linux_agent,
|
||||
)
|
||||
)
|
||||
from quantum.plugins.linuxbridge.common import constants as lconst
|
||||
from quantum.plugins.linuxbridge.db import l2network_db as cdb
|
||||
|
||||
|
@ -39,9 +39,10 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
class LinuxBridgeAgentTest(unittest.TestCase):
|
||||
|
||||
def test_add_gateway_interface(
|
||||
self, tenant_id="test_tenant", network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-b9e6-7313d1c522cc',
|
||||
def test_add_gateway_interface(self, tenant_id="test_tenant",
|
||||
network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-'
|
||||
'b9e6-7313d1c522cc',
|
||||
mac_address='fe:16:3e:51:60:dd'):
|
||||
|
||||
LOG.debug("test_tap_gateway_interface - START")
|
||||
|
@ -77,9 +78,10 @@ class LinuxBridgeAgentTest(unittest.TestCase):
|
|||
|
||||
LOG.debug("test_add_gateway_interface - END")
|
||||
|
||||
def test_add_tap_interface(
|
||||
self, tenant_id="test_tenant", network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-b9e6-7313d1c522cc',
|
||||
def test_add_tap_interface(self, tenant_id="test_tenant",
|
||||
network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-'
|
||||
'b9e6-7313d1c522cc',
|
||||
mac_address='fe:16:3e:51:60:dd'):
|
||||
|
||||
LOG.debug("test_add_tap_interface - START")
|
||||
|
@ -115,9 +117,10 @@ class LinuxBridgeAgentTest(unittest.TestCase):
|
|||
|
||||
LOG.debug("test_add_tap_interface -END")
|
||||
|
||||
def test_remove_interface(
|
||||
self, tenant_id="test_tenant", network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-b9e6-7313d1c522cc',
|
||||
def test_remove_interface(self, tenant_id="test_tenant",
|
||||
network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-'
|
||||
'b9e6-7313d1c522cc',
|
||||
mac_address='fe:16:3e:51:60:dd'):
|
||||
|
||||
LOG.debug("test_remove_interface - START")
|
||||
|
@ -158,10 +161,10 @@ class LinuxBridgeAgentTest(unittest.TestCase):
|
|||
|
||||
LOG.debug("test_remove_interface -END")
|
||||
|
||||
def test_ensure_vlan_bridge(
|
||||
self, tenant_id="test_tenant",
|
||||
def test_ensure_vlan_bridge(self, tenant_id="test_tenant",
|
||||
network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-b9e6-7313d1c522cc'):
|
||||
interface_id='fe701ddf-26a2-42ea-'
|
||||
'b9e6-7313d1c522cc'):
|
||||
|
||||
LOG.debug("test_ensure_vlan_bridge - START")
|
||||
new_network = (
|
||||
|
@ -195,9 +198,10 @@ class LinuxBridgeAgentTest(unittest.TestCase):
|
|||
|
||||
LOG.debug("test_ensure_vlan_bridge -END")
|
||||
|
||||
def test_delete_vlan_bridge(
|
||||
self, tenant_id="test_tenant", network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-b9e6-7313d1c522cc'):
|
||||
def test_delete_vlan_bridge(self, tenant_id="test_tenant",
|
||||
network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-'
|
||||
'b9e6-7313d1c522cc'):
|
||||
|
||||
LOG.debug("test_delete_vlan_bridge - START")
|
||||
new_network = (
|
||||
|
@ -224,9 +228,10 @@ class LinuxBridgeAgentTest(unittest.TestCase):
|
|||
|
||||
LOG.debug("test_delete_vlan_bridge - END")
|
||||
|
||||
def test_process_deleted_networks(
|
||||
self, tenant_id="test_tenant", network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-b9e6-7313d1c522cc'):
|
||||
def test_process_deleted_networks(self, tenant_id="test_tenant",
|
||||
network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-'
|
||||
'b9e6-7313d1c522cc'):
|
||||
|
||||
LOG.debug("test_delete_vlan_bridge - START")
|
||||
new_network = (
|
||||
|
@ -254,9 +259,11 @@ class LinuxBridgeAgentTest(unittest.TestCase):
|
|||
self.assertEquals(self.device_exists(bridge_name), False)
|
||||
LOG.debug("test_delete_vlan_bridge - END")
|
||||
|
||||
def test_process_unplugged_tap_interface(
|
||||
self, tenant_id="test_tenant", network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-b9e6-7313d1c522cc',
|
||||
def test_process_unplugged_tap_interface(self, tenant_id="test_tenant",
|
||||
network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-'
|
||||
'42ea-b9e6-'
|
||||
'7313d1c522cc',
|
||||
mac_address='fe:16:3e:51:60:dd'):
|
||||
|
||||
LOG.debug("test_process_unplugged_tap_interface - START")
|
||||
|
@ -278,8 +285,8 @@ class LinuxBridgeAgentTest(unittest.TestCase):
|
|||
self._linuxbridge_quantum_agent.process_port_binding(
|
||||
new_port[lconst.PORT_ID], new_network[lconst.NET_ID],
|
||||
interface_id, str(vlan_id))
|
||||
list_interface = self._linuxbridge_quantum_agent.linux_br.\
|
||||
get_interfaces_on_bridge(bridge_name)
|
||||
list_interface = (self._linuxbridge_quantum_agent.linux_br.
|
||||
get_interfaces_on_bridge(bridge_name))
|
||||
self._linuxbridge_plugin.unplug_interface(tenant_id,
|
||||
new_network[lconst.NET_ID],
|
||||
new_port[lconst.PORT_ID])
|
||||
|
@ -300,8 +307,8 @@ class LinuxBridgeAgentTest(unittest.TestCase):
|
|||
|
||||
LOG.debug("test_test_process_unplugged_tap_interface -END")
|
||||
|
||||
def test_process_unplugged_interface_empty(
|
||||
self, tenant_id="test_tenant", network_name="test_network"):
|
||||
def test_process_unplugged_interface_empty(self, tenant_id="test_tenant",
|
||||
network_name="test_network"):
|
||||
""" test to unplug not plugged port. It should not raise exception
|
||||
"""
|
||||
LOG.debug("test_process_unplugged_interface_empty - START")
|
||||
|
@ -317,9 +324,10 @@ class LinuxBridgeAgentTest(unittest.TestCase):
|
|||
|
||||
LOG.debug("test_process_unplugged_interface_empty -END")
|
||||
|
||||
def test_process_unplugged_gw_interface(
|
||||
self, tenant_id="test_tenant", network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-b9e6-7313d1c522cc',
|
||||
def test_process_unplugged_gw_interface(self, tenant_id="test_tenant",
|
||||
network_name="test_network",
|
||||
interface_id='fe701ddf-26a2-42ea-'
|
||||
'b9e6-7313d1c522cc',
|
||||
mac_address='fe:16:3e:51:60:dd'):
|
||||
|
||||
LOG.debug("test_process_unplugged_gw_interface - START")
|
||||
|
|
|
@ -563,8 +563,9 @@ class NvpPlugin(object):
|
|||
"""
|
||||
if not nvplib.check_tenant(self.controller, netw_id, tenant_id):
|
||||
raise exception.NetworkNotFound(net_id=netw_id)
|
||||
result = nvplib.plug_interface(self.controller, netw_id, portw_id,
|
||||
"VifAttachment", attachment=remote_interface_id)
|
||||
result = nvplib.plug_interface(self.controller, netw_id,
|
||||
portw_id, "VifAttachment",
|
||||
attachment=remote_interface_id)
|
||||
LOG.debug("plug_interface() completed for %s: %s" %
|
||||
(tenant_id, result))
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import eventlet
|
|||
|
||||
from quantum.plugins.nicira.nicira_nvp_plugin.api_client.common import (
|
||||
_conn_str,
|
||||
)
|
||||
)
|
||||
import quantum.plugins.nicira.nicira_nvp_plugin.api_client.client as client
|
||||
import quantum.plugins.nicira.nicira_nvp_plugin.api_client.request_eventlet
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ from eventlet import timeout
|
|||
from quantum.openstack.common import jsonutils
|
||||
from quantum.plugins.nicira.nicira_nvp_plugin.api_client.common import (
|
||||
_conn_str,
|
||||
)
|
||||
)
|
||||
import quantum.plugins.nicira.nicira_nvp_plugin.api_client.request as request
|
||||
import quantum.plugins.nicira.nicira_nvp_plugin.api_client.client_eventlet
|
||||
|
||||
|
@ -280,8 +280,8 @@ class NvpApiRequestEventlet:
|
|||
LOG.debug('req: %s' % type(req))
|
||||
|
||||
if isinstance(req, httplib.HTTPResponse):
|
||||
if (req.status == httplib.UNAUTHORIZED
|
||||
or req.status == httplib.FORBIDDEN):
|
||||
if ((req.status == httplib.UNAUTHORIZED
|
||||
or req.status == httplib.FORBIDDEN)):
|
||||
self._api_client.need_login = True
|
||||
if attempt <= self._retries:
|
||||
continue
|
||||
|
|
|
@ -20,7 +20,7 @@ import sys
|
|||
from quantum.plugins.nicira.nicira_nvp_plugin import nvplib
|
||||
from quantum.plugins.nicira.nicira_nvp_plugin.QuantumPlugin import (
|
||||
NvpPlugin as QuantumManager,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
@ -31,8 +31,8 @@ def print_help():
|
|||
"""Help for CLI"""
|
||||
print "\nNVP Plugin Commands:"
|
||||
for key in COMMANDS.keys():
|
||||
print " %s %s" % (key,
|
||||
" ".join(["<%s>" % y for y in COMMANDS[key]["args"]]))
|
||||
print " %s %s" %
|
||||
(key, " ".join(["<%s>" % y for y in COMMANDS[key]["args"]]))
|
||||
|
||||
|
||||
def build_args(cmd, cmdargs, arglist):
|
||||
|
@ -46,14 +46,14 @@ def build_args(cmd, cmdargs, arglist):
|
|||
except:
|
||||
LOG.error("Not enough arguments for \"%s\" (expected: %d, got: %d)" % (
|
||||
cmd, len(cmdargs), len(orig_arglist)))
|
||||
print "Usage:\n %s %s" % (cmd,
|
||||
" ".join(["<%s>" % y for y in COMMANDS[cmd]["args"]]))
|
||||
print "Usage:\n %s %s" %
|
||||
(cmd, " ".join(["<%s>" % y for y in COMMANDS[cmd]["args"]]))
|
||||
sys.exit()
|
||||
if len(arglist) > 0:
|
||||
LOG.error("Too many arguments for \"%s\" (expected: %d, got: %d)" % (
|
||||
cmd, len(cmdargs), len(orig_arglist)))
|
||||
print "Usage:\n %s %s" % (cmd,
|
||||
" ".join(["<%s>" % y for y in COMMANDS[cmd]["args"]]))
|
||||
print "Usage:\n %s %s" %
|
||||
(cmd, " ".join(["<%s>" % y for y in COMMANDS[cmd]["args"]]))
|
||||
sys.exit()
|
||||
return args
|
||||
|
||||
|
@ -79,17 +79,19 @@ COMMANDS = {
|
|||
"check_config": {
|
||||
"need_login": True,
|
||||
"func": check_config,
|
||||
"args": []},
|
||||
}
|
||||
"args": []
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
usagestr = "Usage: %prog [OPTIONS] <command> [args]"
|
||||
PARSER = OptionParser(usage=usagestr)
|
||||
PARSER.add_option("-v", "--verbose", dest="verbose",
|
||||
action="store_true", default=False, help="turn on verbose logging")
|
||||
PARSER.add_option("-c", "--configfile", dest="configfile",
|
||||
type="string", default="/etc/quantum/plugins/nvp/nvp.ini",
|
||||
action="store_true", default=False,
|
||||
help="turn on verbose logging")
|
||||
PARSER.add_option("-c", "--configfile", dest="configfile", type="string",
|
||||
default="/etc/quantum/plugins/nvp/nvp.ini",
|
||||
help="nvp plugin config file path (nvp.ini)")
|
||||
options, args = PARSER.parse_args()
|
||||
|
||||
|
|
|
@ -182,12 +182,10 @@ def create_network(tenant_id, net_name, **kwargs):
|
|||
transport_type = kwargs.get("transport_type", "gre")
|
||||
lswitch_obj = {
|
||||
"display_name": net_name,
|
||||
"transport_zones": [
|
||||
{
|
||||
"transport_zones": [{
|
||||
"zone_uuid": transport_zone,
|
||||
"transport_type": transport_type,
|
||||
},
|
||||
],
|
||||
}],
|
||||
"tags": [{"tag": tenant_id, "scope": "os_tid"}],
|
||||
}
|
||||
|
||||
|
@ -237,8 +235,7 @@ def query_ports(controller, network, relations=None, fields="*", filters=None):
|
|||
if filters and "attachment" in filters:
|
||||
uri += "&attachment_vif_uuid=%s" % filters["attachment"]
|
||||
try:
|
||||
resp_obj = do_single_request("GET", uri,
|
||||
controller=controller)
|
||||
resp_obj = do_single_request("GET", uri, controller=controller)
|
||||
except NvpApiClient.ResourceNotFound as e:
|
||||
LOG.error("Network not found, Error: %s" % str(e))
|
||||
raise exception.NetworkNotFound(net_id=network)
|
||||
|
@ -259,9 +256,8 @@ def delete_port(controller, network, port):
|
|||
|
||||
|
||||
def delete_all_ports(controller, ls_uuid):
|
||||
res = do_single_request("GET",
|
||||
"/ws.v1/lswitch/%s/lport?fields=uuid" % ls_uuid,
|
||||
controller=controller)
|
||||
res = do_single_request("GET", "/ws.v1/lswitch/%s/lport?fields=uuid" %
|
||||
ls_uuid, controller=controller)
|
||||
res = jsonutils.loads(res)
|
||||
for r in res["results"]:
|
||||
do_single_request(
|
||||
|
|
|
@ -19,7 +19,7 @@ import unittest
|
|||
from quantum.plugins.nicira.nicira_nvp_plugin.QuantumPlugin import (
|
||||
NVPCluster,
|
||||
parse_config,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class ConfigParserTest(unittest.TestCase):
|
||||
|
|
|
@ -25,7 +25,7 @@ from quantum.plugins.nicira.nicira_nvp_plugin.QuantumPlugin import NvpPlugin
|
|||
from quantum.plugins.nicira.nicira_nvp_plugin import (
|
||||
NvpApiClient,
|
||||
nvplib,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
@ -55,8 +55,8 @@ class NvpTests(unittest.TestCase):
|
|||
body = {"display_name": name,
|
||||
"tags": [{"tag": "plugin-test"}]}
|
||||
try:
|
||||
resp_obj = self.quantum.api_client.request("POST",
|
||||
post_uri, jsonutils.dumps(body))
|
||||
resp_obj = self.quantum.api_client.request("POST", post_uri,
|
||||
jsonutils.dumps(body))
|
||||
except NvpApiClient.NvpApiException as e:
|
||||
print("Unknown API Error: %s" % str(e))
|
||||
raise exception.QuantumException()
|
||||
|
|
|
@ -26,7 +26,7 @@ from mock import patch
|
|||
from quantum.plugins.nicira.nicira_nvp_plugin.api_client import (
|
||||
client_eventlet as nace,
|
||||
request_eventlet as nare,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
|
|
@ -24,7 +24,7 @@ from quantum.plugins.nicira.nicira_nvp_plugin.QuantumPlugin import NvpPlugin
|
|||
from quantum.plugins.nicira.nicira_nvp_plugin import (
|
||||
NvpApiClient,
|
||||
nvplib,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
@ -202,9 +202,10 @@ class NvpTests(unittest.TestCase):
|
|||
self.assertTrue(True)
|
||||
|
||||
def test_create_multi_port_attachment(self):
|
||||
resp = self.quantum.create_custom_network(
|
||||
"quantum-test-tenant", "quantum-Private-TenantA",
|
||||
self.BRIDGE_TZ_UUID, self.quantum.controller)
|
||||
resp = self.quantum.create_custom_network("quantum-test-tenant",
|
||||
"quantum-Private-TenantA",
|
||||
self.BRIDGE_TZ_UUID,
|
||||
self.quantum.controller)
|
||||
net_id = resp["net-id"]
|
||||
|
||||
resp = self.quantum.create_port("quantum-test-tenant", net_id,
|
||||
|
@ -508,7 +509,8 @@ class NvpTests(unittest.TestCase):
|
|||
|
||||
# Make sure we only get the filtered ones back
|
||||
ports = self.quantum.get_all_ports("quantum-test-tenant", net_id,
|
||||
filter_opts={"attachment": "attachment2"})
|
||||
filter_opts={"attachment":
|
||||
"attachment2"})
|
||||
self.assertTrue(len(ports) == 1)
|
||||
self.assertTrue(ports[0]["port-id"] == port_id2)
|
||||
|
||||
|
|
|
@ -475,9 +475,9 @@ class OVSQuantumTunnelAgent(object):
|
|||
lsw_id = lsw_id_bindings[new_net_uuid]
|
||||
self.port_bound(p, new_net_uuid, lsw_id)
|
||||
all_bindings[p.vif_id].op_status = OP_STATUS_UP
|
||||
LOG.info("Port " + str(p) + " on net-id = "
|
||||
+ new_net_uuid + " bound to " +
|
||||
str(self.local_vlan_map[new_net_uuid]))
|
||||
LOG.info("Port %s on net-id = %s bound to %s " % (
|
||||
str(p), new_net_uuid,
|
||||
str(self.local_vlan_map[new_net_uuid])))
|
||||
|
||||
for vif_id in disappeared_vif_ports_ids:
|
||||
LOG.info("Port Disappeared: " + vif_id)
|
||||
|
@ -506,7 +506,8 @@ def main():
|
|||
usagestr = "%prog [OPTIONS] <config file>"
|
||||
parser = OptionParser(usage=usagestr)
|
||||
parser.add_option("-v", "--verbose", dest="verbose",
|
||||
action="store_true", default=False, help="turn on verbose logging")
|
||||
action="store_true", default=False,
|
||||
help="turn on verbose logging")
|
||||
|
||||
options, args = parser.parse_args()
|
||||
|
||||
|
|
|
@ -34,8 +34,7 @@ class VlanBinding(BASE):
|
|||
self.vlan_id = vlan_id
|
||||
|
||||
def __repr__(self):
|
||||
return "<VlanBinding(%s,%s)>" % \
|
||||
(self.vlan_id, self.network_id)
|
||||
return "<VlanBinding(%s,%s)>" % (self.vlan_id, self.network_id)
|
||||
|
||||
|
||||
class TunnelIP(BASE):
|
||||
|
|
|
@ -31,8 +31,8 @@ LV_IDS = [42, 43]
|
|||
LVM = ovs_quantum_agent.LocalVLANMapping(LV_ID, LS_ID, LV_IDS)
|
||||
VIF_ID = '404deaec-5d37-11e1-a64b-000c29d5f0a8'
|
||||
VIF_MAC = '3c:09:24:1e:78:23'
|
||||
VIF_PORT = ovs_lib.VifPort('port', 'ofport', VIF_ID, VIF_MAC,
|
||||
'switch')
|
||||
VIF_PORT = ovs_lib.VifPort('port', 'ofport',
|
||||
VIF_ID, VIF_MAC, 'switch')
|
||||
|
||||
|
||||
class DummyPort:
|
||||
|
@ -57,16 +57,14 @@ class TunnelTest(unittest.TestCase):
|
|||
self.TUN_OFPORT = 'PATCH_TUN_OFPORT'
|
||||
|
||||
self.mox.StubOutClassWithMocks(ovs_lib, 'OVSBridge')
|
||||
self.mock_int_bridge = ovs_lib.OVSBridge(self.INT_BRIDGE,
|
||||
'sudo')
|
||||
self.mock_int_bridge = ovs_lib.OVSBridge(self.INT_BRIDGE, 'sudo')
|
||||
self.mock_int_bridge.delete_port('patch-tun')
|
||||
self.mock_int_bridge.add_patch_port(
|
||||
'patch-tun', 'patch-int').AndReturn(self.TUN_OFPORT)
|
||||
self.mock_int_bridge.remove_all_flows()
|
||||
self.mock_int_bridge.add_flow(priority=1, actions='normal')
|
||||
|
||||
self.mock_tun_bridge = ovs_lib.OVSBridge(self.TUN_BRIDGE,
|
||||
'sudo')
|
||||
self.mock_tun_bridge = ovs_lib.OVSBridge(self.TUN_BRIDGE, 'sudo')
|
||||
self.mock_tun_bridge.reset_bridge()
|
||||
self.mock_tun_bridge.add_patch_port(
|
||||
'patch-int', 'patch-tun').AndReturn(self.INT_OFPORT)
|
||||
|
|
|
@ -19,7 +19,7 @@ import unittest
|
|||
from quantum.plugins.openvswitch.ovs_quantum_plugin import (
|
||||
NoFreeVLANException,
|
||||
VlanMap,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class VlanMapTest(unittest.TestCase):
|
||||
|
|
|
@ -271,7 +271,8 @@ def main():
|
|||
usagestr = "%prog [OPTIONS] <config file>"
|
||||
parser = OptionParser(usage=usagestr)
|
||||
parser.add_option("-v", "--verbose", dest="verbose",
|
||||
action="store_true", default=False, help="turn on verbose logging")
|
||||
action="store_true", default=False,
|
||||
help="turn on verbose logging")
|
||||
|
||||
options, args = parser.parse_args()
|
||||
|
||||
|
|
|
@ -72,9 +72,9 @@ class DnsmasqFilter(CommandFilter):
|
|||
"""Specific filter for the dnsmasq call (which includes env)"""
|
||||
|
||||
def match(self, userargs):
|
||||
if (userargs[0].startswith("FLAGFILE=") and
|
||||
if ((userargs[0].startswith("FLAGFILE=") and
|
||||
userargs[1].startswith("NETWORK_ID=") and
|
||||
userargs[2] == "dnsmasq"):
|
||||
userargs[2] == "dnsmasq")):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -43,4 +43,4 @@ filterlist = [
|
|||
# 'ip', 'tuntap'
|
||||
filters.CommandFilter("/usr/sbin/ip", "root"),
|
||||
filters.CommandFilter("/sbin/ip", "root"),
|
||||
]
|
||||
]
|
||||
|
|
|
@ -33,4 +33,4 @@ filterlist = [
|
|||
# "xe", "vif-param-get", ...
|
||||
filters.CommandFilter("/usr/bin/xe", "root"),
|
||||
filters.CommandFilter("/usr/sbin/xe", "root"),
|
||||
]
|
||||
]
|
||||
|
|
|
@ -28,4 +28,4 @@ filterlist = [
|
|||
# "xe", "vif-param-get", ...
|
||||
filters.CommandFilter("/usr/bin/xe", "root"),
|
||||
filters.CommandFilter("/usr/sbin/xe", "root"),
|
||||
]
|
||||
]
|
||||
|
|
|
@ -22,8 +22,7 @@ import sys
|
|||
|
||||
FILTERS_MODULES = ['quantum.rootwrap.linuxbridge-agent',
|
||||
'quantum.rootwrap.openvswitch-agent',
|
||||
'quantum.rootwrap.ryu-agent',
|
||||
]
|
||||
'quantum.rootwrap.ryu-agent']
|
||||
|
||||
|
||||
def load_filters():
|
||||
|
|
|
@ -219,8 +219,9 @@ class BaseAPIOperationsTest(AbstractAPITest):
|
|||
# Create a network and a port
|
||||
network_id = self._create_network(fmt)
|
||||
port_id = self._create_port(network_id, "ACTIVE", fmt)
|
||||
show_network_req = testlib.show_network_detail_request(
|
||||
self.tenant_id, network_id, fmt)
|
||||
show_network_req = testlib.show_network_detail_request(self.tenant_id,
|
||||
network_id,
|
||||
fmt)
|
||||
show_network_res = show_network_req.get_response(self.api)
|
||||
self.assertEqual(show_network_res.status_int, 200)
|
||||
network_data = self._deserialize_net_response(content_type,
|
||||
|
|
|
@ -62,7 +62,8 @@ class APITestV10(test_api.BaseAPIOperationsTest):
|
|||
test_api.NETS: nets.ControllerV10._serialization_metadata,
|
||||
test_api.PORTS: ports.ControllerV10._serialization_metadata,
|
||||
test_api.ATTS: atts.ControllerV10._serialization_metadata,
|
||||
})
|
||||
}
|
||||
)
|
||||
self._successful_create_code = exc.HTTPOk.code
|
||||
self._network_not_found_code = 420
|
||||
self._network_in_use_code = 421
|
||||
|
@ -112,7 +113,8 @@ class APITestV11(test_api.BaseAPIOperationsTest):
|
|||
test_api.NETS: nets.ControllerV11._serialization_metadata,
|
||||
test_api.PORTS: ports.ControllerV11._serialization_metadata,
|
||||
test_api.ATTS: atts.ControllerV11._serialization_metadata,
|
||||
})
|
||||
}
|
||||
)
|
||||
self._successful_create_code = exc.HTTPAccepted.code
|
||||
self._network_not_found_code = exc.HTTPNotFound.code
|
||||
self._network_in_use_code = exc.HTTPConflict.code
|
||||
|
@ -155,7 +157,8 @@ class APIFiltersTest(test_api.AbstractAPITest):
|
|||
test_api.NETS: nets.ControllerV11._serialization_metadata,
|
||||
test_api.PORTS: ports.ControllerV11._serialization_metadata,
|
||||
test_api.ATTS: atts.ControllerV11._serialization_metadata,
|
||||
})
|
||||
}
|
||||
)
|
||||
self._successful_create_code = exc.HTTPAccepted.code
|
||||
self.net_op_status = test_config.get('default_net_op_status',
|
||||
'UNKNOWN')
|
||||
|
|
|
@ -80,8 +80,7 @@ class QuantumDbPluginV2TestCase(unittest.TestCase):
|
|||
|
||||
def deserialize(self, content_type, response):
|
||||
ctype = 'application/%s' % content_type
|
||||
data = self._deserializers[ctype].\
|
||||
deserialize(response.body)['body']
|
||||
data = self._deserializers[ctype].deserialize(response.body)['body']
|
||||
return data
|
||||
|
||||
def _create_network(self, fmt, name, admin_status_up):
|
||||
|
|
|
@ -28,7 +28,7 @@ from quantum.extensions.extensions import (
|
|||
ExtensionManager,
|
||||
ExtensionMiddleware,
|
||||
PluginAwareExtensionManager,
|
||||
)
|
||||
)
|
||||
from quantum.openstack.common import jsonutils
|
||||
from quantum.plugins.sample.SamplePlugin import QuantumEchoPlugin
|
||||
from quantum.tests.unit import BaseTest
|
||||
|
@ -37,7 +37,7 @@ from quantum.tests.unit.extension_stubs import (
|
|||
StubBaseAppController,
|
||||
StubExtension,
|
||||
StubPlugin,
|
||||
)
|
||||
)
|
||||
import quantum.tests.unit.extensions
|
||||
from quantum import wsgi
|
||||
|
||||
|
|
|
@ -146,8 +146,8 @@ class OVS_Lib_Test(unittest.TestCase):
|
|||
|
||||
def test_count_flows(self):
|
||||
utils.execute(["ovs-ofctl", "dump-flows", self.BR_NAME],
|
||||
root_helper=self.root_helper).\
|
||||
AndReturn("ignore\nflow-1\n")
|
||||
root_helper=self.root_helper).AndReturn('ignore'
|
||||
'\nflow-1\n')
|
||||
self.mox.ReplayAll()
|
||||
|
||||
# counts the number of flows as total lines of output - 2
|
||||
|
|
|
@ -485,8 +485,8 @@ class RequestDeserializer(object):
|
|||
}
|
||||
self.body_deserializers.update(body_deserializers or {})
|
||||
|
||||
self.headers_deserializer = headers_deserializer or \
|
||||
RequestHeadersDeserializer()
|
||||
self.headers_deserializer = (headers_deserializer or
|
||||
RequestHeadersDeserializer())
|
||||
|
||||
def deserialize(self, request):
|
||||
"""Extract necessary pieces of the request.
|
||||
|
|
|
@ -68,7 +68,7 @@ def check_dependencies():
|
|||
"""Make sure virtualenv is in the path."""
|
||||
|
||||
if not HAS_VIRTUALENV:
|
||||
raise Exception('Virtualenv not found. ' +
|
||||
raise Exception('Virtualenv not found. '
|
||||
'Try installing python-virtualenv')
|
||||
print 'done.'
|
||||
|
||||
|
|
Loading…
Reference in New Issue