update Quantum references to Neutron
implements bug: 1197208 Change-Id: I14de163ca3cf498f5cb738a4c09088bba1759488
This commit is contained in:
parent
1f71152b4b
commit
84e054b200
@ -13,7 +13,7 @@ may encounter when deploying Horizon in a production environment.
|
||||
has successfully authenticated determines the dashboards and panels
|
||||
that will be available within the OpenStack Dashboard. If you are not
|
||||
seeing a particular service you expected (e.g. Object Storage/Swift or
|
||||
Networking/Quantum) make sure your Service Catalog is configured correctly.
|
||||
Networking/Neutron) make sure your Service Catalog is configured correctly.
|
||||
|
||||
Prior to the Essex release of Horizon these features were controlled by
|
||||
individual settings in the ``local_settings.py`` file. This code has been
|
||||
|
@ -20,7 +20,7 @@ and a few notes on the Django-related settings.
|
||||
.. note::
|
||||
|
||||
Prior to the Essex release of Horizon there were settings which controlled
|
||||
whether features such as Object Storage/Swift or Networking/Quantum would be
|
||||
whether features such as Object Storage/Swift or Networking/Neutron would be
|
||||
enabled in the OpenStack Dashboard. This code has beenlong-since removed and
|
||||
those pre-Essex settings have no impact now.
|
||||
|
||||
@ -217,13 +217,13 @@ In the Havana release, there will be a feature for encrypted volumes
|
||||
which will be controlled by the ``can_encrypt_volumes``. Setting it to ``True``
|
||||
in the Grizzly release will have no effect.
|
||||
|
||||
``OPENSTACK_QUANTUM_NETWORK``
|
||||
``OPENSTACK_NEUTRON_NETWORK``
|
||||
-----------------------------
|
||||
|
||||
Default: ``{'enable_lb': False}``
|
||||
|
||||
A dictionary of settings which can be used to enable optional services provided
|
||||
by quantum. Currently only the load balancer service is available.
|
||||
by neutron. Currently only the load balancer service is available.
|
||||
|
||||
``OPENSTACK_ENDPOINT_TYPE``
|
||||
---------------------------
|
||||
|
@ -164,7 +164,7 @@ LOGGING = {
|
||||
'handlers': ['test'],
|
||||
'propagate': False,
|
||||
},
|
||||
'quantumclient': {
|
||||
'neutronclient': {
|
||||
'handlers': ['test'],
|
||||
'propagate': False,
|
||||
},
|
||||
|
@ -40,8 +40,8 @@ from openstack_dashboard.api import heat
|
||||
from openstack_dashboard.api import keystone
|
||||
from openstack_dashboard.api import lbaas
|
||||
from openstack_dashboard.api import network
|
||||
from openstack_dashboard.api import neutron
|
||||
from openstack_dashboard.api import nova
|
||||
from openstack_dashboard.api import quantum
|
||||
from openstack_dashboard.api import swift
|
||||
|
||||
assert base
|
||||
@ -51,6 +51,6 @@ assert glance
|
||||
assert keystone
|
||||
assert network
|
||||
assert nova
|
||||
assert quantum
|
||||
assert neutron
|
||||
assert lbaas
|
||||
assert swift
|
||||
|
@ -16,20 +16,20 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from openstack_dashboard.api.quantum import QuantumAPIDictWrapper
|
||||
from openstack_dashboard.api.quantum import quantumclient
|
||||
from openstack_dashboard.api.quantum import subnet_get
|
||||
from openstack_dashboard.api.neutron import NeutronAPIDictWrapper
|
||||
from openstack_dashboard.api.neutron import neutronclient
|
||||
from openstack_dashboard.api.neutron import subnet_get
|
||||
|
||||
|
||||
class Vip(QuantumAPIDictWrapper):
|
||||
"""Wrapper for quantum load balancer vip"""
|
||||
class Vip(NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron load balancer vip"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
super(Vip, self).__init__(apiresource)
|
||||
|
||||
|
||||
class Pool(QuantumAPIDictWrapper):
|
||||
"""Wrapper for quantum load balancer pool"""
|
||||
class Pool(NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron load balancer pool"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
super(Pool, self).__init__(apiresource)
|
||||
@ -70,8 +70,8 @@ class Pool(QuantumAPIDictWrapper):
|
||||
return self.AttributeDict(pFormatted)
|
||||
|
||||
|
||||
class Member(QuantumAPIDictWrapper):
|
||||
"""Wrapper for quantum load balancer member"""
|
||||
class Member(NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron load balancer member"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
super(Member, self).__init__(apiresource)
|
||||
@ -98,15 +98,15 @@ class Member(QuantumAPIDictWrapper):
|
||||
return self.AttributeDict(mFormatted)
|
||||
|
||||
|
||||
class PoolStats(QuantumAPIDictWrapper):
|
||||
"""Wrapper for quantum load balancer pool stats"""
|
||||
class PoolStats(NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron load balancer pool stats"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
super(PoolStats, self).__init__(apiresource)
|
||||
|
||||
|
||||
class PoolMonitor(QuantumAPIDictWrapper):
|
||||
"""Wrapper for quantum load balancer pool health monitor"""
|
||||
class PoolMonitor(NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron load balancer pool health monitor"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
super(PoolMonitor, self).__init__(apiresource)
|
||||
@ -134,27 +134,27 @@ def vip_create(request, **kwargs):
|
||||
'connection_limit': kwargs['connection_limit'],
|
||||
'admin_state_up': kwargs['admin_state_up']
|
||||
}}
|
||||
vip = quantumclient(request).create_vip(body).get('vip')
|
||||
vip = neutronclient(request).create_vip(body).get('vip')
|
||||
return Vip(vip)
|
||||
|
||||
|
||||
def vips_get(request, **kwargs):
|
||||
vips = quantumclient(request).list_vips().get('vips')
|
||||
vips = neutronclient(request).list_vips().get('vips')
|
||||
return [Vip(v) for v in vips]
|
||||
|
||||
|
||||
def vip_get(request, vip_id):
|
||||
vip = quantumclient(request).show_vip(vip_id).get('vip')
|
||||
vip = neutronclient(request).show_vip(vip_id).get('vip')
|
||||
return Vip(vip)
|
||||
|
||||
|
||||
def vip_update(request, vip_id, **kwargs):
|
||||
vip = quantumclient(request).update_vip(vip_id, kwargs).get('vip')
|
||||
vip = neutronclient(request).update_vip(vip_id, kwargs).get('vip')
|
||||
return Vip(vip)
|
||||
|
||||
|
||||
def vip_delete(request, vip_id):
|
||||
quantumclient(request).delete_vip(vip_id)
|
||||
neutronclient(request).delete_vip(vip_id)
|
||||
|
||||
|
||||
def pool_create(request, **kwargs):
|
||||
@ -175,32 +175,32 @@ def pool_create(request, **kwargs):
|
||||
'lb_method': kwargs['lb_method'],
|
||||
'admin_state_up': kwargs['admin_state_up']
|
||||
}}
|
||||
pool = quantumclient(request).create_pool(body).get('pool')
|
||||
pool = neutronclient(request).create_pool(body).get('pool')
|
||||
return Pool(pool)
|
||||
|
||||
|
||||
def pools_get(request, **kwargs):
|
||||
pools = quantumclient(request).list_pools().get('pools')
|
||||
pools = neutronclient(request).list_pools().get('pools')
|
||||
return [Pool(p) for p in pools]
|
||||
|
||||
|
||||
def pool_get(request, pool_id):
|
||||
pool = quantumclient(request).show_pool(pool_id).get('pool')
|
||||
pool = neutronclient(request).show_pool(pool_id).get('pool')
|
||||
return Pool(pool)
|
||||
|
||||
|
||||
def pool_update(request, pool_id, **kwargs):
|
||||
pool = quantumclient(request).update_pool(pool_id, kwargs).get('pool')
|
||||
pool = neutronclient(request).update_pool(pool_id, kwargs).get('pool')
|
||||
return Pool(pool)
|
||||
|
||||
|
||||
def pool_delete(request, pool):
|
||||
quantumclient(request).delete_pool(pool)
|
||||
neutronclient(request).delete_pool(pool)
|
||||
|
||||
|
||||
# not linked to UI yet
|
||||
def pool_stats(request, pool_id, **kwargs):
|
||||
stats = quantumclient(request).retrieve_pool_stats(pool_id, **kwargs)
|
||||
stats = neutronclient(request).retrieve_pool_stats(pool_id, **kwargs)
|
||||
return PoolStats(stats)
|
||||
|
||||
|
||||
@ -228,32 +228,32 @@ def pool_health_monitor_create(request, **kwargs):
|
||||
body['health_monitor']['http_method'] = kwargs['http_method']
|
||||
body['health_monitor']['url_path'] = kwargs['url_path']
|
||||
body['health_monitor']['expected_codes'] = kwargs['expected_codes']
|
||||
mon = quantumclient(request).create_health_monitor(body).get(
|
||||
mon = neutronclient(request).create_health_monitor(body).get(
|
||||
'health_monitor')
|
||||
|
||||
return PoolMonitor(mon)
|
||||
|
||||
|
||||
def pool_health_monitors_get(request, **kwargs):
|
||||
monitors = quantumclient(request
|
||||
monitors = neutronclient(request
|
||||
).list_health_monitors().get('health_monitors')
|
||||
return [PoolMonitor(m) for m in monitors]
|
||||
|
||||
|
||||
def pool_health_monitor_get(request, monitor_id):
|
||||
monitor = quantumclient(request
|
||||
monitor = neutronclient(request
|
||||
).show_health_monitor(monitor_id
|
||||
).get('health_monitor')
|
||||
return PoolMonitor(monitor)
|
||||
|
||||
|
||||
def pool_health_monitor_update(request, monitor_id, **kwargs):
|
||||
monitor = quantumclient(request).update_health_monitor(monitor_id, kwargs)
|
||||
monitor = neutronclient(request).update_health_monitor(monitor_id, kwargs)
|
||||
return PoolMonitor(monitor)
|
||||
|
||||
|
||||
def pool_health_monitor_delete(request, mon_id):
|
||||
quantumclient(request).delete_health_monitor(mon_id)
|
||||
neutronclient(request).delete_health_monitor(mon_id)
|
||||
|
||||
|
||||
def member_create(request, **kwargs):
|
||||
@ -272,27 +272,27 @@ def member_create(request, **kwargs):
|
||||
'weight': kwargs['weight'],
|
||||
'admin_state_up': kwargs['admin_state_up']
|
||||
}}
|
||||
member = quantumclient(request).create_member(body).get('member')
|
||||
member = neutronclient(request).create_member(body).get('member')
|
||||
return Member(member)
|
||||
|
||||
|
||||
def members_get(request, **kwargs):
|
||||
members = quantumclient(request).list_members().get('members')
|
||||
members = neutronclient(request).list_members().get('members')
|
||||
return [Member(m) for m in members]
|
||||
|
||||
|
||||
def member_get(request, member_id):
|
||||
member = quantumclient(request).show_member(member_id).get('member')
|
||||
member = neutronclient(request).show_member(member_id).get('member')
|
||||
return Member(member)
|
||||
|
||||
|
||||
def member_update(request, member_id, **kwargs):
|
||||
member = quantumclient(request).update_member(member_id, kwargs)
|
||||
member = neutronclient(request).update_member(member_id, kwargs)
|
||||
return Member(member)
|
||||
|
||||
|
||||
def member_delete(request, mem_id):
|
||||
quantumclient(request).delete_member(mem_id)
|
||||
neutronclient(request).delete_member(mem_id)
|
||||
|
||||
|
||||
def pool_monitor_association_create(request, **kwargs):
|
||||
@ -305,7 +305,7 @@ def pool_monitor_association_create(request, **kwargs):
|
||||
|
||||
body = {'health_monitor': {'id': kwargs['monitor_id'], }}
|
||||
|
||||
quantumclient(request).associate_health_monitor(
|
||||
neutronclient(request).associate_health_monitor(
|
||||
kwargs['pool_id'], body)
|
||||
|
||||
|
||||
@ -317,5 +317,5 @@ def pool_monitor_association_delete(request, **kwargs):
|
||||
:param pool_id: id of pool
|
||||
"""
|
||||
|
||||
quantumclient(request).disassociate_health_monitor(
|
||||
neutronclient(request).disassociate_health_monitor(
|
||||
kwargs['pool_id'], kwargs['monitor_id'])
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
"""Abstraction layer for networking functionalities.
|
||||
|
||||
Currently Nova and Quantum have duplicated features. This API layer is
|
||||
Currently Nova and Neutron have duplicated features. This API layer is
|
||||
introduced to astract the differences between them for seamless consumption by
|
||||
different dashboard implementations.
|
||||
"""
|
||||
@ -28,7 +28,7 @@ class NetworkClient(object):
|
||||
def __init__(self, request):
|
||||
from openstack_dashboard import api
|
||||
if api.base.is_service_enabled(request, 'network'):
|
||||
self.floating_ips = api.quantum.FloatingIpManager(request)
|
||||
self.floating_ips = api.neutron.FloatingIpManager(request)
|
||||
else:
|
||||
self.floating_ips = api.nova.FloatingIpManager(request)
|
||||
|
||||
|
@ -31,14 +31,14 @@ from openstack_dashboard.api.base import url_for
|
||||
from openstack_dashboard.api import network
|
||||
from openstack_dashboard.api import nova
|
||||
|
||||
from quantumclient.v2_0 import client as quantum_client
|
||||
from neutronclient.v2_0 import client as neutron_client
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
IP_VERSION_DICT = {4: 'IPv4', 6: 'IPv6'}
|
||||
|
||||
|
||||
class QuantumAPIDictWrapper(APIDictWrapper):
|
||||
class NeutronAPIDictWrapper(APIDictWrapper):
|
||||
|
||||
def set_id_as_name_if_empty(self, length=8):
|
||||
try:
|
||||
@ -54,8 +54,8 @@ class QuantumAPIDictWrapper(APIDictWrapper):
|
||||
return self._apidict.items()
|
||||
|
||||
|
||||
class Network(QuantumAPIDictWrapper):
|
||||
"""Wrapper for quantum Networks"""
|
||||
class Network(NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron Networks"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
apiresource['admin_state'] = \
|
||||
@ -67,16 +67,16 @@ class Network(QuantumAPIDictWrapper):
|
||||
super(Network, self).__init__(apiresource)
|
||||
|
||||
|
||||
class Subnet(QuantumAPIDictWrapper):
|
||||
"""Wrapper for quantum subnets"""
|
||||
class Subnet(NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron subnets"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
apiresource['ipver_str'] = get_ipver_str(apiresource['ip_version'])
|
||||
super(Subnet, self).__init__(apiresource)
|
||||
|
||||
|
||||
class Port(QuantumAPIDictWrapper):
|
||||
"""Wrapper for quantum ports"""
|
||||
class Port(NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron ports"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
apiresource['admin_state'] = \
|
||||
@ -84,8 +84,8 @@ class Port(QuantumAPIDictWrapper):
|
||||
super(Port, self).__init__(apiresource)
|
||||
|
||||
|
||||
class Router(QuantumAPIDictWrapper):
|
||||
"""Wrapper for quantum routers"""
|
||||
class Router(NeutronAPIDictWrapper):
|
||||
"""Wrapper for neutron routers"""
|
||||
|
||||
def __init__(self, apiresource):
|
||||
#apiresource['admin_state'] = \
|
||||
@ -114,7 +114,7 @@ class FloatingIpTarget(APIDictWrapper):
|
||||
class FloatingIpManager(network.FloatingIpManager):
|
||||
def __init__(self, request):
|
||||
self.request = request
|
||||
self.client = quantumclient(request)
|
||||
self.client = neutronclient(request)
|
||||
|
||||
def list_pools(self):
|
||||
search_opts = {'router:external': True}
|
||||
@ -153,7 +153,7 @@ class FloatingIpManager(network.FloatingIpManager):
|
||||
self.client.delete_floatingip(floating_ip_id)
|
||||
|
||||
def associate(self, floating_ip_id, port_id):
|
||||
# NOTE: In Quantum Horizon floating IP support, port_id is
|
||||
# NOTE: In Neutron Horizon floating IP support, port_id is
|
||||
# "<port_id>_<ip_address>" format to identify multiple ports.
|
||||
pid, ip_address = port_id.split('_', 1)
|
||||
update_dict = {'port_id': pid,
|
||||
@ -184,7 +184,7 @@ class FloatingIpManager(network.FloatingIpManager):
|
||||
return targets
|
||||
|
||||
def get_target_id_by_instance(self, instance_id):
|
||||
# In Quantum one port can have multiple ip addresses, so this method
|
||||
# In Neutron one port can have multiple ip addresses, so this method
|
||||
# picks up the first one and generate target id.
|
||||
if not instance_id:
|
||||
return None
|
||||
@ -196,10 +196,10 @@ class FloatingIpManager(network.FloatingIpManager):
|
||||
|
||||
def is_simple_associate_supported(self):
|
||||
# NOTE: There are two reason that simple association support
|
||||
# needs more considerations. (1) Quantum does not support the
|
||||
# needs more considerations. (1) Neutron does not support the
|
||||
# default floating IP pool at the moment. It can be avoided
|
||||
# in case where only one floating IP pool exists.
|
||||
# (2) Quantum floating IP is associated with each VIF and
|
||||
# (2) Neutron floating IP is associated with each VIF and
|
||||
# we need to check whether such VIF is only one for an instance
|
||||
# to enable simple association support.
|
||||
return False
|
||||
@ -210,13 +210,13 @@ def get_ipver_str(ip_version):
|
||||
return IP_VERSION_DICT.get(ip_version, '')
|
||||
|
||||
|
||||
def quantumclient(request):
|
||||
def neutronclient(request):
|
||||
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
|
||||
LOG.debug('quantumclient connection created using token "%s" and url "%s"'
|
||||
LOG.debug('neutronclient connection created using token "%s" and url "%s"'
|
||||
% (request.user.token.id, url_for(request, 'network')))
|
||||
LOG.debug('user_id=%(user)s, tenant_id=%(tenant)s' %
|
||||
{'user': request.user.id, 'tenant': request.user.tenant_id})
|
||||
c = quantum_client.Client(token=request.user.token.id,
|
||||
c = neutron_client.Client(token=request.user.token.id,
|
||||
endpoint_url=url_for(request, 'network'),
|
||||
insecure=insecure)
|
||||
return c
|
||||
@ -224,7 +224,7 @@ def quantumclient(request):
|
||||
|
||||
def network_list(request, **params):
|
||||
LOG.debug("network_list(): params=%s" % (params))
|
||||
networks = quantumclient(request).list_networks(**params).get('networks')
|
||||
networks = neutronclient(request).list_networks(**params).get('networks')
|
||||
# Get subnet list to expand subnet info in network list.
|
||||
subnets = subnet_list(request)
|
||||
subnet_dict = SortedDict([(s['id'], s) for s in subnets])
|
||||
@ -242,13 +242,13 @@ def network_list_for_tenant(request, tenant_id, **params):
|
||||
LOG.debug("network_list_for_tenant(): tenant_id=%s, params=%s"
|
||||
% (tenant_id, params))
|
||||
|
||||
# If a user has admin role, network list returned by Quantum API
|
||||
# If a user has admin role, network list returned by Neutron API
|
||||
# contains networks that do not belong to that tenant.
|
||||
# So we need to specify tenant_id when calling network_list().
|
||||
networks = network_list(request, tenant_id=tenant_id,
|
||||
shared=False, **params)
|
||||
|
||||
# In the current Quantum API, there is no way to retrieve
|
||||
# In the current Neutron API, there is no way to retrieve
|
||||
# both owner networks and public networks in a single API call.
|
||||
networks += network_list(request, shared=True, **params)
|
||||
|
||||
@ -257,7 +257,7 @@ def network_list_for_tenant(request, tenant_id, **params):
|
||||
|
||||
def network_get(request, network_id, expand_subnet=True, **params):
|
||||
LOG.debug("network_get(): netid=%s, params=%s" % (network_id, params))
|
||||
network = quantumclient(request).show_network(network_id,
|
||||
network = neutronclient(request).show_network(network_id,
|
||||
**params).get('network')
|
||||
# Since the number of subnets per network must be small,
|
||||
# call subnet_get() for each subnet instead of calling
|
||||
@ -278,32 +278,32 @@ def network_create(request, **kwargs):
|
||||
"""
|
||||
LOG.debug("network_create(): kwargs = %s" % kwargs)
|
||||
body = {'network': kwargs}
|
||||
network = quantumclient(request).create_network(body=body).get('network')
|
||||
network = neutronclient(request).create_network(body=body).get('network')
|
||||
return Network(network)
|
||||
|
||||
|
||||
def network_modify(request, network_id, **kwargs):
|
||||
LOG.debug("network_modify(): netid=%s, params=%s" % (network_id, kwargs))
|
||||
body = {'network': kwargs}
|
||||
network = quantumclient(request).update_network(network_id,
|
||||
network = neutronclient(request).update_network(network_id,
|
||||
body=body).get('network')
|
||||
return Network(network)
|
||||
|
||||
|
||||
def network_delete(request, network_id):
|
||||
LOG.debug("network_delete(): netid=%s" % network_id)
|
||||
quantumclient(request).delete_network(network_id)
|
||||
neutronclient(request).delete_network(network_id)
|
||||
|
||||
|
||||
def subnet_list(request, **params):
|
||||
LOG.debug("subnet_list(): params=%s" % (params))
|
||||
subnets = quantumclient(request).list_subnets(**params).get('subnets')
|
||||
subnets = neutronclient(request).list_subnets(**params).get('subnets')
|
||||
return [Subnet(s) for s in subnets]
|
||||
|
||||
|
||||
def subnet_get(request, subnet_id, **params):
|
||||
LOG.debug("subnet_get(): subnetid=%s, params=%s" % (subnet_id, params))
|
||||
subnet = quantumclient(request).show_subnet(subnet_id,
|
||||
subnet = neutronclient(request).show_subnet(subnet_id,
|
||||
**params).get('subnet')
|
||||
return Subnet(subnet)
|
||||
|
||||
@ -327,32 +327,32 @@ def subnet_create(request, network_id, cidr, ip_version, **kwargs):
|
||||
'ip_version': ip_version,
|
||||
'cidr': cidr}}
|
||||
body['subnet'].update(kwargs)
|
||||
subnet = quantumclient(request).create_subnet(body=body).get('subnet')
|
||||
subnet = neutronclient(request).create_subnet(body=body).get('subnet')
|
||||
return Subnet(subnet)
|
||||
|
||||
|
||||
def subnet_modify(request, subnet_id, **kwargs):
|
||||
LOG.debug("subnet_modify(): subnetid=%s, kwargs=%s" % (subnet_id, kwargs))
|
||||
body = {'subnet': kwargs}
|
||||
subnet = quantumclient(request).update_subnet(subnet_id,
|
||||
subnet = neutronclient(request).update_subnet(subnet_id,
|
||||
body=body).get('subnet')
|
||||
return Subnet(subnet)
|
||||
|
||||
|
||||
def subnet_delete(request, subnet_id):
|
||||
LOG.debug("subnet_delete(): subnetid=%s" % subnet_id)
|
||||
quantumclient(request).delete_subnet(subnet_id)
|
||||
neutronclient(request).delete_subnet(subnet_id)
|
||||
|
||||
|
||||
def port_list(request, **params):
|
||||
LOG.debug("port_list(): params=%s" % (params))
|
||||
ports = quantumclient(request).list_ports(**params).get('ports')
|
||||
ports = neutronclient(request).list_ports(**params).get('ports')
|
||||
return [Port(p) for p in ports]
|
||||
|
||||
|
||||
def port_get(request, port_id, **params):
|
||||
LOG.debug("port_get(): portid=%s, params=%s" % (port_id, params))
|
||||
port = quantumclient(request).show_port(port_id, **params).get('port')
|
||||
port = neutronclient(request).show_port(port_id, **params).get('port')
|
||||
return Port(port)
|
||||
|
||||
|
||||
@ -369,19 +369,19 @@ def port_create(request, network_id, **kwargs):
|
||||
LOG.debug("port_create(): netid=%s, kwargs=%s" % (network_id, kwargs))
|
||||
body = {'port': {'network_id': network_id}}
|
||||
body['port'].update(kwargs)
|
||||
port = quantumclient(request).create_port(body=body).get('port')
|
||||
port = neutronclient(request).create_port(body=body).get('port')
|
||||
return Port(port)
|
||||
|
||||
|
||||
def port_delete(request, port_id):
|
||||
LOG.debug("port_delete(): portid=%s" % port_id)
|
||||
quantumclient(request).delete_port(port_id)
|
||||
neutronclient(request).delete_port(port_id)
|
||||
|
||||
|
||||
def port_modify(request, port_id, **kwargs):
|
||||
LOG.debug("port_modify(): portid=%s, kwargs=%s" % (port_id, kwargs))
|
||||
body = {'port': kwargs}
|
||||
port = quantumclient(request).update_port(port_id, body=body).get('port')
|
||||
port = neutronclient(request).update_port(port_id, body=body).get('port')
|
||||
return Port(port)
|
||||
|
||||
|
||||
@ -389,23 +389,23 @@ def router_create(request, **kwargs):
|
||||
LOG.debug("router_create():, kwargs=%s" % kwargs)
|
||||
body = {'router': {}}
|
||||
body['router'].update(kwargs)
|
||||
router = quantumclient(request).create_router(body=body).get('router')
|
||||
router = neutronclient(request).create_router(body=body).get('router')
|
||||
return Router(router)
|
||||
|
||||
|
||||
def router_get(request, router_id, **params):
|
||||
router = quantumclient(request).show_router(router_id,
|
||||
router = neutronclient(request).show_router(router_id,
|
||||
**params).get('router')
|
||||
return Router(router)
|
||||
|
||||
|
||||
def router_list(request, **params):
|
||||
routers = quantumclient(request).list_routers(**params).get('routers')
|
||||
routers = neutronclient(request).list_routers(**params).get('routers')
|
||||
return [Router(r) for r in routers]
|
||||
|
||||
|
||||
def router_delete(request, router_id):
|
||||
quantumclient(request).delete_router(router_id)
|
||||
neutronclient(request).delete_router(router_id)
|
||||
|
||||
|
||||
def router_add_interface(request, router_id, subnet_id=None, port_id=None):
|
||||
@ -414,7 +414,7 @@ def router_add_interface(request, router_id, subnet_id=None, port_id=None):
|
||||
body['subnet_id'] = subnet_id
|
||||
if port_id:
|
||||
body['port_id'] = port_id
|
||||
client = quantumclient(request)
|
||||
client = neutronclient(request)
|
||||
return client.add_interface_router(router_id, body)
|
||||
|
||||
|
||||
@ -424,13 +424,13 @@ def router_remove_interface(request, router_id, subnet_id=None, port_id=None):
|
||||
body['subnet_id'] = subnet_id
|
||||
if port_id:
|
||||
body['port_id'] = port_id
|
||||
quantumclient(request).remove_interface_router(router_id, body)
|
||||
neutronclient(request).remove_interface_router(router_id, body)
|
||||
|
||||
|
||||
def router_add_gateway(request, router_id, network_id):
|
||||
body = {'network_id': network_id}
|
||||
quantumclient(request).add_gateway_router(router_id, body)
|
||||
neutronclient(request).add_gateway_router(router_id, body)
|
||||
|
||||
|
||||
def router_remove_gateway(request, router_id):
|
||||
quantumclient(request).remove_gateway_router(router_id)
|
||||
neutronclient(request).remove_gateway_router(router_id)
|
@ -61,7 +61,7 @@ class CreateNetwork(forms.SelfHandlingForm):
|
||||
'admin_state_up': data['admin_state'],
|
||||
'shared': data['shared'],
|
||||
'router:external': data['external']}
|
||||
network = api.quantum.network_create(request, **params)
|
||||
network = api.neutron.network_create(request, **params)
|
||||
msg = _('Network %s was successfully created.') % data['name']
|
||||
LOG.debug(msg)
|
||||
messages.success(request, msg)
|
||||
@ -89,7 +89,7 @@ class UpdateNetwork(forms.SelfHandlingForm):
|
||||
'admin_state_up': data['admin_state'],
|
||||
'shared': data['shared'],
|
||||
'router:external': data['external']}
|
||||
network = api.quantum.network_modify(request, data['network_id'],
|
||||
network = api.neutron.network_modify(request, data['network_id'],
|
||||
**params)
|
||||
msg = _('Network %s was successfully updated.') % data['name']
|
||||
LOG.debug(msg)
|
||||
|
@ -54,13 +54,13 @@ class CreatePort(forms.SelfHandlingForm):
|
||||
try:
|
||||
# We must specify tenant_id of the network which a subnet is
|
||||
# created for if admin user does not belong to the tenant.
|
||||
network = api.quantum.network_get(request, data['network_id'])
|
||||
network = api.neutron.network_get(request, data['network_id'])
|
||||
data['tenant_id'] = network.tenant_id
|
||||
data['admin_state_up'] = data['admin_state']
|
||||
del data['network_name']
|
||||
del data['admin_state']
|
||||
|
||||
port = api.quantum.port_create(request, **data)
|
||||
port = api.neutron.port_create(request, **data)
|
||||
msg = _('Port %s was successfully created.') % port['id']
|
||||
LOG.debug(msg)
|
||||
messages.success(request, msg)
|
||||
@ -87,7 +87,7 @@ class UpdatePort(project_forms.UpdatePort):
|
||||
def handle(self, request, data):
|
||||
try:
|
||||
LOG.debug('params = %s' % data)
|
||||
port = api.quantum.port_modify(request, data['port_id'],
|
||||
port = api.neutron.port_modify(request, data['port_id'],
|
||||
name=data['name'],
|
||||
admin_state_up=data['admin_state'],
|
||||
device_id=data['device_id'],
|
||||
|
@ -38,7 +38,7 @@ class DeletePort(tables.DeleteAction):
|
||||
|
||||
def delete(self, request, obj_id):
|
||||
try:
|
||||
api.quantum.port_delete(request, obj_id)
|
||||
api.neutron.port_delete(request, obj_id)
|
||||
except:
|
||||
msg = _('Failed to delete subnet %s') % obj_id
|
||||
LOG.info(msg)
|
||||
|
@ -36,7 +36,7 @@ class OverviewTab(tabs.Tab):
|
||||
def get_context_data(self, request):
|
||||
port_id = self.tab_group.kwargs['port_id']
|
||||
try:
|
||||
port = api.quantum.port_get(self.request, port_id)
|
||||
port = api.neutron.port_get(self.request, port_id)
|
||||
except:
|
||||
redirect = reverse('horizon:admin:networks:index')
|
||||
msg = _('Unable to retrieve port details.')
|
||||
|
@ -46,7 +46,7 @@ class CreateView(forms.ModalFormView):
|
||||
if not hasattr(self, "_object"):
|
||||
try:
|
||||
network_id = self.kwargs["network_id"]
|
||||
self._object = api.quantum.network_get(self.request,
|
||||
self._object = api.neutron.network_get(self.request,
|
||||
network_id)
|
||||
except:
|
||||
redirect = reverse(self.failure_url,
|
||||
|
@ -34,7 +34,7 @@ class DeleteSubnet(tables.DeleteAction):
|
||||
|
||||
def delete(self, request, obj_id):
|
||||
try:
|
||||
api.quantum.subnet_delete(request, obj_id)
|
||||
api.neutron.subnet_delete(request, obj_id)
|
||||
except:
|
||||
msg = _('Failed to delete subnet %s') % obj_id
|
||||
LOG.info(msg)
|
||||
|
@ -42,7 +42,7 @@ class CreateSubnet(project_workflows.CreateSubnet):
|
||||
try:
|
||||
# We must specify tenant_id of the network which a subnet is
|
||||
# created for if admin user does not belong to the tenant.
|
||||
network = api.quantum.network_get(request,
|
||||
network = api.neutron.network_get(request,
|
||||
self.context['network_id'])
|
||||
except:
|
||||
msg = (_('Failed to retrieve network %s for a subnet') %
|
||||
|
@ -36,7 +36,7 @@ class DeleteNetwork(tables.DeleteAction):
|
||||
|
||||
def delete(self, request, obj_id):
|
||||
try:
|
||||
api.quantum.network_delete(request, obj_id)
|
||||
api.neutron.network_delete(request, obj_id)
|
||||
except:
|
||||
msg = _('Failed to delete network %s') % obj_id
|
||||
LOG.info(msg)
|
||||
|
@ -31,11 +31,11 @@ INDEX_URL = reverse('horizon:admin:networks:index')
|
||||
|
||||
|
||||
class NetworkTests(test.BaseAdminViewTests):
|
||||
@test.create_stubs({api.quantum: ('network_list',),
|
||||
@test.create_stubs({api.neutron: ('network_list',),
|
||||
api.keystone: ('tenant_list',)})
|
||||
def test_index(self):
|
||||
tenants = self.tenants.list()
|
||||
api.quantum.network_list(IsA(http.HttpRequest)) \
|
||||
api.neutron.network_list(IsA(http.HttpRequest)) \
|
||||
.AndReturn(self.networks.list())
|
||||
api.keystone.tenant_list(IsA(http.HttpRequest))\
|
||||
.AndReturn([tenants, False])
|
||||
@ -48,10 +48,10 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
networks = res.context['networks_table'].data
|
||||
self.assertItemsEqual(networks, self.networks.list())
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_list',)})
|
||||
@test.create_stubs({api.neutron: ('network_list',)})
|
||||
def test_index_network_list_exception(self):
|
||||
api.quantum.network_list(IsA(http.HttpRequest)) \
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.neutron.network_list(IsA(http.HttpRequest)) \
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -61,16 +61,16 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
self.assertEqual(len(res.context['networks_table'].data), 0)
|
||||
self.assertMessageCount(res, error=1)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_list',
|
||||
'port_list',)})
|
||||
def test_network_detail(self):
|
||||
network_id = self.networks.first().id
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id)\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.subnets.first()])
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.ports.first()])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -84,16 +84,16 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
self.assertItemsEqual(subnets, [self.subnets.first()])
|
||||
self.assertItemsEqual(ports, [self.ports.first()])
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_list',
|
||||
'port_list',)})
|
||||
def test_network_detail_network_exception(self):
|
||||
network_id = self.networks.first().id
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.subnets.first()])
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.ports.first()])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -104,16 +104,16 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
redir_url = INDEX_URL
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_list',
|
||||
'port_list',)})
|
||||
def test_network_detail_subnet_exception(self):
|
||||
network_id = self.networks.first().id
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id).\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id).\
|
||||
AndReturn(self.networks.first())
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
AndRaise(self.exceptions.quantum)
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
AndRaise(self.exceptions.neutron)
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
AndReturn([self.ports.first()])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -127,17 +127,17 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
self.assertEqual(len(subnets), 0)
|
||||
self.assertItemsEqual(ports, [self.ports.first()])
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_list',
|
||||
'port_list',)})
|
||||
def test_network_detail_port_exception(self):
|
||||
network_id = self.networks.first().id
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id).\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id).\
|
||||
AndReturn(self.networks.first())
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
AndReturn([self.subnets.first()])
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
AndRaise(self.exceptions.quantum)
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
AndRaise(self.exceptions.neutron)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -162,7 +162,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
|
||||
self.assertTemplateUsed(res, 'admin/networks/create.html')
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_create',),
|
||||
@test.create_stubs({api.neutron: ('network_create',),
|
||||
api.keystone: ('tenant_list',)})
|
||||
def test_network_create_post(self):
|
||||
tenants = self.tenants.list()
|
||||
@ -175,7 +175,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
'admin_state_up': network.admin_state_up,
|
||||
'router:external': True,
|
||||
'shared': True}
|
||||
api.quantum.network_create(IsA(http.HttpRequest), **params)\
|
||||
api.neutron.network_create(IsA(http.HttpRequest), **params)\
|
||||
.AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -190,7 +190,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
self.assertNoFormErrors(res)
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_create',),
|
||||
@test.create_stubs({api.neutron: ('network_create',),
|
||||
api.keystone: ('tenant_list',)})
|
||||
def test_network_create_post_network_exception(self):
|
||||
tenants = self.tenants.list()
|
||||
@ -203,8 +203,8 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
'admin_state_up': network.admin_state_up,
|
||||
'router:external': True,
|
||||
'shared': False}
|
||||
api.quantum.network_create(IsA(http.HttpRequest), **params)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.neutron.network_create(IsA(http.HttpRequest), **params)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = {'tenant_id': tenant_id,
|
||||
@ -218,10 +218,10 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
self.assertNoFormErrors(res)
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_network_update_get(self):
|
||||
network = self.networks.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network.id)\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network.id)\
|
||||
.AndReturn(network)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -231,11 +231,11 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
|
||||
self.assertTemplateUsed(res, 'admin/networks/update.html')
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_network_update_get_exception(self):
|
||||
network = self.networks.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -245,7 +245,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
redir_url = INDEX_URL
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_modify',
|
||||
@test.create_stubs({api.neutron: ('network_modify',
|
||||
'network_get',)})
|
||||
def test_network_update_post(self):
|
||||
network = self.networks.first()
|
||||
@ -253,10 +253,10 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
'shared': True,
|
||||
'admin_state_up': network.admin_state_up,
|
||||
'router:external': True}
|
||||
api.quantum.network_modify(IsA(http.HttpRequest), network.id,
|
||||
api.neutron.network_modify(IsA(http.HttpRequest), network.id,
|
||||
**params)\
|
||||
.AndReturn(network)
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network.id)\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network.id)\
|
||||
.AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -271,7 +271,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_modify',
|
||||
@test.create_stubs({api.neutron: ('network_modify',
|
||||
'network_get',)})
|
||||
def test_network_update_post_exception(self):
|
||||
network = self.networks.first()
|
||||
@ -279,10 +279,10 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
'shared': False,
|
||||
'admin_state_up': network.admin_state_up,
|
||||
'router:external': False}
|
||||
api.quantum.network_modify(IsA(http.HttpRequest), network.id,
|
||||
api.neutron.network_modify(IsA(http.HttpRequest), network.id,
|
||||
**params)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network.id)\
|
||||
.AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -297,7 +297,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_list',
|
||||
@test.create_stubs({api.neutron: ('network_list',
|
||||
'network_delete'),
|
||||
api.keystone: ('tenant_list',)})
|
||||
def test_delete_network(self):
|
||||
@ -305,9 +305,9 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
network = self.networks.first()
|
||||
api.keystone.tenant_list(IsA(http.HttpRequest))\
|
||||
.AndReturn([tenants, False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest))\
|
||||
api.neutron.network_list(IsA(http.HttpRequest))\
|
||||
.AndReturn([network])
|
||||
api.quantum.network_delete(IsA(http.HttpRequest), network.id)
|
||||
api.neutron.network_delete(IsA(http.HttpRequest), network.id)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -316,7 +316,7 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_list',
|
||||
@test.create_stubs({api.neutron: ('network_list',
|
||||
'network_delete'),
|
||||
api.keystone: ('tenant_list',)})
|
||||
def test_delete_network_exception(self):
|
||||
@ -324,10 +324,10 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
network = self.networks.first()
|
||||
api.keystone.tenant_list(IsA(http.HttpRequest))\
|
||||
.AndReturn([tenants, False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest))\
|
||||
api.neutron.network_list(IsA(http.HttpRequest))\
|
||||
.AndReturn([network])
|
||||
api.quantum.network_delete(IsA(http.HttpRequest), network.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.neutron.network_delete(IsA(http.HttpRequest), network.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -339,10 +339,10 @@ class NetworkTests(test.BaseAdminViewTests):
|
||||
|
||||
class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_get',)})
|
||||
@test.create_stubs({api.neutron: ('subnet_get',)})
|
||||
def test_subnet_detail(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(self.subnets.first())
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -354,11 +354,11 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
self.assertTemplateUsed(res, 'project/networks/subnets/detail.html')
|
||||
self.assertEqual(res.context['subnet'].id, subnet.id)
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_get',)})
|
||||
@test.create_stubs({api.neutron: ('subnet_get',)})
|
||||
def test_subnet_detail_exception(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -371,10 +371,10 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
redir_url = reverse('horizon:project:networks:index')
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_get(self):
|
||||
network = self.networks.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
self.mox.ReplayAll()
|
||||
@ -385,18 +385,18 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_create',)})
|
||||
def test_subnet_create_post(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.subnet_create(IsA(http.HttpRequest),
|
||||
api.neutron.subnet_create(IsA(http.HttpRequest),
|
||||
network_id=network.id,
|
||||
name=subnet.name,
|
||||
cidr=subnet.cidr,
|
||||
@ -418,14 +418,14 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
args=[subnet.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_create',)})
|
||||
def test_subnet_create_post_network_exception(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = form_data_subnet(subnet, allocation_pools=[])
|
||||
@ -439,18 +439,18 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
redir_url = reverse('horizon:project:networks:index')
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_create',)})
|
||||
def test_subnet_create_post_subnet_exception(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.subnet_create(IsA(http.HttpRequest),
|
||||
api.neutron.subnet_create(IsA(http.HttpRequest),
|
||||
network_id=network.id,
|
||||
name=subnet.name,
|
||||
cidr=subnet.cidr,
|
||||
@ -458,7 +458,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
gateway_ip=subnet.gateway_ip,
|
||||
enable_dhcp=subnet.enable_dhcp,
|
||||
tenant_id=subnet.tenant_id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = form_data_subnet(subnet, allocation_pools=[])
|
||||
@ -470,11 +470,11 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
args=[subnet.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_cidr_inconsistent(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
self.mox.ReplayAll()
|
||||
@ -489,11 +489,11 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
expected_msg = 'Network Address and IP version are inconsistent.'
|
||||
self.assertContains(res, expected_msg)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_gw_inconsistent(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
self.mox.ReplayAll()
|
||||
@ -508,13 +508,13 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
|
||||
self.assertContains(res, 'Gateway IP and IP version are inconsistent.')
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_modify',
|
||||
@test.create_stubs({api.neutron: ('subnet_modify',
|
||||
'subnet_get',)})
|
||||
def test_subnet_update_post(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(subnet)
|
||||
api.quantum.subnet_modify(IsA(http.HttpRequest), subnet.id,
|
||||
api.neutron.subnet_modify(IsA(http.HttpRequest), subnet.id,
|
||||
name=subnet.name,
|
||||
gateway_ip=subnet.gateway_ip,
|
||||
enable_dhcp=subnet.enable_dhcp,
|
||||
@ -532,11 +532,11 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
args=[subnet.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_modify',
|
||||
@test.create_stubs({api.neutron: ('subnet_modify',
|
||||
'subnet_get',)})
|
||||
def test_subnet_update_post_gw_inconsistent(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(subnet)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -550,16 +550,16 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
|
||||
self.assertContains(res, 'Gateway IP and IP version are inconsistent.')
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_delete',
|
||||
@test.create_stubs({api.neutron: ('subnet_delete',
|
||||
'subnet_list',
|
||||
'port_list',)})
|
||||
def test_subnet_delete(self):
|
||||
subnet = self.subnets.first()
|
||||
network_id = subnet.network_id
|
||||
api.quantum.subnet_delete(IsA(http.HttpRequest), subnet.id)
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.subnet_delete(IsA(http.HttpRequest), subnet.id)
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.subnets.first()])
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.ports.first()])
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -570,17 +570,17 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
|
||||
self.assertRedirectsNoFollow(res, url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_delete',
|
||||
@test.create_stubs({api.neutron: ('subnet_delete',
|
||||
'subnet_list',
|
||||
'port_list',)})
|
||||
def test_subnet_delete_exception(self):
|
||||
subnet = self.subnets.first()
|
||||
network_id = subnet.network_id
|
||||
api.quantum.subnet_delete(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.subnet_delete(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.subnets.first()])
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.ports.first()])
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -594,10 +594,10 @@ class NetworkSubnetTests(test.BaseAdminViewTests):
|
||||
|
||||
class NetworkPortTests(test.BaseAdminViewTests):
|
||||
|
||||
@test.create_stubs({api.quantum: ('port_get',)})
|
||||
@test.create_stubs({api.neutron: ('port_get',)})
|
||||
def test_port_detail(self):
|
||||
port = self.ports.first()
|
||||
api.quantum.port_get(IsA(http.HttpRequest), port.id)\
|
||||
api.neutron.port_get(IsA(http.HttpRequest), port.id)\
|
||||
.AndReturn(self.ports.first())
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -608,11 +608,11 @@ class NetworkPortTests(test.BaseAdminViewTests):
|
||||
self.assertTemplateUsed(res, 'project/networks/ports/detail.html')
|
||||
self.assertEqual(res.context['port'].id, port.id)
|
||||
|
||||
@test.create_stubs({api.quantum: ('port_get',)})
|
||||
@test.create_stubs({api.neutron: ('port_get',)})
|
||||
def test_port_detail_exception(self):
|
||||
port = self.ports.first()
|
||||
api.quantum.port_get(IsA(http.HttpRequest), port.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.neutron.port_get(IsA(http.HttpRequest), port.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -624,10 +624,10 @@ class NetworkPortTests(test.BaseAdminViewTests):
|
||||
redir_url = reverse('horizon:project:networks:index')
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_port_create_get(self):
|
||||
network = self.networks.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
self.mox.ReplayAll()
|
||||
@ -638,18 +638,18 @@ class NetworkPortTests(test.BaseAdminViewTests):
|
||||
|
||||
self.assertTemplateUsed(res, 'admin/networks/ports/create.html')
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'port_create')})
|
||||
def test_port_create_post(self):
|
||||
network = self.networks.first()
|
||||
port = self.ports.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.port_create(IsA(http.HttpRequest),
|
||||
api.neutron.port_create(IsA(http.HttpRequest),
|
||||
tenant_id=network.tenant_id,
|
||||
network_id=network.id,
|
||||
name=port.name,
|
||||
@ -674,25 +674,25 @@ class NetworkPortTests(test.BaseAdminViewTests):
|
||||
args=[port.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'port_create')})
|
||||
def test_port_create_post_exception(self):
|
||||
network = self.networks.first()
|
||||
port = self.ports.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.port_create(IsA(http.HttpRequest),
|
||||
api.neutron.port_create(IsA(http.HttpRequest),
|
||||
tenant_id=network.tenant_id,
|
||||
network_id=network.id,
|
||||
name=port.name,
|
||||
admin_state_up=port.admin_state_up,
|
||||
device_id=port.device_id,
|
||||
device_owner=port.device_owner)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = {'network_id': port.network_id,
|
||||
@ -710,10 +710,10 @@ class NetworkPortTests(test.BaseAdminViewTests):
|
||||
args=[port.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('port_get',)})
|
||||
@test.create_stubs({api.neutron: ('port_get',)})
|
||||
def test_port_update_get(self):
|
||||
port = self.ports.first()
|
||||
api.quantum.port_get(IsA(http.HttpRequest),
|
||||
api.neutron.port_get(IsA(http.HttpRequest),
|
||||
port.id)\
|
||||
.AndReturn(port)
|
||||
self.mox.ReplayAll()
|
||||
@ -724,13 +724,13 @@ class NetworkPortTests(test.BaseAdminViewTests):
|
||||
|
||||
self.assertTemplateUsed(res, 'admin/networks/ports/update.html')
|
||||
|
||||
@test.create_stubs({api.quantum: ('port_get',
|
||||
@test.create_stubs({api.neutron: ('port_get',
|
||||
'port_modify')})
|
||||
def test_port_update_post(self):
|
||||
port = self.ports.first()
|
||||
api.quantum.port_get(IsA(http.HttpRequest), port.id)\
|
||||
api.neutron.port_get(IsA(http.HttpRequest), port.id)\
|
||||
.AndReturn(port)
|
||||
api.quantum.port_modify(IsA(http.HttpRequest), port.id,
|
||||
api.neutron.port_modify(IsA(http.HttpRequest), port.id,
|
||||
name=port.name,
|
||||
admin_state_up=port.admin_state_up,
|
||||
device_id=port.device_id,
|
||||
@ -752,18 +752,18 @@ class NetworkPortTests(test.BaseAdminViewTests):
|
||||
args=[port.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('port_get',
|
||||
@test.create_stubs({api.neutron: ('port_get',
|
||||
'port_modify')})
|
||||
def test_port_update_post_exception(self):
|
||||
port = self.ports.first()
|
||||
api.quantum.port_get(IsA(http.HttpRequest), port.id)\
|
||||
api.neutron.port_get(IsA(http.HttpRequest), port.id)\
|
||||
.AndReturn(port)
|
||||
api.quantum.port_modify(IsA(http.HttpRequest), port.id,
|
||||
api.neutron.port_modify(IsA(http.HttpRequest), port.id,
|
||||
name=port.name,
|
||||
admin_state_up=port.admin_state_up,
|
||||
device_id=port.device_id,
|
||||
device_owner=port.device_owner)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = {'network_id': port.network_id,
|
||||
@ -780,16 +780,16 @@ class NetworkPortTests(test.BaseAdminViewTests):
|
||||
args=[port.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('port_delete',
|
||||
@test.create_stubs({api.neutron: ('port_delete',
|
||||
'subnet_list',
|
||||
'port_list',)})
|
||||
def test_port_delete(self):
|
||||
port = self.ports.first()
|
||||
network_id = port.network_id
|
||||
api.quantum.port_delete(IsA(http.HttpRequest), port.id)
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.port_delete(IsA(http.HttpRequest), port.id)
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.subnets.first()])
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.ports.first()])
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -800,17 +800,17 @@ class NetworkPortTests(test.BaseAdminViewTests):
|
||||
|
||||
self.assertRedirectsNoFollow(res, url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('port_delete',
|
||||
@test.create_stubs({api.neutron: ('port_delete',
|
||||
'subnet_list',
|
||||
'port_list',)})
|
||||
def test_port_delete_exception(self):
|
||||
port = self.ports.first()
|
||||
network_id = port.network_id
|
||||
api.quantum.port_delete(IsA(http.HttpRequest), port.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.port_delete(IsA(http.HttpRequest), port.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.subnets.first()])
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.ports.first()])
|
||||
self.mox.ReplayAll()
|
||||
|
||||
|
@ -56,7 +56,7 @@ class IndexView(tables.DataTableView):
|
||||
|
||||
def get_data(self):
|
||||
try:
|
||||
networks = api.quantum.network_list(self.request)
|
||||
networks = api.neutron.network_list(self.request)
|
||||
except:
|
||||
networks = []
|
||||
msg = _('Network list can not be retrieved.')
|
||||
@ -86,7 +86,7 @@ class DetailView(tables.MultiTableView):
|
||||
def get_subnets_data(self):
|
||||
try:
|
||||
network_id = self.kwargs['network_id']
|
||||
subnets = api.quantum.subnet_list(self.request,
|
||||
subnets = api.neutron.subnet_list(self.request,
|
||||
network_id=network_id)
|
||||
except:
|
||||
subnets = []
|
||||
@ -99,7 +99,7 @@ class DetailView(tables.MultiTableView):
|
||||
def get_ports_data(self):
|
||||
try:
|
||||
network_id = self.kwargs['network_id']
|
||||
ports = api.quantum.port_list(self.request, network_id=network_id)
|
||||
ports = api.neutron.port_list(self.request, network_id=network_id)
|
||||
except:
|
||||
ports = []
|
||||
msg = _('Port list can not be retrieved.')
|
||||
@ -112,7 +112,7 @@ class DetailView(tables.MultiTableView):
|
||||
if not hasattr(self, "_network"):
|
||||
try:
|
||||
network_id = self.kwargs['network_id']
|
||||
network = api.quantum.network_get(self.request, network_id)
|
||||
network = api.neutron.network_get(self.request, network_id)
|
||||
network.set_id_as_name_if_empty(length=0)
|
||||
except:
|
||||
redirect = self.failure_url
|
||||
|
@ -33,9 +33,9 @@ class DeleteRouter(r_tables.DeleteRouter):
|
||||
def delete(self, request, obj_id):
|
||||
search_opts = {'device_owner': 'network:router_interface',
|
||||
'device_id': obj_id}
|
||||
ports = api.quantum.port_list(request, **search_opts)
|
||||
ports = api.neutron.port_list(request, **search_opts)
|
||||
for port in ports:
|
||||
api.quantum.router_remove_interface(request, obj_id,
|
||||
api.neutron.router_remove_interface(request, obj_id,
|
||||
port_id=port.id)
|
||||
super(DeleteRouter, self).delete(request, obj_id)
|
||||
|
||||
@ -47,7 +47,7 @@ class UpdateRow(tables.Row):
|
||||
ajax = True
|
||||
|
||||
def get_data(self, request, router_id):
|
||||
router = api.quantum.router_get(request, router_id)
|
||||
router = api.neutron.router_get(request, router_id)
|
||||
return router
|
||||
|
||||
|
||||
|
@ -29,11 +29,11 @@ class RouterTests(test.BaseAdminViewTests, r_test.RouterTests):
|
||||
INDEX_URL = reverse('horizon:%s:routers:index' % DASHBOARD)
|
||||
DETAIL_PATH = 'horizon:%s:routers:detail' % DASHBOARD
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_list', 'network_list'),
|
||||
@test.create_stubs({api.neutron: ('router_list', 'network_list'),
|
||||
api.keystone: ('tenant_list',)})
|
||||
def test_index(self):
|
||||
tenants = self.tenants.list()
|
||||
api.quantum.router_list(
|
||||
api.neutron.router_list(
|
||||
IsA(http.HttpRequest),
|
||||
search_opts=None).AndReturn(self.routers.list())
|
||||
api.keystone.tenant_list(IsA(http.HttpRequest))\
|
||||
@ -48,12 +48,12 @@ class RouterTests(test.BaseAdminViewTests, r_test.RouterTests):
|
||||
routers = res.context['table'].data
|
||||
self.assertItemsEqual(routers, self.routers.list())
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_list',),
|
||||
@test.create_stubs({api.neutron: ('router_list',),
|
||||
api.keystone: ('tenant_list',)})
|
||||
def test_index_router_list_exception(self):
|
||||
api.quantum.router_list(
|
||||
api.neutron.router_list(
|
||||
IsA(http.HttpRequest),
|
||||
search_opts=None).AndRaise(self.exceptions.quantum)
|
||||
search_opts=None).AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
res = self.client.get(self.INDEX_URL)
|
||||
|
@ -15,7 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Views for managing Quantum Routers.
|
||||
Views for managing Neutron Routers.
|
||||
"""
|
||||
|
||||
import logging
|
||||
@ -41,7 +41,7 @@ class IndexView(r_views.IndexView, n_views.IndexView):
|
||||
|
||||
def _get_routers(self, search_opts=None):
|
||||
try:
|
||||
routers = api.quantum.router_list(self.request,
|
||||
routers = api.neutron.router_list(self.request,
|
||||
search_opts=search_opts)
|
||||
except:
|
||||
routers = []
|
||||
|
@ -172,7 +172,7 @@ class FloatingIpViewTests(test.TestCase):
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
|
||||
class FloatingIpQuantumViewTests(FloatingIpViewTests):
|
||||
class FloatingIpNeutronViewTests(FloatingIpViewTests):
|
||||
def setUp(self):
|
||||
super(FloatingIpViewTests, self).setUp()
|
||||
self._floating_ips_orig = self.floating_ips
|
||||
|
@ -22,7 +22,7 @@ def get_int_or_uuid(value):
|
||||
|
||||
This method is mainly used to convert floating IP id to the
|
||||
appropriate type. For floating IP id, integer is used in Nova's
|
||||
original implementation, but UUID is used in Quantum based one.
|
||||
original implementation, but UUID is used in Neutron based one.
|
||||
"""
|
||||
try:
|
||||
uuid.UUID(value)
|
||||
|
@ -51,7 +51,7 @@ class AssociateIPAction(workflows.Action):
|
||||
self.fields['instance_id'].label = label
|
||||
|
||||
# If AssociateIP is invoked from instance menu, instance_id parameter
|
||||
# is passed in URL. In Quantum based Floating IP implementation
|
||||
# is passed in URL. In Neutron based Floating IP implementation
|
||||
# an association target is not an instance but a port, so we need
|
||||
# to get an association target based on a received instance_id
|
||||
# and set the initial value of instance_id ChoiceField.
|
||||
@ -92,15 +92,15 @@ class AssociateIPAction(workflows.Action):
|
||||
# Sort instances for easy browsing
|
||||
instances = sorted(instances, key=lambda x: x[1])
|
||||
|
||||
quantum_enabled = api.base.is_service_enabled(request, 'network')
|
||||
neutron_enabled = api.base.is_service_enabled(request, 'network')
|
||||
if instances:
|
||||
if quantum_enabled:
|
||||
if neutron_enabled:
|
||||
label = _("Select a port")
|
||||
else:
|
||||
label = _("Select an instance")
|
||||
instances.insert(0, ("", label))
|
||||
else:
|
||||
if quantum_enabled:
|
||||
if neutron_enabled:
|
||||
label = _("No ports available")
|
||||
else:
|
||||
label = _("No instances available")
|
||||
|
@ -430,9 +430,9 @@ class SecurityGroupsViewTests(test.TestCase):
|
||||
INDEX_URL)
|
||||
|
||||
|
||||
class SecurityGroupsQuantumTests(SecurityGroupsViewTests):
|
||||
class SecurityGroupsNeutronTests(SecurityGroupsViewTests):
|
||||
def setUp(self):
|
||||
super(SecurityGroupsQuantumTests, self).setUp()
|
||||
super(SecurityGroupsNeutronTests, self).setUp()
|
||||
|
||||
self._sec_groups_orig = self.security_groups
|
||||
self.security_groups = self.security_groups_uuid
|
||||
@ -451,4 +451,4 @@ class SecurityGroupsQuantumTests(SecurityGroupsViewTests):
|
||||
def tearDown(self):
|
||||
self.security_groups = self._sec_groups_orig
|
||||
self.security_group_rules = self._sec_group_rules_orig
|
||||
super(SecurityGroupsQuantumTests, self).tearDown()
|
||||
super(SecurityGroupsNeutronTests, self).tearDown()
|
||||
|
@ -97,7 +97,7 @@ class AccessAndSecurityTests(test.TestCase):
|
||||
self.assertContains(res, '<option value="2">server_2 (2)</option>')
|
||||
|
||||
|
||||
class AccessAndSecurityQuantumProxyTests(AccessAndSecurityTests):
|
||||
class AccessAndSecurityNeutronProxyTests(AccessAndSecurityTests):
|
||||
def setUp(self):
|
||||
super(AccessAndSecurityQuantumProxyTests, self).setUp()
|
||||
super(AccessAndSecurityNeutronProxyTests, self).setUp()
|
||||
self.floating_ips = self.floating_ips_uuid
|
||||
|
@ -358,8 +358,8 @@ class SimpleAssociateIP(tables.Action):
|
||||
|
||||
def single(self, table, request, instance_id):
|
||||
try:
|
||||
# target_id is port_id for Quantum and instance_id for Nova Network
|
||||
# (Quantum API wrapper returns a 'portid_fixedip' string)
|
||||
# target_id is port_id for Neutron and instance_id for Nova Network
|
||||
# (Neutron API wrapper returns a 'portid_fixedip' string)
|
||||
target_id = api.network.floating_ip_target_get_by_instance(
|
||||
request, instance_id).split('_')[0]
|
||||
|
||||
@ -386,8 +386,8 @@ class SimpleDisassociateIP(tables.Action):
|
||||
|
||||
def single(self, table, request, instance_id):
|
||||
try:
|
||||
# target_id is port_id for Quantum and instance_id for Nova Network
|
||||
# (Quantum API wrapper returns a 'portid_fixedip' string)
|
||||
# target_id is port_id for Neutron and instance_id for Nova Network
|
||||
# (Neutron API wrapper returns a 'portid_fixedip' string)
|
||||
target_id = api.network.floating_ip_target_get_by_instance(
|
||||
request, instance_id).split('_')[0]
|
||||
|
||||
|
@ -803,7 +803,7 @@ class InstanceTests(test.TestCase):
|
||||
'availability_zone_list',),
|
||||
cinder: ('volume_snapshot_list',
|
||||
'volume_list',),
|
||||
api.quantum: ('network_list',),
|
||||
api.neutron: ('network_list',),
|
||||
api.glance: ('image_list_detailed',)})
|
||||
def test_launch_instance_get(self):
|
||||
image = self.images.first()
|
||||
@ -820,11 +820,11 @@ class InstanceTests(test.TestCase):
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False) \
|
||||
.AndReturn(self.networks.list()[:1])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True) \
|
||||
.AndReturn(self.networks.list()[1:])
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest))\
|
||||
@ -860,7 +860,7 @@ class InstanceTests(test.TestCase):
|
||||
'<PostCreationStep: customizeaction>'])
|
||||
|
||||
@test.create_stubs({api.glance: ('image_list_detailed',),
|
||||
api.quantum: ('network_list',),
|
||||
api.neutron: ('network_list',),
|
||||
api.nova: ('flavor_list',
|
||||
'keypair_list',
|
||||
'security_group_list',
|
||||
@ -894,11 +894,11 @@ class InstanceTests(test.TestCase):
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False) \
|
||||
.AndReturn(self.networks.list()[:1])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True) \
|
||||
.AndReturn(self.networks.list()[1:])
|
||||
cinder.volume_list(IsA(http.HttpRequest)) \
|
||||
@ -939,7 +939,7 @@ class InstanceTests(test.TestCase):
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.glance: ('image_list_detailed',),
|
||||
api.quantum: ('network_list',),
|
||||
api.neutron: ('network_list',),
|
||||
api.nova: ('flavor_list',
|
||||
'tenant_absolute_limits',
|
||||
'keypair_list',
|
||||
@ -972,11 +972,11 @@ class InstanceTests(test.TestCase):
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([self.images.list(), False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False) \
|
||||
.AndReturn(self.networks.list()[:1])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True) \
|
||||
.AndReturn(self.networks.list()[1:])
|
||||
api.nova.flavor_list(IsA(http.HttpRequest)) \
|
||||
@ -1020,7 +1020,7 @@ class InstanceTests(test.TestCase):
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
@test.create_stubs({api.glance: ('image_list_detailed',),
|
||||
api.quantum: ('network_list',),
|
||||
api.neutron: ('network_list',),
|
||||
api.nova: ('flavor_list',
|
||||
'keypair_list',
|
||||
'security_group_list',
|
||||
@ -1057,11 +1057,11 @@ class InstanceTests(test.TestCase):
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False) \
|
||||
.AndReturn(self.networks.list()[:1])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True) \
|
||||
.AndReturn(self.networks.list()[1:])
|
||||
cinder.volume_list(IsA(http.HttpRequest)) \
|
||||
@ -1103,7 +1103,7 @@ class InstanceTests(test.TestCase):
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.glance: ('image_list_detailed',),
|
||||
api.quantum: ('network_list',),
|
||||
api.neutron: ('network_list',),
|
||||
api.nova: ('server_create',
|
||||
'flavor_list',
|
||||
'keypair_list',
|
||||
@ -1140,11 +1140,11 @@ class InstanceTests(test.TestCase):
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False) \
|
||||
.AndReturn(self.networks.list()[:1])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True) \
|
||||
.AndReturn(self.networks.list()[1:])
|
||||
cinder.volume_list(IsA(http.HttpRequest)) \
|
||||
@ -1188,7 +1188,7 @@ class InstanceTests(test.TestCase):
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.glance: ('image_list_detailed',),
|
||||
api.quantum: ('network_list',),
|
||||
api.neutron: ('network_list',),
|
||||
api.nova: ('flavor_list',
|
||||
'keypair_list',
|
||||
'availability_zone_list',
|
||||
@ -1216,11 +1216,11 @@ class InstanceTests(test.TestCase):
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False) \
|
||||
.AndReturn(self.networks.list()[:1])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True) \
|
||||
.AndReturn(self.networks.list()[1:])
|
||||
api.nova.flavor_list(IsA(http.HttpRequest)) \
|
||||
@ -1260,7 +1260,7 @@ class InstanceTests(test.TestCase):
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
@test.create_stubs({api.glance: ('image_list_detailed',),
|
||||
api.quantum: ('network_list',),
|
||||
api.neutron: ('network_list',),
|
||||
cinder: ('volume_list',
|
||||
'volume_snapshot_list',),
|
||||
api.nova: ('flavor_list',
|
||||
@ -1281,11 +1281,11 @@ class InstanceTests(test.TestCase):
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False) \
|
||||
.AndReturn(self.networks.list()[:1])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True) \
|
||||
.AndReturn(self.networks.list()[1:])
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
@ -1309,7 +1309,7 @@ class InstanceTests(test.TestCase):
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
@test.create_stubs({api.glance: ('image_list_detailed',),
|
||||
api.quantum: ('network_list',),
|
||||
api.neutron: ('network_list',),
|
||||
api.nova: ('flavor_list',
|
||||
'keypair_list',
|
||||
'security_group_list',
|
||||
@ -1343,11 +1343,11 @@ class InstanceTests(test.TestCase):
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False) \
|
||||
.AndReturn(self.networks.list()[:1])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True) \
|
||||
.AndReturn(self.networks.list()[1:])
|
||||
cinder.volume_list(IgnoreArg()).AndReturn(self.volumes.list())
|
||||
@ -1388,7 +1388,7 @@ class InstanceTests(test.TestCase):
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.glance: ('image_list_detailed',),
|
||||
api.quantum: ('network_list',),
|
||||
api.neutron: ('network_list',),
|
||||
api.nova: ('flavor_list',
|
||||
'keypair_list',
|
||||
'security_group_list',
|
||||
@ -1424,11 +1424,11 @@ class InstanceTests(test.TestCase):
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False) \
|
||||
.AndReturn(self.networks.list()[:1])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True) \
|
||||
.AndReturn(self.networks.list()[1:])
|
||||
cinder.volume_list(IsA(http.HttpRequest)) \
|
||||
@ -1517,7 +1517,7 @@ class InstanceTests(test.TestCase):
|
||||
'tenant_absolute_limits',),
|
||||
cinder: ('volume_snapshot_list',
|
||||
'volume_list',),
|
||||
api.quantum: ('network_list',),
|
||||
api.neutron: ('network_list',),
|
||||
api.glance: ('image_list_detailed',)})
|
||||
def test_select_default_keypair_if_only_one(self):
|
||||
keypair = self.keypairs.first()
|
||||
@ -1535,11 +1535,11 @@ class InstanceTests(test.TestCase):
|
||||
filters={'property-owner_id': self.tenant.id,
|
||||
'status': 'active'}) \
|
||||
.AndReturn([[], False])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False) \
|
||||
.AndReturn(self.networks.list()[:1])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True) \
|
||||
.AndReturn(self.networks.list()[1:])
|
||||
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
|
||||
|
@ -451,7 +451,7 @@ class SetNetworkAction(workflows.Action):
|
||||
def populate_network_choices(self, request, context):
|
||||
try:
|
||||
tenant_id = self.request.user.tenant_id
|
||||
networks = api.quantum.network_list_for_tenant(request, tenant_id)
|
||||
networks = api.neutron.network_list_for_tenant(request, tenant_id)
|
||||
for n in networks:
|
||||
n.set_id_as_name_if_empty()
|
||||
network_list = [(network.id, network.name) for network in networks]
|
||||
|
@ -12,5 +12,10 @@ class LoadBalancer(horizon.Panel):
|
||||
permissions = ('openstack.services.network',)
|
||||
|
||||
|
||||
if getattr(settings, 'OPENSTACK_QUANTUM_NETWORK', {}).get('enable_lb', False):
|
||||
network_config = (
|
||||
getattr(settings, 'OPENSTACK_NEUTRON_NETWORK', {}) or
|
||||
getattr(settings, 'OPENSTACK_QUANTUM_NETWORK', {})
|
||||
)
|
||||
|
||||
if network_config.get('enable_lb'):
|
||||
dashboard.Project.register(LoadBalancer)
|
||||
|
@ -85,16 +85,16 @@ class LoadBalancerTests(test.TestCase):
|
||||
|
||||
def set_up_expect_with_exception(self):
|
||||
api.lbaas.pools_get(
|
||||
IsA(http.HttpRequest)).AndRaise(self.exceptions.quantum)
|
||||
IsA(http.HttpRequest)).AndRaise(self.exceptions.neutron)
|
||||
api.lbaas.members_get(
|
||||
IsA(http.HttpRequest)).AndRaise(self.exceptions.quantum)
|
||||
IsA(http.HttpRequest)).AndRaise(self.exceptions.neutron)
|
||||
api.lbaas.pool_health_monitors_get(
|
||||
IsA(http.HttpRequest)).AndRaise(self.exceptions.quantum)
|
||||
IsA(http.HttpRequest)).AndRaise(self.exceptions.neutron)
|
||||
|
||||
@test.create_stubs({api.lbaas: ('pools_get', 'vip_get',
|
||||
'members_get', 'pool_get',
|
||||
'pool_health_monitors_get'),
|
||||
api.quantum: ('subnet_get',)})
|
||||
api.neutron: ('subnet_get',)})
|
||||
def test_index_pools(self):
|
||||
self.set_up_expect()
|
||||
|
||||
@ -111,7 +111,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
@test.create_stubs({api.lbaas: ('pools_get', 'vip_get',
|
||||
'members_get', 'pool_get',
|
||||
'pool_health_monitors_get'),
|
||||
api.quantum: ('subnet_get',)})
|
||||
api.neutron: ('subnet_get',)})
|
||||
def test_index_members(self):
|
||||
self.set_up_expect()
|
||||
|
||||
@ -128,7 +128,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
@test.create_stubs({api.lbaas: ('pools_get', 'vip_get',
|
||||
'pool_health_monitors_get',
|
||||
'members_get', 'pool_get'),
|
||||
api.quantum: ('subnet_get',)})
|
||||
api.neutron: ('subnet_get',)})
|
||||
def test_index_monitors(self):
|
||||
self.set_up_expect()
|
||||
|
||||
@ -190,7 +190,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
'horizon/common/_detail_table.html')
|
||||
self.assertEqual(len(res.context['monitorstable_table'].data), 0)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_list_for_tenant',),
|
||||
@test.create_stubs({api.neutron: ('network_list_for_tenant',),
|
||||
api.lbaas: ('pool_create', )})
|
||||
def test_add_pool_post(self):
|
||||
pool = self.pools.first()
|
||||
@ -198,7 +198,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
subnet = self.subnets.first()
|
||||
networks = [{'subnets': [subnet, ]}, ]
|
||||
|
||||
api.quantum.network_list_for_tenant(
|
||||
api.neutron.network_list_for_tenant(
|
||||
IsA(http.HttpRequest), subnet.tenant_id).AndReturn(networks)
|
||||
|
||||
api.lbaas.pool_create(
|
||||
@ -224,13 +224,13 @@ class LoadBalancerTests(test.TestCase):
|
||||
self.assertNoFormErrors(res)
|
||||
self.assertRedirectsNoFollow(res, str(self.INDEX_URL))
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_list_for_tenant',)})
|
||||
@test.create_stubs({api.neutron: ('network_list_for_tenant',)})
|
||||
def test_add_pool_get(self):
|
||||
subnet = self.subnets.first()
|
||||
|
||||
networks = [{'subnets': [subnet, ]}, ]
|
||||
|
||||
api.quantum.network_list_for_tenant(
|
||||
api.neutron.network_list_for_tenant(
|
||||
IsA(http.HttpRequest), subnet.tenant_id).AndReturn(networks)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -245,7 +245,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
self.assertQuerysetEqual(workflow.steps, expected_objs)
|
||||
|
||||
@test.create_stubs({api.lbaas: ('pool_get', 'vip_create'),
|
||||
api.quantum: ('subnet_get', )})
|
||||
api.neutron: ('subnet_get', )})
|
||||
def test_add_vip_post(self):
|
||||
vip = self.vips.first()
|
||||
|
||||
@ -255,7 +255,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
api.lbaas.pool_get(
|
||||
IsA(http.HttpRequest), pool.id).MultipleTimes().AndReturn(pool)
|
||||
|
||||
api.quantum.subnet_get(
|
||||
api.neutron.subnet_get(
|
||||
IsA(http.HttpRequest), subnet.id).AndReturn(subnet)
|
||||
|
||||
api.lbaas.vip_create(
|
||||
@ -299,7 +299,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
self.assertRedirectsNoFollow(res, str(self.INDEX_URL))
|
||||
|
||||
@test.create_stubs({api.lbaas: ('pool_get', ),
|
||||
api.quantum: ('subnet_get', )})
|
||||
api.neutron: ('subnet_get', )})
|
||||
def test_add_vip_post_with_error(self):
|
||||
vip = self.vips.first()
|
||||
|
||||
@ -307,7 +307,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
pool = self.pools.first()
|
||||
|
||||
api.lbaas.pool_get(IsA(http.HttpRequest), pool.id).AndReturn(pool)
|
||||
api.quantum.subnet_get(
|
||||
api.neutron.subnet_get(
|
||||
IsA(http.HttpRequest), subnet.id).AndReturn(subnet)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -330,13 +330,13 @@ class LoadBalancerTests(test.TestCase):
|
||||
self.assertFormErrors(res, 2)
|
||||
|
||||
@test.create_stubs({api.lbaas: ('pool_get', ),
|
||||
api.quantum: ('subnet_get', )})
|
||||
api.neutron: ('subnet_get', )})
|
||||
def test_add_vip_get(self):
|
||||
subnet = self.subnets.first()
|
||||
pool = self.pools.first()
|
||||
|
||||
api.lbaas.pool_get(IsA(http.HttpRequest), pool.id).AndReturn(pool)
|
||||
api.quantum.subnet_get(
|
||||
api.neutron.subnet_get(
|
||||
IsA(http.HttpRequest), subnet.id).AndReturn(subnet)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -425,7 +425,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
self.assertQuerysetEqual(workflow.steps, expected_objs)
|
||||
|
||||
@test.create_stubs({api.lbaas: ('pools_get', 'member_create'),
|
||||
api.quantum: ('port_list',),
|
||||
api.neutron: ('port_list',),
|
||||
api.nova: ('server_list',)})
|
||||
def test_add_member_post(self):
|
||||
member = self.members.first()
|
||||
@ -445,7 +445,7 @@ class LoadBalancerTests(test.TestCase):
|
||||
api.nova.server_list(IsA(http.HttpRequest)).AndReturn(
|
||||
[[server1, server2], False])
|
||||
|
||||
api.quantum.port_list(IsA(http.HttpRequest),
|
||||
api.neutron.port_list(IsA(http.HttpRequest),
|
||||
device_id=server1.id).AndReturn([port1, ])
|
||||
|
||||
api.lbaas.member_create(
|
||||
|
@ -128,7 +128,7 @@ class AddVipView(workflows.WorkflowView):
|
||||
initial['pool_id'] = self.kwargs['pool_id']
|
||||
try:
|
||||
pool = api.lbaas.pool_get(self.request, initial['pool_id'])
|
||||
initial['subnet'] = api.quantum.subnet_get(
|
||||
initial['subnet'] = api.neutron.subnet_get(
|
||||
self.request, pool.subnet_id).cidr
|
||||
except:
|
||||
initial['subnet'] = ''
|
||||
|
@ -48,7 +48,7 @@ class AddPoolAction(workflows.Action):
|
||||
|
||||
subnet_id_choices = [('', _("Select a Subnet"))]
|
||||
try:
|
||||
networks = api.quantum.network_list_for_tenant(request, tenant_id)
|
||||
networks = api.neutron.network_list_for_tenant(request, tenant_id)
|
||||
except:
|
||||
exceptions.handle(request,
|
||||
_('Unable to retrieve networks list.'))
|
||||
@ -344,7 +344,7 @@ class AddMember(workflows.Workflow):
|
||||
for m in context['members']:
|
||||
params = {'device_id': m}
|
||||
try:
|
||||
plist = api.quantum.port_list(request, **params)
|
||||
plist = api.neutron.port_list(request, **params)
|
||||
except:
|
||||
return False
|
||||
if plist:
|
||||
|
@ -61,33 +61,33 @@ class JSONView(View):
|
||||
self.add_resource_url('horizon:project:instances:detail',
|
||||
data['servers'])
|
||||
|
||||
# Get quantum data
|
||||
# Get neutron data
|
||||
try:
|
||||
quantum_public_networks = api.quantum.network_list(request,
|
||||
neutron_public_networks = api.neutron.network_list(request,
|
||||
**{'router:external': True})
|
||||
quantum_networks = api.quantum.network_list_for_tenant(request,
|
||||
neutron_networks = api.neutron.network_list_for_tenant(request,
|
||||
request.user.tenant_id)
|
||||
quantum_subnets = api.quantum.subnet_list(request,
|
||||
neutron_subnets = api.neutron.subnet_list(request,
|
||||
tenant_id=request.user.tenant_id)
|
||||
quantum_ports = api.quantum.port_list(request,
|
||||
neutron_ports = api.neutron.port_list(request,
|
||||
tenant_id=request.user.tenant_id)
|
||||
quantum_routers = api.quantum.router_list(request,
|
||||
neutron_routers = api.neutron.router_list(request,
|
||||
tenant_id=request.user.tenant_id)
|
||||
except:
|
||||
quantum_public_networks = []
|
||||
quantum_networks = []
|
||||
quantum_subnets = []
|
||||
quantum_ports = []
|
||||
quantum_routers = []
|
||||
neutron_public_networks = []
|
||||
neutron_networks = []
|
||||
neutron_subnets = []
|
||||
neutron_ports = []
|
||||
neutron_routers = []
|
||||
|
||||
networks = [{'name': network.name,
|
||||
'id': network.id,
|
||||
'router:external': network['router:external']}
|
||||
for network in quantum_networks]
|
||||
for network in neutron_networks]
|
||||
self.add_resource_url('horizon:project:networks:detail',
|
||||
networks)
|
||||
# Add public networks to the networks list
|
||||
for publicnet in quantum_public_networks:
|
||||
for publicnet in neutron_public_networks:
|
||||
found = False
|
||||
for network in networks:
|
||||
if publicnet.id == network['id']:
|
||||
@ -103,19 +103,19 @@ class JSONView(View):
|
||||
data['subnets'] = [{'id': subnet.id,
|
||||
'cidr': subnet.cidr,
|
||||
'network_id': subnet.network_id}
|
||||
for subnet in quantum_subnets]
|
||||
for subnet in neutron_subnets]
|
||||
|
||||
data['ports'] = [{'id': port.id,
|
||||
'network_id': port.network_id,
|
||||
'device_id': port.device_id,
|
||||
'fixed_ips': port.fixed_ips} for port in quantum_ports]
|
||||
'fixed_ips': port.fixed_ips} for port in neutron_ports]
|
||||
self.add_resource_url('horizon:project:networks:ports:detail',
|
||||
data['ports'])
|
||||
|
||||
data['routers'] = [{'id': router.id,
|
||||
'name': router.name,
|
||||
'external_gateway_info': router.external_gateway_info}
|
||||
for router in quantum_routers]
|
||||
for router in neutron_routers]
|
||||
|
||||
# user can't see port on external network. so we are
|
||||
# adding fake port based on router information
|
||||
|
@ -46,7 +46,7 @@ class UpdateNetwork(forms.SelfHandlingForm):
|
||||
try:
|
||||
params = {'admin_state_up': data['admin_state'],
|
||||
'name': data['name']}
|
||||
network = api.quantum.network_modify(request, data['network_id'],
|
||||
network = api.neutron.network_modify(request, data['network_id'],
|
||||
**params)
|
||||
msg = _('Network %s was successfully updated.') % data['name']
|
||||
LOG.debug(msg)
|
||||
|
@ -41,7 +41,7 @@ class UpdatePort(forms.SelfHandlingForm):
|
||||
def handle(self, request, data):
|
||||
try:
|
||||
LOG.debug('params = %s' % data)
|
||||
port = api.quantum.port_modify(request, data['port_id'],
|
||||
port = api.neutron.port_modify(request, data['port_id'],
|
||||
name=data['name'],
|
||||
admin_state_up=data['admin_state'])
|
||||
msg = _('Port %s was successfully updated.') % data['port_id']
|
||||
|
@ -36,7 +36,7 @@ class OverviewTab(tabs.Tab):
|
||||
def get_context_data(self, request):
|
||||
port_id = self.tab_group.kwargs['port_id']
|
||||
try:
|
||||
port = api.quantum.port_get(self.request, port_id)
|
||||
port = api.neutron.port_get(self.request, port_id)
|
||||
except:
|
||||
redirect = reverse('horizon:project:networks:index')
|
||||
msg = _('Unable to retrieve port details.')
|
||||
|
@ -46,7 +46,7 @@ class UpdateView(forms.ModalFormView):
|
||||
if not hasattr(self, "_object"):
|
||||
port_id = self.kwargs['port_id']
|
||||
try:
|
||||
self._object = api.quantum.port_get(self.request, port_id)
|
||||
self._object = api.neutron.port_get(self.request, port_id)
|
||||
except:
|
||||
redirect = reverse("horizon:project:networks:detail",
|
||||
args=(self.kwargs['network_id'],))
|
||||
|
@ -47,7 +47,7 @@ class DeleteSubnet(CheckNetworkEditable, tables.DeleteAction):
|
||||
|
||||
def delete(self, request, obj_id):
|
||||
try:
|
||||
api.quantum.subnet_delete(request, obj_id)
|
||||
api.neutron.subnet_delete(request, obj_id)
|
||||
except:
|
||||
msg = _('Failed to delete subnet %s') % obj_id
|
||||
LOG.info(msg)
|
||||
@ -91,7 +91,7 @@ class SubnetsTable(tables.DataTable):
|
||||
if not hasattr(self, "_network"):
|
||||
try:
|
||||
network_id = self.kwargs['network_id']
|
||||
network = api.quantum.network_get(self.request, network_id)
|
||||
network = api.neutron.network_get(self.request, network_id)
|
||||
network.set_id_as_name_if_empty(length=0)
|
||||
except:
|
||||
msg = _('Unable to retrieve details for network "%s".') \
|
||||
|
@ -36,7 +36,7 @@ class OverviewTab(tabs.Tab):
|
||||
def get_context_data(self, request):
|
||||
subnet_id = self.tab_group.kwargs['subnet_id']
|
||||
try:
|
||||
subnet = api.quantum.subnet_get(self.request, subnet_id)
|
||||
subnet = api.neutron.subnet_get(self.request, subnet_id)
|
||||
except:
|
||||
redirect = reverse('horizon:project:networks:index')
|
||||
msg = _('Unable to retrieve subnet details.')
|
||||
|
@ -15,7 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Views for managing Quantum Subnets.
|
||||
Views for managing Neutron Subnets.
|
||||
"""
|
||||
import logging
|
||||
|
||||
@ -43,7 +43,7 @@ class CreateView(workflows.WorkflowView):
|
||||
if not hasattr(self, "_object"):
|
||||
try:
|
||||
network_id = self.kwargs["network_id"]
|
||||
self._object = api.quantum.network_get(self.request,
|
||||
self._object = api.neutron.network_get(self.request,
|
||||
network_id)
|
||||
self._object.set_id_as_name_if_empty()
|
||||
except:
|
||||
@ -65,7 +65,7 @@ class UpdateView(workflows.WorkflowView):
|
||||
if not hasattr(self, "_object"):
|
||||
subnet_id = self.kwargs['subnet_id']
|
||||
try:
|
||||
self._object = api.quantum.subnet_get(self.request, subnet_id)
|
||||
self._object = api.neutron.subnet_get(self.request, subnet_id)
|
||||
except:
|
||||
redirect = reverse("horizon:project:networks:index")
|
||||
msg = _('Unable to retrieve subnet details')
|
||||
|
@ -179,7 +179,7 @@ class UpdateSubnet(network_workflows.CreateNetwork):
|
||||
|
||||
self._setup_subnet_parameters(params, data, is_create=False)
|
||||
|
||||
subnet = api.quantum.subnet_modify(request, subnet_id, **params)
|
||||
subnet = api.neutron.subnet_modify(request, subnet_id, **params)
|
||||
msg = _('Subnet "%s" was successfully updated.') % data['cidr']
|
||||
LOG.debug(msg)
|
||||
return subnet
|
||||
|
@ -46,14 +46,14 @@ class DeleteNetwork(CheckNetworkEditable, tables.DeleteAction):
|
||||
def delete(self, request, network_id):
|
||||
try:
|
||||
# Retrieve existing subnets belonging to the network.
|
||||
subnets = api.quantum.subnet_list(request, network_id=network_id)
|
||||
subnets = api.neutron.subnet_list(request, network_id=network_id)
|
||||
LOG.debug('Network %s has subnets: %s' %
|
||||
(network_id, [s.id for s in subnets]))
|
||||
for s in subnets:
|
||||
api.quantum.subnet_delete(request, s.id)
|
||||
api.neutron.subnet_delete(request, s.id)
|
||||
LOG.debug('Deleted subnet %s' % s.id)
|
||||
|
||||
api.quantum.network_delete(request, network_id)
|
||||
api.neutron.network_delete(request, network_id)
|
||||
LOG.debug('Deleted network %s successfully' % network_id)
|
||||
except:
|
||||
msg = _('Failed to delete network %s') % network_id
|
||||
|
@ -95,13 +95,13 @@ def _str_host_routes(host_routes):
|
||||
|
||||
class NetworkTests(test.TestCase):
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_list',)})
|
||||
@test.create_stubs({api.neutron: ('network_list',)})
|
||||
def test_index(self):
|
||||
api.quantum.network_list(
|
||||
api.neutron.network_list(
|
||||
IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False).AndReturn(self.networks.list())
|
||||
api.quantum.network_list(
|
||||
api.neutron.network_list(
|
||||
IsA(http.HttpRequest),
|
||||
shared=True).AndReturn([])
|
||||
|
||||
@ -113,12 +113,12 @@ class NetworkTests(test.TestCase):
|
||||
networks = res.context['networks_table'].data
|
||||
self.assertItemsEqual(networks, self.networks.list())
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_list',)})
|
||||
@test.create_stubs({api.neutron: ('network_list',)})
|
||||
def test_index_network_list_exception(self):
|
||||
api.quantum.network_list(
|
||||
api.neutron.network_list(
|
||||
IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
shared=False).AndRaise(self.exceptions.quantum)
|
||||
shared=False).AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
res = self.client.get(INDEX_URL)
|
||||
@ -127,18 +127,18 @@ class NetworkTests(test.TestCase):
|
||||
self.assertEqual(len(res.context['networks_table'].data), 0)
|
||||
self.assertMessageCount(res, error=1)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_list',
|
||||
'port_list',)})
|
||||
def test_network_detail(self):
|
||||
network_id = self.networks.first().id
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id)\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.subnets.first()])
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.ports.first()])
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id)\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id)\
|
||||
.AndReturn(self.networks.first())
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -152,13 +152,13 @@ class NetworkTests(test.TestCase):
|
||||
self.assertItemsEqual(subnets, [self.subnets.first()])
|
||||
self.assertItemsEqual(ports, [self.ports.first()])
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_list',
|
||||
'port_list',)})
|
||||
def test_network_detail_network_exception(self):
|
||||
network_id = self.networks.first().id
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
url = reverse('horizon:project:networks:detail', args=[network_id])
|
||||
@ -167,19 +167,19 @@ class NetworkTests(test.TestCase):
|
||||
redir_url = INDEX_URL
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_list',
|
||||
'port_list',)})
|
||||
def test_network_detail_subnet_exception(self):
|
||||
network_id = self.networks.first().id
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id).\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id).\
|
||||
AndReturn(self.networks.first())
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
AndRaise(self.exceptions.quantum)
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
AndRaise(self.exceptions.neutron)
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
AndReturn([self.ports.first()])
|
||||
# Called from SubnetTable
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id).\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id).\
|
||||
AndReturn(self.networks.first())
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -193,19 +193,19 @@ class NetworkTests(test.TestCase):
|
||||
self.assertEqual(len(subnets), 0)
|
||||
self.assertItemsEqual(ports, [self.ports.first()])
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_list',
|
||||
'port_list',)})
|
||||
def test_network_detail_port_exception(self):
|
||||
network_id = self.networks.first().id
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id).\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id).\
|
||||
AndReturn(self.networks.first())
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
AndReturn([self.subnets.first()])
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
AndRaise(self.exceptions.quantum)
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id).\
|
||||
AndRaise(self.exceptions.neutron)
|
||||
# Called from SubnetTable
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id).\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id).\
|
||||
AndReturn(self.networks.first())
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -234,10 +234,10 @@ class NetworkTests(test.TestCase):
|
||||
'<CreateSubnetDetail: createsubnetdetailaction>']
|
||||
self.assertQuerysetEqual(workflow.steps, expected_objs)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_create',)})
|
||||
@test.create_stubs({api.neutron: ('network_create',)})
|
||||
def test_network_create_post(self):
|
||||
network = self.networks.first()
|
||||
api.quantum.network_create(IsA(http.HttpRequest), name=network.name,
|
||||
api.neutron.network_create(IsA(http.HttpRequest), name=network.name,
|
||||
admin_state_up=network.admin_state_up)\
|
||||
.AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
@ -253,15 +253,15 @@ class NetworkTests(test.TestCase):
|
||||
self.assertNoFormErrors(res)
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_create',
|
||||
@test.create_stubs({api.neutron: ('network_create',
|
||||
'subnet_create',)})
|
||||
def test_network_create_post_with_subnet(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_create(IsA(http.HttpRequest), name=network.name,
|
||||
api.neutron.network_create(IsA(http.HttpRequest), name=network.name,
|
||||
admin_state_up=network.admin_state_up)\
|
||||
.AndReturn(network)
|
||||
api.quantum.subnet_create(IsA(http.HttpRequest),
|
||||
api.neutron.subnet_create(IsA(http.HttpRequest),
|
||||
network_id=network.id,
|
||||
name=subnet.name,
|
||||
cidr=subnet.cidr,
|
||||
@ -281,12 +281,12 @@ class NetworkTests(test.TestCase):
|
||||
self.assertNoFormErrors(res)
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_create',)})
|
||||
@test.create_stubs({api.neutron: ('network_create',)})
|
||||
def test_network_create_post_network_exception(self):
|
||||
network = self.networks.first()
|
||||
api.quantum.network_create(IsA(http.HttpRequest), name=network.name,
|
||||
api.neutron.network_create(IsA(http.HttpRequest), name=network.name,
|
||||
admin_state_up=network.admin_state_up)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = {'net_name': network.name,
|
||||
@ -300,13 +300,13 @@ class NetworkTests(test.TestCase):
|
||||
self.assertNoFormErrors(res)
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_create',)})
|
||||
@test.create_stubs({api.neutron: ('network_create',)})
|
||||
def test_network_create_post_with_subnet_network_exception(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_create(IsA(http.HttpRequest), name=network.name,
|
||||
api.neutron.network_create(IsA(http.HttpRequest), name=network.name,
|
||||
admin_state_up=network.admin_state_up)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = {'net_name': network.name,
|
||||
@ -319,24 +319,24 @@ class NetworkTests(test.TestCase):
|
||||
self.assertNoFormErrors(res)
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_create',
|
||||
@test.create_stubs({api.neutron: ('network_create',
|
||||
'network_delete',
|
||||
'subnet_create',)})
|
||||
def test_network_create_post_with_subnet_subnet_exception(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_create(IsA(http.HttpRequest), name=network.name,
|
||||
api.neutron.network_create(IsA(http.HttpRequest), name=network.name,
|
||||
admin_state_up=network.admin_state_up)\
|
||||
.AndReturn(network)
|
||||
api.quantum.subnet_create(IsA(http.HttpRequest),
|
||||
api.neutron.subnet_create(IsA(http.HttpRequest),
|
||||
network_id=network.id,
|
||||
name=subnet.name,
|
||||
cidr=subnet.cidr,
|
||||
ip_version=subnet.ip_version,
|
||||
gateway_ip=subnet.gateway_ip,
|
||||
enable_dhcp=subnet.enable_dhcp)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.quantum.network_delete(IsA(http.HttpRequest),
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
api.neutron.network_delete(IsA(http.HttpRequest),
|
||||
network.id)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -416,10 +416,10 @@ class NetworkTests(test.TestCase):
|
||||
|
||||
self.assertContains(res, 'Gateway IP and IP version are inconsistent.')
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_network_update_get(self):
|
||||
network = self.networks.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network.id)\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network.id)\
|
||||
.AndReturn(network)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -429,11 +429,11 @@ class NetworkTests(test.TestCase):
|
||||
|
||||
self.assertTemplateUsed(res, 'project/networks/update.html')
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_network_update_get_exception(self):
|
||||
network = self.networks.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -443,15 +443,15 @@ class NetworkTests(test.TestCase):
|
||||
redir_url = INDEX_URL
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_modify',
|
||||
@test.create_stubs({api.neutron: ('network_modify',
|
||||
'network_get',)})
|
||||
def test_network_update_post(self):
|
||||
network = self.networks.first()
|
||||
api.quantum.network_modify(IsA(http.HttpRequest), network.id,
|
||||
api.neutron.network_modify(IsA(http.HttpRequest), network.id,
|
||||
name=network.name,
|
||||
admin_state_up=network.admin_state_up)\
|
||||
.AndReturn(network)
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network.id)\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network.id)\
|
||||
.AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -464,15 +464,15 @@ class NetworkTests(test.TestCase):
|
||||
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_modify',
|
||||
@test.create_stubs({api.neutron: ('network_modify',
|
||||
'network_get',)})
|
||||
def test_network_update_post_exception(self):
|
||||
network = self.networks.first()
|
||||
api.quantum.network_modify(IsA(http.HttpRequest), network.id,
|
||||
api.neutron.network_modify(IsA(http.HttpRequest), network.id,
|
||||
name=network.name,
|
||||
admin_state_up=network.admin_state_up)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network.id)\
|
||||
.AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -485,21 +485,21 @@ class NetworkTests(test.TestCase):
|
||||
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_list',
|
||||
@test.create_stubs({api.neutron: ('network_list',
|
||||
'subnet_list',
|
||||
'network_delete')})
|
||||
def test_delete_network_no_subnet(self):
|
||||
network = self.networks.first()
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=network.tenant_id,
|
||||
shared=False)\
|
||||
.AndReturn([network])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True)\
|
||||
.AndReturn([])
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network.id)\
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network.id)\
|
||||
.AndReturn([])
|
||||
api.quantum.network_delete(IsA(http.HttpRequest), network.id)
|
||||
api.neutron.network_delete(IsA(http.HttpRequest), network.id)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -508,23 +508,23 @@ class NetworkTests(test.TestCase):
|
||||
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_list',
|
||||
@test.create_stubs({api.neutron: ('network_list',
|
||||
'subnet_list',
|
||||
'network_delete',
|
||||
'subnet_delete')})
|
||||
def test_delete_network_with_subnet(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=network.tenant_id,
|
||||
shared=False)\
|
||||
.AndReturn([network])
|
||||
api.quantum.network_list(IsA(http.HttpRequest), shared=True)\
|
||||
api.neutron.network_list(IsA(http.HttpRequest), shared=True)\
|
||||
.AndReturn([])
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network.id)\
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network.id)\
|
||||
.AndReturn([subnet])
|
||||
api.quantum.subnet_delete(IsA(http.HttpRequest), subnet.id)
|
||||
api.quantum.network_delete(IsA(http.HttpRequest), network.id)
|
||||
api.neutron.subnet_delete(IsA(http.HttpRequest), subnet.id)
|
||||
api.neutron.network_delete(IsA(http.HttpRequest), network.id)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -533,25 +533,25 @@ class NetworkTests(test.TestCase):
|
||||
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_list',
|
||||
@test.create_stubs({api.neutron: ('network_list',
|
||||
'subnet_list',
|
||||
'network_delete',
|
||||
'subnet_delete')})
|
||||
def test_delete_network_exception(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
tenant_id=network.tenant_id,
|
||||
shared=False)\
|
||||
.AndReturn([network])
|
||||
api.quantum.network_list(IsA(http.HttpRequest),
|
||||
api.neutron.network_list(IsA(http.HttpRequest),
|
||||
shared=True)\
|
||||
.AndReturn([])
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network.id)\
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network.id)\
|
||||
.AndReturn([subnet])
|
||||
api.quantum.subnet_delete(IsA(http.HttpRequest), subnet.id)
|
||||
api.quantum.network_delete(IsA(http.HttpRequest), network.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.neutron.subnet_delete(IsA(http.HttpRequest), subnet.id)
|
||||
api.neutron.network_delete(IsA(http.HttpRequest), network.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -563,10 +563,10 @@ class NetworkTests(test.TestCase):
|
||||
|
||||
class NetworkSubnetTests(test.TestCase):
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_get',)})
|
||||
@test.create_stubs({api.neutron: ('subnet_get',)})
|
||||
def test_subnet_detail(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(self.subnets.first())
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -578,11 +578,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
self.assertTemplateUsed(res, 'project/networks/subnets/detail.html')
|
||||
self.assertEqual(res.context['subnet'].id, subnet.id)
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_get',)})
|
||||
@test.create_stubs({api.neutron: ('subnet_get',)})
|
||||
def test_subnet_detail_exception(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -592,10 +592,10 @@ class NetworkSubnetTests(test.TestCase):
|
||||
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_get(self):
|
||||
network = self.networks.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
self.mox.ReplayAll()
|
||||
@ -606,15 +606,15 @@ class NetworkSubnetTests(test.TestCase):
|
||||
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_create',)})
|
||||
def test_subnet_create_post(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.subnet_create(IsA(http.HttpRequest),
|
||||
api.neutron.subnet_create(IsA(http.HttpRequest),
|
||||
network_id=network.id,
|
||||
name=subnet.name,
|
||||
cidr=subnet.cidr,
|
||||
@ -635,15 +635,15 @@ class NetworkSubnetTests(test.TestCase):
|
||||
args=[subnet.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_create',)})
|
||||
def test_subnet_create_post_with_additional_attributes(self):
|
||||
network = self.networks.list()[1]
|
||||
subnet = self.subnets.list()[1]
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.subnet_create(IsA(http.HttpRequest),
|
||||
api.neutron.subnet_create(IsA(http.HttpRequest),
|
||||
network_id=network.id,
|
||||
name=subnet.name,
|
||||
cidr=subnet.cidr,
|
||||
@ -666,15 +666,15 @@ class NetworkSubnetTests(test.TestCase):
|
||||
args=[subnet.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_create',)})
|
||||
def test_subnet_create_post_with_additional_attributes_no_gateway(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.subnet_create(IsA(http.HttpRequest),
|
||||
api.neutron.subnet_create(IsA(http.HttpRequest),
|
||||
network_id=network.id,
|
||||
name=subnet.name,
|
||||
cidr=subnet.cidr,
|
||||
@ -695,14 +695,14 @@ class NetworkSubnetTests(test.TestCase):
|
||||
args=[subnet.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_create',)})
|
||||
def test_subnet_create_post_network_exception(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = form_data_subnet(subnet,
|
||||
@ -714,22 +714,22 @@ class NetworkSubnetTests(test.TestCase):
|
||||
self.assertNoFormErrors(res)
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',
|
||||
@test.create_stubs({api.neutron: ('network_get',
|
||||
'subnet_create',)})
|
||||
def test_subnet_create_post_subnet_exception(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.subnet_create(IsA(http.HttpRequest),
|
||||
api.neutron.subnet_create(IsA(http.HttpRequest),
|
||||
network_id=network.id,
|
||||
name=subnet.name,
|
||||
cidr=subnet.cidr,
|
||||
ip_version=subnet.ip_version,
|
||||
gateway_ip=subnet.gateway_ip,
|
||||
enable_dhcp=subnet.enable_dhcp)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = form_data_subnet(subnet,
|
||||
@ -742,11 +742,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
args=[subnet.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_cidr_inconsistent(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
self.mox.ReplayAll()
|
||||
@ -763,11 +763,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
self.assertFormErrors(res, 1, expected_msg)
|
||||
self.assertTemplateUsed(res, WorkflowView.template_name)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_gw_inconsistent(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id)\
|
||||
.AndReturn(self.networks.first())
|
||||
self.mox.ReplayAll()
|
||||
@ -782,11 +782,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
|
||||
self.assertContains(res, 'Gateway IP and IP version are inconsistent.')
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_invalid_pools_start_only(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id).AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -802,11 +802,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'Start and end addresses must be specified '
|
||||
'(value=%s)' % allocation_pools)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_invalid_pools_three_entries(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id).AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -822,11 +822,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'Start and end addresses must be specified '
|
||||
'(value=%s)' % allocation_pools)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_invalid_pools_invalid_address(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id).AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -842,11 +842,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'allocation_pools: Invalid IP address '
|
||||
'(value=%s)' % allocation_pools.split(',')[1])
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_invalid_pools_ip_network(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id).AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -862,11 +862,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'allocation_pools: Invalid IP address '
|
||||
'(value=%s)' % allocation_pools.split(',')[0])
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_invalid_pools_start_larger_than_end(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id).AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -882,11 +882,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'Start address is larger than end address '
|
||||
'(value=%s)' % allocation_pools)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_invalid_nameservers(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id).AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -902,11 +902,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'dns_nameservers: Invalid IP address '
|
||||
'(value=%s)' % dns_nameservers[1])
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_invalid_routes_destination_only(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id).AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -924,11 +924,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'Destination CIDR and nexthop must be specified '
|
||||
'(value=%s)' % host_routes)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_invalid_routes_three_entries(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id).AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -946,11 +946,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'Destination CIDR and nexthop must be specified '
|
||||
'(value=%s)' % host_routes)
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_invalid_routes_invalid_destination(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id).AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -967,11 +967,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'host_routes: Invalid IP address '
|
||||
'(value=%s)' % host_routes.split(',')[0])
|
||||
|
||||
@test.create_stubs({api.quantum: ('network_get',)})
|
||||
@test.create_stubs({api.neutron: ('network_get',)})
|
||||
def test_subnet_create_post_invalid_routes_nexthop_ip_network(self):
|
||||
network = self.networks.first()
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.network_get(IsA(http.HttpRequest),
|
||||
api.neutron.network_get(IsA(http.HttpRequest),
|
||||
network.id).AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -988,13 +988,13 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'host_routes: Invalid IP address '
|
||||
'(value=%s)' % host_routes.split(',')[1])
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_modify',
|
||||
@test.create_stubs({api.neutron: ('subnet_modify',
|
||||
'subnet_get',)})
|
||||
def test_subnet_update_post(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(subnet)
|
||||
api.quantum.subnet_modify(IsA(http.HttpRequest), subnet.id,
|
||||
api.neutron.subnet_modify(IsA(http.HttpRequest), subnet.id,
|
||||
name=subnet.name,
|
||||
gateway_ip=subnet.gateway_ip,
|
||||
enable_dhcp=subnet.enable_dhcp,
|
||||
@ -1013,13 +1013,13 @@ class NetworkSubnetTests(test.TestCase):
|
||||
args=[subnet.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_modify',
|
||||
@test.create_stubs({api.neutron: ('subnet_modify',
|
||||
'subnet_get',)})
|
||||
def test_subnet_update_post_no_gateway(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(subnet)
|
||||
api.quantum.subnet_modify(IsA(http.HttpRequest), subnet.id,
|
||||
api.neutron.subnet_modify(IsA(http.HttpRequest), subnet.id,
|
||||
name=subnet.name,
|
||||
gateway_ip=None,
|
||||
enable_dhcp=subnet.enable_dhcp,
|
||||
@ -1039,13 +1039,13 @@ class NetworkSubnetTests(test.TestCase):
|
||||
args=[subnet.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_modify',
|
||||
@test.create_stubs({api.neutron: ('subnet_modify',
|
||||
'subnet_get',)})
|
||||
def test_subnet_update_post_with_additional_attributes(self):
|
||||
subnet = self.subnets.list()[1]
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(subnet)
|
||||
api.quantum.subnet_modify(IsA(http.HttpRequest), subnet.id,
|
||||
api.neutron.subnet_modify(IsA(http.HttpRequest), subnet.id,
|
||||
name=subnet.name,
|
||||
gateway_ip=subnet.gateway_ip,
|
||||
enable_dhcp=False,
|
||||
@ -1064,11 +1064,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
args=[subnet.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_modify',
|
||||
@test.create_stubs({api.neutron: ('subnet_modify',
|
||||
'subnet_get',)})
|
||||
def test_subnet_update_post_gw_inconsistent(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(subnet)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -1082,11 +1082,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
|
||||
self.assertContains(res, 'Gateway IP and IP version are inconsistent.')
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_modify',
|
||||
@test.create_stubs({api.neutron: ('subnet_modify',
|
||||
'subnet_get',)})
|
||||
def test_subnet_update_post_invalid_nameservers(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(subnet)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -1102,11 +1102,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'dns_nameservers: Invalid IP address '
|
||||
'(value=%s)' % dns_nameservers[1])
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_modify',
|
||||
@test.create_stubs({api.neutron: ('subnet_modify',
|
||||
'subnet_get',)})
|
||||
def test_subnet_update_post_invalid_routes_destination_only(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(subnet)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -1124,11 +1124,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'Destination CIDR and nexthop must be specified '
|
||||
'(value=%s)' % host_routes)
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_modify',
|
||||
@test.create_stubs({api.neutron: ('subnet_modify',
|
||||
'subnet_get',)})
|
||||
def test_subnet_update_post_invalid_routes_three_entries(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(subnet)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -1146,11 +1146,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'Destination CIDR and nexthop must be specified '
|
||||
'(value=%s)' % host_routes)
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_modify',
|
||||
@test.create_stubs({api.neutron: ('subnet_modify',
|
||||
'subnet_get',)})
|
||||
def test_subnet_update_post_invalid_routes_invalid_destination(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(subnet)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -1167,11 +1167,11 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'host_routes: Invalid IP address '
|
||||
'(value=%s)' % host_routes.split(',')[0])
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_modify',
|
||||
@test.create_stubs({api.neutron: ('subnet_modify',
|
||||
'subnet_get',)})
|
||||
def test_subnet_update_post_invalid_routes_nexthop_ip_network(self):
|
||||
subnet = self.subnets.first()
|
||||
api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndReturn(subnet)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -1188,22 +1188,22 @@ class NetworkSubnetTests(test.TestCase):
|
||||
'host_routes: Invalid IP address '
|
||||
'(value=%s)' % host_routes.split(',')[1])
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_delete',
|
||||
@test.create_stubs({api.neutron: ('subnet_delete',
|
||||
'subnet_list',
|
||||
'network_get',
|
||||
'port_list',)})
|
||||
def test_subnet_delete(self):
|
||||
subnet = self.subnets.first()
|
||||
network_id = subnet.network_id
|
||||
api.quantum.subnet_delete(IsA(http.HttpRequest), subnet.id)
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.subnet_delete(IsA(http.HttpRequest), subnet.id)
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.subnets.first()])
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id)\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.ports.first()])
|
||||
# Called from SubnetTable
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id)\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id)\
|
||||
.AndReturn(self.networks.first())
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -1214,23 +1214,23 @@ class NetworkSubnetTests(test.TestCase):
|
||||
|
||||
self.assertRedirectsNoFollow(res, url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_delete',
|
||||
@test.create_stubs({api.neutron: ('subnet_delete',
|
||||
'subnet_list',
|
||||
'network_get',
|
||||
'port_list',)})
|
||||
def test_subnet_delete_excceeption(self):
|
||||
subnet = self.subnets.first()
|
||||
network_id = subnet.network_id
|
||||
api.quantum.subnet_delete(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.quantum.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.subnet_delete(IsA(http.HttpRequest), subnet.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
api.neutron.subnet_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.subnets.first()])
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id)\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id)\
|
||||
.AndReturn(self.networks.first())
|
||||
api.quantum.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
api.neutron.port_list(IsA(http.HttpRequest), network_id=network_id)\
|
||||
.AndReturn([self.ports.first()])
|
||||
# Called from SubnetTable
|
||||
api.quantum.network_get(IsA(http.HttpRequest), network_id)\
|
||||
api.neutron.network_get(IsA(http.HttpRequest), network_id)\
|
||||
.AndReturn(self.networks.first())
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -1244,10 +1244,10 @@ class NetworkSubnetTests(test.TestCase):
|
||||
|
||||
class NetworkPortTests(test.TestCase):
|
||||
|
||||
@test.create_stubs({api.quantum: ('port_get',)})
|
||||
@test.create_stubs({api.neutron: ('port_get',)})
|
||||
def test_port_detail(self):
|
||||
port = self.ports.first()
|
||||
api.quantum.port_get(IsA(http.HttpRequest), port.id)\
|
||||
api.neutron.port_get(IsA(http.HttpRequest), port.id)\
|
||||
.AndReturn(self.ports.first())
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -1258,11 +1258,11 @@ class NetworkPortTests(test.TestCase):
|
||||
self.assertTemplateUsed(res, 'project/networks/ports/detail.html')
|
||||
self.assertEqual(res.context['port'].id, port.id)
|
||||
|
||||
@test.create_stubs({api.quantum: ('port_get',)})
|
||||
@test.create_stubs({api.neutron: ('port_get',)})
|
||||
def test_port_detail_exception(self):
|
||||
port = self.ports.first()
|
||||
api.quantum.port_get(IsA(http.HttpRequest), port.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.neutron.port_get(IsA(http.HttpRequest), port.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -1271,10 +1271,10 @@ class NetworkPortTests(test.TestCase):
|
||||
|
||||
self.assertRedirectsNoFollow(res, INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('port_get',)})
|
||||
@test.create_stubs({api.neutron: ('port_get',)})
|
||||
def test_port_update_get(self):
|
||||
port = self.ports.first()
|
||||
api.quantum.port_get(IsA(http.HttpRequest),
|
||||
api.neutron.port_get(IsA(http.HttpRequest),
|
||||
port.id)\
|
||||
.AndReturn(port)
|
||||
self.mox.ReplayAll()
|
||||
@ -1285,13 +1285,13 @@ class NetworkPortTests(test.TestCase):
|
||||
|
||||
self.assertTemplateUsed(res, 'project/networks/ports/update.html')
|
||||
|
||||
@test.create_stubs({api.quantum: ('port_get',
|
||||
@test.create_stubs({api.neutron: ('port_get',
|
||||
'port_modify')})
|
||||
def test_port_update_post(self):
|
||||
port = self.ports.first()
|
||||
api.quantum.port_get(IsA(http.HttpRequest), port.id)\
|
||||
api.neutron.port_get(IsA(http.HttpRequest), port.id)\
|
||||
.AndReturn(port)
|
||||
api.quantum.port_modify(IsA(http.HttpRequest), port.id,
|
||||
api.neutron.port_modify(IsA(http.HttpRequest), port.id,
|
||||
name=port.name,
|
||||
admin_state_up=port.admin_state_up)\
|
||||
.AndReturn(port)
|
||||
@ -1309,16 +1309,16 @@ class NetworkPortTests(test.TestCase):
|
||||
args=[port.network_id])
|
||||
self.assertRedirectsNoFollow(res, redir_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('port_get',
|
||||
@test.create_stubs({api.neutron: ('port_get',
|
||||
'port_modify')})
|
||||
def test_port_update_post_exception(self):
|
||||
port = self.ports.first()
|
||||
api.quantum.port_get(IsA(http.HttpRequest), port.id)\
|
||||
api.neutron.port_get(IsA(http.HttpRequest), port.id)\
|
||||
.AndReturn(port)
|
||||
api.quantum.port_modify(IsA(http.HttpRequest), port.id,
|
||||
api.neutron.port_modify(IsA(http.HttpRequest), port.id,
|
||||
name=port.name,
|
||||
admin_state_up=port.admin_state_up)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = {'network_id': port.network_id,
|
||||
|
@ -15,7 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Views for managing Quantum Networks.
|
||||
Views for managing Neutron Networks.
|
||||
"""
|
||||
import logging
|
||||
|
||||
@ -46,7 +46,7 @@ class IndexView(tables.DataTableView):
|
||||
def get_data(self):
|
||||
try:
|
||||
tenant_id = self.request.user.tenant_id
|
||||
networks = api.quantum.network_list_for_tenant(self.request,
|
||||
networks = api.neutron.network_list_for_tenant(self.request,
|
||||
tenant_id)
|
||||
except:
|
||||
networks = []
|
||||
@ -79,7 +79,7 @@ class UpdateView(forms.ModalFormView):
|
||||
if not hasattr(self, "_object"):
|
||||
network_id = self.kwargs['network_id']
|
||||
try:
|
||||
self._object = api.quantum.network_get(self.request,
|
||||
self._object = api.neutron.network_get(self.request,
|
||||
network_id)
|
||||
except:
|
||||
redirect = self.success_url
|
||||
@ -103,7 +103,7 @@ class DetailView(tables.MultiTableView):
|
||||
def get_subnets_data(self):
|
||||
try:
|
||||
network = self._get_data()
|
||||
subnets = api.quantum.subnet_list(self.request,
|
||||
subnets = api.neutron.subnet_list(self.request,
|
||||
network_id=network.id)
|
||||
except:
|
||||
subnets = []
|
||||
@ -116,7 +116,7 @@ class DetailView(tables.MultiTableView):
|
||||
def get_ports_data(self):
|
||||
try:
|
||||
network_id = self.kwargs['network_id']
|
||||
ports = api.quantum.port_list(self.request, network_id=network_id)
|
||||
ports = api.neutron.port_list(self.request, network_id=network_id)
|
||||
except:
|
||||
ports = []
|
||||
msg = _('Port list can not be retrieved.')
|
||||
@ -129,7 +129,7 @@ class DetailView(tables.MultiTableView):
|
||||
if not hasattr(self, "_network"):
|
||||
try:
|
||||
network_id = self.kwargs['network_id']
|
||||
network = api.quantum.network_get(self.request, network_id)
|
||||
network = api.neutron.network_get(self.request, network_id)
|
||||
network.set_id_as_name_if_empty(length=0)
|
||||
except:
|
||||
msg = _('Unable to retrieve details for network "%s".') \
|
||||
|
@ -259,7 +259,7 @@ class CreateNetwork(workflows.Workflow):
|
||||
try:
|
||||
params = {'name': data['net_name'],
|
||||
'admin_state_up': data['admin_state']}
|
||||
network = api.quantum.network_create(request, **params)
|
||||
network = api.neutron.network_create(request, **params)
|
||||
network.set_id_as_name_if_empty()
|
||||
self.context['net_id'] = network.id
|
||||
msg = _('Network "%s" was successfully created.') % network.name
|
||||
@ -320,7 +320,7 @@ class CreateNetwork(workflows.Workflow):
|
||||
|
||||
self._setup_subnet_parameters(params, data)
|
||||
|
||||
subnet = api.quantum.subnet_create(request, **params)
|
||||
subnet = api.neutron.subnet_create(request, **params)
|
||||
self.context['subnet_id'] = subnet.id
|
||||
msg = _('Subnet "%s" was successfully created.') % data['cidr']
|
||||
LOG.debug(msg)
|
||||
@ -341,7 +341,7 @@ class CreateNetwork(workflows.Workflow):
|
||||
def _delete_network(self, request, network):
|
||||
"""Delete the created network when subnet creation failed"""
|
||||
try:
|
||||
api.quantum.network_delete(request, network.id)
|
||||
api.neutron.network_delete(request, network.id)
|
||||
msg = _('Delete the created network "%s" '
|
||||
'due to subnet creation failure.') % network.name
|
||||
LOG.debug(msg)
|
||||
|
@ -4,7 +4,7 @@
|
||||
# All rights reserved.
|
||||
|
||||
"""
|
||||
Views for managing Quantum Routers.
|
||||
Views for managing Neutron Routers.
|
||||
"""
|
||||
import logging
|
||||
|
||||
@ -28,7 +28,7 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
|
||||
def handle(self, request, data):
|
||||
try:
|
||||
router = api.quantum.router_create(request,
|
||||
router = api.neutron.router_create(request,
|
||||
name=data['name'])
|
||||
message = _('Router %s was successfully created.') % data['name']
|
||||
messages.success(request, message)
|
||||
|
@ -52,7 +52,7 @@ class AddInterface(forms.SelfHandlingForm):
|
||||
tenant_id = self.request.user.tenant_id
|
||||
networks = []
|
||||
try:
|
||||
networks = api.quantum.network_list_for_tenant(request, tenant_id)
|
||||
networks = api.neutron.network_list_for_tenant(request, tenant_id)
|
||||
except Exception as e:
|
||||
msg = _('Failed to get network list %s') % e.message
|
||||
LOG.info(msg)
|
||||
@ -90,12 +90,12 @@ class AddInterface(forms.SelfHandlingForm):
|
||||
def _add_interface_by_subnet(self, request, data):
|
||||
router_id = data['router_id']
|
||||
try:
|
||||
router_inf = api.quantum.router_add_interface(
|
||||
router_inf = api.neutron.router_add_interface(
|
||||
request, router_id, subnet_id=data['subnet_id'])
|
||||
except Exception as e:
|
||||
self._handle_error(request, router_id, e)
|
||||
try:
|
||||
port = api.quantum.port_get(request, router_inf['port_id'])
|
||||
port = api.neutron.port_get(request, router_inf['port_id'])
|
||||
except:
|
||||
# Ignore an error when port_get() since it is just
|
||||
# to get an IP address for the interface.
|
||||
@ -106,7 +106,7 @@ class AddInterface(forms.SelfHandlingForm):
|
||||
router_id = data['router_id']
|
||||
subnet_id = data['subnet_id']
|
||||
try:
|
||||
subnet = api.quantum.subnet_get(request, subnet_id)
|
||||
subnet = api.neutron.subnet_get(request, subnet_id)
|
||||
except:
|
||||
msg = _('Unable to get subnet "%s"') % subnet_id
|
||||
self._handle_error(request, router_id, msg)
|
||||
@ -115,11 +115,11 @@ class AddInterface(forms.SelfHandlingForm):
|
||||
body = {'network_id': subnet.network_id,
|
||||
'fixed_ips': [{'subnet_id': subnet.id,
|
||||
'ip_address': ip_address}]}
|
||||
port = api.quantum.port_create(request, **body)
|
||||
port = api.neutron.port_create(request, **body)
|
||||
except Exception as e:
|
||||
self._handle_error(request, router_id, e)
|
||||
try:
|
||||
api.quantum.router_add_interface(request, router_id,
|
||||
api.neutron.router_add_interface(request, router_id,
|
||||
port_id=port.id)
|
||||
except Exception as e:
|
||||
self._delete_port(request, port)
|
||||
@ -134,7 +134,7 @@ class AddInterface(forms.SelfHandlingForm):
|
||||
|
||||
def _delete_port(self, request, port):
|
||||
try:
|
||||
api.quantum.port_delete(request, port.id)
|
||||
api.neutron.port_delete(request, port.id)
|
||||
except:
|
||||
msg = _('Failed to delete port %s') % port.id
|
||||
LOG.info(msg)
|
||||
@ -159,7 +159,7 @@ class SetGatewayForm(forms.SelfHandlingForm):
|
||||
def populate_network_id_choices(self, request):
|
||||
search_opts = {'router:external': True}
|
||||
try:
|
||||
networks = api.quantum.network_list(request, **search_opts)
|
||||
networks = api.neutron.network_list(request, **search_opts)
|
||||
except Exception as e:
|
||||
msg = _('Failed to get network list %s') % e.message
|
||||
LOG.info(msg)
|
||||
@ -177,7 +177,7 @@ class SetGatewayForm(forms.SelfHandlingForm):
|
||||
|
||||
def handle(self, request, data):
|
||||
try:
|
||||
api.quantum.router_add_gateway(request,
|
||||
api.neutron.router_add_gateway(request,
|
||||
data['router_id'],
|
||||
data['network_id'])
|
||||
msg = _('Gateway interface is added')
|
||||
|
@ -56,11 +56,11 @@ class RemoveInterface(tables.DeleteAction):
|
||||
def delete(self, request, obj_id):
|
||||
try:
|
||||
router_id = self.table.kwargs['router_id']
|
||||
port = api.quantum.port_get(request, obj_id)
|
||||
port = api.neutron.port_get(request, obj_id)
|
||||
if port['device_owner'] == 'network:router_gateway':
|
||||
api.quantum.router_remove_gateway(request, router_id)
|
||||
api.neutron.router_remove_gateway(request, router_id)
|
||||
else:
|
||||
api.quantum.router_remove_interface(request,
|
||||
api.neutron.router_remove_interface(request,
|
||||
router_id,
|
||||
port_id=obj_id)
|
||||
except:
|
||||
|
@ -34,7 +34,7 @@ class OverviewTab(tabs.Tab):
|
||||
def get_context_data(self, request):
|
||||
port_id = self.tab_group.kwargs['port_id']
|
||||
try:
|
||||
port = api.quantum.port_get(self.request, port_id)
|
||||
port = api.neutron.port_get(self.request, port_id)
|
||||
except:
|
||||
redirect = reverse(self.failure_url)
|
||||
msg = _('Unable to retrieve port details.')
|
||||
|
@ -46,7 +46,7 @@ class AddInterfaceView(forms.ModalFormView):
|
||||
if not hasattr(self, "_object"):
|
||||
try:
|
||||
router_id = self.kwargs["router_id"]
|
||||
self._object = api.quantum.router_get(self.request,
|
||||
self._object = api.neutron.router_get(self.request,
|
||||
router_id)
|
||||
except:
|
||||
redirect = reverse(self.failure_url, args=[router_id])
|
||||
@ -78,7 +78,7 @@ class SetGatewayView(forms.ModalFormView):
|
||||
if not hasattr(self, "_object"):
|
||||
try:
|
||||
router_id = self.kwargs["router_id"]
|
||||
self._object = api.quantum.router_get(self.request,
|
||||
self._object = api.neutron.router_get(self.request,
|
||||
router_id)
|
||||
except:
|
||||
redirect = reverse(self.failure_url)
|
||||
|
@ -23,8 +23,8 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import exceptions
|
||||
from horizon import messages
|
||||
from horizon import tables
|
||||
from neutronclient.common import exceptions as q_ext
|
||||
from openstack_dashboard import api
|
||||
from quantumclient.common import exceptions as q_ext
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -38,8 +38,8 @@ class DeleteRouter(tables.DeleteAction):
|
||||
obj = self.table.get_object_by_id(obj_id)
|
||||
name = self.table.get_object_display(obj)
|
||||
try:
|
||||
api.quantum.router_delete(request, obj_id)
|
||||
except q_ext.QuantumClientException as e:
|
||||
api.neutron.router_delete(request, obj_id)
|
||||
except q_ext.NeutronClientException as e:
|
||||
msg = _('Unable to delete router "%s"') % e.message
|
||||
LOG.info(msg)
|
||||
messages.error(request, msg)
|
||||
@ -86,7 +86,7 @@ class ClearGateway(tables.BatchAction):
|
||||
obj = self.table.get_object_by_id(obj_id)
|
||||
name = self.table.get_object_display(obj)
|
||||
try:
|
||||
api.quantum.router_remove_gateway(request, obj_id)
|
||||
api.neutron.router_remove_gateway(request, obj_id)
|
||||
except Exception as e:
|
||||
msg = (_('Unable to clear gateway for router '
|
||||
'"%(name)s": "%(msg)s"')
|
||||
@ -108,7 +108,7 @@ class UpdateRow(tables.Row):
|
||||
ajax = True
|
||||
|
||||
def get_data(self, request, router_id):
|
||||
router = api.quantum.router_get(request, router_id)
|
||||
router = api.neutron.router_get(request, router_id)
|
||||
return router
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ class OverviewTab(tabs.Tab):
|
||||
def get_context_data(self, request):
|
||||
router_id = self.tab_group.kwargs['router_id']
|
||||
try:
|
||||
router = api.quantum.router_get(request, router_id)
|
||||
router = api.neutron.router_get(request, router_id)
|
||||
except:
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve router details.'),
|
||||
|
@ -29,19 +29,19 @@ class RouterTests(test.TestCase):
|
||||
def _mock_external_network_list(self):
|
||||
search_opts = {'router:external': True}
|
||||
ext_nets = [n for n in self.networks.list() if n['router:external']]
|
||||
api.quantum.network_list(
|
||||
api.neutron.network_list(
|
||||
IsA(http.HttpRequest),
|
||||
**search_opts).AndReturn(ext_nets)
|
||||
|
||||
def _mock_external_network_get(self, router):
|
||||
ext_net_id = router.external_gateway_info['network_id']
|
||||
ext_net = self.networks.list()[2]
|
||||
api.quantum.network_get(IsA(http.HttpRequest), ext_net_id,
|
||||
api.neutron.network_get(IsA(http.HttpRequest), ext_net_id,
|
||||
expand_subnet=False).AndReturn(ext_net)
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_list', 'network_list')})
|
||||
@test.create_stubs({api.neutron: ('router_list', 'network_list')})
|
||||
def test_index(self):
|
||||
api.quantum.router_list(
|
||||
api.neutron.router_list(
|
||||
IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
search_opts=None).AndReturn(self.routers.list())
|
||||
@ -54,12 +54,12 @@ class RouterTests(test.TestCase):
|
||||
routers = res.context['table'].data
|
||||
self.assertItemsEqual(routers, self.routers.list())
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_list', 'network_list')})
|
||||
@test.create_stubs({api.neutron: ('router_list', 'network_list')})
|
||||
def test_index_router_list_exception(self):
|
||||
api.quantum.router_list(
|
||||
api.neutron.router_list(
|
||||
IsA(http.HttpRequest),
|
||||
tenant_id=self.tenant.id,
|
||||
search_opts=None).AndRaise(self.exceptions.quantum)
|
||||
search_opts=None).AndRaise(self.exceptions.neutron)
|
||||
self._mock_external_network_list()
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -69,13 +69,13 @@ class RouterTests(test.TestCase):
|
||||
self.assertEqual(len(res.context['table'].data), 0)
|
||||
self.assertMessageCount(res, error=1)
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_get', 'port_list',
|
||||
@test.create_stubs({api.neutron: ('router_get', 'port_list',
|
||||
'network_get')})
|
||||
def test_router_detail(self):
|
||||
router = self.routers.first()
|
||||
api.quantum.router_get(IsA(http.HttpRequest), router.id)\
|
||||
api.neutron.router_get(IsA(http.HttpRequest), router.id)\
|
||||
.AndReturn(self.routers.first())
|
||||
api.quantum.port_list(IsA(http.HttpRequest),
|
||||
api.neutron.port_list(IsA(http.HttpRequest),
|
||||
device_id=router.id)\
|
||||
.AndReturn([self.ports.first()])
|
||||
self._mock_external_network_get(router)
|
||||
@ -89,12 +89,12 @@ class RouterTests(test.TestCase):
|
||||
ports = res.context['interfaces_table'].data
|
||||
self.assertItemsEqual(ports, [self.ports.first()])
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_get', 'port_list')})
|
||||
@test.create_stubs({api.neutron: ('router_get', 'port_list')})
|
||||
def test_router_detail_exception(self):
|
||||
router = self.routers.first()
|
||||
api.quantum.router_get(IsA(http.HttpRequest), router.id)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.quantum.port_list(IsA(http.HttpRequest),
|
||||
api.neutron.router_get(IsA(http.HttpRequest), router.id)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
api.neutron.port_list(IsA(http.HttpRequest),
|
||||
device_id=router.id)\
|
||||
.AndReturn([self.ports.first()])
|
||||
self.mox.ReplayAll()
|
||||
@ -110,10 +110,10 @@ class RouterActionTests(test.TestCase):
|
||||
INDEX_URL = reverse('horizon:%s:routers:index' % DASHBOARD)
|
||||
DETAIL_PATH = 'horizon:%s:routers:detail' % DASHBOARD
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_create',)})
|
||||
@test.create_stubs({api.neutron: ('router_create',)})
|
||||
def test_router_create_post(self):
|
||||
router = self.routers.first()
|
||||
api.quantum.router_create(IsA(http.HttpRequest), name=router.name)\
|
||||
api.neutron.router_create(IsA(http.HttpRequest), name=router.name)\
|
||||
.AndReturn(router)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -124,11 +124,11 @@ class RouterActionTests(test.TestCase):
|
||||
self.assertNoFormErrors(res)
|
||||
self.assertRedirectsNoFollow(res, self.INDEX_URL)
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_create',)})
|
||||
@test.create_stubs({api.neutron: ('router_create',)})
|
||||
def test_router_create_post_exception(self):
|
||||
router = self.routers.first()
|
||||
api.quantum.router_create(IsA(http.HttpRequest), name=router.name)\
|
||||
.AndRaise(self.exceptions.quantum)
|
||||
api.neutron.router_create(IsA(http.HttpRequest), name=router.name)\
|
||||
.AndRaise(self.exceptions.neutron)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
form_data = {'name': router.name}
|
||||
@ -139,11 +139,11 @@ class RouterActionTests(test.TestCase):
|
||||
self.assertRedirectsNoFollow(res, self.INDEX_URL)
|
||||
|
||||
def _mock_network_list(self, tenant_id):
|
||||
api.quantum.network_list(
|
||||
api.neutron.network_list(
|
||||
IsA(http.HttpRequest),
|
||||
shared=False,
|
||||
tenant_id=tenant_id).AndReturn(self.networks.list())
|
||||
api.quantum.network_list(
|
||||
api.neutron.network_list(
|
||||
IsA(http.HttpRequest),
|
||||
shared=True).AndReturn([])
|
||||
|
||||
@ -152,20 +152,20 @@ class RouterActionTests(test.TestCase):
|
||||
subnet = self.subnets.first()
|
||||
port = self.ports.first()
|
||||
|
||||
add_interface = api.quantum.router_add_interface(
|
||||
add_interface = api.neutron.router_add_interface(
|
||||
IsA(http.HttpRequest), router.id, subnet_id=subnet.id)
|
||||
if raise_error:
|
||||
add_interface.AndRaise(self.exceptions.quantum)
|
||||
add_interface.AndRaise(self.exceptions.neutron)
|
||||
else:
|
||||
add_interface.AndReturn({'subnet_id': subnet.id,
|
||||
'port_id': port.id})
|
||||
api.quantum.port_get(IsA(http.HttpRequest), port.id)\
|
||||
api.neutron.port_get(IsA(http.HttpRequest), port.id)\
|
||||
.AndReturn(port)
|
||||
self._check_router_addinterface(router, subnet)
|
||||
|
||||
def _check_router_addinterface(self, router, subnet, ip_address=''):
|
||||
# mock APIs used to show router detail
|
||||
api.quantum.router_get(IsA(http.HttpRequest), router.id)\
|
||||
api.neutron.router_get(IsA(http.HttpRequest), router.id)\
|
||||
.AndReturn(router)
|
||||
self._mock_network_list(router['tenant_id'])
|
||||
self.mox.ReplayAll()
|
||||
@ -182,14 +182,14 @@ class RouterActionTests(test.TestCase):
|
||||
detail_url = reverse(self.DETAIL_PATH, args=[router.id])
|
||||
self.assertRedirectsNoFollow(res, detail_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_get',
|
||||
@test.create_stubs({api.neutron: ('router_get',
|
||||
'router_add_interface',
|
||||
'port_get',
|
||||
'network_list')})
|
||||
def test_router_addinterface(self):
|
||||
self._test_router_addinterface()
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_get',
|
||||
@test.create_stubs({api.neutron: ('router_get',
|
||||
'router_add_interface',
|
||||
'network_list')})
|
||||
def test_router_addinterface_exception(self):
|
||||
@ -206,74 +206,74 @@ class RouterActionTests(test.TestCase):
|
||||
|
||||
def _setup_mock_addinterface_ip_addr(self, router, subnet, port,
|
||||
ip_addr, errors=[]):
|
||||
subnet_get = api.quantum.subnet_get(IsA(http.HttpRequest), subnet.id)
|
||||
subnet_get = api.neutron.subnet_get(IsA(http.HttpRequest), subnet.id)
|
||||
if 'subnet_get' in errors:
|
||||
subnet_get.AndRaise(self.exceptions.quantum)
|
||||
subnet_get.AndRaise(self.exceptions.neutron)
|
||||
return
|
||||
subnet_get.AndReturn(subnet)
|
||||
|
||||
params = {'network_id': subnet.network_id,
|
||||
'fixed_ips': [{'subnet_id': subnet.id,
|
||||
'ip_address': ip_addr}]}
|
||||
port_create = api.quantum.port_create(IsA(http.HttpRequest), **params)
|
||||
port_create = api.neutron.port_create(IsA(http.HttpRequest), **params)
|
||||
if 'port_create' in errors:
|
||||
port_create.AndRaise(self.exceptions.quantum)
|
||||
port_create.AndRaise(self.exceptions.neutron)
|
||||
return
|
||||
port_create.AndReturn(port)
|
||||
|
||||
add_inf = api.quantum.router_add_interface(
|
||||
add_inf = api.neutron.router_add_interface(
|
||||
IsA(http.HttpRequest), router.id, port_id=port.id)
|
||||
if 'add_interface' not in errors:
|
||||
return
|
||||
|
||||
add_inf.AndRaise(self.exceptions.quantum)
|
||||
port_delete = api.quantum.port_delete(IsA(http.HttpRequest), port.id)
|
||||
add_inf.AndRaise(self.exceptions.neutron)
|
||||
port_delete = api.neutron.port_delete(IsA(http.HttpRequest), port.id)
|
||||
if 'port_delete' in errors:
|
||||
port_delete.AndRaise(self.exceptions.quantum)
|
||||
port_delete.AndRaise(self.exceptions.neutron)
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_add_interface', 'subnet_get',
|
||||
@test.create_stubs({api.neutron: ('router_add_interface', 'subnet_get',
|
||||
'port_create',
|
||||
'router_get', 'network_list')})
|
||||
def test_router_addinterface_ip_addr(self):
|
||||
self._test_router_addinterface_ip_addr()
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_get',
|
||||
@test.create_stubs({api.neutron: ('subnet_get',
|
||||
'router_get', 'network_list')})
|
||||
def test_router_addinterface_ip_addr_exception_subnet_get(self):
|
||||
self._test_router_addinterface_ip_addr(errors=['subnet_get'])
|
||||
|
||||
@test.create_stubs({api.quantum: ('subnet_get', 'port_create',
|
||||
@test.create_stubs({api.neutron: ('subnet_get', 'port_create',
|
||||
'router_get', 'network_list')})
|
||||
def test_router_addinterface_ip_addr_exception_port_create(self):
|
||||
self._test_router_addinterface_ip_addr(errors=['port_create'])
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_add_interface', 'subnet_get',
|
||||
@test.create_stubs({api.neutron: ('router_add_interface', 'subnet_get',
|
||||
'port_create', 'port_delete',
|
||||
'router_get', 'network_list')})
|
||||
def test_router_addinterface_ip_addr_exception_add_interface(self):
|
||||
self._test_router_addinterface_ip_addr(errors=['add_interface'])
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_add_interface', 'subnet_get',
|
||||
@test.create_stubs({api.neutron: ('router_add_interface', 'subnet_get',
|
||||
'port_create', 'port_delete',
|
||||
'router_get', 'network_list')})
|
||||
def test_router_addinterface_ip_addr_exception_port_delete(self):
|
||||
self._test_router_addinterface_ip_addr(errors=['add_interface',
|
||||
'port_delete'])
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_get',
|
||||
@test.create_stubs({api.neutron: ('router_get',
|
||||
'router_add_gateway',
|
||||
'network_list')})
|
||||
def test_router_add_gateway(self):
|
||||
router = self.routers.first()
|
||||
network = self.networks.first()
|
||||
api.quantum.router_add_gateway(
|
||||
api.neutron.router_add_gateway(
|
||||
IsA(http.HttpRequest),
|
||||
router.id,
|
||||
network.id).AndReturn(None)
|
||||
api.quantum.router_get(
|
||||
api.neutron.router_get(
|
||||
IsA(http.HttpRequest), router.id).AndReturn(router)
|
||||
search_opts = {'router:external': True}
|
||||
api.quantum.network_list(
|
||||
api.neutron.network_list(
|
||||
IsA(http.HttpRequest), **search_opts).AndReturn([network])
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -288,20 +288,20 @@ class RouterActionTests(test.TestCase):
|
||||
detail_url = self.INDEX_URL
|
||||
self.assertRedirectsNoFollow(res, detail_url)
|
||||
|
||||
@test.create_stubs({api.quantum: ('router_get',
|
||||
@test.create_stubs({api.neutron: ('router_get',
|
||||
'router_add_gateway',
|
||||
'network_list')})
|
||||
def test_router_add_gateway_exception(self):
|
||||
router = self.routers.first()
|
||||
network = self.networks.first()
|
||||
api.quantum.router_add_gateway(
|
||||
api.neutron.router_add_gateway(
|
||||
IsA(http.HttpRequest),
|
||||
router.id,
|
||||
network.id).AndRaise(self.exceptions.quantum)
|
||||
api.quantum.router_get(
|
||||
network.id).AndRaise(self.exceptions.neutron)
|
||||
api.neutron.router_get(
|
||||
IsA(http.HttpRequest), router.id).AndReturn(router)
|
||||
search_opts = {'router:external': True}
|
||||
api.quantum.network_list(
|
||||
api.neutron.network_list(
|
||||
IsA(http.HttpRequest), **search_opts).AndReturn([network])
|
||||
self.mox.ReplayAll()
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Views for managing Quantum Routers.
|
||||
Views for managing Neutron Routers.
|
||||
"""
|
||||
|
||||
import logging
|
||||
@ -44,7 +44,7 @@ class IndexView(tables.DataTableView):
|
||||
def _get_routers(self, search_opts=None):
|
||||
try:
|
||||
tenant_id = self.request.user.tenant_id
|
||||
routers = api.quantum.router_list(self.request,
|
||||
routers = api.neutron.router_list(self.request,
|
||||
tenant_id=tenant_id,
|
||||
search_opts=search_opts)
|
||||
except:
|
||||
@ -66,7 +66,7 @@ class IndexView(tables.DataTableView):
|
||||
def _list_external_networks(self):
|
||||
try:
|
||||
search_opts = {'router:external': True}
|
||||
ext_nets = api.quantum.network_list(self.request,
|
||||
ext_nets = api.neutron.network_list(self.request,
|
||||
**search_opts)
|
||||
for ext_net in ext_nets:
|
||||
ext_net.set_id_as_name_if_empty()
|
||||
@ -97,7 +97,7 @@ class DetailView(tables.MultiTableView):
|
||||
if not hasattr(self, "_router"):
|
||||
try:
|
||||
router_id = self.kwargs['router_id']
|
||||
router = api.quantum.router_get(self.request, router_id)
|
||||
router = api.neutron.router_get(self.request, router_id)
|
||||
router.set_id_as_name_if_empty(length=0)
|
||||
except:
|
||||
msg = _('Unable to retrieve details for router "%s".') \
|
||||
@ -107,7 +107,7 @@ class DetailView(tables.MultiTableView):
|
||||
if router.external_gateway_info:
|
||||
ext_net_id = router.external_gateway_info['network_id']
|
||||
try:
|
||||
ext_net = api.quantum.network_get(self.request, ext_net_id,
|
||||
ext_net = api.neutron.network_get(self.request, ext_net_id,
|
||||
expand_subnet=False)
|
||||
ext_net.set_id_as_name_if_empty(length=0)
|
||||
router.external_gateway_info['network'] = ext_net.name
|
||||
@ -128,7 +128,7 @@ class DetailView(tables.MultiTableView):
|
||||
def get_interfaces_data(self):
|
||||
try:
|
||||
device_id = self.kwargs['router_id']
|
||||
ports = api.quantum.port_list(self.request,
|
||||
ports = api.neutron.port_list(self.request,
|
||||
device_id=device_id)
|
||||
except:
|
||||
ports = []
|
||||
|
@ -22,8 +22,8 @@ from cinderclient import exceptions as cinderclient
|
||||
from glanceclient.common import exceptions as glanceclient
|
||||
from heatclient import exc as heatclient
|
||||
from keystoneclient import exceptions as keystoneclient
|
||||
from neutronclient.common import exceptions as neutronclient
|
||||
from novaclient import exceptions as novaclient
|
||||
from quantumclient.common import exceptions as quantumclient
|
||||
from swiftclient import client as swiftclient
|
||||
|
||||
|
||||
@ -34,8 +34,8 @@ UNAUTHORIZED = (keystoneclient.Unauthorized,
|
||||
novaclient.Unauthorized,
|
||||
novaclient.Forbidden,
|
||||
glanceclient.Unauthorized,
|
||||
quantumclient.Unauthorized,
|
||||
quantumclient.Forbidden,
|
||||
neutronclient.Unauthorized,
|
||||
neutronclient.Forbidden,
|
||||
heatclient.HTTPUnauthorized,
|
||||
heatclient.HTTPForbidden)
|
||||
|
||||
@ -43,8 +43,8 @@ NOT_FOUND = (keystoneclient.NotFound,
|
||||
cinderclient.NotFound,
|
||||
novaclient.NotFound,
|
||||
glanceclient.NotFound,
|
||||
quantumclient.NetworkNotFoundClient,
|
||||
quantumclient.PortNotFoundClient,
|
||||
neutronclient.NetworkNotFoundClient,
|
||||
neutronclient.PortNotFoundClient,
|
||||
heatclient.HTTPNotFound)
|
||||
|
||||
# NOTE(gabriel): This is very broad, and may need to be dialed in.
|
||||
@ -54,13 +54,13 @@ RECOVERABLE = (keystoneclient.ClientException,
|
||||
cinderclient.ClientException,
|
||||
novaclient.ClientException,
|
||||
glanceclient.ClientException,
|
||||
# NOTE(amotoki): Quantum exceptions other than the first one
|
||||
# NOTE(amotoki): Neutron exceptions other than the first one
|
||||
# are recoverable in many cases (e.g., NetworkInUse is not
|
||||
# raised once VMs which use the network are terminated).
|
||||
quantumclient.QuantumClientException,
|
||||
quantumclient.NetworkInUseClient,
|
||||
quantumclient.PortInUseClient,
|
||||
quantumclient.AlreadyAttachedClient,
|
||||
quantumclient.StateInvalidClient,
|
||||
neutronclient.NeutronClientException,
|
||||
neutronclient.NetworkInUseClient,
|
||||
neutronclient.PortInUseClient,
|
||||
neutronclient.AlreadyAttachedClient,
|
||||
neutronclient.StateInvalidClient,
|
||||
swiftclient.ClientException,
|
||||
heatclient.HTTPException)
|
||||
|
@ -154,10 +154,10 @@ OPENSTACK_HYPERVISOR_FEATURES = {
|
||||
'can_encrypt_volumes': False
|
||||
}
|
||||
|
||||
# The OPENSTACK_QUANTUM_NETWORK settings can be used to enable optional
|
||||
# services provided by quantum. Currently only the load balancer service
|
||||
# The OPENSTACK_NEUTRON_NETWORK settings can be used to enable optional
|
||||
# services provided by neutron. Currently only the load balancer service
|
||||
# is available.
|
||||
OPENSTACK_QUANTUM_NETWORK = {
|
||||
OPENSTACK_NEUTRON_NETWORK = {
|
||||
'enable_lb': False
|
||||
}
|
||||
|
||||
|
@ -18,11 +18,11 @@
|
||||
from openstack_dashboard import api
|
||||
from openstack_dashboard.test import helpers as test
|
||||
|
||||
from quantumclient.v2_0.client import Client as quantumclient
|
||||
from neutronclient.v2_0.client import Client as neutronclient
|
||||
|
||||
|
||||
class LbaasApiTests(test.APITestCase):
|
||||
@test.create_stubs({quantumclient: ('create_vip',)})
|
||||
@test.create_stubs({neutronclient: ('create_vip',)})
|
||||
def test_vip_create(self):
|
||||
vip1 = self.api_vips.first()
|
||||
form_data = {'address': vip1['address'],
|
||||
@ -37,13 +37,13 @@ class LbaasApiTests(test.APITestCase):
|
||||
'admin_state_up': vip1['admin_state_up']
|
||||
}
|
||||
vip = {'vip': self.api_vips.first()}
|
||||
quantumclient.create_vip({'vip': form_data}).AndReturn(vip)
|
||||
neutronclient.create_vip({'vip': form_data}).AndReturn(vip)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.lbaas.vip_create(self.request, **form_data)
|
||||
self.assertIsInstance(ret_val, api.lbaas.Vip)
|
||||
|
||||
@test.create_stubs({quantumclient: ('list_vips',)})
|
||||
@test.create_stubs({neutronclient: ('list_vips',)})
|
||||
def test_vips_get(self):
|
||||
vips = {'vips': [{'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||
'address': '10.0.0.100',
|
||||
@ -56,14 +56,14 @@ class LbaasApiTests(test.APITestCase):
|
||||
'connection_limit': '10',
|
||||
'admin_state_up': True
|
||||
}, ]}
|
||||
quantumclient.list_vips().AndReturn(vips)
|
||||
neutronclient.list_vips().AndReturn(vips)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.lbaas.vips_get(self.request)
|
||||
for v in ret_val:
|
||||
self.assertIsInstance(v, api.lbaas.Vip)
|
||||
|
||||
@test.create_stubs({quantumclient: ('show_vip',)})
|
||||
@test.create_stubs({neutronclient: ('show_vip',)})
|
||||
def test_vip_get(self):
|
||||
vip = {'vip': {'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||
'address': '10.0.0.100',
|
||||
@ -76,13 +76,13 @@ class LbaasApiTests(test.APITestCase):
|
||||
'connection_limit': '10',
|
||||
'admin_state_up': True
|
||||
}}
|
||||
quantumclient.show_vip(vip['vip']['id']).AndReturn(vip)
|
||||
neutronclient.show_vip(vip['vip']['id']).AndReturn(vip)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.lbaas.vip_get(self.request, vip['vip']['id'])
|
||||
self.assertIsInstance(ret_val, api.lbaas.Vip)
|
||||
|
||||
@test.create_stubs({quantumclient: ('update_vip',)})
|
||||
@test.create_stubs({neutronclient: ('update_vip',)})
|
||||
def test_vip_update(self):
|
||||
form_data = {'address': '10.0.0.100',
|
||||
'name': 'vip1name',
|
||||
@ -106,14 +106,14 @@ class LbaasApiTests(test.APITestCase):
|
||||
'connection_limit': '10',
|
||||
'admin_state_up': True
|
||||
}}
|
||||
quantumclient.update_vip(vip['vip']['id'], form_data).AndReturn(vip)
|
||||
neutronclient.update_vip(vip['vip']['id'], form_data).AndReturn(vip)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.lbaas.vip_update(self.request,
|
||||
vip['vip']['id'], **form_data)
|
||||
self.assertIsInstance(ret_val, api.lbaas.Vip)
|
||||
|
||||
@test.create_stubs({quantumclient: ('create_pool',)})
|
||||
@test.create_stubs({neutronclient: ('create_pool',)})
|
||||
def test_pool_create(self):
|
||||
form_data = {'name': 'pool1name',
|
||||
'description': 'pool1description',
|
||||
@ -131,13 +131,13 @@ class LbaasApiTests(test.APITestCase):
|
||||
'lb_method': 'ROUND_ROBIN',
|
||||
'admin_state_up': True
|
||||
}}
|
||||
quantumclient.create_pool({'pool': form_data}).AndReturn(pool)
|
||||
neutronclient.create_pool({'pool': form_data}).AndReturn(pool)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.lbaas.pool_create(self.request, **form_data)
|
||||
self.assertIsInstance(ret_val, api.lbaas.Pool)
|
||||
|
||||
@test.create_stubs({quantumclient: ('list_pools',)})
|
||||
@test.create_stubs({neutronclient: ('list_pools',)})
|
||||
def test_pools_get(self):
|
||||
pools = {'pools': [{
|
||||
'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||
@ -147,14 +147,14 @@ class LbaasApiTests(test.APITestCase):
|
||||
'protocol': 'HTTP',
|
||||
'lb_method': 'ROUND_ROBIN',
|
||||
'admin_state_up': True}, ]}
|
||||
quantumclient.list_pools().AndReturn(pools)
|
||||
neutronclient.list_pools().AndReturn(pools)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.lbaas.pools_get(self.request)
|
||||
for v in ret_val:
|
||||
self.assertIsInstance(v, api.lbaas.Pool)
|
||||
|
||||
@test.create_stubs({quantumclient: ('show_pool',)})
|
||||
@test.create_stubs({neutronclient: ('show_pool',)})
|
||||
def test_pool_get(self):
|
||||
pool = {'pool': {'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||
'name': 'pool1name',
|
||||
@ -164,13 +164,13 @@ class LbaasApiTests(test.APITestCase):
|
||||
'lb_method': 'ROUND_ROBIN',
|
||||
'admin_state_up': True
|
||||
}}
|
||||
quantumclient.show_pool(pool['pool']['id']).AndReturn(pool)
|
||||
neutronclient.show_pool(pool['pool']['id']).AndReturn(pool)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.lbaas.pool_get(self.request, pool['pool']['id'])
|
||||
self.assertIsInstance(ret_val, api.lbaas.Pool)
|
||||
|
||||
@test.create_stubs({quantumclient: ('update_pool',)})
|
||||
@test.create_stubs({neutronclient: ('update_pool',)})
|
||||
def test_pool_update(self):
|
||||
form_data = {'name': 'pool1name',
|
||||
'description': 'pool1description',
|
||||
@ -188,7 +188,7 @@ class LbaasApiTests(test.APITestCase):
|
||||
'lb_method': 'LEAST_CONNECTION',
|
||||
'admin_state_up': True
|
||||
}}
|
||||
quantumclient.update_pool(pool['pool']['id'],
|
||||
neutronclient.update_pool(pool['pool']['id'],
|
||||
form_data).AndReturn(pool)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -196,7 +196,7 @@ class LbaasApiTests(test.APITestCase):
|
||||
pool['pool']['id'], **form_data)
|
||||
self.assertIsInstance(ret_val, api.lbaas.Pool)
|
||||
|
||||
@test.create_stubs({quantumclient: ('create_health_monitor',)})
|
||||
@test.create_stubs({neutronclient: ('create_health_monitor',)})
|
||||
def test_pool_health_monitor_create(self):
|
||||
form_data = {'type': 'PING',
|
||||
'delay': '10',
|
||||
@ -211,7 +211,7 @@ class LbaasApiTests(test.APITestCase):
|
||||
'timeout': '10',
|
||||
'max_retries': '10',
|
||||
'admin_state_up': True}}
|
||||
quantumclient.create_health_monitor({
|
||||
neutronclient.create_health_monitor({
|
||||
'health_monitor': form_data}).AndReturn(monitor)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -219,7 +219,7 @@ class LbaasApiTests(test.APITestCase):
|
||||
self.request, **form_data)
|
||||
self.assertIsInstance(ret_val, api.lbaas.PoolMonitor)
|
||||
|
||||
@test.create_stubs({quantumclient: ('list_health_monitors',)})
|
||||
@test.create_stubs({neutronclient: ('list_health_monitors',)})
|
||||
def test_pool_health_monitors_get(self):
|
||||
monitors = {'health_monitors': [
|
||||
{'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||
@ -232,14 +232,14 @@ class LbaasApiTests(test.APITestCase):
|
||||
'expected_codes': '200',
|
||||
'admin_state_up': True}, ]}
|
||||
|
||||
quantumclient.list_health_monitors().AndReturn(monitors)
|
||||
neutronclient.list_health_monitors().AndReturn(monitors)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.lbaas.pool_health_monitors_get(self.request)
|
||||
for v in ret_val:
|
||||
self.assertIsInstance(v, api.lbaas.PoolMonitor)
|
||||
|
||||
@test.create_stubs({quantumclient: ('show_health_monitor',)})
|
||||
@test.create_stubs({neutronclient: ('show_health_monitor',)})
|
||||
def test_pool_health_monitor_get(self):
|
||||
monitor = {'health_monitor':
|
||||
{'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||
@ -251,7 +251,7 @@ class LbaasApiTests(test.APITestCase):
|
||||
'url_path': '/monitor',
|
||||
'expected_codes': '200',
|
||||
'admin_state_up': True}}
|
||||
quantumclient.show_health_monitor(
|
||||
neutronclient.show_health_monitor(
|
||||
monitor['health_monitor']['id']).AndReturn(monitor)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -259,7 +259,7 @@ class LbaasApiTests(test.APITestCase):
|
||||
self.request, monitor['health_monitor']['id'])
|
||||
self.assertIsInstance(ret_val, api.lbaas.PoolMonitor)
|
||||
|
||||
@test.create_stubs({quantumclient: ('create_member', )})
|
||||
@test.create_stubs({neutronclient: ('create_member', )})
|
||||
def test_member_create(self):
|
||||
form_data = {'pool_id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||
'address': '10.0.1.2',
|
||||
@ -276,13 +276,13 @@ class LbaasApiTests(test.APITestCase):
|
||||
'weight': '10',
|
||||
'admin_state_up': True}}
|
||||
|
||||
quantumclient.create_member({'member': form_data}).AndReturn(member)
|
||||
neutronclient.create_member({'member': form_data}).AndReturn(member)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.lbaas.member_create(self.request, **form_data)
|
||||
self.assertIsInstance(ret_val, api.lbaas.Member)
|
||||
|
||||
@test.create_stubs({quantumclient: ('list_members',)})
|
||||
@test.create_stubs({neutronclient: ('list_members',)})
|
||||
def test_members_get(self):
|
||||
members = {'members': [
|
||||
{'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||
@ -292,14 +292,14 @@ class LbaasApiTests(test.APITestCase):
|
||||
'weight': '10',
|
||||
'admin_state_up': True
|
||||
}, ]}
|
||||
quantumclient.list_members().AndReturn(members)
|
||||
neutronclient.list_members().AndReturn(members)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.lbaas.members_get(self.request)
|
||||
for v in ret_val:
|
||||
self.assertIsInstance(v, api.lbaas.Member)
|
||||
|
||||
@test.create_stubs({quantumclient: ('show_member',)})
|
||||
@test.create_stubs({neutronclient: ('show_member',)})
|
||||
def test_member_get(self):
|
||||
member = {'member': {'id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||
'pool_id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||
@ -307,13 +307,13 @@ class LbaasApiTests(test.APITestCase):
|
||||
'protocol_port': '80',
|
||||
'weight': '10',
|
||||
'admin_state_up': True}}
|
||||
quantumclient.show_member(member['member']['id']).AndReturn(member)
|
||||
neutronclient.show_member(member['member']['id']).AndReturn(member)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.lbaas.member_get(self.request, member['member']['id'])
|
||||
self.assertIsInstance(ret_val, api.lbaas.Member)
|
||||
|
||||
@test.create_stubs({quantumclient: ('update_member',)})
|
||||
@test.create_stubs({neutronclient: ('update_member',)})
|
||||
def test_member_update(self):
|
||||
form_data = {'pool_id': 'abcdef-c3eb-4fee-9763-12de3338041e',
|
||||
'address': '10.0.1.4',
|
||||
@ -330,7 +330,7 @@ class LbaasApiTests(test.APITestCase):
|
||||
'admin_state_up': True
|
||||
}}
|
||||
|
||||
quantumclient.update_member(member['member']['id'],
|
||||
neutronclient.update_member(member['member']['id'],
|
||||
form_data).AndReturn(member)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
|
@ -142,13 +142,13 @@ class NetworkApiNovaFloatingIpTests(test.APITestCase):
|
||||
self.assertEqual(instance_id, ret)
|
||||
|
||||
|
||||
class NetworkApiQuantumFloatingIpTests(test.APITestCase):
|
||||
class NetworkApiNeutronFloatingIpTests(test.APITestCase):
|
||||
def setUp(self):
|
||||
super(NetworkApiQuantumFloatingIpTests, self).setUp()
|
||||
super(NetworkApiNeutronFloatingIpTests, self).setUp()
|
||||
self.mox.StubOutWithMock(api.base, 'is_service_enabled')
|
||||
api.base.is_service_enabled(IsA(http.HttpRequest), 'network') \
|
||||
.AndReturn(True)
|
||||
self.qclient = self.stub_quantumclient()
|
||||
self.qclient = self.stub_neutronclient()
|
||||
|
||||
def test_floating_ip_pools_list(self):
|
||||
search_opts = {'router:external': True}
|
||||
|
@ -18,19 +18,19 @@ from openstack_dashboard import api
|
||||
from openstack_dashboard.test import helpers as test
|
||||
|
||||
|
||||
class QuantumApiTests(test.APITestCase):
|
||||
class NeutronApiTests(test.APITestCase):
|
||||
def test_network_list(self):
|
||||
networks = {'networks': self.api_networks.list()}
|
||||
subnets = {'subnets': self.api_subnets.list()}
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.list_networks().AndReturn(networks)
|
||||
quantumclient.list_subnets().AndReturn(subnets)
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.list_networks().AndReturn(networks)
|
||||
neutronclient.list_subnets().AndReturn(subnets)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.network_list(self.request)
|
||||
ret_val = api.neutron.network_list(self.request)
|
||||
for n in ret_val:
|
||||
self.assertIsInstance(n, api.quantum.Network)
|
||||
self.assertIsInstance(n, api.neutron.Network)
|
||||
|
||||
def test_network_get(self):
|
||||
network = {'network': self.api_networks.first()}
|
||||
@ -38,69 +38,69 @@ class QuantumApiTests(test.APITestCase):
|
||||
network_id = self.api_networks.first()['id']
|
||||
subnet_id = self.api_networks.first()['subnets'][0]
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.show_network(network_id).AndReturn(network)
|
||||
quantumclient.show_subnet(subnet_id).AndReturn(subnet)
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.show_network(network_id).AndReturn(network)
|
||||
neutronclient.show_subnet(subnet_id).AndReturn(subnet)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.network_get(self.request, network_id)
|
||||
self.assertIsInstance(ret_val, api.quantum.Network)
|
||||
ret_val = api.neutron.network_get(self.request, network_id)
|
||||
self.assertIsInstance(ret_val, api.neutron.Network)
|
||||
|
||||
def test_network_create(self):
|
||||
network = {'network': self.api_networks.first()}
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
neutronclient = self.stub_neutronclient()
|
||||
form_data = {'network': {'name': 'net1'}}
|
||||
quantumclient.create_network(body=form_data).AndReturn(network)
|
||||
neutronclient.create_network(body=form_data).AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.network_create(self.request, name='net1')
|
||||
self.assertIsInstance(ret_val, api.quantum.Network)
|
||||
ret_val = api.neutron.network_create(self.request, name='net1')
|
||||
self.assertIsInstance(ret_val, api.neutron.Network)
|
||||
|
||||
def test_network_modify(self):
|
||||
network = {'network': self.api_networks.first()}
|
||||
network_id = self.api_networks.first()['id']
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
neutronclient = self.stub_neutronclient()
|
||||
form_data = {'network': {'name': 'net1'}}
|
||||
quantumclient.update_network(network_id, body=form_data)\
|
||||
neutronclient.update_network(network_id, body=form_data)\
|
||||
.AndReturn(network)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.network_modify(self.request, network_id,
|
||||
ret_val = api.neutron.network_modify(self.request, network_id,
|
||||
name='net1')
|
||||
self.assertIsInstance(ret_val, api.quantum.Network)
|
||||
self.assertIsInstance(ret_val, api.neutron.Network)
|
||||
|
||||
def test_network_delete(self):
|
||||
network_id = self.api_networks.first()['id']
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.delete_network(network_id)
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.delete_network(network_id)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
api.quantum.network_delete(self.request, network_id)
|
||||
api.neutron.network_delete(self.request, network_id)
|
||||
|
||||
def test_subnet_list(self):
|
||||
subnets = {'subnets': self.api_subnets.list()}
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.list_subnets().AndReturn(subnets)
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.list_subnets().AndReturn(subnets)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.subnet_list(self.request)
|
||||
ret_val = api.neutron.subnet_list(self.request)
|
||||
for n in ret_val:
|
||||
self.assertIsInstance(n, api.quantum.Subnet)
|
||||
self.assertIsInstance(n, api.neutron.Subnet)
|
||||
|
||||
def test_subnet_get(self):
|
||||
subnet = {'subnet': self.api_subnets.first()}
|
||||
subnet_id = self.api_subnets.first()['id']
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.show_subnet(subnet_id).AndReturn(subnet)
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.show_subnet(subnet_id).AndReturn(subnet)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.subnet_get(self.request, subnet_id)
|
||||
self.assertIsInstance(ret_val, api.quantum.Subnet)
|
||||
ret_val = api.neutron.subnet_get(self.request, subnet_id)
|
||||
self.assertIsInstance(ret_val, api.neutron.Subnet)
|
||||
|
||||
def test_subnet_create(self):
|
||||
subnet_data = self.api_subnets.first()
|
||||
@ -111,13 +111,13 @@ class QuantumApiTests(test.APITestCase):
|
||||
'ip_version': subnet_data['ip_version'],
|
||||
'gateway_ip': subnet_data['gateway_ip']}
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.create_subnet(body={'subnet': params})\
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.create_subnet(body={'subnet': params})\
|
||||
.AndReturn({'subnet': subnet_data})
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.subnet_create(self.request, **params)
|
||||
self.assertIsInstance(ret_val, api.quantum.Subnet)
|
||||
ret_val = api.neutron.subnet_create(self.request, **params)
|
||||
self.assertIsInstance(ret_val, api.neutron.Subnet)
|
||||
|
||||
def test_subnet_modify(self):
|
||||
subnet_data = self.api_subnets.first()
|
||||
@ -125,44 +125,44 @@ class QuantumApiTests(test.APITestCase):
|
||||
params = {'name': subnet_data['name'],
|
||||
'gateway_ip': subnet_data['gateway_ip']}
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.update_subnet(subnet_id, body={'subnet': params})\
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.update_subnet(subnet_id, body={'subnet': params})\
|
||||
.AndReturn({'subnet': subnet_data})
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.subnet_modify(self.request, subnet_id, **params)
|
||||
self.assertIsInstance(ret_val, api.quantum.Subnet)
|
||||
ret_val = api.neutron.subnet_modify(self.request, subnet_id, **params)
|
||||
self.assertIsInstance(ret_val, api.neutron.Subnet)
|
||||
|
||||
def test_subnet_delete(self):
|
||||
subnet_id = self.api_subnets.first()['id']
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.delete_subnet(subnet_id)
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.delete_subnet(subnet_id)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
api.quantum.subnet_delete(self.request, subnet_id)
|
||||
api.neutron.subnet_delete(self.request, subnet_id)
|
||||
|
||||
def test_port_list(self):
|
||||
ports = {'ports': self.api_ports.list()}
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.list_ports().AndReturn(ports)
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.list_ports().AndReturn(ports)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.port_list(self.request)
|
||||
ret_val = api.neutron.port_list(self.request)
|
||||
for p in ret_val:
|
||||
self.assertIsInstance(p, api.quantum.Port)
|
||||
self.assertIsInstance(p, api.neutron.Port)
|
||||
|
||||
def test_port_get(self):
|
||||
port = {'port': self.api_ports.first()}
|
||||
port_id = self.api_ports.first()['id']
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.show_port(port_id).AndReturn(port)
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.show_port(port_id).AndReturn(port)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.port_get(self.request, port_id)
|
||||
self.assertIsInstance(ret_val, api.quantum.Port)
|
||||
ret_val = api.neutron.port_get(self.request, port_id)
|
||||
self.assertIsInstance(ret_val, api.neutron.Port)
|
||||
|
||||
def test_port_create(self):
|
||||
port_data = self.api_ports.first()
|
||||
@ -171,14 +171,14 @@ class QuantumApiTests(test.APITestCase):
|
||||
'name': port_data['name'],
|
||||
'device_id': port_data['device_id']}
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.create_port(body={'port': params})\
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.create_port(body={'port': params})\
|
||||
.AndReturn({'port': port_data})
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.port_create(self.request, **params)
|
||||
self.assertIsInstance(ret_val, api.quantum.Port)
|
||||
self.assertEqual(ret_val.id, api.quantum.Port(port_data).id)
|
||||
ret_val = api.neutron.port_create(self.request, **params)
|
||||
self.assertIsInstance(ret_val, api.neutron.Port)
|
||||
self.assertEqual(ret_val.id, api.neutron.Port(port_data).id)
|
||||
|
||||
def test_port_modify(self):
|
||||
port_data = self.api_ports.first()
|
||||
@ -186,87 +186,87 @@ class QuantumApiTests(test.APITestCase):
|
||||
params = {'name': port_data['name'],
|
||||
'device_id': port_data['device_id']}
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.update_port(port_id, body={'port': params})\
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.update_port(port_id, body={'port': params})\
|
||||
.AndReturn({'port': port_data})
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.port_modify(self.request, port_id, **params)
|
||||
self.assertIsInstance(ret_val, api.quantum.Port)
|
||||
self.assertEqual(ret_val.id, api.quantum.Port(port_data).id)
|
||||
ret_val = api.neutron.port_modify(self.request, port_id, **params)
|
||||
self.assertIsInstance(ret_val, api.neutron.Port)
|
||||
self.assertEqual(ret_val.id, api.neutron.Port(port_data).id)
|
||||
|
||||
def test_port_delete(self):
|
||||
port_id = self.api_ports.first()['id']
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.delete_port(port_id)
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.delete_port(port_id)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
api.quantum.port_delete(self.request, port_id)
|
||||
api.neutron.port_delete(self.request, port_id)
|
||||
|
||||
def test_router_list(self):
|
||||
routers = {'routers': self.api_routers.list()}
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.list_routers().AndReturn(routers)
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.list_routers().AndReturn(routers)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.router_list(self.request)
|
||||
ret_val = api.neutron.router_list(self.request)
|
||||
for n in ret_val:
|
||||
self.assertIsInstance(n, api.quantum.Router)
|
||||
self.assertIsInstance(n, api.neutron.Router)
|
||||
|
||||
def test_router_get(self):
|
||||
router = {'router': self.api_routers.first()}
|
||||
router_id = self.api_routers.first()['id']
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.show_router(router_id).AndReturn(router)
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.show_router(router_id).AndReturn(router)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.router_get(self.request, router_id)
|
||||
self.assertIsInstance(ret_val, api.quantum.Router)
|
||||
ret_val = api.neutron.router_get(self.request, router_id)
|
||||
self.assertIsInstance(ret_val, api.neutron.Router)
|
||||
|
||||
def test_router_create(self):
|
||||
router = {'router': self.api_routers.first()}
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
neutronclient = self.stub_neutronclient()
|
||||
form_data = {'router': {'name': 'router1'}}
|
||||
quantumclient.create_router(body=form_data).AndReturn(router)
|
||||
neutronclient.create_router(body=form_data).AndReturn(router)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.quantum.router_create(self.request, name='router1')
|
||||
self.assertIsInstance(ret_val, api.quantum.Router)
|
||||
ret_val = api.neutron.router_create(self.request, name='router1')
|
||||
self.assertIsInstance(ret_val, api.neutron.Router)
|
||||
|
||||
def test_router_delete(self):
|
||||
router_id = self.api_routers.first()['id']
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.delete_router(router_id)
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.delete_router(router_id)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
api.quantum.router_delete(self.request, router_id)
|
||||
api.neutron.router_delete(self.request, router_id)
|
||||
|
||||
def test_router_add_interface(self):
|
||||
subnet_id = self.api_subnets.first()['id']
|
||||
router_id = self.api_routers.first()['id']
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
neutronclient = self.stub_neutronclient()
|
||||
form_data = {'subnet_id': subnet_id}
|
||||
quantumclient.add_interface_router(
|
||||
neutronclient.add_interface_router(
|
||||
router_id, form_data).AndReturn(None)
|
||||
self.mox.ReplayAll()
|
||||
|
||||
api.quantum.router_add_interface(
|
||||
api.neutron.router_add_interface(
|
||||
self.request, router_id, subnet_id=subnet_id)
|
||||
|
||||
def test_router_remove_interface(self):
|
||||
router_id = self.api_routers.first()['id']
|
||||
fake_port = self.api_ports.first()['id']
|
||||
|
||||
quantumclient = self.stub_quantumclient()
|
||||
quantumclient.remove_interface_router(
|
||||
neutronclient = self.stub_neutronclient()
|
||||
neutronclient.remove_interface_router(
|
||||
router_id, {'port_id': fake_port})
|
||||
self.mox.ReplayAll()
|
||||
|
||||
api.quantum.router_remove_interface(
|
||||
api.neutron.router_remove_interface(
|
||||
self.request, router_id, port_id=fake_port)
|
@ -33,8 +33,8 @@ from cinderclient import client as cinder_client
|
||||
import glanceclient
|
||||
from heatclient import client as heat_client
|
||||
from keystoneclient.v2_0 import client as keystone_client
|
||||
from neutronclient.v2_0 import client as neutron_client
|
||||
from novaclient.v1_1 import client as nova_client
|
||||
from quantumclient.v2_0 import client as quantum_client
|
||||
from swiftclient import client as swift_client
|
||||
|
||||
import httplib2
|
||||
@ -246,7 +246,7 @@ class APITestCase(TestCase):
|
||||
self._original_glanceclient = api.glance.glanceclient
|
||||
self._original_keystoneclient = api.keystone.keystoneclient
|
||||
self._original_novaclient = api.nova.novaclient
|
||||
self._original_quantumclient = api.quantum.quantumclient
|
||||
self._original_neutronclient = api.neutron.neutronclient
|
||||
self._original_cinderclient = api.cinder.cinderclient
|
||||
self._original_heatclient = api.heat.heatclient
|
||||
|
||||
@ -254,7 +254,7 @@ class APITestCase(TestCase):
|
||||
api.glance.glanceclient = lambda request: self.stub_glanceclient()
|
||||
api.keystone.keystoneclient = fake_keystoneclient
|
||||
api.nova.novaclient = lambda request: self.stub_novaclient()
|
||||
api.quantum.quantumclient = lambda request: self.stub_quantumclient()
|
||||
api.neutron.neutronclient = lambda request: self.stub_neutronclient()
|
||||
api.cinder.cinderclient = lambda request: self.stub_cinderclient()
|
||||
api.heat.heatclient = lambda request: self.stub_heatclient()
|
||||
|
||||
@ -263,7 +263,7 @@ class APITestCase(TestCase):
|
||||
api.glance.glanceclient = self._original_glanceclient
|
||||
api.nova.novaclient = self._original_novaclient
|
||||
api.keystone.keystoneclient = self._original_keystoneclient
|
||||
api.quantum.quantumclient = self._original_quantumclient
|
||||
api.neutron.neutronclient = self._original_neutronclient
|
||||
api.cinder.cinderclient = self._original_cinderclient
|
||||
api.heat.heatclient = self._original_heatclient
|
||||
|
||||
@ -296,11 +296,11 @@ class APITestCase(TestCase):
|
||||
self.glanceclient = self.mox.CreateMock(glanceclient.Client)
|
||||
return self.glanceclient
|
||||
|
||||
def stub_quantumclient(self):
|
||||
if not hasattr(self, "quantumclient"):
|
||||
self.mox.StubOutWithMock(quantum_client, 'Client')
|
||||
self.quantumclient = self.mox.CreateMock(quantum_client.Client)
|
||||
return self.quantumclient
|
||||
def stub_neutronclient(self):
|
||||
if not hasattr(self, "neutronclient"):
|
||||
self.mox.StubOutWithMock(neutron_client, 'Client')
|
||||
self.neutronclient = self.mox.CreateMock(neutron_client.Client)
|
||||
return self.neutronclient
|
||||
|
||||
def stub_swiftclient(self, expected_calls=1):
|
||||
if not hasattr(self, "swiftclient"):
|
||||
|
@ -84,7 +84,7 @@ OPENSTACK_KEYSTONE_BACKEND = {
|
||||
'can_edit_role': True
|
||||
}
|
||||
|
||||
OPENSTACK_QUANTUM_NETWORK = {
|
||||
OPENSTACK_NEUTRON_NETWORK = {
|
||||
'enable_lb': True
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
from cinderclient import exceptions as cinder_exceptions
|
||||
import glanceclient.exc as glance_exceptions
|
||||
from keystoneclient import exceptions as keystone_exceptions
|
||||
from neutronclient.common import exceptions as neutron_exceptions
|
||||
from novaclient import exceptions as nova_exceptions
|
||||
from quantumclient.common import exceptions as quantum_exceptions
|
||||
from swiftclient import client as swift_exceptions
|
||||
|
||||
from .utils import TestDataContainer
|
||||
@ -60,8 +60,8 @@ def data(TEST):
|
||||
glance_exception = glance_exceptions.ClientException
|
||||
TEST.exceptions.glance = create_stubbed_exception(glance_exception)
|
||||
|
||||
quantum_exception = quantum_exceptions.QuantumClientException
|
||||
TEST.exceptions.quantum = create_stubbed_exception(quantum_exception)
|
||||
neutron_exception = neutron_exceptions.NeutronClientException
|
||||
TEST.exceptions.neutron = create_stubbed_exception(neutron_exception)
|
||||
|
||||
swift_exception = swift_exceptions.ClientException
|
||||
TEST.exceptions.swift = create_stubbed_exception(swift_exception)
|
||||
|
@ -82,13 +82,13 @@ SERVICE_CATALOG = [
|
||||
"internalURL": "http://int.swift.example.com:8080/",
|
||||
"publicURL": "http://public.swift.example.com:8080/"}]},
|
||||
{"type": "network",
|
||||
"name": "quantum",
|
||||
"name": "neutron",
|
||||
"endpoints_links": [],
|
||||
"endpoints": [
|
||||
{"region": "RegionOne",
|
||||
"adminURL": "http://admin.quantum.example.com:9696/",
|
||||
"internalURL": "http://int.quantum.example.com:9696/",
|
||||
"publicURL": "http://public.quantum.example.com:9696/"}]},
|
||||
"adminURL": "http://admin.neutron.example.com:9696/",
|
||||
"internalURL": "http://int.neutron.example.com:9696/",
|
||||
"publicURL": "http://public.neutron.example.com:9696/"}]},
|
||||
{"type": "ec2",
|
||||
"name": "EC2 Service",
|
||||
"endpoints_links": [],
|
||||
|
@ -19,17 +19,17 @@ from openstack_dashboard.api.lbaas import Pool
|
||||
from openstack_dashboard.api.lbaas import PoolMonitor
|
||||
from openstack_dashboard.api.lbaas import Vip
|
||||
|
||||
from openstack_dashboard.api.quantum import FloatingIp
|
||||
from openstack_dashboard.api.quantum import Network
|
||||
from openstack_dashboard.api.quantum import Port
|
||||
from openstack_dashboard.api.quantum import Router
|
||||
from openstack_dashboard.api.quantum import Subnet
|
||||
from openstack_dashboard.api.neutron import FloatingIp
|
||||
from openstack_dashboard.api.neutron import Network
|
||||
from openstack_dashboard.api.neutron import Port
|
||||
from openstack_dashboard.api.neutron import Router
|
||||
from openstack_dashboard.api.neutron import Subnet
|
||||
|
||||
from .utils import TestDataContainer
|
||||
|
||||
|
||||
def data(TEST):
|
||||
# data returned by openstack_dashboard.api.quantum wrapper
|
||||
# data returned by openstack_dashboard.api.neutron wrapper
|
||||
TEST.networks = TestDataContainer()
|
||||
TEST.subnets = TestDataContainer()
|
||||
TEST.ports = TestDataContainer()
|
||||
@ -40,7 +40,7 @@ def data(TEST):
|
||||
TEST.members = TestDataContainer()
|
||||
TEST.monitors = TestDataContainer()
|
||||
|
||||
# data return by quantumclient
|
||||
# data return by neutronclient
|
||||
TEST.api_networks = TestDataContainer()
|
||||
TEST.api_subnets = TestDataContainer()
|
||||
TEST.api_ports = TestDataContainer()
|
@ -427,7 +427,7 @@ def data(TEST):
|
||||
TEST.floating_ips.add(NetFloatingIp(generate_fip(fip_1)),
|
||||
NetFloatingIp(generate_fip(fip_2)))
|
||||
|
||||
# Floating IP with UUID id (for Floating IP with Quantum Proxy)
|
||||
# Floating IP with UUID id (for Floating IP with Neutron Proxy)
|
||||
fip_3 = {'id': str(uuid.uuid4()),
|
||||
'fixed_ip': '10.0.0.4',
|
||||
'instance_id': server_1.id,
|
||||
|
@ -19,8 +19,8 @@ def load_test_data(load_onto=None):
|
||||
from . import glance_data
|
||||
from . import heat_data
|
||||
from . import keystone_data
|
||||
from . import neutron_data
|
||||
from . import nova_data
|
||||
from . import quantum_data
|
||||
from . import swift_data
|
||||
|
||||
# The order of these loaders matters, some depend on others.
|
||||
@ -29,7 +29,7 @@ def load_test_data(load_onto=None):
|
||||
glance_data.data,
|
||||
nova_data.data,
|
||||
cinder_data.data,
|
||||
quantum_data.data,
|
||||
neutron_data.data,
|
||||
swift_data.data,
|
||||
heat_data.data)
|
||||
if load_onto:
|
||||
|
@ -11,7 +11,7 @@ python-glanceclient>=0.9.0,<2
|
||||
python-heatclient>=0.2.2
|
||||
python-keystoneclient>=0.2,<0.3
|
||||
python-novaclient>=2.12.0,<3
|
||||
python-quantumclient>=2.2.0,<3.0.0
|
||||
python-neutronclient>=2.2.3,<3.0.0
|
||||
python-swiftclient>=1.2,<2
|
||||
pytz
|
||||
# Horizon Utility Requirements
|
||||
|
@ -6,7 +6,7 @@ set -o errexit
|
||||
# Increment me any time the environment should be rebuilt.
|
||||
# This includes dependncy changes, directory renames, etc.
|
||||
# Simple integer secuence: 1, 2, 3...
|
||||
environment_version=36
|
||||
environment_version=37
|
||||
#--------------------------------------------------------#
|
||||
|
||||
function usage {
|
||||
|
Loading…
Reference in New Issue
Block a user