Implement neutron client plugin
This moves the client creation code out of Clients._neutron() into its own client plugin. Neutron is an integrated project, and python-neutronclient is a dependency, so the import is now mandatory. Also any conditional code which skipped if the neutron client was missing has been removed, since the presense or absense of an installed neutronclient has no bearing on whether neutron is installed on a given cloud. Change-Id: Id9fdc50e80efe78731e21934ed9f2704cc3eb408
This commit is contained in:
parent
9e58745627
commit
7d3111f941
|
@ -13,12 +13,10 @@
|
|||
# under the License.
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine import clients
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import neutron
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
|
||||
class ExtraRoute(neutron.NeutronResource):
|
||||
|
@ -97,9 +95,6 @@ class ExtraRoute(neutron.NeutronResource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'OS::Neutron::ExtraRoute': ExtraRoute,
|
||||
}
|
||||
|
|
|
@ -11,20 +11,16 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from testtools import skipIf
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
|
||||
from heat.common import template_format
|
||||
from heat.engine import resource
|
||||
from heat.engine.resources.neutron import neutron_utils
|
||||
from heat.engine import scheduler
|
||||
from heat.openstack.common.importutils import try_import
|
||||
from heat.tests.common import HeatTestCase
|
||||
from heat.tests import utils
|
||||
|
||||
from ..resources import extraroute # noqa
|
||||
|
||||
neutronclient = try_import('neutronclient.v2_0.client')
|
||||
qe = try_import('neutronclient.common.exceptions')
|
||||
|
||||
neutron_template = '''
|
||||
{
|
||||
|
@ -56,9 +52,7 @@ neutron_template = '''
|
|||
'''
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class NeutronExtraRouteTest(HeatTestCase):
|
||||
@skipIf(neutron_utils.neutronV20 is None, "Missing Neutron v2_0")
|
||||
def setUp(self):
|
||||
super(NeutronExtraRouteTest, self).setUp()
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'show_router')
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
from ceilometerclient import client as ceilometerclient
|
||||
from cinderclient import client as cinderclient
|
||||
from heatclient import client as heatclient
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
from oslo.config import cfg
|
||||
from stevedore import extension
|
||||
from troveclient import client as troveclient
|
||||
|
@ -112,27 +111,6 @@ class OpenStackClients(object):
|
|||
'Replace with calls to client("neutron")')
|
||||
return self.client('neutron')
|
||||
|
||||
def _neutron(self):
|
||||
|
||||
con = self.context
|
||||
if self.auth_token is None:
|
||||
LOG.error(_("Neutron connection failed, no auth_token!"))
|
||||
return None
|
||||
|
||||
endpoint_type = self._get_client_option('neutron', 'endpoint_type')
|
||||
args = {
|
||||
'auth_url': con.auth_url,
|
||||
'service_type': 'network',
|
||||
'token': self.auth_token,
|
||||
'endpoint_url': self.url_for(service_type='network',
|
||||
endpoint_type=endpoint_type),
|
||||
'endpoint_type': endpoint_type,
|
||||
'ca_cert': self._get_client_option('neutron', 'ca_file'),
|
||||
'insecure': self._get_client_option('neutron', 'insecure')
|
||||
}
|
||||
|
||||
return neutronclient.Client(**args)
|
||||
|
||||
def cinder(self):
|
||||
warnings.warn('cinder() is deprecated. '
|
||||
'Replace with calls to client("cinder")')
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutronclient.v2_0 import client as nc
|
||||
|
||||
from heat.engine.clients import client_plugin
|
||||
|
||||
|
||||
class NeutronClientPlugin(client_plugin.ClientPlugin):
|
||||
|
||||
def _create(self):
|
||||
|
||||
con = self.context
|
||||
|
||||
endpoint_type = self._get_client_option('neutron', 'endpoint_type')
|
||||
args = {
|
||||
'auth_url': con.auth_url,
|
||||
'service_type': 'network',
|
||||
'token': self.auth_token,
|
||||
'endpoint_url': self.url_for(service_type='network',
|
||||
endpoint_type=endpoint_type),
|
||||
'endpoint_type': endpoint_type,
|
||||
'ca_cert': self._get_client_option('neutron', 'ca_file'),
|
||||
'insecure': self._get_client_option('neutron', 'insecure')
|
||||
}
|
||||
|
||||
return nc.Client(**args)
|
|
@ -15,7 +15,6 @@ from novaclient import exceptions as nova_exceptions
|
|||
|
||||
from heat.common import exception
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
from heat.engine import resource
|
||||
|
@ -24,6 +23,8 @@ from heat.openstack.common import excutils
|
|||
from heat.openstack.common.gettextutils import _
|
||||
from heat.openstack.common import log as logging
|
||||
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
@ -69,11 +70,10 @@ class ElasticIp(resource.Resource):
|
|||
|
||||
def _ipaddress(self):
|
||||
if self.ipaddress is None and self.resource_id is not None:
|
||||
if self.properties[self.DOMAIN] and clients.neutronclient:
|
||||
ne = clients.neutronclient.exceptions.NeutronClientException
|
||||
if self.properties[self.DOMAIN]:
|
||||
try:
|
||||
ips = self.neutron().show_floatingip(self.resource_id)
|
||||
except ne as e:
|
||||
except NeutronClientException as e:
|
||||
if e.status_code == 404:
|
||||
LOG.warn(_("Floating IPs not found: %s") % e)
|
||||
else:
|
||||
|
@ -90,7 +90,7 @@ class ElasticIp(resource.Resource):
|
|||
def handle_create(self):
|
||||
"""Allocate a floating IP for the current tenant."""
|
||||
ips = None
|
||||
if self.properties[self.DOMAIN] and clients.neutronclient:
|
||||
if self.properties[self.DOMAIN]:
|
||||
from heat.engine.resources.internet_gateway import InternetGateway
|
||||
|
||||
ext_net = InternetGateway.get_external_network_id(self.neutron())
|
||||
|
@ -101,10 +101,6 @@ class ElasticIp(resource.Resource):
|
|||
self.resource_id_set(ips['id'])
|
||||
LOG.info(_('ElasticIp create %s') % str(ips))
|
||||
else:
|
||||
if self.properties[self.DOMAIN]:
|
||||
raise exception.Error(_('Domain property can not be set on '
|
||||
'resource %s without Neutron available')
|
||||
% self.name)
|
||||
try:
|
||||
ips = self.nova().floating_ips.create()
|
||||
except nova_exceptions.NotFound:
|
||||
|
@ -135,11 +131,10 @@ class ElasticIp(resource.Resource):
|
|||
|
||||
"""De-allocate a floating IP."""
|
||||
if self.resource_id is not None:
|
||||
if self.properties[self.DOMAIN] and clients.neutronclient:
|
||||
ne = clients.neutronclient.exceptions.NeutronClientException
|
||||
if self.properties[self.DOMAIN]:
|
||||
try:
|
||||
self.neutron().delete_floatingip(self.resource_id)
|
||||
except ne as e:
|
||||
except NeutronClientException as e:
|
||||
if e.status_code != 404:
|
||||
raise e
|
||||
else:
|
||||
|
@ -205,7 +200,6 @@ class ElasticIpAssociation(resource.Resource):
|
|||
{'instance': self.properties[self.INSTANCE_ID],
|
||||
'eip': self.properties[self.EIP]})
|
||||
elif self.properties[self.ALLOCATION_ID]:
|
||||
assert clients.neutronclient, "Neutron required for VPC operations"
|
||||
port_id = None
|
||||
port_rsrc = None
|
||||
if self.properties[self.NETWORK_INTERFACE_ID]:
|
||||
|
@ -252,11 +246,10 @@ class ElasticIpAssociation(resource.Resource):
|
|||
pass
|
||||
elif self.properties[self.ALLOCATION_ID]:
|
||||
float_id = self.properties[self.ALLOCATION_ID]
|
||||
ne = clients.neutronclient.exceptions.NeutronClientException
|
||||
try:
|
||||
self.neutron().update_floatingip(
|
||||
float_id, {'floatingip': {'port_id': None}})
|
||||
except ne as e:
|
||||
except NeutronClientException as e:
|
||||
if e.status_code != 404:
|
||||
raise e
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# under the License.
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine import clients
|
||||
from heat.engine import properties
|
||||
from heat.engine import resource
|
||||
from heat.engine.resources import route_table
|
||||
|
@ -134,9 +133,6 @@ class VPCGatewayAttachment(resource.Resource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'AWS::EC2::InternetGateway': InternetGateway,
|
||||
'AWS::EC2::VPCGatewayAttachment': VPCGatewayAttachment,
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import properties
|
||||
from heat.engine import resource
|
||||
from heat.engine.resources.neutron import neutron
|
||||
|
@ -123,8 +124,6 @@ class NetworkInterface(resource.Resource):
|
|||
self.resource_id_set(port['id'])
|
||||
|
||||
def handle_delete(self):
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
client = self.neutron()
|
||||
try:
|
||||
client.delete_port(self.resource_id)
|
||||
|
@ -134,8 +133,6 @@ class NetworkInterface(resource.Resource):
|
|||
|
||||
def _get_fixed_ip_address(self, ):
|
||||
if self.fixed_ip_address is None:
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
client = self.neutron()
|
||||
try:
|
||||
port = client.show_port(self.resource_id)['port']
|
||||
|
@ -153,9 +150,6 @@ class NetworkInterface(resource.Resource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'AWS::EC2::NetworkInterface': NetworkInterface,
|
||||
}
|
||||
|
|
|
@ -12,13 +12,11 @@
|
|||
# under the License.
|
||||
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import neutron
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
|
||||
class Firewall(neutron.NeutronResource):
|
||||
|
@ -393,9 +391,6 @@ class FirewallRule(neutron.NeutronResource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'OS::Neutron::Firewall': Firewall,
|
||||
'OS::Neutron::FirewallPolicy': FirewallPolicy,
|
||||
|
|
|
@ -12,15 +12,13 @@
|
|||
# under the License.
|
||||
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import neutron
|
||||
from heat.engine.resources.neutron import neutron_utils
|
||||
from heat.engine.resources.neutron import router
|
||||
from heat.engine import support
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
|
||||
class FloatingIP(neutron.NeutronResource):
|
||||
|
@ -219,9 +217,6 @@ class FloatingIPAssociation(neutron.NeutronResource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'OS::Neutron::FloatingIP': FloatingIP,
|
||||
'OS::Neutron::FloatingIPAssociation': FloatingIPAssociation,
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
from heat.common import exception
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
from heat.engine import resource
|
||||
|
@ -23,8 +22,7 @@ from heat.engine.resources import nova_utils
|
|||
from heat.engine import scheduler
|
||||
from heat.engine import support
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
|
||||
class HealthMonitor(neutron.NeutronResource):
|
||||
|
@ -697,9 +695,6 @@ class LoadBalancer(resource.Resource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'OS::Neutron::HealthMonitor': HealthMonitor,
|
||||
'OS::Neutron::Pool': Pool,
|
||||
|
|
|
@ -12,13 +12,11 @@
|
|||
# under the License.
|
||||
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import neutron
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
|
||||
class MeteringLabel(neutron.NeutronResource):
|
||||
|
@ -168,9 +166,6 @@ class MeteringRule(neutron.NeutronResource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'OS::Neutron::MeteringLabel': MeteringLabel,
|
||||
'OS::Neutron::MeteringRule': MeteringRule,
|
||||
|
|
|
@ -12,14 +12,12 @@
|
|||
# under the License.
|
||||
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import neutron
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
import neutronclient.common.exceptions as neutron_exp
|
||||
from neutronclient.neutron import v2_0 as neutronV20
|
||||
import neutronclient.common.exceptions as neutron_exp
|
||||
from neutronclient.neutron import v2_0 as neutronV20
|
||||
|
||||
|
||||
class Net(neutron.NeutronResource):
|
||||
|
@ -195,9 +193,6 @@ class NetworkConstraint(constraints.BaseCustomConstraint):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'OS::Neutron::Net': Net,
|
||||
}
|
||||
|
|
|
@ -16,15 +16,13 @@
|
|||
|
||||
from heat.common import exception
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import neutron
|
||||
from heat.engine.resources.neutron import neutron_utils
|
||||
from heat.engine import support
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
|
||||
class NetworkGateway(neutron.NeutronResource):
|
||||
|
@ -250,9 +248,6 @@ class NetworkGateway(neutron.NeutronResource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'OS::Neutron::NetworkGateway': NetworkGateway,
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# under the License.
|
||||
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import neutron
|
||||
from heat.engine.resources.neutron import neutron_utils
|
||||
|
@ -20,8 +19,7 @@ from heat.engine.resources.neutron import subnet
|
|||
from heat.engine import support
|
||||
from heat.openstack.common import log as logging
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
import neutronclient.common.exceptions as neutron_exp
|
||||
import neutronclient.common.exceptions as neutron_exp
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -296,9 +294,6 @@ class Port(neutron.NeutronResource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'OS::Neutron::Port': Port,
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
from heat.common import exception
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import net
|
||||
|
@ -130,9 +129,6 @@ class ProviderNet(net.Net):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'OS::Neutron::ProviderNet': ProviderNet,
|
||||
}
|
||||
|
|
|
@ -13,15 +13,13 @@
|
|||
|
||||
from heat.common import exception
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import neutron
|
||||
from heat.engine.resources.neutron import neutron_utils
|
||||
from heat.engine.resources.neutron import subnet
|
||||
from heat.engine import support
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
|
||||
class Router(neutron.NeutronResource):
|
||||
|
@ -367,9 +365,6 @@ class RouterGateway(neutron.NeutronResource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'OS::Neutron::Router': Router,
|
||||
'OS::Neutron::RouterInterface': RouterInterface,
|
||||
|
|
|
@ -12,13 +12,11 @@
|
|||
# under the License.
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine import clients
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import neutron
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
import neutronclient.common.exceptions as neutron_exp
|
||||
import neutronclient.common.exceptions as neutron_exp
|
||||
|
||||
|
||||
class SecurityGroup(neutron.NeutronResource):
|
||||
|
|
|
@ -12,15 +12,13 @@
|
|||
# under the License.
|
||||
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import neutron
|
||||
from heat.engine.resources.neutron import neutron_utils
|
||||
from heat.engine import support
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
|
||||
class Subnet(neutron.NeutronResource):
|
||||
|
@ -234,9 +232,6 @@ class Subnet(neutron.NeutronResource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'OS::Neutron::Subnet': Subnet,
|
||||
}
|
||||
|
|
|
@ -12,15 +12,13 @@
|
|||
# under the License.
|
||||
|
||||
from heat.engine import attributes
|
||||
from heat.engine import clients
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import neutron
|
||||
from heat.engine.resources.neutron import neutron_utils
|
||||
from heat.engine import support
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
|
||||
class VPNService(neutron.NeutronResource):
|
||||
|
@ -689,9 +687,6 @@ class IPsecPolicy(neutron.NeutronResource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'OS::Neutron::VPNService': VPNService,
|
||||
'OS::Neutron::IPsecSiteConnection': IPsecSiteConnection,
|
||||
|
|
|
@ -11,14 +11,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from heat.engine import clients
|
||||
from heat.engine import properties
|
||||
from heat.engine import resource
|
||||
from heat.engine.resources.neutron import neutron
|
||||
from heat.engine.resources.vpc import VPC
|
||||
|
||||
if clients.neutronclient is not None:
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
from neutronclient.common.exceptions import NeutronClientException
|
||||
|
||||
|
||||
class RouteTable(resource.Resource):
|
||||
|
@ -176,9 +174,6 @@ class SubnetRouteTableAssociation(resource.Resource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'AWS::EC2::RouteTable': RouteTable,
|
||||
'AWS::EC2::SubnetRouteTableAssociation': SubnetRouteTableAssociation,
|
||||
|
|
|
@ -15,7 +15,6 @@ from novaclient import exceptions as nova_exceptions
|
|||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine import clients
|
||||
from heat.engine import properties
|
||||
from heat.engine import resource
|
||||
|
||||
|
@ -93,7 +92,7 @@ class SecurityGroup(resource.Resource):
|
|||
}
|
||||
|
||||
def handle_create(self):
|
||||
if self.properties[self.VPC_ID] and clients.neutronclient is not None:
|
||||
if self.properties[self.VPC_ID]:
|
||||
self._handle_create_neutron()
|
||||
else:
|
||||
self._handle_create_nova()
|
||||
|
@ -216,7 +215,7 @@ class SecurityGroup(resource.Resource):
|
|||
raise
|
||||
|
||||
def handle_delete(self):
|
||||
if self.properties[self.VPC_ID] and clients.neutronclient is not None:
|
||||
if self.properties[self.VPC_ID]:
|
||||
self._handle_delete_neutron()
|
||||
else:
|
||||
self._handle_delete_nova()
|
||||
|
@ -274,9 +273,8 @@ class SecurityGroup(resource.Resource):
|
|||
if res:
|
||||
return res
|
||||
|
||||
if self.properties[self.SECURITY_GROUP_EGRESS] and not(
|
||||
self.properties[self.VPC_ID] and
|
||||
clients.neutronclient is not None):
|
||||
if self.properties[self.SECURITY_GROUP_EGRESS] and not \
|
||||
self.properties[self.VPC_ID]:
|
||||
raise exception.EgressRuleNotAllowed()
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# under the License.
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine import clients
|
||||
from heat.engine import properties
|
||||
from heat.engine import resource
|
||||
from heat.engine.resources.vpc import VPC
|
||||
|
@ -118,9 +117,6 @@ class Subnet(resource.Resource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'AWS::EC2::Subnet': Subnet,
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# under the License.
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine import clients
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
from heat.engine import resource
|
||||
|
@ -125,9 +124,6 @@ class VPC(resource.Resource):
|
|||
|
||||
|
||||
def resource_mapping():
|
||||
if clients.neutronclient is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'AWS::EC2::VPC': VPC,
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import datetime
|
|||
import mock
|
||||
import mox
|
||||
from oslo.config import cfg
|
||||
from testtools import skipIf
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import short_id
|
||||
|
@ -32,13 +31,10 @@ from heat.engine.resources import loadbalancer
|
|||
from heat.engine.resources.neutron import loadbalancer as neutron_lb
|
||||
from heat.engine import rsrc_defn
|
||||
from heat.engine import scheduler
|
||||
from heat.openstack.common.importutils import try_import
|
||||
from heat.openstack.common import timeutils
|
||||
from heat.tests.common import HeatTestCase
|
||||
from heat.tests import utils
|
||||
|
||||
neutronclient = try_import('neutronclient.v2_0.client')
|
||||
|
||||
|
||||
as_template = '''
|
||||
{
|
||||
|
@ -811,7 +807,6 @@ class AutoScalingTest(HeatTestCase):
|
|||
rsrc.delete()
|
||||
self.m.VerifyAll()
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
def test_lb_reload_members(self):
|
||||
t = template_format.parse(as_template)
|
||||
t['Resources']['ElasticLoadBalancer'] = {
|
||||
|
@ -847,7 +842,6 @@ class AutoScalingTest(HeatTestCase):
|
|||
|
||||
self.m.VerifyAll()
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
def test_lb_reload_invalid_resource(self):
|
||||
t = template_format.parse(as_template)
|
||||
t['Resources']['ElasticLoadBalancer'] = {
|
||||
|
|
|
@ -12,12 +12,11 @@
|
|||
# under the License.
|
||||
|
||||
import mox
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
from novaclient import exceptions as nova_exceptions
|
||||
from testtools import skipIf
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
from heat.engine import clients
|
||||
from heat.engine.clients.os import nova
|
||||
from heat.engine import parser
|
||||
from heat.engine.resources import eip
|
||||
|
@ -136,28 +135,14 @@ eip_template_ipassoc3 = '''
|
|||
'''
|
||||
|
||||
|
||||
def force_networking(mode):
|
||||
if mode == 'nova':
|
||||
force_networking.client = clients.neutronclient
|
||||
clients.neutronclient = None
|
||||
if mode == 'neutron':
|
||||
clients.neutronclient = force_networking.client
|
||||
force_networking.client = None
|
||||
|
||||
|
||||
class EIPTest(HeatTestCase):
|
||||
def setUp(self):
|
||||
# force Nova, will test Neutron below
|
||||
force_networking('nova')
|
||||
super(EIPTest, self).setUp()
|
||||
self.fc = fakes.FakeClient()
|
||||
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
|
||||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
|
||||
def tearDown(self):
|
||||
super(EIPTest, self).tearDown()
|
||||
force_networking('neutron')
|
||||
|
||||
def create_eip(self, t, stack, resource_name):
|
||||
resource_defns = stack.t.resource_definitions(stack)
|
||||
rsrc = eip.ElasticIp(resource_name,
|
||||
|
@ -276,7 +261,6 @@ class EIPTest(HeatTestCase):
|
|||
|
||||
class AllocTest(HeatTestCase):
|
||||
|
||||
@skipIf(clients.neutronclient is None, 'neutronclient unavailable')
|
||||
def setUp(self):
|
||||
super(AllocTest, self).setUp()
|
||||
|
||||
|
@ -284,28 +268,28 @@ class AllocTest(HeatTestCase):
|
|||
self.m.StubOutWithMock(self.fc.servers, 'get')
|
||||
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
|
||||
self.m.StubOutWithMock(parser.Stack, 'resource_by_refid')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client,
|
||||
self.m.StubOutWithMock(neutronclient.Client,
|
||||
'create_floatingip')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client,
|
||||
self.m.StubOutWithMock(neutronclient.Client,
|
||||
'show_floatingip')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client,
|
||||
self.m.StubOutWithMock(neutronclient.Client,
|
||||
'update_floatingip')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client,
|
||||
self.m.StubOutWithMock(neutronclient.Client,
|
||||
'delete_floatingip')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client,
|
||||
self.m.StubOutWithMock(neutronclient.Client,
|
||||
'add_gateway_router')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client, 'list_networks')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client, 'list_ports')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client, 'list_subnets')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client, 'show_network')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client, 'list_routers')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client,
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'list_networks')
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'list_ports')
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'list_subnets')
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'show_network')
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'list_routers')
|
||||
self.m.StubOutWithMock(neutronclient.Client,
|
||||
'remove_gateway_router')
|
||||
self.stub_keystoneclient()
|
||||
|
||||
def mock_show_network(self):
|
||||
vpc_name = utils.PhysName('test_stack', 'the_vpc')
|
||||
clients.neutronclient.Client.show_network(
|
||||
neutronclient.Client.show_network(
|
||||
'aaaa-netid'
|
||||
).AndReturn({"network": {
|
||||
"status": "BUILD",
|
||||
|
@ -338,16 +322,16 @@ class AllocTest(HeatTestCase):
|
|||
return rsrc
|
||||
|
||||
def mock_update_floatingip(self, port='the_nic'):
|
||||
clients.neutronclient.Client.update_floatingip(
|
||||
neutronclient.Client.update_floatingip(
|
||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
|
||||
{'floatingip': {'port_id': port}}).AndReturn(None)
|
||||
|
||||
def mock_create_gateway_attachment(self):
|
||||
clients.neutronclient.Client.add_gateway_router(
|
||||
neutronclient.Client.add_gateway_router(
|
||||
'bbbb', {'network_id': 'eeee'}).AndReturn(None)
|
||||
|
||||
def mock_create_floatingip(self):
|
||||
clients.neutronclient.Client.list_networks(
|
||||
neutronclient.Client.list_networks(
|
||||
**{'router:external': True}).AndReturn({'networks': [{
|
||||
'status': 'ACTIVE',
|
||||
'subnets': [],
|
||||
|
@ -359,7 +343,7 @@ class AllocTest(HeatTestCase):
|
|||
'id': 'eeee'
|
||||
}]})
|
||||
|
||||
clients.neutronclient.Client.create_floatingip({
|
||||
neutronclient.Client.create_floatingip({
|
||||
'floatingip': {'floating_network_id': u'eeee'}
|
||||
}).AndReturn({'floatingip': {
|
||||
"status": "ACTIVE",
|
||||
|
@ -368,7 +352,7 @@ class AllocTest(HeatTestCase):
|
|||
}})
|
||||
|
||||
def mock_show_floatingip(self, refid):
|
||||
clients.neutronclient.Client.show_floatingip(
|
||||
neutronclient.Client.show_floatingip(
|
||||
refid,
|
||||
).AndReturn({'floatingip': {
|
||||
'router_id': None,
|
||||
|
@ -382,10 +366,10 @@ class AllocTest(HeatTestCase):
|
|||
|
||||
def mock_delete_floatingip(self):
|
||||
id = 'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||
clients.neutronclient.Client.delete_floatingip(id).AndReturn(None)
|
||||
neutronclient.Client.delete_floatingip(id).AndReturn(None)
|
||||
|
||||
def mock_list_ports(self):
|
||||
clients.neutronclient.Client.list_ports(id='the_nic').AndReturn(
|
||||
neutronclient.Client.list_ports(id='the_nic').AndReturn(
|
||||
{"ports": [{
|
||||
"status": "DOWN",
|
||||
"binding:host_id": "null",
|
||||
|
@ -405,7 +389,7 @@ class AllocTest(HeatTestCase):
|
|||
}]})
|
||||
|
||||
def mock_list_instance_ports(self, refid):
|
||||
clients.neutronclient.Client.list_ports(device_id=refid).AndReturn(
|
||||
neutronclient.Client.list_ports(device_id=refid).AndReturn(
|
||||
{"ports": [{
|
||||
"status": "DOWN",
|
||||
"binding:host_id": "null",
|
||||
|
@ -425,7 +409,7 @@ class AllocTest(HeatTestCase):
|
|||
}]})
|
||||
|
||||
def mock_list_subnets(self):
|
||||
clients.neutronclient.Client.list_subnets(
|
||||
neutronclient.Client.list_subnets(
|
||||
id='mysubnetid-70ec').AndReturn(
|
||||
{'subnets': [{
|
||||
u'name': u'wp-Subnet-pyjm7bvoi4xw',
|
||||
|
@ -444,7 +428,7 @@ class AllocTest(HeatTestCase):
|
|||
|
||||
def mock_router_for_vpc(self):
|
||||
vpc_name = utils.PhysName('test_stack', 'the_vpc')
|
||||
clients.neutronclient.Client.list_routers(name=vpc_name).AndReturn({
|
||||
neutronclient.Client.list_routers(name=vpc_name).AndReturn({
|
||||
"routers": [{
|
||||
"status": "ACTIVE",
|
||||
"external_gateway_info": {
|
||||
|
@ -460,7 +444,7 @@ class AllocTest(HeatTestCase):
|
|||
|
||||
def mock_no_router_for_vpc(self):
|
||||
vpc_name = utils.PhysName('test_stack', 'the_vpc')
|
||||
clients.neutronclient.Client.list_routers(name=vpc_name).AndReturn({
|
||||
neutronclient.Client.list_routers(name=vpc_name).AndReturn({
|
||||
"routers": []
|
||||
})
|
||||
|
||||
|
|
|
@ -14,12 +14,13 @@
|
|||
import copy
|
||||
|
||||
import mox
|
||||
from testtools import skipIf
|
||||
from neutronclient.common import exceptions as qe
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
from heat.engine.cfn import functions as cfn_funcs
|
||||
from heat.engine import clients
|
||||
from heat.engine.clients.os import neutron
|
||||
from heat.engine import properties
|
||||
from heat.engine.resources.neutron import net
|
||||
from heat.engine.resources.neutron.neutron import NeutronResource as qr
|
||||
|
@ -29,12 +30,9 @@ from heat.engine.resources.neutron import router
|
|||
from heat.engine.resources.neutron import subnet
|
||||
from heat.engine import rsrc_defn
|
||||
from heat.engine import scheduler
|
||||
from heat.openstack.common.importutils import try_import
|
||||
from heat.tests.common import HeatTestCase
|
||||
from heat.tests import utils
|
||||
|
||||
neutronclient = try_import('neutronclient.v2_0.client')
|
||||
qe = try_import('neutronclient.common.exceptions')
|
||||
|
||||
neutron_template = '''
|
||||
{
|
||||
|
@ -517,7 +515,6 @@ class NeutronTest(HeatTestCase):
|
|||
})
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class NeutronNetTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -717,7 +714,6 @@ class NeutronNetTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class NeutronProviderNetTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -836,7 +832,6 @@ class NeutronProviderNetTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class NeutronSubnetTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1138,10 +1133,8 @@ class NeutronSubnetTest(HeatTestCase):
|
|||
}, p)
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class NeutronRouterTest(HeatTestCase):
|
||||
|
||||
@skipIf(neutron_utils.neutronV20 is None, "Missing Neutron v2_0")
|
||||
def setUp(self):
|
||||
super(NeutronRouterTest, self).setUp()
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'create_router')
|
||||
|
@ -1758,10 +1751,8 @@ class NeutronRouterTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class NeutronFloatingIPTest(HeatTestCase):
|
||||
|
||||
@skipIf(net.clients.neutronclient is None, "Missing Neutron Client")
|
||||
def setUp(self):
|
||||
super(NeutronFloatingIPTest, self).setUp()
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'create_floatingip')
|
||||
|
@ -2139,10 +2130,8 @@ class NeutronFloatingIPTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class NeutronPortTest(HeatTestCase):
|
||||
|
||||
@skipIf(net.clients.neutronclient is None, "Missing Neutron Client")
|
||||
def setUp(self):
|
||||
super(NeutronPortTest, self).setUp()
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'create_port')
|
||||
|
@ -2380,12 +2369,11 @@ class NeutronPortTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class NetworkConstraintTest(HeatTestCase):
|
||||
|
||||
def test_validate(self):
|
||||
self.m.StubOutWithMock(clients.OpenStackClients, '_neutron')
|
||||
clients.OpenStackClients._neutron().MultipleTimes().AndReturn(None)
|
||||
self.m.StubOutWithMock(neutron.NeutronClientPlugin, '_create')
|
||||
neutron.NeutronClientPlugin._create().MultipleTimes().AndReturn(None)
|
||||
self.m.StubOutWithMock(net.neutronV20, 'find_resourceid_by_name_or_id')
|
||||
net.neutronV20.find_resourceid_by_name_or_id(
|
||||
None, 'network', 'foo'
|
||||
|
|
|
@ -12,29 +12,25 @@
|
|||
# under the License.
|
||||
|
||||
import copy
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
import uuid
|
||||
|
||||
import mox
|
||||
from oslo.config import cfg
|
||||
from testtools import skipIf
|
||||
|
||||
from heat.common import template_format
|
||||
from heat.db import api as db_api
|
||||
from heat.engine import clients
|
||||
from heat.engine import environment
|
||||
from heat.engine import parser
|
||||
from heat.engine.resources import image
|
||||
from heat.engine.resources import instance
|
||||
from heat.engine.resources import nova_utils
|
||||
from heat.engine import template
|
||||
from heat.openstack.common.importutils import try_import
|
||||
from heat.tests.common import HeatTestCase
|
||||
from heat.tests import utils
|
||||
from heat.tests.v1_1 import fakes as v1fakes
|
||||
|
||||
|
||||
neutroncli = try_import('neutronclient')
|
||||
|
||||
as_template = '''
|
||||
{
|
||||
"AWSTemplateFormatVersion" : "2010-09-09",
|
||||
|
@ -117,16 +113,16 @@ class AutoScalingTest(HeatTestCase):
|
|||
|
||||
self.stub_keystoneclient()
|
||||
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client,
|
||||
self.m.StubOutWithMock(neutronclient.Client,
|
||||
'create_health_monitor')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client,
|
||||
self.m.StubOutWithMock(neutronclient.Client,
|
||||
'associate_health_monitor')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client, 'create_pool')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client, 'create_vip')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client, 'show_pool')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client, 'show_vip')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client, 'create_member')
|
||||
self.m.StubOutWithMock(clients.neutronclient.Client, 'list_members')
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'create_pool')
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'create_vip')
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'show_pool')
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'show_vip')
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'create_member')
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'list_members')
|
||||
|
||||
self.m.StubOutWithMock(nova_utils, 'server_to_ipaddress')
|
||||
self.m.StubOutWithMock(parser.Stack, 'validate')
|
||||
|
@ -135,7 +131,6 @@ class AutoScalingTest(HeatTestCase):
|
|||
self.m.StubOutWithMock(instance.Instance, 'check_create_complete')
|
||||
self.m.StubOutWithMock(image.ImageConstraint, "validate")
|
||||
|
||||
@skipIf(neutroncli is None, 'neutronclient unavailable')
|
||||
def test_lb(self):
|
||||
|
||||
tmpl = template_format.parse(as_template)
|
||||
|
@ -254,25 +249,25 @@ class AutoScalingTest(HeatTestCase):
|
|||
|
||||
instances = {}
|
||||
|
||||
clients.neutronclient.Client.create_health_monitor(mon_block).\
|
||||
neutronclient.Client.create_health_monitor(mon_block).\
|
||||
AndReturn(mon_ret_block)
|
||||
|
||||
clients.neutronclient.Client.create_pool(pool_block).\
|
||||
neutronclient.Client.create_pool(pool_block).\
|
||||
AndReturn(pool_ret_block)
|
||||
|
||||
clients.neutronclient.Client.associate_health_monitor(
|
||||
neutronclient.Client.associate_health_monitor(
|
||||
pool_ret_block['pool']['id'],
|
||||
{'health_monitor': {
|
||||
'id': mon_ret_block['health_monitor']['id']
|
||||
}}).AndReturn(None)
|
||||
|
||||
clients.neutronclient.Client.create_vip(vip_block).\
|
||||
neutronclient.Client.create_vip(vip_block).\
|
||||
AndReturn(vip_ret_block)
|
||||
|
||||
clients.neutronclient.Client.show_pool(pool_ret_block['pool']['id']).\
|
||||
neutronclient.Client.show_pool(pool_ret_block['pool']['id']).\
|
||||
AndReturn(pool_ret_block)
|
||||
|
||||
clients.neutronclient.Client.show_vip(vip_ret_block['vip']['id']).\
|
||||
neutronclient.Client.show_vip(vip_ret_block['vip']['id']).\
|
||||
AndReturn(vip_ret_block)
|
||||
|
||||
parser.Stack.validate()
|
||||
|
@ -290,7 +285,7 @@ class AutoScalingTest(HeatTestCase):
|
|||
mox.IgnoreArg(),
|
||||
mox.IgnoreArg()).AndReturn('1.2.3.4')
|
||||
|
||||
clients.neutronclient.Client.create_member(membera_block).\
|
||||
neutronclient.Client.create_member(membera_block).\
|
||||
AndReturn(membera_ret_block)
|
||||
|
||||
instances[instid] = membera_ret_block['member']['id']
|
||||
|
@ -316,14 +311,14 @@ class AutoScalingTest(HeatTestCase):
|
|||
mox.IgnoreArg(),
|
||||
mox.IgnoreArg()).AndReturn('1.2.3.5')
|
||||
|
||||
clients.neutronclient.Client.create_member(memberb_block).\
|
||||
neutronclient.Client.create_member(memberb_block).\
|
||||
AndReturn(memberb_ret_block)
|
||||
|
||||
nova_utils.server_to_ipaddress(
|
||||
mox.IgnoreArg(),
|
||||
mox.IgnoreArg()).AndReturn('1.2.3.6')
|
||||
|
||||
clients.neutronclient.Client.create_member(memberc_block).\
|
||||
neutronclient.Client.create_member(memberc_block).\
|
||||
AndReturn(memberc_ret_block)
|
||||
|
||||
self.m.ReplayAll()
|
||||
|
|
|
@ -13,17 +13,15 @@
|
|||
|
||||
import copy
|
||||
|
||||
from testtools import skipIf
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
from heat.engine.resources.neutron import firewall
|
||||
from heat.engine import scheduler
|
||||
from heat.openstack.common.importutils import try_import
|
||||
from heat.tests.common import HeatTestCase
|
||||
from heat.tests import utils
|
||||
|
||||
neutronclient = try_import('neutronclient.v2_0.client')
|
||||
|
||||
firewall_template = '''
|
||||
{
|
||||
|
@ -84,7 +82,6 @@ firewall_rule_template = '''
|
|||
'''
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class FirewallTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -212,7 +209,6 @@ class FirewallTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class FirewallPolicyTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -339,7 +335,6 @@ class FirewallPolicyTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class FirewallRuleTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
import copy
|
||||
import mox
|
||||
|
||||
from testtools import skipIf
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
|
@ -22,12 +22,10 @@ from heat.engine.clients.os import nova
|
|||
from heat.engine.resources.neutron import loadbalancer
|
||||
from heat.engine.resources.neutron import neutron_utils
|
||||
from heat.engine import scheduler
|
||||
from heat.openstack.common.importutils import try_import
|
||||
from heat.tests.common import HeatTestCase
|
||||
from heat.tests import utils
|
||||
from heat.tests.v1_1 import fakes as nova_fakes
|
||||
|
||||
neutronclient = try_import('neutronclient.v2_0.client')
|
||||
|
||||
health_monitor_template = '''
|
||||
{
|
||||
|
@ -219,7 +217,6 @@ pool_with_health_monitors_template = '''
|
|||
'''
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class HealthMonitorTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -345,7 +342,6 @@ class HealthMonitorTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class PoolTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -843,7 +839,6 @@ class PoolTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class PoolMemberTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -946,7 +941,6 @@ class PoolMemberTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class LoadBalancerTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1033,7 +1027,6 @@ class LoadBalancerTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class PoolUpdateHealthMonitorsTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -11,17 +11,15 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from testtools import skipIf
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
from heat.engine.resources.neutron import metering
|
||||
from heat.engine import scheduler
|
||||
from heat.openstack.common.importutils import try_import
|
||||
from heat.tests.common import HeatTestCase
|
||||
from heat.tests import utils
|
||||
|
||||
neutronclient = try_import('neutronclient.v2_0.client')
|
||||
|
||||
metering_template = '''
|
||||
{
|
||||
|
@ -50,7 +48,6 @@ metering_template = '''
|
|||
'''
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class MeteringLabelTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -160,7 +157,6 @@ class MeteringLabelTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class MeteringRuleTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
|
||||
import mox
|
||||
from mox import IgnoreArg
|
||||
from testtools import skipIf
|
||||
from neutronclient.common import exceptions as qe
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
|
@ -24,14 +25,9 @@ from heat.engine.resources.neutron import network_gateway
|
|||
from heat.engine.resources.neutron import neutron_utils
|
||||
from heat.engine import rsrc_defn
|
||||
from heat.engine import scheduler
|
||||
from heat.openstack.common.importutils import try_import
|
||||
from heat.tests.common import HeatTestCase
|
||||
from heat.tests import utils
|
||||
|
||||
neutronclient = try_import('neutronclient.v2_0.client')
|
||||
neutronV20 = try_import('neutronclient.neutron.v2_0')
|
||||
|
||||
qe = try_import('neutronclient.common.exceptions')
|
||||
|
||||
gw_template_deprecated = '''
|
||||
{
|
||||
|
@ -96,9 +92,7 @@ sng = {
|
|||
}
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class NeutronNetworkGatewayTest(HeatTestCase):
|
||||
@skipIf(neutronV20 is None, 'Missing Neutron v2_0')
|
||||
def setUp(self):
|
||||
super(NeutronNetworkGatewayTest, self).setUp()
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'create_network_gateway')
|
||||
|
|
|
@ -13,21 +13,17 @@
|
|||
|
||||
import copy
|
||||
import mox
|
||||
|
||||
from testtools import skipIf
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
from heat.engine.resources.neutron import neutron_utils
|
||||
from heat.engine.resources.neutron import vpnservice
|
||||
from heat.engine import scheduler
|
||||
from heat.openstack.common.importutils import try_import
|
||||
from heat.tests.common import HeatTestCase
|
||||
from heat.tests import utils
|
||||
|
||||
|
||||
neutronclient = try_import('neutronclient.v2_0.client')
|
||||
|
||||
vpnservice_template_deprecated = '''
|
||||
{
|
||||
"AWSTemplateFormatVersion" : "2010-09-09",
|
||||
|
@ -153,7 +149,6 @@ ipsecpolicy_template = '''
|
|||
'''
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class VPNServiceTest(HeatTestCase):
|
||||
|
||||
VPN_SERVICE_CONF = {
|
||||
|
@ -304,7 +299,6 @@ class VPNServiceTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class IPsecSiteConnectionTest(HeatTestCase):
|
||||
|
||||
IPSEC_SITE_CONNECTION_CONF = {
|
||||
|
@ -462,7 +456,6 @@ class IPsecSiteConnectionTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class IKEPolicyTest(HeatTestCase):
|
||||
|
||||
IKE_POLICY_CONF = {
|
||||
|
@ -604,7 +597,6 @@ class IKEPolicyTest(HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||
class IPsecPolicyTest(HeatTestCase):
|
||||
|
||||
IPSEC_POLICY_CONF = {
|
||||
|
|
|
@ -15,13 +15,11 @@ import os
|
|||
|
||||
import mock
|
||||
import six
|
||||
import testtools
|
||||
import yaml
|
||||
|
||||
from heat.common import config
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
from heat.engine import clients
|
||||
from heat.tests.common import HeatTestCase
|
||||
from heat.tests import utils
|
||||
|
||||
|
@ -190,8 +188,6 @@ class JsonYamlResolvedCompareTest(HeatTestCase):
|
|||
for key in stack1:
|
||||
self.assertEqual(stack1[key].t, stack2[key].t)
|
||||
|
||||
@testtools.skipIf(clients.neutronclient is None,
|
||||
'neutronclient unavailable')
|
||||
def test_neutron_resolved(self):
|
||||
self.compare_stacks('Neutron.template', 'Neutron.yaml', {})
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from testtools import skipIf
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
from heat.engine import parser
|
||||
|
@ -29,7 +27,6 @@ except ImportError:
|
|||
|
||||
class VPCTestBase(HeatTestCase):
|
||||
|
||||
@skipIf(neutronclient is None, 'neutronclient unavaialble')
|
||||
def setUp(self):
|
||||
super(VPCTestBase, self).setUp()
|
||||
self.m.StubOutWithMock(neutronclient.Client, 'add_interface_router')
|
||||
|
|
|
@ -40,6 +40,7 @@ oslo.config.opts =
|
|||
heat.clients =
|
||||
glance = heat.engine.clients.os.glance:GlanceClientPlugin
|
||||
nova = heat.engine.clients.os.nova:NovaClientPlugin
|
||||
neutron = heat.engine.clients.os.neutron:NeutronClientPlugin
|
||||
swift = heat.engine.clients.os.swift:SwiftClientPlugin
|
||||
|
||||
heat.constraints =
|
||||
|
|
Loading…
Reference in New Issue