MANY flake8 error fixes, all cosmetic
This commit is contained in:
@@ -259,7 +259,7 @@ def ip_address_find(context, lock_mode=False, **filters):
|
|||||||
|
|
||||||
query = query.outerjoin(stmt, stmt.c.id == models.IPAddress.id)
|
query = query.outerjoin(stmt, stmt.c.id == models.IPAddress.id)
|
||||||
|
|
||||||
#!@# HACK(amir): replace once attributes are configured in ip address
|
# !@# HACK(amir): replace once attributes are configured in ip address
|
||||||
# extension correctly
|
# extension correctly
|
||||||
if "True" in ip_shared:
|
if "True" in ip_shared:
|
||||||
query = query.filter(stmt.c.ports_count > 1)
|
query = query.filter(stmt.c.ports_count > 1)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from quark.db.custom_types import INET
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
# commands auto generated by Alembic - please adjust! ###
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'quark_mac_address_ranges',
|
'quark_mac_address_ranges',
|
||||||
sa.Column('id', sa.String(length=36), nullable=False),
|
sa.Column('id', sa.String(length=36), nullable=False),
|
||||||
@@ -260,11 +260,11 @@ def upgrade():
|
|||||||
sa.ForeignKeyConstraint(['port_id'], ['quark_ports.id'], ),
|
sa.ForeignKeyConstraint(['port_id'], ['quark_ports.id'], ),
|
||||||
mysql_engine='InnoDB'
|
mysql_engine='InnoDB'
|
||||||
)
|
)
|
||||||
### end Alembic commands ###
|
# end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
# commands auto generated by Alembic - please adjust! ###
|
||||||
op.drop_table('quark_port_ip_address_associations')
|
op.drop_table('quark_port_ip_address_associations')
|
||||||
op.drop_table('quark_dns_nameservers')
|
op.drop_table('quark_dns_nameservers')
|
||||||
op.drop_index('ix_quark_ip_addresses_version',
|
op.drop_index('ix_quark_ip_addresses_version',
|
||||||
@@ -299,4 +299,4 @@ def downgrade():
|
|||||||
op.drop_table('quark_ip_policy')
|
op.drop_table('quark_ip_policy')
|
||||||
op.drop_table('quark_tag_associations')
|
op.drop_table('quark_tag_associations')
|
||||||
op.drop_table('quark_mac_address_ranges')
|
op.drop_table('quark_mac_address_ranges')
|
||||||
### end Alembic commands ###
|
# end Alembic commands ###
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ from alembic import op
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
# commands auto generated by Alembic - please adjust! ###
|
||||||
op.create_index(op.f('ix_quark_mac_addresses_deallocated'),
|
op.create_index(op.f('ix_quark_mac_addresses_deallocated'),
|
||||||
'quark_mac_addresses',
|
'quark_mac_addresses',
|
||||||
['deallocated'],
|
['deallocated'],
|
||||||
@@ -22,12 +22,12 @@ def upgrade():
|
|||||||
op.create_unique_constraint('mac_address_range_id_address',
|
op.create_unique_constraint('mac_address_range_id_address',
|
||||||
'quark_mac_addresses',
|
'quark_mac_addresses',
|
||||||
['mac_address_range_id', 'address'])
|
['mac_address_range_id', 'address'])
|
||||||
### end Alembic commands ###
|
# end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
# commands auto generated by Alembic - please adjust! ###
|
||||||
op.drop_constraint('mac_address_range_id_address', 'quark_mac_addresses')
|
op.drop_constraint('mac_address_range_id_address', 'quark_mac_addresses')
|
||||||
op.drop_index(op.f('ix_quark_mac_addresses_deallocated'),
|
op.drop_index(op.f('ix_quark_mac_addresses_deallocated'),
|
||||||
table_name='quark_mac_addresses')
|
table_name='quark_mac_addresses')
|
||||||
### end Alembic commands ###
|
# end Alembic commands ###
|
||||||
|
|||||||
@@ -14,15 +14,15 @@ from alembic import op
|
|||||||
|
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
# commands auto generated by Alembic - please adjust! ###
|
||||||
op.create_unique_constraint(
|
op.create_unique_constraint(
|
||||||
'subnet_id_address',
|
'subnet_id_address',
|
||||||
'quark_ip_addresses',
|
'quark_ip_addresses',
|
||||||
['subnet_id', 'address'])
|
['subnet_id', 'address'])
|
||||||
### end Alembic commands ###
|
# end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
# commands auto generated by Alembic - please adjust! ###
|
||||||
op.drop_constraint('subnet_id_address', 'quark_ip_addresses')
|
op.drop_constraint('subnet_id_address', 'quark_ip_addresses')
|
||||||
### end Alembic commands ###
|
# end Alembic commands ###
|
||||||
|
|||||||
@@ -28,5 +28,5 @@ def main():
|
|||||||
config.neutron_config = cli.CONF
|
config.neutron_config = cli.CONF
|
||||||
|
|
||||||
cli.CONF()
|
cli.CONF()
|
||||||
#TODO(gongysh) enable logging
|
# TODO(gongysh) enable logging
|
||||||
cli.CONF.command.func(config, cli.CONF.command.name)
|
cli.CONF.command.func(config, cli.CONF.command.name)
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ from neutron.openstack.common import log as logging
|
|||||||
from neutron.openstack.common import timeutils
|
from neutron.openstack.common import timeutils
|
||||||
|
|
||||||
from quark.db import custom_types
|
from quark.db import custom_types
|
||||||
#NOTE(mdietz): This is the only way to actually create the quotas table,
|
# NOTE(mdietz): This is the only way to actually create the quotas table,
|
||||||
# regardless if we need it. This is how it's done upstream.
|
# regardless if we need it. This is how it's done upstream.
|
||||||
#NOTE(jhammond): If it isn't obvious quota_driver is unused and that's ok.
|
# NOTE(jhammond): If it isn't obvious quota_driver is unused and that's ok.
|
||||||
# DO NOT DELETE IT!!!
|
# DO NOT DELETE IT!!!
|
||||||
from quark import quota_driver # noqa
|
from quark import quota_driver # noqa
|
||||||
|
|
||||||
|
|||||||
@@ -70,16 +70,16 @@ class BaseDriver(object):
|
|||||||
|
|
||||||
def delete_security_group(self, context, group_id, **kwargs):
|
def delete_security_group(self, context, group_id, **kwargs):
|
||||||
LOG.info("Deleting security profile %s for tenant %s" %
|
LOG.info("Deleting security profile %s for tenant %s" %
|
||||||
(group_id, context.tenant_id))
|
(group_id, context.tenant_id))
|
||||||
|
|
||||||
def update_security_group(self, context, group_id, **kwargs):
|
def update_security_group(self, context, group_id, **kwargs):
|
||||||
LOG.info("Updating security profile %s for tenant %s" %
|
LOG.info("Updating security profile %s for tenant %s" %
|
||||||
(group_id, context.tenant_id))
|
(group_id, context.tenant_id))
|
||||||
|
|
||||||
def create_security_group_rule(self, context, group_id, rule):
|
def create_security_group_rule(self, context, group_id, rule):
|
||||||
LOG.info("Creating security rule on group %s for tenant %s" %
|
LOG.info("Creating security rule on group %s for tenant %s" %
|
||||||
(group_id, context.tenant_id))
|
(group_id, context.tenant_id))
|
||||||
|
|
||||||
def delete_security_group_rule(self, context, group_id, rule):
|
def delete_security_group_rule(self, context, group_id, rule):
|
||||||
LOG.info("Deleting security rule on group %s for tenant %s" %
|
LOG.info("Deleting security rule on group %s for tenant %s" %
|
||||||
(group_id, context.tenant_id))
|
(group_id, context.tenant_id))
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class NVPDriver(base.BaseDriver):
|
|||||||
return "NVP"
|
return "NVP"
|
||||||
|
|
||||||
def load_config(self):
|
def load_config(self):
|
||||||
#NOTE(mdietz): What does default_tz actually mean?
|
# NOTE(mdietz): What does default_tz actually mean?
|
||||||
# We don't have one default.
|
# We don't have one default.
|
||||||
# NOTE(jkoelker): Transport Zone
|
# NOTE(jkoelker): Transport Zone
|
||||||
default_tz = CONF.NVP.default_tz
|
default_tz = CONF.NVP.default_tz
|
||||||
@@ -248,7 +248,7 @@ class NVPDriver(base.BaseDriver):
|
|||||||
'packets': stats['rx_packets'],
|
'packets': stats['rx_packets'],
|
||||||
'bytes': stats['rx_bytes'],
|
'bytes': stats['rx_bytes'],
|
||||||
'errors': stats['rx_errors']
|
'errors': stats['rx_errors']
|
||||||
},
|
},
|
||||||
'transmitted': {
|
'transmitted': {
|
||||||
'packets': stats['tx_packets'],
|
'packets': stats['tx_packets'],
|
||||||
'bytes': stats['tx_bytes'],
|
'bytes': stats['tx_bytes'],
|
||||||
@@ -433,7 +433,7 @@ class NVPDriver(base.BaseDriver):
|
|||||||
if phys_net and not net_type:
|
if phys_net and not net_type:
|
||||||
raise exceptions.ProvidernetParamError(
|
raise exceptions.ProvidernetParamError(
|
||||||
msg="provider:network_type parameter required")
|
msg="provider:network_type parameter required")
|
||||||
if not net_type in ("bridge", "vlan") and segment_id:
|
if net_type not in ("bridge", "vlan") and segment_id:
|
||||||
raise exceptions.SegmentIdUnsupported(net_type=net_type)
|
raise exceptions.SegmentIdUnsupported(net_type=net_type)
|
||||||
if net_type == "vlan" and not segment_id:
|
if net_type == "vlan" and not segment_id:
|
||||||
raise exceptions.SegmentIdRequired(net_type=net_type)
|
raise exceptions.SegmentIdRequired(net_type=net_type)
|
||||||
@@ -460,7 +460,7 @@ class NVPDriver(base.BaseDriver):
|
|||||||
# if type maps to 'bridge', then segment_id, which maps
|
# if type maps to 'bridge', then segment_id, which maps
|
||||||
# to vlan_id, is conditionally provided
|
# to vlan_id, is conditionally provided
|
||||||
LOG.debug("Creating new lswitch for %s network %s" %
|
LOG.debug("Creating new lswitch for %s network %s" %
|
||||||
(context.tenant_id, network_name))
|
(context.tenant_id, network_name))
|
||||||
|
|
||||||
tenant_id = context.tenant_id
|
tenant_id = context.tenant_id
|
||||||
connection = self.get_connection()
|
connection = self.get_connection()
|
||||||
|
|||||||
@@ -74,16 +74,16 @@ class UnmanagedDriver(object):
|
|||||||
|
|
||||||
def delete_security_group(self, context, group_id, **kwargs):
|
def delete_security_group(self, context, group_id, **kwargs):
|
||||||
LOG.info("Deleting security profile %s for tenant %s" %
|
LOG.info("Deleting security profile %s for tenant %s" %
|
||||||
(group_id, context.tenant_id))
|
(group_id, context.tenant_id))
|
||||||
|
|
||||||
def update_security_group(self, context, group_id, **kwargs):
|
def update_security_group(self, context, group_id, **kwargs):
|
||||||
LOG.info("Updating security profile %s for tenant %s" %
|
LOG.info("Updating security profile %s for tenant %s" %
|
||||||
(group_id, context.tenant_id))
|
(group_id, context.tenant_id))
|
||||||
|
|
||||||
def create_security_group_rule(self, context, group_id, rule):
|
def create_security_group_rule(self, context, group_id, rule):
|
||||||
LOG.info("Creating security rule on group %s for tenant %s" %
|
LOG.info("Creating security rule on group %s for tenant %s" %
|
||||||
(group_id, context.tenant_id))
|
(group_id, context.tenant_id))
|
||||||
|
|
||||||
def delete_security_group_rule(self, context, group_id, rule):
|
def delete_security_group_rule(self, context, group_id, rule):
|
||||||
LOG.info("Deleting security rule on group %s for tenant %s" %
|
LOG.info("Deleting security rule on group %s for tenant %s" %
|
||||||
(group_id, context.tenant_id))
|
(group_id, context.tenant_id))
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import sys
|
|||||||
from gunicorn.app import base
|
from gunicorn.app import base
|
||||||
from gunicorn import config as gconfig
|
from gunicorn import config as gconfig
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from neutron.common import config
|
from neutron.common import config
|
||||||
from neutron.common import legacy
|
from neutron.common import legacy
|
||||||
from neutron.common import utils
|
from neutron.common import utils
|
||||||
|
|||||||
@@ -19,15 +19,12 @@ Quark Pluggable IPAM
|
|||||||
|
|
||||||
import random
|
import random
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.openstack.common.notifier import api as notifier_api
|
from neutron.openstack.common.notifier import api as notifier_api
|
||||||
from neutron.openstack.common import timeutils
|
from neutron.openstack.common import timeutils
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from quark.db import api as db_api
|
from quark.db import api as db_api
|
||||||
from quark.db import models
|
from quark.db import models
|
||||||
from quark import exceptions as q_exc
|
from quark import exceptions as q_exc
|
||||||
@@ -61,7 +58,7 @@ MAGIC_INT = 144115188075855872
|
|||||||
|
|
||||||
|
|
||||||
def rfc2462_ip(mac, cidr):
|
def rfc2462_ip(mac, cidr):
|
||||||
#NOTE(mdietz): see RFC2462
|
# NOTE(mdietz): see RFC2462
|
||||||
int_val = netaddr.IPNetwork(cidr).value
|
int_val = netaddr.IPNetwork(cidr).value
|
||||||
mac = netaddr.EUI(mac)
|
mac = netaddr.EUI(mac)
|
||||||
int_val += mac.eui64().value
|
int_val += mac.eui64().value
|
||||||
@@ -213,7 +210,7 @@ class QuarkIpam(object):
|
|||||||
address = db_api.ip_address_find(elevated, **ip_kwargs)
|
address = db_api.ip_address_find(elevated, **ip_kwargs)
|
||||||
|
|
||||||
if address:
|
if address:
|
||||||
#NOTE(mdietz): We should always be in the CIDR but we
|
# NOTE(mdietz): We should always be in the CIDR but we
|
||||||
# also said that before :-/
|
# also said that before :-/
|
||||||
subnet = address.get('subnet')
|
subnet = address.get('subnet')
|
||||||
if subnet:
|
if subnet:
|
||||||
@@ -295,8 +292,7 @@ class QuarkIpam(object):
|
|||||||
|
|
||||||
This should provide a performance boost over attempting to check
|
This should provide a performance boost over attempting to check
|
||||||
each and every subnet in the existing reallocate logic, as we'd
|
each and every subnet in the existing reallocate logic, as we'd
|
||||||
have to iterate over each and every subnet returned
|
have to iterate over each and every subnet returned """
|
||||||
"""
|
|
||||||
if not (ip_address is None and "mac_address" in kwargs and
|
if not (ip_address is None and "mac_address" in kwargs and
|
||||||
kwargs["mac_address"]):
|
kwargs["mac_address"]):
|
||||||
return self._allocate_from_subnet(context, net_id, subnet,
|
return self._allocate_from_subnet(context, net_id, subnet,
|
||||||
@@ -312,7 +308,7 @@ class QuarkIpam(object):
|
|||||||
|
|
||||||
ip_address = netaddr.IPAddress(ip_address)
|
ip_address = netaddr.IPAddress(ip_address)
|
||||||
|
|
||||||
#NOTE(mdietz): treating the IPSet as a boolean caused netaddr
|
# NOTE(mdietz): treating the IPSet as a boolean caused netaddr
|
||||||
# to attempt to enumerate the entire set!
|
# to attempt to enumerate the entire set!
|
||||||
if (ip_policy_cidrs is not None and
|
if (ip_policy_cidrs is not None and
|
||||||
ip_address in ip_policy_cidrs):
|
ip_address in ip_policy_cidrs):
|
||||||
|
|||||||
@@ -17,13 +17,11 @@
|
|||||||
v2 Neutron Plug-in API Quark Implementation
|
v2 Neutron Plug-in API Quark Implementation
|
||||||
"""
|
"""
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from neutron.db import api as neutron_db_api
|
from neutron.db import api as neutron_db_api
|
||||||
from neutron.extensions import securitygroup as sg_ext
|
from neutron.extensions import securitygroup as sg_ext
|
||||||
from neutron import neutron_plugin_base_v2
|
from neutron import neutron_plugin_base_v2
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron import quota
|
from neutron import quota
|
||||||
|
|
||||||
from quark.api import extensions
|
from quark.api import extensions
|
||||||
from quark.db import models
|
from quark.db import models
|
||||||
from quark.plugin_modules import ip_addresses
|
from quark.plugin_modules import ip_addresses
|
||||||
@@ -75,7 +73,7 @@ def sessioned(func):
|
|||||||
res = func(self, context, *args, **kwargs)
|
res = func(self, context, *args, **kwargs)
|
||||||
context.session.close()
|
context.session.close()
|
||||||
|
|
||||||
#NOTE(mdietz): Forces neutron to get a fresh session
|
# NOTE(mdietz): Forces neutron to get a fresh session
|
||||||
# if it needs it after our call
|
# if it needs it after our call
|
||||||
context._session = None
|
context._session = None
|
||||||
return res
|
return res
|
||||||
@@ -122,16 +120,16 @@ class Plugin(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
|||||||
def delete_mac_address_range(self, context, id):
|
def delete_mac_address_range(self, context, id):
|
||||||
mac_address_ranges.delete_mac_address_range(context, id)
|
mac_address_ranges.delete_mac_address_range(context, id)
|
||||||
|
|
||||||
#TODO(dietz/perkins): passing in net_driver as a stopgap,
|
# TODO(dietz/perkins): passing in net_driver as a stopgap,
|
||||||
#XXX DO NOT DEPLOY!! XXX see redmine #2487
|
# XXX DO NOT DEPLOY!! XXX see redmine #2487
|
||||||
@sessioned
|
@sessioned
|
||||||
def create_security_group(self, context, security_group, net_driver):
|
def create_security_group(self, context, security_group, net_driver):
|
||||||
self._fix_missing_tenant_id(context, security_group["security_group"])
|
self._fix_missing_tenant_id(context, security_group["security_group"])
|
||||||
return security_groups.create_security_group(context, security_group,
|
return security_groups.create_security_group(context, security_group,
|
||||||
net_driver)
|
net_driver)
|
||||||
|
|
||||||
#TODO(dietz/perkins): passing in net_driver as a stopgap,
|
# TODO(dietz/perkins): passing in net_driver as a stopgap,
|
||||||
#XXX DO NOT DEPLOY!! XXX see redmine #2487
|
# XXX DO NOT DEPLOY!! XXX see redmine #2487
|
||||||
@sessioned
|
@sessioned
|
||||||
def create_security_group_rule(self, context, security_group,
|
def create_security_group_rule(self, context, security_group,
|
||||||
security_group_rule, net_driver):
|
security_group_rule, net_driver):
|
||||||
@@ -140,14 +138,14 @@ class Plugin(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
|||||||
security_group_rule,
|
security_group_rule,
|
||||||
net_driver)
|
net_driver)
|
||||||
|
|
||||||
#TODO(dietz/perkins): passing in net_driver as a stopgap,
|
# TODO(dietz/perkins): passing in net_driver as a stopgap,
|
||||||
#XXX DO NOT DEPLOY!! XXX see redmine #2487
|
# XXX DO NOT DEPLOY!! XXX see redmine #2487
|
||||||
@sessioned
|
@sessioned
|
||||||
def delete_security_group(self, context, id, net_driver):
|
def delete_security_group(self, context, id, net_driver):
|
||||||
security_groups.delete_security_group(context, id, net_driver)
|
security_groups.delete_security_group(context, id, net_driver)
|
||||||
|
|
||||||
#TODO(dietz/perkins): passing in net_driver as a stopgap,
|
# TODO(dietz/perkins): passing in net_driver as a stopgap,
|
||||||
#XXX DO NOT DEPLOY!! XXX see redmine #2487
|
# XXX DO NOT DEPLOY!! XXX see redmine #2487
|
||||||
@sessioned
|
@sessioned
|
||||||
def delete_security_group_rule(self, context, id, net_driver):
|
def delete_security_group_rule(self, context, id, net_driver):
|
||||||
security_groups.delete_security_group_rule(context, id, net_driver)
|
security_groups.delete_security_group_rule(context, id, net_driver)
|
||||||
@@ -176,8 +174,8 @@ class Plugin(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
|||||||
fields, sorts, limit,
|
fields, sorts, limit,
|
||||||
marker, page_reverse)
|
marker, page_reverse)
|
||||||
|
|
||||||
#TODO(dietz/perkins): passing in net_driver as a stopgap,
|
# TODO(dietz/perkins): passing in net_driver as a stopgap,
|
||||||
#XXX DO NOT DEPLOY!! XXX see redmine #2487
|
# XXX DO NOT DEPLOY!! XXX see redmine #2487
|
||||||
@sessioned
|
@sessioned
|
||||||
def update_security_group(self, context, id, security_group, net_driver):
|
def update_security_group(self, context, id, security_group, net_driver):
|
||||||
return security_groups.update_security_group(context, id,
|
return security_groups.update_security_group(context, id,
|
||||||
|
|||||||
@@ -14,12 +14,10 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.openstack.common import importutils
|
from neutron.openstack.common import importutils
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from quark.db import api as db_api
|
from quark.db import api as db_api
|
||||||
from quark import exceptions as quark_exceptions
|
from quark import exceptions as quark_exceptions
|
||||||
from quark import plugin_views as v
|
from quark import plugin_views as v
|
||||||
@@ -39,7 +37,7 @@ def get_ip_addresses(context, **filters):
|
|||||||
|
|
||||||
def get_ip_address(context, id):
|
def get_ip_address(context, id):
|
||||||
LOG.info("get_ip_address %s for tenant %s" %
|
LOG.info("get_ip_address %s for tenant %s" %
|
||||||
(id, context.tenant_id))
|
(id, context.tenant_id))
|
||||||
addr = db_api.ip_address_find(context, id=id, scope=db_api.ONE)
|
addr = db_api.ip_address_find(context, id=id, scope=db_api.ONE)
|
||||||
if not addr:
|
if not addr:
|
||||||
raise quark_exceptions.IpAddressNotFound(addr_id=id)
|
raise quark_exceptions.IpAddressNotFound(addr_id=id)
|
||||||
@@ -101,7 +99,7 @@ def _get_deallocated_override():
|
|||||||
|
|
||||||
def update_ip_address(context, id, ip_address):
|
def update_ip_address(context, id, ip_address):
|
||||||
LOG.info("update_ip_address %s for tenant %s" %
|
LOG.info("update_ip_address %s for tenant %s" %
|
||||||
(id, context.tenant_id))
|
(id, context.tenant_id))
|
||||||
|
|
||||||
with context.session.begin():
|
with context.session.begin():
|
||||||
address = db_api.ip_address_find(
|
address = db_api.ip_address_find(
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
|
||||||
from quark.db import api as db_api
|
from quark.db import api as db_api
|
||||||
from quark import exceptions as quark_exceptions
|
from quark import exceptions as quark_exceptions
|
||||||
from quark import plugin_views as v
|
from quark import plugin_views as v
|
||||||
@@ -27,7 +26,7 @@ def _to_mac_range(val):
|
|||||||
cidr_parts = val.split("/")
|
cidr_parts = val.split("/")
|
||||||
prefix = cidr_parts[0]
|
prefix = cidr_parts[0]
|
||||||
|
|
||||||
#FIXME(anyone): replace is slow, but this doesn't really
|
# FIXME(anyone): replace is slow, but this doesn't really
|
||||||
# get called ever. Fix maybe?
|
# get called ever. Fix maybe?
|
||||||
prefix = prefix.replace(':', '')
|
prefix = prefix.replace(':', '')
|
||||||
prefix = prefix.replace('-', '')
|
prefix = prefix.replace('-', '')
|
||||||
@@ -61,7 +60,7 @@ def get_mac_address_range(context, id, fields=None):
|
|||||||
will be returned.
|
will be returned.
|
||||||
"""
|
"""
|
||||||
LOG.info("get_mac_address_range %s for tenant %s fields %s" %
|
LOG.info("get_mac_address_range %s for tenant %s fields %s" %
|
||||||
(id, context.tenant_id, fields))
|
(id, context.tenant_id, fields))
|
||||||
|
|
||||||
mac_address_range = db_api.mac_address_range_find(
|
mac_address_range = db_api.mac_address_range_find(
|
||||||
context, id=id, scope=db_api.ONE)
|
context, id=id, scope=db_api.ONE)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ ipam_driver = (importutils.import_class(CONF.QUARK.ipam_driver))()
|
|||||||
|
|
||||||
|
|
||||||
def _adapt_provider_nets(context, network):
|
def _adapt_provider_nets(context, network):
|
||||||
#TODO(mdietz) going to ignore all the boundary and network
|
# TODO(mdietz) going to ignore all the boundary and network
|
||||||
# type checking for now.
|
# type checking for now.
|
||||||
attrs = network["network"]
|
attrs = network["network"]
|
||||||
net_type = utils.pop_param(attrs, pnet.NETWORK_TYPE)
|
net_type = utils.pop_param(attrs, pnet.NETWORK_TYPE)
|
||||||
@@ -72,7 +72,7 @@ def create_network(context, network):
|
|||||||
else:
|
else:
|
||||||
net_uuid = uuidutils.generate_uuid()
|
net_uuid = uuidutils.generate_uuid()
|
||||||
|
|
||||||
#TODO(mdietz) this will be the first component registry hook, but
|
# TODO(mdietz) this will be the first component registry hook, but
|
||||||
# lets make it work first
|
# lets make it work first
|
||||||
pnet_type, phys_net, seg_id = _adapt_provider_nets(context, network)
|
pnet_type, phys_net, seg_id = _adapt_provider_nets(context, network)
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ def create_network(context, network):
|
|||||||
new_subnets.append(s)
|
new_subnets.append(s)
|
||||||
new_net["subnets"] = new_subnets
|
new_net["subnets"] = new_subnets
|
||||||
|
|
||||||
#if not security_groups.get_security_groups(
|
# if not security_groups.get_security_groups(
|
||||||
# context,
|
# context,
|
||||||
# filters={"id": security_groups.DEFAULT_SG_UUID}):
|
# filters={"id": security_groups.DEFAULT_SG_UUID}):
|
||||||
# security_groups._create_default_security_group(context)
|
# security_groups._create_default_security_group(context)
|
||||||
@@ -129,7 +129,7 @@ def update_network(context, id, network):
|
|||||||
neutron/api/v2/attributes.py.
|
neutron/api/v2/attributes.py.
|
||||||
"""
|
"""
|
||||||
LOG.info("update_network %s for tenant %s" %
|
LOG.info("update_network %s for tenant %s" %
|
||||||
(id, context.tenant_id))
|
(id, context.tenant_id))
|
||||||
with context.session.begin():
|
with context.session.begin():
|
||||||
net = db_api.network_find(context, id=id, scope=db_api.ONE)
|
net = db_api.network_find(context, id=id, scope=db_api.ONE)
|
||||||
if not net:
|
if not net:
|
||||||
@@ -150,7 +150,7 @@ def get_network(context, id, fields=None):
|
|||||||
will be returned.
|
will be returned.
|
||||||
"""
|
"""
|
||||||
LOG.info("get_network %s for tenant %s fields %s" %
|
LOG.info("get_network %s for tenant %s fields %s" %
|
||||||
(id, context.tenant_id, fields))
|
(id, context.tenant_id, fields))
|
||||||
|
|
||||||
network = db_api.network_find(context, id=id, join_subnets=True,
|
network = db_api.network_find(context, id=id, join_subnets=True,
|
||||||
scope=db_api.ONE)
|
scope=db_api.ONE)
|
||||||
@@ -179,7 +179,7 @@ def get_networks(context, filters=None, fields=None):
|
|||||||
will be returned.
|
will be returned.
|
||||||
"""
|
"""
|
||||||
LOG.info("get_networks for tenant %s with filters %s, fields %s" %
|
LOG.info("get_networks for tenant %s with filters %s, fields %s" %
|
||||||
(context.tenant_id, filters, fields))
|
(context.tenant_id, filters, fields))
|
||||||
nets = db_api.network_find(context, join_subnets=True, **filters) or []
|
nets = db_api.network_find(context, join_subnets=True, **filters) or []
|
||||||
nets = [v._make_network_dict(net, fields=fields) for net in nets]
|
nets = [v._make_network_dict(net, fields=fields) for net in nets]
|
||||||
return nets
|
return nets
|
||||||
@@ -203,7 +203,7 @@ def get_networks_count(context, filters=None):
|
|||||||
defined plugin API.
|
defined plugin API.
|
||||||
"""
|
"""
|
||||||
LOG.info("get_networks_count for tenant %s filters %s" %
|
LOG.info("get_networks_count for tenant %s filters %s" %
|
||||||
(context.tenant_id, filters))
|
(context.tenant_id, filters))
|
||||||
return db_api.network_count_all(context)
|
return db_api.network_count_all(context)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ def update_port(context, id, port):
|
|||||||
fixed_ips = port["port"].pop("fixed_ips", None)
|
fixed_ips = port["port"].pop("fixed_ips", None)
|
||||||
if fixed_ips is not None:
|
if fixed_ips is not None:
|
||||||
|
|
||||||
#NOTE(mdietz): we want full control over IPAM since
|
# NOTE(mdietz): we want full control over IPAM since
|
||||||
# we're allocating by subnet instead of
|
# we're allocating by subnet instead of
|
||||||
# network.
|
# network.
|
||||||
ipam_driver = ipam.IPAM_REGISTRY.get_strategy(
|
ipam_driver = ipam.IPAM_REGISTRY.get_strategy(
|
||||||
@@ -272,7 +272,7 @@ def update_port(context, id, port):
|
|||||||
with context.session.begin():
|
with context.session.begin():
|
||||||
port = db_api.port_update(context, port_db, **port["port"])
|
port = db_api.port_update(context, port_db, **port["port"])
|
||||||
|
|
||||||
#NOTE(mdietz): fix for issue 112, we wanted the IPs to be in
|
# NOTE(mdietz): fix for issue 112, we wanted the IPs to be in
|
||||||
# allocated_at order, so get a fresh object every time
|
# allocated_at order, so get a fresh object every time
|
||||||
if port_db in context.session:
|
if port_db in context.session:
|
||||||
context.session.expunge(port_db)
|
context.session.expunge(port_db)
|
||||||
@@ -344,7 +344,7 @@ def get_port(context, id, fields=None):
|
|||||||
will be returned.
|
will be returned.
|
||||||
"""
|
"""
|
||||||
LOG.info("get_port %s for tenant %s fields %s" %
|
LOG.info("get_port %s for tenant %s fields %s" %
|
||||||
(id, context.tenant_id, fields))
|
(id, context.tenant_id, fields))
|
||||||
results = db_api.port_find(context, id=id, fields=fields,
|
results = db_api.port_find(context, id=id, fields=fields,
|
||||||
scope=db_api.ONE)
|
scope=db_api.ONE)
|
||||||
|
|
||||||
@@ -374,7 +374,7 @@ def get_ports(context, filters=None, fields=None):
|
|||||||
will be returned.
|
will be returned.
|
||||||
"""
|
"""
|
||||||
LOG.info("get_ports for tenant %s filters %s fields %s" %
|
LOG.info("get_ports for tenant %s filters %s fields %s" %
|
||||||
(context.tenant_id, filters, fields))
|
(context.tenant_id, filters, fields))
|
||||||
if filters is None:
|
if filters is None:
|
||||||
filters = {}
|
filters = {}
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ def get_ports_count(context, filters=None):
|
|||||||
defined plugin API.
|
defined plugin API.
|
||||||
"""
|
"""
|
||||||
LOG.info("get_ports_count for tenant %s filters %s" %
|
LOG.info("get_ports_count for tenant %s filters %s" %
|
||||||
(context.tenant_id, filters))
|
(context.tenant_id, filters))
|
||||||
return db_api.port_count_all(context, join_security_groups=True, **filters)
|
return db_api.port_count_all(context, join_security_groups=True, **filters)
|
||||||
|
|
||||||
|
|
||||||
@@ -422,7 +422,7 @@ def delete_port(context, id):
|
|||||||
: param id: UUID representing the port to delete.
|
: param id: UUID representing the port to delete.
|
||||||
"""
|
"""
|
||||||
LOG.info("delete_port %s for tenant %s" %
|
LOG.info("delete_port %s for tenant %s" %
|
||||||
(id, context.tenant_id))
|
(id, context.tenant_id))
|
||||||
|
|
||||||
port = db_api.port_find(context, id=id, scope=db_api.ONE)
|
port = db_api.port_find(context, id=id, scope=db_api.ONE)
|
||||||
if not port:
|
if not port:
|
||||||
@@ -453,7 +453,7 @@ def disassociate_port(context, id, ip_address_id):
|
|||||||
disassociate.
|
disassociate.
|
||||||
"""
|
"""
|
||||||
LOG.info("disassociate_port %s for tenant %s ip_address_id %s" %
|
LOG.info("disassociate_port %s for tenant %s ip_address_id %s" %
|
||||||
(id, context.tenant_id, ip_address_id))
|
(id, context.tenant_id, ip_address_id))
|
||||||
with context.session.begin():
|
with context.session.begin():
|
||||||
port = db_api.port_find(context, id=id, ip_address_id=[ip_address_id],
|
port = db_api.port_find(context, id=id, ip_address_id=[ip_address_id],
|
||||||
scope=db_api.ONE)
|
scope=db_api.ONE)
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ def create_route(context, route):
|
|||||||
|
|
||||||
|
|
||||||
def delete_route(context, id):
|
def delete_route(context, id):
|
||||||
#TODO(mdietz): This is probably where we check to see that someone is
|
# TODO(mdietz): This is probably where we check to see that someone is
|
||||||
# admin and only filter on tenant if they aren't. Correct
|
# admin and only filter on tenant if they aren't. Correct
|
||||||
# for all the above later
|
# for all the above later
|
||||||
LOG.info("delete_route %s for tenant %s" % (id, context.tenant_id))
|
LOG.info("delete_route %s for tenant %s" % (id, context.tenant_id))
|
||||||
|
|||||||
@@ -67,9 +67,9 @@ def _validate_security_group_rule(context, rule):
|
|||||||
|
|
||||||
def create_security_group(context, security_group, net_driver):
|
def create_security_group(context, security_group, net_driver):
|
||||||
# TODO(dietz/perkins): passing in net_driver as a stopgap,
|
# TODO(dietz/perkins): passing in net_driver as a stopgap,
|
||||||
# XXX DO NOT DEPLOY!! XXX see redmine #2487
|
# XXX DO NOT DEPLOY!! XXX see redmine # 2487
|
||||||
LOG.info("create_security_group for tenant %s" %
|
LOG.info("create_security_group for tenant %s" %
|
||||||
(context.tenant_id))
|
(context.tenant_id))
|
||||||
group = security_group["security_group"]
|
group = security_group["security_group"]
|
||||||
group_name = group.get('name', '')
|
group_name = group.get('name', '')
|
||||||
if group_name == "default":
|
if group_name == "default":
|
||||||
@@ -121,7 +121,7 @@ def _create_default_security_group(context, net_driver):
|
|||||||
|
|
||||||
def create_security_group_rule(context, security_group_rule, net_driver):
|
def create_security_group_rule(context, security_group_rule, net_driver):
|
||||||
LOG.info("create_security_group for tenant %s" %
|
LOG.info("create_security_group for tenant %s" %
|
||||||
(context.tenant_id))
|
(context.tenant_id))
|
||||||
|
|
||||||
with context.session.begin():
|
with context.session.begin():
|
||||||
rule = _validate_security_group_rule(
|
rule = _validate_security_group_rule(
|
||||||
@@ -146,12 +146,12 @@ def create_security_group_rule(context, security_group_rule, net_driver):
|
|||||||
|
|
||||||
def delete_security_group(context, id, net_driver):
|
def delete_security_group(context, id, net_driver):
|
||||||
LOG.info("delete_security_group %s for tenant %s" %
|
LOG.info("delete_security_group %s for tenant %s" %
|
||||||
(id, context.tenant_id))
|
(id, context.tenant_id))
|
||||||
|
|
||||||
with context.session.begin():
|
with context.session.begin():
|
||||||
group = db_api.security_group_find(context, id=id, scope=db_api.ONE)
|
group = db_api.security_group_find(context, id=id, scope=db_api.ONE)
|
||||||
|
|
||||||
#TODO(anyone): name and ports are lazy-loaded. Could be good op later
|
# TODO(anyone): name and ports are lazy-loaded. Could be good op later
|
||||||
if not group:
|
if not group:
|
||||||
raise sg_ext.SecurityGroupNotFound(group_id=id)
|
raise sg_ext.SecurityGroupNotFound(group_id=id)
|
||||||
if id == DEFAULT_SG_UUID or group.name == "default":
|
if id == DEFAULT_SG_UUID or group.name == "default":
|
||||||
@@ -164,7 +164,7 @@ def delete_security_group(context, id, net_driver):
|
|||||||
|
|
||||||
def delete_security_group_rule(context, id, net_driver):
|
def delete_security_group_rule(context, id, net_driver):
|
||||||
LOG.info("delete_security_group %s for tenant %s" %
|
LOG.info("delete_security_group %s for tenant %s" %
|
||||||
(id, context.tenant_id))
|
(id, context.tenant_id))
|
||||||
with context.session.begin():
|
with context.session.begin():
|
||||||
rule = db_api.security_group_rule_find(context, id=id,
|
rule = db_api.security_group_rule_find(context, id=id,
|
||||||
scope=db_api.ONE)
|
scope=db_api.ONE)
|
||||||
@@ -185,7 +185,7 @@ def delete_security_group_rule(context, id, net_driver):
|
|||||||
|
|
||||||
def get_security_group(context, id, fields=None):
|
def get_security_group(context, id, fields=None):
|
||||||
LOG.info("get_security_group %s for tenant %s" %
|
LOG.info("get_security_group %s for tenant %s" %
|
||||||
(id, context.tenant_id))
|
(id, context.tenant_id))
|
||||||
group = db_api.security_group_find(context, id=id, scope=db_api.ONE)
|
group = db_api.security_group_find(context, id=id, scope=db_api.ONE)
|
||||||
if not group:
|
if not group:
|
||||||
raise sg_ext.SecurityGroupNotFound(group_id=id)
|
raise sg_ext.SecurityGroupNotFound(group_id=id)
|
||||||
@@ -194,7 +194,7 @@ def get_security_group(context, id, fields=None):
|
|||||||
|
|
||||||
def get_security_group_rule(context, id, fields=None):
|
def get_security_group_rule(context, id, fields=None):
|
||||||
LOG.info("get_security_group_rule %s for tenant %s" %
|
LOG.info("get_security_group_rule %s for tenant %s" %
|
||||||
(id, context.tenant_id))
|
(id, context.tenant_id))
|
||||||
rule = db_api.security_group_rule_find(context, id=id,
|
rule = db_api.security_group_rule_find(context, id=id,
|
||||||
scope=db_api.ONE)
|
scope=db_api.ONE)
|
||||||
if not rule:
|
if not rule:
|
||||||
@@ -206,7 +206,7 @@ def get_security_groups(context, filters=None, fields=None,
|
|||||||
sorts=None, limit=None, marker=None,
|
sorts=None, limit=None, marker=None,
|
||||||
page_reverse=False):
|
page_reverse=False):
|
||||||
LOG.info("get_security_groups for tenant %s" %
|
LOG.info("get_security_groups for tenant %s" %
|
||||||
(context.tenant_id))
|
(context.tenant_id))
|
||||||
groups = db_api.security_group_find(context, **filters)
|
groups = db_api.security_group_find(context, **filters)
|
||||||
return [v._make_security_group_dict(group) for group in groups]
|
return [v._make_security_group_dict(group) for group in groups]
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ def get_security_group_rules(context, filters=None, fields=None,
|
|||||||
sorts=None, limit=None, marker=None,
|
sorts=None, limit=None, marker=None,
|
||||||
page_reverse=False):
|
page_reverse=False):
|
||||||
LOG.info("get_security_group_rules for tenant %s" %
|
LOG.info("get_security_group_rules for tenant %s" %
|
||||||
(context.tenant_id))
|
(context.tenant_id))
|
||||||
rules = db_api.security_group_rule_find(context, **filters)
|
rules = db_api.security_group_rule_find(context, **filters)
|
||||||
return [v._make_security_group_rule_dict(rule) for rule in rules]
|
return [v._make_security_group_rule_dict(rule) for rule in rules]
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ def get_subnet(context, id, fields=None):
|
|||||||
will be returned.
|
will be returned.
|
||||||
"""
|
"""
|
||||||
LOG.info("get_subnet %s for tenant %s with fields %s" %
|
LOG.info("get_subnet %s for tenant %s with fields %s" %
|
||||||
(id, context.tenant_id, fields))
|
(id, context.tenant_id, fields))
|
||||||
subnet = db_api.subnet_find(context, id=id, join_dns=True,
|
subnet = db_api.subnet_find(context, id=id, join_dns=True,
|
||||||
join_routes=True, scope=db_api.ONE)
|
join_routes=True, scope=db_api.ONE)
|
||||||
if not subnet:
|
if not subnet:
|
||||||
@@ -282,7 +282,7 @@ def get_subnets(context, filters=None, fields=None):
|
|||||||
will be returned.
|
will be returned.
|
||||||
"""
|
"""
|
||||||
LOG.info("get_subnets for tenant %s with filters %s fields %s" %
|
LOG.info("get_subnets for tenant %s with filters %s fields %s" %
|
||||||
(context.tenant_id, filters, fields))
|
(context.tenant_id, filters, fields))
|
||||||
subnets = db_api.subnet_find(context, join_dns=True, join_routes=True,
|
subnets = db_api.subnet_find(context, join_dns=True, join_routes=True,
|
||||||
**filters)
|
**filters)
|
||||||
return v._make_subnets_list(subnets, fields=fields)
|
return v._make_subnets_list(subnets, fields=fields)
|
||||||
@@ -306,7 +306,7 @@ def get_subnets_count(context, filters=None):
|
|||||||
defined plugin API.
|
defined plugin API.
|
||||||
"""
|
"""
|
||||||
LOG.info("get_subnets_count for tenant %s with filters %s" %
|
LOG.info("get_subnets_count for tenant %s with filters %s" %
|
||||||
(context.tenant_id, filters))
|
(context.tenant_id, filters))
|
||||||
return db_api.subnet_count_all(context, **filters)
|
return db_api.subnet_count_all(context, **filters)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,9 @@ View Helpers for Quark Plugin
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
from neutron.extensions import securitygroup as sg_ext
|
from neutron.extensions import securitygroup as sg_ext
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from quark.db import api as db_api
|
from quark.db import api as db_api
|
||||||
from quark.db import models
|
from quark.db import models
|
||||||
from quark import network_strategy
|
from quark import network_strategy
|
||||||
@@ -115,18 +113,18 @@ def _make_subnet_dict(subnet, fields=None):
|
|||||||
return {"destination": route["cidr"],
|
return {"destination": route["cidr"],
|
||||||
"nexthop": route["gateway"]}
|
"nexthop": route["gateway"]}
|
||||||
|
|
||||||
#TODO(mdietz): really inefficient, should go away
|
# TODO(mdietz): really inefficient, should go away
|
||||||
res["gateway_ip"] = None
|
res["gateway_ip"] = None
|
||||||
res["host_routes"] = []
|
res["host_routes"] = []
|
||||||
default_found = False
|
default_found = False
|
||||||
for route in subnet["routes"]:
|
for route in subnet["routes"]:
|
||||||
netroute = netaddr.IPNetwork(route["cidr"])
|
netroute = netaddr.IPNetwork(route["cidr"])
|
||||||
if _is_default_route(netroute):
|
if _is_default_route(netroute):
|
||||||
#NOTE(mdietz): This has the potential to find more than one default
|
# NOTE(mdietz): This has the potential to find more than one
|
||||||
# route. Quark normally won't allow you to create
|
# default route. Quark normally won't allow you to create
|
||||||
# more than one, but it's plausible one exists
|
# more than one, but it's plausible one exists regardless.
|
||||||
# regardless. As such, we're going to pretend
|
# As such, we're going to pretend it isn't possible, but
|
||||||
# it isn't possible, but log it anyway.
|
# log it anyway.
|
||||||
if default_found:
|
if default_found:
|
||||||
LOG.info(_("Default route %(gateway_ip)s already found for "
|
LOG.info(_("Default route %(gateway_ip)s already found for "
|
||||||
"subnet %(id)s") % res)
|
"subnet %(id)s") % res)
|
||||||
@@ -178,7 +176,7 @@ def _port_dict(port, fields=None):
|
|||||||
mac = str(netaddr.EUI(res["mac_address"])).replace('-', ':')
|
mac = str(netaddr.EUI(res["mac_address"])).replace('-', ':')
|
||||||
res["mac_address"] = mac
|
res["mac_address"] = mac
|
||||||
|
|
||||||
#NOTE(mdietz): more pythonic key in dict check fails here. Leave as get
|
# NOTE(mdietz): more pythonic key in dict check fails here. Leave as get
|
||||||
if port.get("bridge"):
|
if port.get("bridge"):
|
||||||
res["bridge"] = port["bridge"]
|
res["bridge"] = port["bridge"]
|
||||||
return res
|
return res
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ class TestNVPDriver(test_base.TestBase):
|
|||||||
def _create_lport_query(self, switch_count, profiles=[]):
|
def _create_lport_query(self, switch_count, profiles=[]):
|
||||||
query = mock.Mock()
|
query = mock.Mock()
|
||||||
port_list = {"_relations":
|
port_list = {"_relations":
|
||||||
{"LogicalSwitchConfig":
|
{"LogicalSwitchConfig":
|
||||||
{"uuid": self.lswitch_uuid,
|
{"uuid": self.lswitch_uuid,
|
||||||
"security_profiles": profiles}}}
|
"security_profiles": profiles}}}
|
||||||
port_query = {"results": [port_list], "result_count": switch_count}
|
port_query = {"results": [port_list], "result_count": switch_count}
|
||||||
query.results = mock.Mock(return_value=port_query)
|
query.results = mock.Mock(return_value=port_query)
|
||||||
query.security_profile_uuid().results.return_value = {
|
query.security_profile_uuid().results.return_value = {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
import contextlib
|
||||||
import cProfile as profiler
|
import cProfile as profiler
|
||||||
import gc
|
import gc
|
||||||
try:
|
try:
|
||||||
@@ -23,9 +24,6 @@ except Exception:
|
|||||||
pass
|
pass
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import contextlib
|
|
||||||
|
|
||||||
from neutron.api.v2 import attributes
|
from neutron.api.v2 import attributes
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user