Rename Quantum to Neutron
quantumclient is gone upstream and has been replaced by neutronclient. This patch retains the OS::Quantum::XX namespace Fixes: bug #1197208 Change-Id: Id48f9598ea1884132d411ad533770ae49494102b
This commit is contained in:
parent
9b53378e27
commit
ed0fb7e823
@ -36,4 +36,4 @@ We have integration with
|
|||||||
* https://github.com/openstack/python-novaclient (instance)
|
* https://github.com/openstack/python-novaclient (instance)
|
||||||
* https://github.com/openstack/python-keystoneclient (auth)
|
* https://github.com/openstack/python-keystoneclient (auth)
|
||||||
* https://github.com/openstack/python-swiftclient (s3)
|
* https://github.com/openstack/python-swiftclient (s3)
|
||||||
* https://github.com/openstack/python-quantumclient (networking)
|
* https://github.com/openstack/python-neutronclient (networking)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||||
version="5.0"
|
version="5.0"
|
||||||
xml:id="quantum-cli-reference">
|
xml:id="neutron-cli-reference">
|
||||||
<?dbhtml stop-chunking?>
|
<?dbhtml stop-chunking?>
|
||||||
<title>OpenStack Heat CLI Guide</title>
|
<title>OpenStack Heat CLI Guide</title>
|
||||||
<para>This section describes heat commands</para>
|
<para>This section describes heat commands</para>
|
||||||
|
@ -29,10 +29,10 @@ except ImportError:
|
|||||||
swiftclient = None
|
swiftclient = None
|
||||||
logger.info('swiftclient not available')
|
logger.info('swiftclient not available')
|
||||||
try:
|
try:
|
||||||
from quantumclient.v2_0 import client as quantumclient
|
from neutronclient.v2_0 import client as neutronclient
|
||||||
except ImportError:
|
except ImportError:
|
||||||
quantumclient = None
|
neutronclient = None
|
||||||
logger.info('quantumclient not available')
|
logger.info('neutronclient not available')
|
||||||
try:
|
try:
|
||||||
from cinderclient import client as cinderclient
|
from cinderclient import client as cinderclient
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -64,7 +64,7 @@ class OpenStackClients(object):
|
|||||||
self._nova = {}
|
self._nova = {}
|
||||||
self._keystone = None
|
self._keystone = None
|
||||||
self._swift = None
|
self._swift = None
|
||||||
self._quantum = None
|
self._neutron = None
|
||||||
self._cinder = None
|
self._cinder = None
|
||||||
self._ceilometer = None
|
self._ceilometer = None
|
||||||
|
|
||||||
@ -133,15 +133,15 @@ class OpenStackClients(object):
|
|||||||
self._swift = swiftclient.Connection(**args)
|
self._swift = swiftclient.Connection(**args)
|
||||||
return self._swift
|
return self._swift
|
||||||
|
|
||||||
def quantum(self):
|
def neutron(self):
|
||||||
if quantumclient is None:
|
if neutronclient is None:
|
||||||
return None
|
return None
|
||||||
if self._quantum:
|
if self._neutron:
|
||||||
return self._quantum
|
return self._neutron
|
||||||
|
|
||||||
con = self.context
|
con = self.context
|
||||||
if self.auth_token is None:
|
if self.auth_token is None:
|
||||||
logger.error("Quantum connection failed, no auth_token!")
|
logger.error("Neutron connection failed, no auth_token!")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
@ -151,9 +151,9 @@ class OpenStackClients(object):
|
|||||||
'endpoint_url': self.url_for(service_type='network')
|
'endpoint_url': self.url_for(service_type='network')
|
||||||
}
|
}
|
||||||
|
|
||||||
self._quantum = quantumclient.Client(**args)
|
self._neutron = neutronclient.Client(**args)
|
||||||
|
|
||||||
return self._quantum
|
return self._neutron
|
||||||
|
|
||||||
def cinder(self):
|
def cinder(self):
|
||||||
if cinderclient is None:
|
if cinderclient is None:
|
||||||
|
@ -325,8 +325,8 @@ class Resource(object):
|
|||||||
def swift(self):
|
def swift(self):
|
||||||
return self.stack.clients.swift()
|
return self.stack.clients.swift()
|
||||||
|
|
||||||
def quantum(self):
|
def neutron(self):
|
||||||
return self.stack.clients.quantum()
|
return self.stack.clients.neutron()
|
||||||
|
|
||||||
def cinder(self):
|
def cinder(self):
|
||||||
return self.stack.clients.cinder()
|
return self.stack.clients.cinder()
|
||||||
|
@ -280,9 +280,9 @@ class Instance(resource.Resource):
|
|||||||
else:
|
else:
|
||||||
# if SubnetId property in Instance, ensure subnet exists
|
# if SubnetId property in Instance, ensure subnet exists
|
||||||
if subnet_id:
|
if subnet_id:
|
||||||
quantumclient = self.quantum()
|
neutronclient = self.neutron()
|
||||||
network_id = NetworkInterface.network_id_from_subnet_id(
|
network_id = NetworkInterface.network_id_from_subnet_id(
|
||||||
quantumclient, subnet_id)
|
neutronclient, subnet_id)
|
||||||
# if subnet verified, create a port to use this subnet
|
# if subnet verified, create a port to use this subnet
|
||||||
# if port is not created explicitly, nova will choose
|
# if port is not created explicitly, nova will choose
|
||||||
# the first subnet in the given network.
|
# the first subnet in the given network.
|
||||||
@ -293,7 +293,7 @@ class Instance(resource.Resource):
|
|||||||
'network_id': network_id,
|
'network_id': network_id,
|
||||||
'fixed_ips': [fixed_ip]
|
'fixed_ips': [fixed_ip]
|
||||||
}
|
}
|
||||||
port = quantumclient.create_port({'port': props})['port']
|
port = neutronclient.create_port({'port': props})['port']
|
||||||
nics = [{'port-id': port['id']}]
|
nics = [{'port-id': port['id']}]
|
||||||
|
|
||||||
return nics
|
return nics
|
||||||
|
@ -83,26 +83,26 @@ class VPCGatewayAttachment(resource.Resource):
|
|||||||
deps += (self, route_table)
|
deps += (self, route_table)
|
||||||
|
|
||||||
def handle_create(self):
|
def handle_create(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
external_network_id = InternetGateway.get_external_network_id(client)
|
external_network_id = InternetGateway.get_external_network_id(client)
|
||||||
for router in self._vpc_route_tables():
|
for router in self._vpc_route_tables():
|
||||||
client.add_gateway_router(router.resource_id, {
|
client.add_gateway_router(router.resource_id, {
|
||||||
'network_id': external_network_id})
|
'network_id': external_network_id})
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
|
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
for router in self._vpc_route_tables():
|
for router in self._vpc_route_tables():
|
||||||
try:
|
try:
|
||||||
client.remove_gateway_router(router.resource_id)
|
client.remove_gateway_router(router.resource_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
|
|
||||||
def resource_mapping():
|
def resource_mapping():
|
||||||
if clients.quantumclient is None:
|
if clients.neutronclient is None:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -44,12 +44,12 @@ class NetworkInterface(resource.Resource):
|
|||||||
}
|
}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def network_id_from_subnet_id(quantumclient, subnet_id):
|
def network_id_from_subnet_id(neutronclient, subnet_id):
|
||||||
subnet_info = quantumclient.show_subnet(subnet_id)
|
subnet_info = neutronclient.show_subnet(subnet_id)
|
||||||
return subnet_info['subnet']['network_id']
|
return subnet_info['subnet']['network_id']
|
||||||
|
|
||||||
def handle_create(self):
|
def handle_create(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
|
|
||||||
subnet_id = self.properties['SubnetId']
|
subnet_id = self.properties['SubnetId']
|
||||||
network_id = self.network_id_from_subnet_id(client, subnet_id)
|
network_id = self.network_id_from_subnet_id(client, subnet_id)
|
||||||
@ -80,18 +80,18 @@ class NetworkInterface(resource.Resource):
|
|||||||
self.resource_id_set(port['id'])
|
self.resource_id_set(port['id'])
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
|
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
try:
|
try:
|
||||||
client.delete_port(self.resource_id)
|
client.delete_port(self.resource_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
|
|
||||||
def resource_mapping():
|
def resource_mapping():
|
||||||
if clients.quantumclient is None:
|
if clients.neutronclient is None:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -15,15 +15,15 @@
|
|||||||
|
|
||||||
from heat.engine import clients
|
from heat.engine import clients
|
||||||
from heat.openstack.common import log as logging
|
from heat.openstack.common import log as logging
|
||||||
from heat.engine.resources.quantum import quantum
|
from heat.engine.resources.neutron import neutron
|
||||||
|
|
||||||
if clients.quantumclient is not None:
|
if clients.neutronclient is not None:
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class FloatingIP(quantum.QuantumResource):
|
class FloatingIP(neutron.NeutronResource):
|
||||||
properties_schema = {'floating_network_id': {'Type': 'String',
|
properties_schema = {'floating_network_id': {'Type': 'String',
|
||||||
'Required': True},
|
'Required': True},
|
||||||
'value_specs': {'Type': 'Map',
|
'value_specs': {'Type': 'Map',
|
||||||
@ -36,7 +36,8 @@ class FloatingIP(quantum.QuantumResource):
|
|||||||
# depend on any RouterGateway in this template with the same
|
# depend on any RouterGateway in this template with the same
|
||||||
# network_id as this floating_network_id
|
# network_id as this floating_network_id
|
||||||
for resource in self.stack.resources.itervalues():
|
for resource in self.stack.resources.itervalues():
|
||||||
if (resource.type() == 'OS::Quantum::RouterGateway' and
|
if ((resource.type() == 'OS::Neutron::RouterGateway' or
|
||||||
|
resource.type() == 'OS::Quantum::RouterGateway') and
|
||||||
resource.properties.get('network_id') ==
|
resource.properties.get('network_id') ==
|
||||||
self.properties.get('floating_network_id')):
|
self.properties.get('floating_network_id')):
|
||||||
deps += (self, resource)
|
deps += (self, resource)
|
||||||
@ -45,29 +46,29 @@ class FloatingIP(quantum.QuantumResource):
|
|||||||
props = self.prepare_properties(
|
props = self.prepare_properties(
|
||||||
self.properties,
|
self.properties,
|
||||||
self.physical_resource_name())
|
self.physical_resource_name())
|
||||||
fip = self.quantum().create_floatingip({
|
fip = self.neutron().create_floatingip({
|
||||||
'floatingip': props})['floatingip']
|
'floatingip': props})['floatingip']
|
||||||
self.resource_id_set(fip['id'])
|
self.resource_id_set(fip['id'])
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
try:
|
try:
|
||||||
client.delete_floatingip(self.resource_id)
|
client.delete_floatingip(self.resource_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
def FnGetAtt(self, key):
|
def FnGetAtt(self, key):
|
||||||
try:
|
try:
|
||||||
attributes = self.quantum().show_floatingip(
|
attributes = self.neutron().show_floatingip(
|
||||||
self.resource_id)['floatingip']
|
self.resource_id)['floatingip']
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
logger.warn("failed to fetch resource attributes: %s" % str(ex))
|
logger.warn("failed to fetch resource attributes: %s" % str(ex))
|
||||||
return None
|
return None
|
||||||
return self.handle_get_attributes(self.name, key, attributes)
|
return self.handle_get_attributes(self.name, key, attributes)
|
||||||
|
|
||||||
|
|
||||||
class FloatingIPAssociation(quantum.QuantumResource):
|
class FloatingIPAssociation(neutron.NeutronResource):
|
||||||
properties_schema = {'floatingip_id': {'Type': 'String',
|
properties_schema = {'floatingip_id': {'Type': 'String',
|
||||||
'Required': True},
|
'Required': True},
|
||||||
'port_id': {'Type': 'String',
|
'port_id': {'Type': 'String',
|
||||||
@ -79,29 +80,31 @@ class FloatingIPAssociation(quantum.QuantumResource):
|
|||||||
|
|
||||||
floatingip_id = props.pop('floatingip_id')
|
floatingip_id = props.pop('floatingip_id')
|
||||||
|
|
||||||
self.quantum().update_floatingip(floatingip_id, {
|
self.neutron().update_floatingip(floatingip_id, {
|
||||||
'floatingip': props})['floatingip']
|
'floatingip': props})['floatingip']
|
||||||
self.resource_id_set('%s:%s' % (floatingip_id, props['port_id']))
|
self.resource_id_set('%s:%s' % (floatingip_id, props['port_id']))
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
if not self.resource_id:
|
if not self.resource_id:
|
||||||
return
|
return
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
(floatingip_id, port_id) = self.resource_id.split(':')
|
(floatingip_id, port_id) = self.resource_id.split(':')
|
||||||
try:
|
try:
|
||||||
client.update_floatingip(
|
client.update_floatingip(
|
||||||
floatingip_id,
|
floatingip_id,
|
||||||
{'floatingip': {'port_id': None}})
|
{'floatingip': {'port_id': None}})
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
|
|
||||||
def resource_mapping():
|
def resource_mapping():
|
||||||
if clients.quantumclient is None:
|
if clients.neutronclient is None:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'OS::Neutron::FloatingIP': FloatingIP,
|
||||||
|
'OS::Neutron::FloatingIPAssociation': FloatingIPAssociation,
|
||||||
'OS::Quantum::FloatingIP': FloatingIP,
|
'OS::Quantum::FloatingIP': FloatingIP,
|
||||||
'OS::Quantum::FloatingIPAssociation': FloatingIPAssociation,
|
'OS::Quantum::FloatingIPAssociation': FloatingIPAssociation,
|
||||||
}
|
}
|
@ -15,16 +15,16 @@
|
|||||||
|
|
||||||
from heat.engine import clients
|
from heat.engine import clients
|
||||||
from heat.openstack.common import log as logging
|
from heat.openstack.common import log as logging
|
||||||
from heat.engine.resources.quantum import quantum
|
from heat.engine.resources.neutron import neutron
|
||||||
from heat.engine import scheduler
|
from heat.engine import scheduler
|
||||||
|
|
||||||
if clients.quantumclient is not None:
|
if clients.neutronclient is not None:
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Net(quantum.QuantumResource):
|
class Net(neutron.NeutronResource):
|
||||||
properties_schema = {'name': {'Type': 'String'},
|
properties_schema = {'name': {'Type': 'String'},
|
||||||
'value_specs': {'Type': 'Map',
|
'value_specs': {'Type': 'Map',
|
||||||
'Default': {}},
|
'Default': {}},
|
||||||
@ -43,11 +43,11 @@ class Net(quantum.QuantumResource):
|
|||||||
props = self.prepare_properties(
|
props = self.prepare_properties(
|
||||||
self.properties,
|
self.properties,
|
||||||
self.physical_resource_name())
|
self.physical_resource_name())
|
||||||
net = self.quantum().create_network({'network': props})['network']
|
net = self.neutron().create_network({'network': props})['network']
|
||||||
self.resource_id_set(net['id'])
|
self.resource_id_set(net['id'])
|
||||||
|
|
||||||
def _show_resource(self):
|
def _show_resource(self):
|
||||||
return self.quantum().show_network(
|
return self.neutron().show_network(
|
||||||
self.resource_id)['network']
|
self.resource_id)['network']
|
||||||
|
|
||||||
def check_create_complete(self, *args):
|
def check_create_complete(self, *args):
|
||||||
@ -55,10 +55,10 @@ class Net(quantum.QuantumResource):
|
|||||||
return self.is_built(attributes)
|
return self.is_built(attributes)
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
try:
|
try:
|
||||||
client.delete_network(self.resource_id)
|
client.delete_network(self.resource_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
else:
|
else:
|
||||||
@ -66,9 +66,10 @@ class Net(quantum.QuantumResource):
|
|||||||
|
|
||||||
|
|
||||||
def resource_mapping():
|
def resource_mapping():
|
||||||
if clients.quantumclient is None:
|
if clients.neutronclient is None:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'OS::Neutron::Net': Net,
|
||||||
'OS::Quantum::Net': Net,
|
'OS::Quantum::Net': Net,
|
||||||
}
|
}
|
@ -13,7 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.engine import resource
|
from heat.engine import resource
|
||||||
@ -23,13 +23,13 @@ from heat.openstack.common import log as logging
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class QuantumResource(resource.Resource):
|
class NeutronResource(resource.Resource):
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
'''
|
'''
|
||||||
Validate any of the provided params
|
Validate any of the provided params
|
||||||
'''
|
'''
|
||||||
res = super(QuantumResource, self).validate()
|
res = super(NeutronResource, self).validate()
|
||||||
if res:
|
if res:
|
||||||
return res
|
return res
|
||||||
return self.validate_properties(self.properties)
|
return self.validate_properties(self.properties)
|
||||||
@ -54,7 +54,7 @@ class QuantumResource(resource.Resource):
|
|||||||
def prepare_properties(properties, name):
|
def prepare_properties(properties, name):
|
||||||
'''
|
'''
|
||||||
Prepares the property values so that they can be passed directly to
|
Prepares the property values so that they can be passed directly to
|
||||||
the Quantum call.
|
the Neutron call.
|
||||||
|
|
||||||
Removes None values and value_specs, merges value_specs with the main
|
Removes None values and value_specs, merges value_specs with the main
|
||||||
values.
|
values.
|
||||||
@ -91,13 +91,13 @@ class QuantumResource(resource.Resource):
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
raise exception.Error('%s resource[%s] status[%s]' %
|
raise exception.Error('%s resource[%s] status[%s]' %
|
||||||
('quantum reported unexpected',
|
('neutron reported unexpected',
|
||||||
attributes['name'], attributes['status']))
|
attributes['name'], attributes['status']))
|
||||||
|
|
||||||
def _resolve_attribute(self, name):
|
def _resolve_attribute(self, name):
|
||||||
try:
|
try:
|
||||||
attributes = self._show_resource()
|
attributes = self._show_resource()
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
logger.warn("failed to fetch resource attributes: %s" % str(ex))
|
logger.warn("failed to fetch resource attributes: %s" % str(ex))
|
||||||
return None
|
return None
|
||||||
return self.handle_get_attributes(self.name, name, attributes)
|
return self.handle_get_attributes(self.name, name, attributes)
|
||||||
@ -107,7 +107,7 @@ class QuantumResource(resource.Resource):
|
|||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
self._show_resource()
|
self._show_resource()
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
return
|
return
|
@ -15,16 +15,16 @@
|
|||||||
|
|
||||||
from heat.engine import clients
|
from heat.engine import clients
|
||||||
from heat.openstack.common import log as logging
|
from heat.openstack.common import log as logging
|
||||||
from heat.engine.resources.quantum import quantum
|
from heat.engine.resources.neutron import neutron
|
||||||
from heat.engine import scheduler
|
from heat.engine import scheduler
|
||||||
|
|
||||||
if clients.quantumclient is not None:
|
if clients.neutronclient is not None:
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Port(quantum.QuantumResource):
|
class Port(neutron.NeutronResource):
|
||||||
|
|
||||||
fixed_ip_schema = {'subnet_id': {'Type': 'String',
|
fixed_ip_schema = {'subnet_id': {'Type': 'String',
|
||||||
'Required': True},
|
'Required': True},
|
||||||
@ -65,7 +65,8 @@ class Port(quantum.QuantumResource):
|
|||||||
# to so all subnets in a network should be created before
|
# to so all subnets in a network should be created before
|
||||||
# the ports in that network.
|
# the ports in that network.
|
||||||
for resource in self.stack.resources.itervalues():
|
for resource in self.stack.resources.itervalues():
|
||||||
if (resource.type() == 'OS::Quantum::Subnet' and
|
if ((resource.type() == 'OS::Neutron::Subnet' or
|
||||||
|
resource.type() == 'OS::Quantum::Subnet') and
|
||||||
resource.properties.get('network_id') ==
|
resource.properties.get('network_id') ==
|
||||||
self.properties.get('network_id')):
|
self.properties.get('network_id')):
|
||||||
deps += (self, resource)
|
deps += (self, resource)
|
||||||
@ -74,11 +75,11 @@ class Port(quantum.QuantumResource):
|
|||||||
props = self.prepare_properties(
|
props = self.prepare_properties(
|
||||||
self.properties,
|
self.properties,
|
||||||
self.physical_resource_name())
|
self.physical_resource_name())
|
||||||
port = self.quantum().create_port({'port': props})['port']
|
port = self.neutron().create_port({'port': props})['port']
|
||||||
self.resource_id_set(port['id'])
|
self.resource_id_set(port['id'])
|
||||||
|
|
||||||
def _show_resource(self):
|
def _show_resource(self):
|
||||||
return self.quantum().show_port(
|
return self.neutron().show_port(
|
||||||
self.resource_id)['port']
|
self.resource_id)['port']
|
||||||
|
|
||||||
def check_create_complete(self, *args):
|
def check_create_complete(self, *args):
|
||||||
@ -86,10 +87,10 @@ class Port(quantum.QuantumResource):
|
|||||||
return self.is_built(attributes)
|
return self.is_built(attributes)
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
try:
|
try:
|
||||||
client.delete_port(self.resource_id)
|
client.delete_port(self.resource_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
else:
|
else:
|
||||||
@ -97,9 +98,10 @@ class Port(quantum.QuantumResource):
|
|||||||
|
|
||||||
|
|
||||||
def resource_mapping():
|
def resource_mapping():
|
||||||
if clients.quantumclient is None:
|
if clients.neutronclient is None:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'OS::Neutron::Port': Port,
|
||||||
'OS::Quantum::Port': Port,
|
'OS::Quantum::Port': Port,
|
||||||
}
|
}
|
@ -14,18 +14,18 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from heat.engine import clients
|
from heat.engine import clients
|
||||||
from heat.engine.resources.quantum import quantum
|
from heat.engine.resources.neutron import neutron
|
||||||
from heat.engine import scheduler
|
from heat.engine import scheduler
|
||||||
|
|
||||||
if clients.quantumclient is not None:
|
if clients.neutronclient is not None:
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
|
|
||||||
from heat.openstack.common import log as logging
|
from heat.openstack.common import log as logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Router(quantum.QuantumResource):
|
class Router(neutron.NeutronResource):
|
||||||
properties_schema = {'name': {'Type': 'String'},
|
properties_schema = {'name': {'Type': 'String'},
|
||||||
'value_specs': {'Type': 'Map',
|
'value_specs': {'Type': 'Map',
|
||||||
'Default': {}},
|
'Default': {}},
|
||||||
@ -44,11 +44,11 @@ class Router(quantum.QuantumResource):
|
|||||||
props = self.prepare_properties(
|
props = self.prepare_properties(
|
||||||
self.properties,
|
self.properties,
|
||||||
self.physical_resource_name())
|
self.physical_resource_name())
|
||||||
router = self.quantum().create_router({'router': props})['router']
|
router = self.neutron().create_router({'router': props})['router']
|
||||||
self.resource_id_set(router['id'])
|
self.resource_id_set(router['id'])
|
||||||
|
|
||||||
def _show_resource(self):
|
def _show_resource(self):
|
||||||
return self.quantum().show_router(
|
return self.neutron().show_router(
|
||||||
self.resource_id)['router']
|
self.resource_id)['router']
|
||||||
|
|
||||||
def check_create_complete(self, *args):
|
def check_create_complete(self, *args):
|
||||||
@ -56,17 +56,17 @@ class Router(quantum.QuantumResource):
|
|||||||
return self.is_built(attributes)
|
return self.is_built(attributes)
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
try:
|
try:
|
||||||
client.delete_router(self.resource_id)
|
client.delete_router(self.resource_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
else:
|
else:
|
||||||
return scheduler.TaskRunner(self._confirm_delete)()
|
return scheduler.TaskRunner(self._confirm_delete)()
|
||||||
|
|
||||||
|
|
||||||
class RouterInterface(quantum.QuantumResource):
|
class RouterInterface(neutron.NeutronResource):
|
||||||
properties_schema = {'router_id': {'Type': 'String',
|
properties_schema = {'router_id': {'Type': 'String',
|
||||||
'Required': True},
|
'Required': True},
|
||||||
'subnet_id': {'Type': 'String',
|
'subnet_id': {'Type': 'String',
|
||||||
@ -75,24 +75,24 @@ class RouterInterface(quantum.QuantumResource):
|
|||||||
def handle_create(self):
|
def handle_create(self):
|
||||||
router_id = self.properties.get('router_id')
|
router_id = self.properties.get('router_id')
|
||||||
subnet_id = self.properties.get('subnet_id')
|
subnet_id = self.properties.get('subnet_id')
|
||||||
self.quantum().add_interface_router(
|
self.neutron().add_interface_router(
|
||||||
router_id,
|
router_id,
|
||||||
{'subnet_id': subnet_id})
|
{'subnet_id': subnet_id})
|
||||||
self.resource_id_set('%s:%s' % (router_id, subnet_id))
|
self.resource_id_set('%s:%s' % (router_id, subnet_id))
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
(router_id, subnet_id) = self.resource_id.split(':')
|
(router_id, subnet_id) = self.resource_id.split(':')
|
||||||
try:
|
try:
|
||||||
client.remove_interface_router(
|
client.remove_interface_router(
|
||||||
router_id,
|
router_id,
|
||||||
{'subnet_id': subnet_id})
|
{'subnet_id': subnet_id})
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
|
|
||||||
class RouterGateway(quantum.QuantumResource):
|
class RouterGateway(neutron.NeutronResource):
|
||||||
properties_schema = {'router_id': {'Type': 'String',
|
properties_schema = {'router_id': {'Type': 'String',
|
||||||
'Required': True},
|
'Required': True},
|
||||||
'network_id': {'Type': 'String',
|
'network_id': {'Type': 'String',
|
||||||
@ -103,14 +103,16 @@ class RouterGateway(quantum.QuantumResource):
|
|||||||
for resource in self.stack.resources.itervalues():
|
for resource in self.stack.resources.itervalues():
|
||||||
# depend on any RouterInterface in this template with the same
|
# depend on any RouterInterface in this template with the same
|
||||||
# router_id as this router_id
|
# router_id as this router_id
|
||||||
if (resource.type() == 'OS::Quantum::RouterInterface' and
|
if ((resource.type() == 'OS::Neutron::RouterInterface' or
|
||||||
|
resource.type() == 'OS::Quantum::RouterInterface') and
|
||||||
resource.properties.get('router_id') ==
|
resource.properties.get('router_id') ==
|
||||||
self.properties.get('router_id')):
|
self.properties.get('router_id')):
|
||||||
deps += (self, resource)
|
deps += (self, resource)
|
||||||
# depend on any subnet in this template with the same network_id
|
# depend on any subnet in this template with the same network_id
|
||||||
# as this network_id, as the gateway implicitly creates a port
|
# as this network_id, as the gateway implicitly creates a port
|
||||||
# on that subnet
|
# on that subnet
|
||||||
elif (resource.type() == 'OS::Quantum::Subnet' and
|
elif ((resource.type() == 'OS::Neutron::Subnet' or
|
||||||
|
resource.type() == 'OS::Quantum::Subnet') and
|
||||||
resource.properties.get('network_id') ==
|
resource.properties.get('network_id') ==
|
||||||
self.properties.get('network_id')):
|
self.properties.get('network_id')):
|
||||||
deps += (self, resource)
|
deps += (self, resource)
|
||||||
@ -118,26 +120,29 @@ class RouterGateway(quantum.QuantumResource):
|
|||||||
def handle_create(self):
|
def handle_create(self):
|
||||||
router_id = self.properties.get('router_id')
|
router_id = self.properties.get('router_id')
|
||||||
network_id = self.properties.get('network_id')
|
network_id = self.properties.get('network_id')
|
||||||
self.quantum().add_gateway_router(
|
self.neutron().add_gateway_router(
|
||||||
router_id,
|
router_id,
|
||||||
{'network_id': network_id})
|
{'network_id': network_id})
|
||||||
self.resource_id_set('%s:%s' % (router_id, network_id))
|
self.resource_id_set('%s:%s' % (router_id, network_id))
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
(router_id, network_id) = self.resource_id.split(':')
|
(router_id, network_id) = self.resource_id.split(':')
|
||||||
try:
|
try:
|
||||||
client.remove_gateway_router(router_id)
|
client.remove_gateway_router(router_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
|
|
||||||
def resource_mapping():
|
def resource_mapping():
|
||||||
if clients.quantumclient is None:
|
if clients.neutronclient is None:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'OS::Neutron::Router': Router,
|
||||||
|
'OS::Neutron::RouterInterface': RouterInterface,
|
||||||
|
'OS::Neutron::RouterGateway': RouterGateway,
|
||||||
'OS::Quantum::Router': Router,
|
'OS::Quantum::Router': Router,
|
||||||
'OS::Quantum::RouterInterface': RouterInterface,
|
'OS::Quantum::RouterInterface': RouterInterface,
|
||||||
'OS::Quantum::RouterGateway': RouterGateway,
|
'OS::Quantum::RouterGateway': RouterGateway,
|
@ -15,16 +15,16 @@
|
|||||||
|
|
||||||
from heat.engine import clients
|
from heat.engine import clients
|
||||||
from heat.openstack.common import log as logging
|
from heat.openstack.common import log as logging
|
||||||
from heat.engine.resources.quantum import quantum
|
from heat.engine.resources.neutron import neutron
|
||||||
from heat.engine import scheduler
|
from heat.engine import scheduler
|
||||||
|
|
||||||
if clients.quantumclient is not None:
|
if clients.neutronclient is not None:
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Subnet(quantum.QuantumResource):
|
class Subnet(neutron.NeutronResource):
|
||||||
|
|
||||||
allocation_schema = {'start': {'Type': 'String',
|
allocation_schema = {'start': {'Type': 'String',
|
||||||
'Required': True},
|
'Required': True},
|
||||||
@ -68,27 +68,28 @@ class Subnet(quantum.QuantumResource):
|
|||||||
props = self.prepare_properties(
|
props = self.prepare_properties(
|
||||||
self.properties,
|
self.properties,
|
||||||
self.physical_resource_name())
|
self.physical_resource_name())
|
||||||
subnet = self.quantum().create_subnet({'subnet': props})['subnet']
|
subnet = self.neutron().create_subnet({'subnet': props})['subnet']
|
||||||
self.resource_id_set(subnet['id'])
|
self.resource_id_set(subnet['id'])
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
try:
|
try:
|
||||||
client.delete_subnet(self.resource_id)
|
client.delete_subnet(self.resource_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
else:
|
else:
|
||||||
return scheduler.TaskRunner(self._confirm_delete)()
|
return scheduler.TaskRunner(self._confirm_delete)()
|
||||||
|
|
||||||
def _show_resource(self):
|
def _show_resource(self):
|
||||||
return self.quantum().show_subnet(self.resource_id)['subnet']
|
return self.neutron().show_subnet(self.resource_id)['subnet']
|
||||||
|
|
||||||
|
|
||||||
def resource_mapping():
|
def resource_mapping():
|
||||||
if clients.quantumclient is None:
|
if clients.neutronclient is None:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'OS::Neutron::Subnet': Subnet,
|
||||||
'OS::Quantum::Subnet': Subnet,
|
'OS::Quantum::Subnet': Subnet,
|
||||||
}
|
}
|
@ -83,8 +83,8 @@ class RackspaceResource(resource.Resource):
|
|||||||
|
|
||||||
return self._cloud_blockstore
|
return self._cloud_blockstore
|
||||||
|
|
||||||
def quantum(self):
|
def neutron(self):
|
||||||
'''Rackspace quantum client.'''
|
'''Rackspace neutron client.'''
|
||||||
if not self._cloud_nw:
|
if not self._cloud_nw:
|
||||||
self.__authenticate()
|
self.__authenticate()
|
||||||
self._cloud_nw = self.pyrax.cloud_networks
|
self._cloud_nw = self.pyrax.cloud_networks
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
from heat.engine import clients
|
from heat.engine import clients
|
||||||
from heat.openstack.common import log as logging
|
from heat.openstack.common import log as logging
|
||||||
from heat.engine import resource
|
from heat.engine import resource
|
||||||
from heat.engine.resources.quantum import quantum
|
from heat.engine.resources.neutron import neutron
|
||||||
from heat.engine.resources.vpc import VPC
|
from heat.engine.resources.vpc import VPC
|
||||||
|
|
||||||
if clients.quantumclient is not None:
|
if clients.neutronclient is not None:
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -42,16 +42,16 @@ class RouteTable(resource.Resource):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def handle_create(self):
|
def handle_create(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
props = {'name': self.physical_resource_name()}
|
props = {'name': self.physical_resource_name()}
|
||||||
router = client.create_router({'router': props})['router']
|
router = client.create_router({'router': props})['router']
|
||||||
self.resource_id_set(router['id'])
|
self.resource_id_set(router['id'])
|
||||||
|
|
||||||
def check_create_complete(self, *args):
|
def check_create_complete(self, *args):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
attributes = client.show_router(
|
attributes = client.show_router(
|
||||||
self.resource_id)['router']
|
self.resource_id)['router']
|
||||||
if not quantum.QuantumResource.is_built(attributes):
|
if not neutron.NeutronResource.is_built(attributes):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
network_id = self.properties.get('VpcId')
|
network_id = self.properties.get('VpcId')
|
||||||
@ -66,19 +66,19 @@ class RouteTable(resource.Resource):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
|
|
||||||
router_id = self.resource_id
|
router_id = self.resource_id
|
||||||
try:
|
try:
|
||||||
client.delete_router(router_id)
|
client.delete_router(router_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
# just in case this router has been added to a gateway, remove it
|
# just in case this router has been added to a gateway, remove it
|
||||||
try:
|
try:
|
||||||
client.remove_gateway_router(router_id)
|
client.remove_gateway_router(router_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ class SubnetRouteTableAssocation(resource.Resource):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def handle_create(self):
|
def handle_create(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
subnet_id = self.properties.get('SubnetId')
|
subnet_id = self.properties.get('SubnetId')
|
||||||
|
|
||||||
router_id = self.properties.get('RouteTableId')
|
router_id = self.properties.get('RouteTableId')
|
||||||
@ -107,7 +107,7 @@ class SubnetRouteTableAssocation(resource.Resource):
|
|||||||
client.remove_interface_router(
|
client.remove_interface_router(
|
||||||
previous_router['id'],
|
previous_router['id'],
|
||||||
{'subnet_id': subnet_id})
|
{'subnet_id': subnet_id})
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
@ -115,14 +115,14 @@ class SubnetRouteTableAssocation(resource.Resource):
|
|||||||
router_id, {'subnet_id': subnet_id})
|
router_id, {'subnet_id': subnet_id})
|
||||||
|
|
||||||
def _router_for_subnet(self, subnet_id):
|
def _router_for_subnet(self, subnet_id):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
subnet = client.show_subnet(
|
subnet = client.show_subnet(
|
||||||
subnet_id)['subnet']
|
subnet_id)['subnet']
|
||||||
network_id = subnet['network_id']
|
network_id = subnet['network_id']
|
||||||
return VPC.router_for_vpc(client, network_id)
|
return VPC.router_for_vpc(client, network_id)
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
subnet_id = self.properties.get('SubnetId')
|
subnet_id = self.properties.get('SubnetId')
|
||||||
|
|
||||||
router_id = self.properties.get('RouteTableId')
|
router_id = self.properties.get('RouteTableId')
|
||||||
@ -130,7 +130,7 @@ class SubnetRouteTableAssocation(resource.Resource):
|
|||||||
try:
|
try:
|
||||||
client.remove_interface_router(router_id, {
|
client.remove_interface_router(router_id, {
|
||||||
'subnet_id': subnet_id})
|
'subnet_id': subnet_id})
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
@ -140,13 +140,13 @@ class SubnetRouteTableAssocation(resource.Resource):
|
|||||||
if default_router:
|
if default_router:
|
||||||
client.add_interface_router(
|
client.add_interface_router(
|
||||||
default_router['id'], {'subnet_id': subnet_id})
|
default_router['id'], {'subnet_id': subnet_id})
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
|
|
||||||
def resource_mapping():
|
def resource_mapping():
|
||||||
if clients.quantumclient is None:
|
if clients.neutronclient is None:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -29,14 +29,14 @@ class SecurityGroup(resource.Resource):
|
|||||||
'SecurityGroupEgress': {'Type': 'List'}}
|
'SecurityGroupEgress': {'Type': 'List'}}
|
||||||
|
|
||||||
def handle_create(self):
|
def handle_create(self):
|
||||||
if self.properties['VpcId'] and clients.quantumclient is not None:
|
if self.properties['VpcId'] and clients.neutronclient is not None:
|
||||||
self._handle_create_quantum()
|
self._handle_create_neutron()
|
||||||
else:
|
else:
|
||||||
self._handle_create_nova()
|
self._handle_create_nova()
|
||||||
|
|
||||||
def _handle_create_quantum(self):
|
def _handle_create_neutron(self):
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
|
|
||||||
sec = client.create_security_group({'security_group': {
|
sec = client.create_security_group({'security_group': {
|
||||||
'name': self.physical_resource_name(),
|
'name': self.physical_resource_name(),
|
||||||
@ -46,7 +46,7 @@ class SecurityGroup(resource.Resource):
|
|||||||
self.resource_id_set(sec['id'])
|
self.resource_id_set(sec['id'])
|
||||||
if self.properties['SecurityGroupIngress']:
|
if self.properties['SecurityGroupIngress']:
|
||||||
for i in self.properties['SecurityGroupIngress']:
|
for i in self.properties['SecurityGroupIngress']:
|
||||||
# Quantum only accepts positive ints
|
# Neutron only accepts positive ints
|
||||||
if int(i['FromPort']) < 0:
|
if int(i['FromPort']) < 0:
|
||||||
i['FromPort'] = None
|
i['FromPort'] = None
|
||||||
if int(i['ToPort']) < 0:
|
if int(i['ToPort']) < 0:
|
||||||
@ -66,7 +66,7 @@ class SecurityGroup(resource.Resource):
|
|||||||
'security_group_id': sec['id']
|
'security_group_id': sec['id']
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code == 409:
|
if ex.status_code == 409:
|
||||||
# no worries, the rule is already there
|
# no worries, the rule is already there
|
||||||
pass
|
pass
|
||||||
@ -87,7 +87,7 @@ class SecurityGroup(resource.Resource):
|
|||||||
'security_group_id': sec['id']
|
'security_group_id': sec['id']
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code == 409:
|
if ex.status_code == 409:
|
||||||
# no worries, the rule is already there
|
# no worries, the rule is already there
|
||||||
pass
|
pass
|
||||||
@ -128,8 +128,8 @@ class SecurityGroup(resource.Resource):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
if self.properties['VpcId'] and clients.quantumclient is not None:
|
if self.properties['VpcId'] and clients.neutronclient is not None:
|
||||||
self._handle_delete_quantum()
|
self._handle_delete_neutron()
|
||||||
else:
|
else:
|
||||||
self._handle_delete_nova()
|
self._handle_delete_nova()
|
||||||
|
|
||||||
@ -149,28 +149,28 @@ class SecurityGroup(resource.Resource):
|
|||||||
self.nova().security_groups.delete(self.resource_id)
|
self.nova().security_groups.delete(self.resource_id)
|
||||||
self.resource_id = None
|
self.resource_id = None
|
||||||
|
|
||||||
def _handle_delete_quantum(self):
|
def _handle_delete_neutron(self):
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
|
|
||||||
if self.resource_id is not None:
|
if self.resource_id is not None:
|
||||||
try:
|
try:
|
||||||
sec = client.show_security_group(
|
sec = client.show_security_group(
|
||||||
self.resource_id)['security_group']
|
self.resource_id)['security_group']
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
for rule in sec['security_group_rules']:
|
for rule in sec['security_group_rules']:
|
||||||
try:
|
try:
|
||||||
client.delete_security_group_rule(rule['id'])
|
client.delete_security_group_rule(rule['id'])
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client.delete_security_group(self.resource_id)
|
client.delete_security_group(self.resource_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise
|
raise
|
||||||
self.resource_id = None
|
self.resource_id = None
|
||||||
|
@ -43,7 +43,7 @@ class Subnet(resource.Resource):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def handle_create(self):
|
def handle_create(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
# TODO(sbaker) Verify that this CidrBlock is within the vpc CidrBlock
|
# TODO(sbaker) Verify that this CidrBlock is within the vpc CidrBlock
|
||||||
network_id = self.properties.get('VpcId')
|
network_id = self.properties.get('VpcId')
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ class Subnet(resource.Resource):
|
|||||||
}
|
}
|
||||||
subnet = client.create_subnet({'subnet': props})['subnet']
|
subnet = client.create_subnet({'subnet': props})['subnet']
|
||||||
|
|
||||||
router = VPC.router_for_vpc(self.quantum(), network_id)
|
router = VPC.router_for_vpc(self.neutron(), network_id)
|
||||||
if router:
|
if router:
|
||||||
client.add_interface_router(
|
client.add_interface_router(
|
||||||
router['id'],
|
router['id'],
|
||||||
@ -63,25 +63,25 @@ class Subnet(resource.Resource):
|
|||||||
self.resource_id_set(subnet['id'])
|
self.resource_id_set(subnet['id'])
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
|
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
network_id = self.properties.get('VpcId')
|
network_id = self.properties.get('VpcId')
|
||||||
subnet_id = self.resource_id
|
subnet_id = self.resource_id
|
||||||
|
|
||||||
try:
|
try:
|
||||||
router = VPC.router_for_vpc(self.quantum(), network_id)
|
router = VPC.router_for_vpc(self.neutron(), network_id)
|
||||||
if router:
|
if router:
|
||||||
client.remove_interface_router(
|
client.remove_interface_router(
|
||||||
router['id'],
|
router['id'],
|
||||||
{'subnet_id': subnet_id})
|
{'subnet_id': subnet_id})
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client.delete_subnet(subnet_id)
|
client.delete_subnet(subnet_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ class Subnet(resource.Resource):
|
|||||||
|
|
||||||
|
|
||||||
def resource_mapping():
|
def resource_mapping():
|
||||||
if clients.quantumclient is None:
|
if clients.neutronclient is None:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -17,7 +17,7 @@ from heat.common import exception
|
|||||||
from heat.engine import clients
|
from heat.engine import clients
|
||||||
from heat.openstack.common import log as logging
|
from heat.openstack.common import log as logging
|
||||||
from heat.engine import resource
|
from heat.engine import resource
|
||||||
from heat.engine.resources.quantum import quantum
|
from heat.engine.resources.neutron import neutron
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class VPC(resource.Resource):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def handle_create(self):
|
def handle_create(self):
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
# The VPC's net and router are associated by having identical names.
|
# The VPC's net and router are associated by having identical names.
|
||||||
net_props = {'name': self.physical_resource_name()}
|
net_props = {'name': self.physical_resource_name()}
|
||||||
router_props = {'name': self.physical_resource_name()}
|
router_props = {'name': self.physical_resource_name()}
|
||||||
@ -59,7 +59,7 @@ class VPC(resource.Resource):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def router_for_vpc(client, network_id):
|
def router_for_vpc(client, network_id):
|
||||||
# first get the quantum net
|
# first get the neutron net
|
||||||
net = VPC.network_for_vpc(client, network_id)
|
net = VPC.network_for_vpc(client, network_id)
|
||||||
# then find a router with the same name
|
# then find a router with the same name
|
||||||
routers = client.list_routers(name=net['name'])['routers']
|
routers = client.list_routers(name=net['name'])['routers']
|
||||||
@ -73,31 +73,31 @@ class VPC(resource.Resource):
|
|||||||
return routers[0]
|
return routers[0]
|
||||||
|
|
||||||
def check_create_complete(self, *args):
|
def check_create_complete(self, *args):
|
||||||
net = self.network_for_vpc(self.quantum(), self.resource_id)
|
net = self.network_for_vpc(self.neutron(), self.resource_id)
|
||||||
if not quantum.QuantumResource.is_built(net):
|
if not neutron.NeutronResource.is_built(net):
|
||||||
return False
|
return False
|
||||||
router = self.router_for_vpc(self.quantum(), self.resource_id)
|
router = self.router_for_vpc(self.neutron(), self.resource_id)
|
||||||
return quantum.QuantumResource.is_built(router)
|
return neutron.NeutronResource.is_built(router)
|
||||||
|
|
||||||
def handle_delete(self):
|
def handle_delete(self):
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
client = self.quantum()
|
client = self.neutron()
|
||||||
router = self.router_for_vpc(client, self.resource_id)
|
router = self.router_for_vpc(client, self.resource_id)
|
||||||
try:
|
try:
|
||||||
client.delete_router(router['id'])
|
client.delete_router(router['id'])
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client.delete_network(self.resource_id)
|
client.delete_network(self.resource_id)
|
||||||
except QuantumClientException as ex:
|
except NeutronClientException as ex:
|
||||||
if ex.status_code != 404:
|
if ex.status_code != 404:
|
||||||
raise ex
|
raise ex
|
||||||
|
|
||||||
|
|
||||||
def resource_mapping():
|
def resource_mapping():
|
||||||
if clients.quantumclient is None:
|
if clients.neutronclient is None:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"AWSTemplateFormatVersion" : "2010-09-09",
|
"AWSTemplateFormatVersion" : "2010-09-09",
|
||||||
|
|
||||||
"Description" : "Template to test Quantum resources",
|
"Description" : "Template to test Neutron resources",
|
||||||
|
|
||||||
"Parameters" : {
|
"Parameters" : {
|
||||||
|
|
||||||
@ -9,23 +9,23 @@
|
|||||||
|
|
||||||
"Resources" : {
|
"Resources" : {
|
||||||
"network": {
|
"network": {
|
||||||
"Type": "OS::Quantum::Net",
|
"Type": "OS::Neutron::Net",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"name": "the_network"
|
"name": "the_network"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"unnamed_network": {
|
"unnamed_network": {
|
||||||
"Type": "OS::Quantum::Net"
|
"Type": "OS::Neutron::Net"
|
||||||
},
|
},
|
||||||
"admin_down_network": {
|
"admin_down_network": {
|
||||||
"Type": "OS::Quantum::Net",
|
"Type": "OS::Neutron::Net",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"admin_state_up": false
|
"admin_state_up": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"subnet": {
|
"subnet": {
|
||||||
"Type": "OS::Quantum::Subnet",
|
"Type": "OS::Neutron::Subnet",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"network_id": { "Ref" : "network" },
|
"network_id": { "Ref" : "network" },
|
||||||
"ip_version": 4,
|
"ip_version": 4,
|
||||||
@ -35,7 +35,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"port": {
|
"port": {
|
||||||
"Type": "OS::Quantum::Port",
|
"Type": "OS::Neutron::Port",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"device_id": "d6b4d3a5-c700-476f-b609-1493dd9dadc0",
|
"device_id": "d6b4d3a5-c700-476f-b609-1493dd9dadc0",
|
||||||
"name": "port1",
|
"name": "port1",
|
||||||
@ -48,11 +48,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"router": {
|
"router": {
|
||||||
"Type": "OS::Quantum::Router"
|
"Type": "OS::Neutron::Router"
|
||||||
},
|
},
|
||||||
|
|
||||||
"router_interface": {
|
"router_interface": {
|
||||||
"Type": "OS::Quantum::RouterInterface",
|
"Type": "OS::Neutron::RouterInterface",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"router_id": { "Ref" : "router" },
|
"router_id": { "Ref" : "router" },
|
||||||
"subnet_id": { "Ref" : "subnet" }
|
"subnet_id": { "Ref" : "subnet" }
|
@ -1,16 +1,16 @@
|
|||||||
HeatTemplateFormatVersion: '2012-12-12'
|
HeatTemplateFormatVersion: '2012-12-12'
|
||||||
Description: Template to test Quantum resources
|
Description: Template to test Neutron resources
|
||||||
Resources:
|
Resources:
|
||||||
network:
|
network:
|
||||||
Type: OS::Quantum::Net
|
Type: OS::Neutron::Net
|
||||||
Properties: {name: the_network}
|
Properties: {name: the_network}
|
||||||
unnamed_network:
|
unnamed_network:
|
||||||
Type: 'OS::Quantum::Net'
|
Type: 'OS::Neutron::Net'
|
||||||
admin_down_network:
|
admin_down_network:
|
||||||
Type: OS::Quantum::Net
|
Type: OS::Neutron::Net
|
||||||
Properties: {admin_state_up: false}
|
Properties: {admin_state_up: false}
|
||||||
subnet:
|
subnet:
|
||||||
Type: OS::Quantum::Subnet
|
Type: OS::Neutron::Subnet
|
||||||
Properties:
|
Properties:
|
||||||
network_id: {Ref: network}
|
network_id: {Ref: network}
|
||||||
ip_version: 4
|
ip_version: 4
|
||||||
@ -18,7 +18,7 @@ Resources:
|
|||||||
allocation_pools:
|
allocation_pools:
|
||||||
- {end: 10.0.3.150, start: 10.0.3.20}
|
- {end: 10.0.3.150, start: 10.0.3.20}
|
||||||
port:
|
port:
|
||||||
Type: OS::Quantum::Port
|
Type: OS::Neutron::Port
|
||||||
Properties:
|
Properties:
|
||||||
device_id: d6b4d3a5-c700-476f-b609-1493dd9dadc0
|
device_id: d6b4d3a5-c700-476f-b609-1493dd9dadc0
|
||||||
name: port1
|
name: port1
|
||||||
@ -27,9 +27,9 @@ Resources:
|
|||||||
- subnet_id: {Ref: subnet}
|
- subnet_id: {Ref: subnet}
|
||||||
ip_address: 10.0.3.21
|
ip_address: 10.0.3.21
|
||||||
router:
|
router:
|
||||||
Type: 'OS::Quantum::Router'
|
Type: 'OS::Neutron::Router'
|
||||||
router_interface:
|
router_interface:
|
||||||
Type: OS::Quantum::RouterInterface
|
Type: OS::Neutron::RouterInterface
|
||||||
Properties:
|
Properties:
|
||||||
router_id: {Ref: router}
|
router_id: {Ref: router}
|
||||||
subnet_id: {Ref: subnet}
|
subnet_id: {Ref: subnet}
|
@ -110,7 +110,7 @@ wp_template_with_nic = '''
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
class FakeQuantum(object):
|
class FakeNeutron(object):
|
||||||
|
|
||||||
def show_subnet(self, subnet, **_params):
|
def show_subnet(self, subnet, **_params):
|
||||||
return {
|
return {
|
||||||
@ -169,8 +169,8 @@ class instancesTest(HeatTestCase):
|
|||||||
self.m.StubOutWithMock(instance, 'nova')
|
self.m.StubOutWithMock(instance, 'nova')
|
||||||
instance.nova().MultipleTimes().AndReturn(self.fc)
|
instance.nova().MultipleTimes().AndReturn(self.fc)
|
||||||
|
|
||||||
self.m.StubOutWithMock(instance, 'quantum')
|
self.m.StubOutWithMock(instance, 'neutron')
|
||||||
instance.quantum().MultipleTimes().AndReturn(FakeQuantum())
|
instance.neutron().MultipleTimes().AndReturn(FakeNeutron())
|
||||||
|
|
||||||
instance.t = instance.stack.resolve_runtime_data(instance.t)
|
instance.t = instance.stack.resolve_runtime_data(instance.t)
|
||||||
|
|
||||||
@ -212,8 +212,8 @@ class instancesTest(HeatTestCase):
|
|||||||
instance = instances.Instance('%s_name' % name,
|
instance = instances.Instance('%s_name' % name,
|
||||||
t['Resources']['WebServer'], stack)
|
t['Resources']['WebServer'], stack)
|
||||||
|
|
||||||
self.m.StubOutWithMock(nic, 'quantum')
|
self.m.StubOutWithMock(nic, 'neutron')
|
||||||
nic.quantum().MultipleTimes().AndReturn(FakeQuantum())
|
nic.neutron().MultipleTimes().AndReturn(FakeNeutron())
|
||||||
|
|
||||||
self.m.StubOutWithMock(instance, 'nova')
|
self.m.StubOutWithMock(instance, 'nova')
|
||||||
instance.nova().MultipleTimes().AndReturn(self.fc)
|
instance.nova().MultipleTimes().AndReturn(self.fc)
|
||||||
|
@ -21,10 +21,10 @@ from heat.common import template_format
|
|||||||
from heat.engine import properties
|
from heat.engine import properties
|
||||||
from heat.engine import resource
|
from heat.engine import resource
|
||||||
from heat.engine import scheduler
|
from heat.engine import scheduler
|
||||||
from heat.engine.resources.quantum import net
|
from heat.engine.resources.neutron import net
|
||||||
from heat.engine.resources.quantum import subnet
|
from heat.engine.resources.neutron import subnet
|
||||||
from heat.engine.resources.quantum import router
|
from heat.engine.resources.neutron import router
|
||||||
from heat.engine.resources.quantum.quantum import QuantumResource as qr
|
from heat.engine.resources.neutron.neutron import NeutronResource as qr
|
||||||
from heat.openstack.common.importutils import try_import
|
from heat.openstack.common.importutils import try_import
|
||||||
from heat.tests.common import HeatTestCase
|
from heat.tests.common import HeatTestCase
|
||||||
from heat.tests import fakes
|
from heat.tests import fakes
|
||||||
@ -32,32 +32,32 @@ from heat.tests import utils
|
|||||||
from heat.tests.utils import setup_dummy_db
|
from heat.tests.utils import setup_dummy_db
|
||||||
from heat.tests.utils import parse_stack
|
from heat.tests.utils import parse_stack
|
||||||
|
|
||||||
quantumclient = try_import('quantumclient.v2_0.client')
|
neutronclient = try_import('neutronclient.v2_0.client')
|
||||||
qe = try_import('quantumclient.common.exceptions')
|
qe = try_import('neutronclient.common.exceptions')
|
||||||
|
|
||||||
quantum_template = '''
|
neutron_template = '''
|
||||||
{
|
{
|
||||||
"AWSTemplateFormatVersion" : "2010-09-09",
|
"AWSTemplateFormatVersion" : "2010-09-09",
|
||||||
"Description" : "Template to test Quantum resources",
|
"Description" : "Template to test Neutron resources",
|
||||||
"Parameters" : {},
|
"Parameters" : {},
|
||||||
"Resources" : {
|
"Resources" : {
|
||||||
"network": {
|
"network": {
|
||||||
"Type": "OS::Quantum::Net",
|
"Type": "OS::Neutron::Net",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"name": "the_network"
|
"name": "the_network"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"unnamed_network": {
|
"unnamed_network": {
|
||||||
"Type": "OS::Quantum::Net"
|
"Type": "OS::Neutron::Net"
|
||||||
},
|
},
|
||||||
"admin_down_network": {
|
"admin_down_network": {
|
||||||
"Type": "OS::Quantum::Net",
|
"Type": "OS::Neutron::Net",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"admin_state_up": false
|
"admin_state_up": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"subnet": {
|
"subnet": {
|
||||||
"Type": "OS::Quantum::Subnet",
|
"Type": "OS::Neutron::Subnet",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"network_id": { "Ref" : "network" },
|
"network_id": { "Ref" : "network" },
|
||||||
"ip_version": 4,
|
"ip_version": 4,
|
||||||
@ -67,7 +67,7 @@ quantum_template = '''
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"port": {
|
"port": {
|
||||||
"Type": "OS::Quantum::Port",
|
"Type": "OS::Neutron::Port",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"device_id": "d6b4d3a5-c700-476f-b609-1493dd9dadc0",
|
"device_id": "d6b4d3a5-c700-476f-b609-1493dd9dadc0",
|
||||||
"name": "port1",
|
"name": "port1",
|
||||||
@ -79,24 +79,24 @@ quantum_template = '''
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"port2": {
|
"port2": {
|
||||||
"Type": "OS::Quantum::Port",
|
"Type": "OS::Neutron::Port",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"name": "port2",
|
"name": "port2",
|
||||||
"network_id": { "Ref" : "network" }
|
"network_id": { "Ref" : "network" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"router": {
|
"router": {
|
||||||
"Type": "OS::Quantum::Router"
|
"Type": "OS::Neutron::Router"
|
||||||
},
|
},
|
||||||
"router_interface": {
|
"router_interface": {
|
||||||
"Type": "OS::Quantum::RouterInterface",
|
"Type": "OS::Neutron::RouterInterface",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"router_id": { "Ref" : "router" },
|
"router_id": { "Ref" : "router" },
|
||||||
"subnet_id": { "Ref" : "subnet" }
|
"subnet_id": { "Ref" : "subnet" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gateway": {
|
"gateway": {
|
||||||
"Type": "OS::Quantum::RouterGateway",
|
"Type": "OS::Neutron::RouterGateway",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"router_id": { "Ref" : "router" },
|
"router_id": { "Ref" : "router" },
|
||||||
"network_id": { "Ref" : "network" }
|
"network_id": { "Ref" : "network" }
|
||||||
@ -106,14 +106,14 @@ quantum_template = '''
|
|||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
quantum_floating_template = '''
|
neutron_floating_template = '''
|
||||||
{
|
{
|
||||||
"AWSTemplateFormatVersion" : "2010-09-09",
|
"AWSTemplateFormatVersion" : "2010-09-09",
|
||||||
"Description" : "Template to test Quantum resources",
|
"Description" : "Template to test Neutron resources",
|
||||||
"Parameters" : {},
|
"Parameters" : {},
|
||||||
"Resources" : {
|
"Resources" : {
|
||||||
"port_floating": {
|
"port_floating": {
|
||||||
"Type": "OS::Quantum::Port",
|
"Type": "OS::Neutron::Port",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"network_id": "xyz1234",
|
"network_id": "xyz1234",
|
||||||
"fixed_ips": [{
|
"fixed_ips": [{
|
||||||
@ -123,23 +123,23 @@ quantum_floating_template = '''
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"floating_ip": {
|
"floating_ip": {
|
||||||
"Type": "OS::Quantum::FloatingIP",
|
"Type": "OS::Neutron::FloatingIP",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"floating_network_id": "abcd1234",
|
"floating_network_id": "abcd1234",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"floating_ip_assoc": {
|
"floating_ip_assoc": {
|
||||||
"Type": "OS::Quantum::FloatingIPAssociation",
|
"Type": "OS::Neutron::FloatingIPAssociation",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"floatingip_id": { "Ref" : "floating_ip" },
|
"floatingip_id": { "Ref" : "floating_ip" },
|
||||||
"port_id": { "Ref" : "port_floating" }
|
"port_id": { "Ref" : "port_floating" }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"router": {
|
"router": {
|
||||||
"Type": "OS::Quantum::Router"
|
"Type": "OS::Neutron::Router"
|
||||||
},
|
},
|
||||||
"gateway": {
|
"gateway": {
|
||||||
"Type": "OS::Quantum::RouterGateway",
|
"Type": "OS::Neutron::RouterGateway",
|
||||||
"Properties": {
|
"Properties": {
|
||||||
"router_id": { "Ref" : "router" },
|
"router_id": { "Ref" : "router" },
|
||||||
"network_id": "abcd1234"
|
"network_id": "abcd1234"
|
||||||
@ -150,7 +150,7 @@ quantum_floating_template = '''
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
class QuantumTest(HeatTestCase):
|
class NeutronTest(HeatTestCase):
|
||||||
|
|
||||||
def test_validate_properties(self):
|
def test_validate_properties(self):
|
||||||
vs = {'router:external': True}
|
vs = {'router:external': True}
|
||||||
@ -205,14 +205,14 @@ class QuantumTest(HeatTestCase):
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@skipIf(quantumclient is None, 'quantumclient unavailable')
|
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||||
class QuantumNetTest(HeatTestCase):
|
class NeutronNetTest(HeatTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(QuantumNetTest, self).setUp()
|
super(NeutronNetTest, self).setUp()
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'create_network')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_network')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'delete_network')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_network')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'show_network')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_network')
|
||||||
self.m.StubOutWithMock(clients.OpenStackClients, 'keystone')
|
self.m.StubOutWithMock(clients.OpenStackClients, 'keystone')
|
||||||
setup_dummy_db()
|
setup_dummy_db()
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ class QuantumNetTest(HeatTestCase):
|
|||||||
def test_net(self):
|
def test_net(self):
|
||||||
clients.OpenStackClients.keystone().AndReturn(
|
clients.OpenStackClients.keystone().AndReturn(
|
||||||
fakes.FakeKeystoneClient())
|
fakes.FakeKeystoneClient())
|
||||||
quantumclient.Client.create_network({
|
neutronclient.Client.create_network({
|
||||||
'network': {'name': u'the_network', 'admin_state_up': True}
|
'network': {'name': u'the_network', 'admin_state_up': True}
|
||||||
}).AndReturn({"network": {
|
}).AndReturn({"network": {
|
||||||
"status": "BUILD",
|
"status": "BUILD",
|
||||||
@ -237,7 +237,7 @@ class QuantumNetTest(HeatTestCase):
|
|||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
|
|
||||||
quantumclient.Client.show_network(
|
neutronclient.Client.show_network(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndReturn({"network": {
|
).AndReturn({"network": {
|
||||||
"status": "BUILD",
|
"status": "BUILD",
|
||||||
@ -249,7 +249,7 @@ class QuantumNetTest(HeatTestCase):
|
|||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
|
|
||||||
quantumclient.Client.show_network(
|
neutronclient.Client.show_network(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndReturn({"network": {
|
).AndReturn({"network": {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
@ -261,11 +261,11 @@ class QuantumNetTest(HeatTestCase):
|
|||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
|
|
||||||
quantumclient.Client.show_network(
|
neutronclient.Client.show_network(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
|
|
||||||
quantumclient.Client.show_network(
|
neutronclient.Client.show_network(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndReturn({"network": {
|
).AndReturn({"network": {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
@ -277,7 +277,7 @@ class QuantumNetTest(HeatTestCase):
|
|||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
|
|
||||||
quantumclient.Client.show_network(
|
neutronclient.Client.show_network(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndReturn({"network": {
|
).AndReturn({"network": {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
@ -289,20 +289,20 @@ class QuantumNetTest(HeatTestCase):
|
|||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
|
|
||||||
quantumclient.Client.delete_network(
|
neutronclient.Client.delete_network(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndReturn(None)
|
).AndReturn(None)
|
||||||
|
|
||||||
quantumclient.Client.show_network(
|
neutronclient.Client.show_network(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
|
|
||||||
quantumclient.Client.delete_network(
|
neutronclient.Client.delete_network(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
t = template_format.parse(quantum_template)
|
t = template_format.parse(neutron_template)
|
||||||
stack = parse_stack(t)
|
stack = parse_stack(t)
|
||||||
rsrc = self.create_net(t, stack, 'network')
|
rsrc = self.create_net(t, stack, 'network')
|
||||||
|
|
||||||
@ -339,14 +339,14 @@ class QuantumNetTest(HeatTestCase):
|
|||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
|
||||||
|
|
||||||
@skipIf(quantumclient is None, 'quantumclient unavailable')
|
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||||
class QuantumSubnetTest(HeatTestCase):
|
class NeutronSubnetTest(HeatTestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(QuantumSubnetTest, self).setUp()
|
super(NeutronSubnetTest, self).setUp()
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'create_subnet')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_subnet')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'delete_subnet')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_subnet')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'show_subnet')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_subnet')
|
||||||
self.m.StubOutWithMock(clients.OpenStackClients, 'keystone')
|
self.m.StubOutWithMock(clients.OpenStackClients, 'keystone')
|
||||||
setup_dummy_db()
|
setup_dummy_db()
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ class QuantumSubnetTest(HeatTestCase):
|
|||||||
|
|
||||||
clients.OpenStackClients.keystone().AndReturn(
|
clients.OpenStackClients.keystone().AndReturn(
|
||||||
fakes.FakeKeystoneClient())
|
fakes.FakeKeystoneClient())
|
||||||
quantumclient.Client.create_subnet({
|
neutronclient.Client.create_subnet({
|
||||||
'subnet': {
|
'subnet': {
|
||||||
'name': utils.PhysName('test_stack', 'test_subnet'),
|
'name': utils.PhysName('test_stack', 'test_subnet'),
|
||||||
'network_id': u'None',
|
'network_id': u'None',
|
||||||
@ -386,9 +386,9 @@ class QuantumSubnetTest(HeatTestCase):
|
|||||||
"tenant_id": "c1210485b2424d48804aad5d39c61b8f"
|
"tenant_id": "c1210485b2424d48804aad5d39c61b8f"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
quantumclient.Client.show_subnet(
|
neutronclient.Client.show_subnet(
|
||||||
'91e47a57-7508-46fe-afc9-fc454e8580e1').AndRaise(
|
'91e47a57-7508-46fe-afc9-fc454e8580e1').AndRaise(
|
||||||
qe.QuantumClientException(status_code=404))
|
qe.NeutronClientException(status_code=404))
|
||||||
sn = {
|
sn = {
|
||||||
"subnet": {
|
"subnet": {
|
||||||
"name": "name",
|
"name": "name",
|
||||||
@ -404,27 +404,27 @@ class QuantumSubnetTest(HeatTestCase):
|
|||||||
"enable_dhcp": True,
|
"enable_dhcp": True,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
quantumclient.Client.show_subnet(
|
neutronclient.Client.show_subnet(
|
||||||
'91e47a57-7508-46fe-afc9-fc454e8580e1').AndReturn(sn)
|
'91e47a57-7508-46fe-afc9-fc454e8580e1').AndReturn(sn)
|
||||||
quantumclient.Client.show_subnet(
|
neutronclient.Client.show_subnet(
|
||||||
'91e47a57-7508-46fe-afc9-fc454e8580e1').AndReturn(sn)
|
'91e47a57-7508-46fe-afc9-fc454e8580e1').AndReturn(sn)
|
||||||
quantumclient.Client.show_subnet(
|
neutronclient.Client.show_subnet(
|
||||||
'91e47a57-7508-46fe-afc9-fc454e8580e1').AndReturn(sn)
|
'91e47a57-7508-46fe-afc9-fc454e8580e1').AndReturn(sn)
|
||||||
|
|
||||||
quantumclient.Client.delete_subnet(
|
neutronclient.Client.delete_subnet(
|
||||||
'91e47a57-7508-46fe-afc9-fc454e8580e1'
|
'91e47a57-7508-46fe-afc9-fc454e8580e1'
|
||||||
).AndReturn(None)
|
).AndReturn(None)
|
||||||
|
|
||||||
quantumclient.Client.show_subnet(
|
neutronclient.Client.show_subnet(
|
||||||
'91e47a57-7508-46fe-afc9-fc454e8580e1'
|
'91e47a57-7508-46fe-afc9-fc454e8580e1'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
|
|
||||||
quantumclient.Client.delete_subnet(
|
neutronclient.Client.delete_subnet(
|
||||||
'91e47a57-7508-46fe-afc9-fc454e8580e1'
|
'91e47a57-7508-46fe-afc9-fc454e8580e1'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
t = template_format.parse(quantum_template)
|
t = template_format.parse(neutron_template)
|
||||||
stack = parse_stack(t)
|
stack = parse_stack(t)
|
||||||
rsrc = self.create_subnet(t, stack, 'subnet')
|
rsrc = self.create_subnet(t, stack, 'subnet')
|
||||||
|
|
||||||
@ -457,7 +457,7 @@ class QuantumSubnetTest(HeatTestCase):
|
|||||||
|
|
||||||
clients.OpenStackClients.keystone().AndReturn(
|
clients.OpenStackClients.keystone().AndReturn(
|
||||||
fakes.FakeKeystoneClient())
|
fakes.FakeKeystoneClient())
|
||||||
quantumclient.Client.create_subnet({
|
neutronclient.Client.create_subnet({
|
||||||
'subnet': {
|
'subnet': {
|
||||||
'name': utils.PhysName('test_stack', 'test_subnet'),
|
'name': utils.PhysName('test_stack', 'test_subnet'),
|
||||||
'network_id': u'None',
|
'network_id': u'None',
|
||||||
@ -484,7 +484,7 @@ class QuantumSubnetTest(HeatTestCase):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
quantumclient.Client.show_subnet(
|
neutronclient.Client.show_subnet(
|
||||||
'91e47a57-7508-46fe-afc9-fc454e8580e1').AndReturn({
|
'91e47a57-7508-46fe-afc9-fc454e8580e1').AndReturn({
|
||||||
"subnet": {
|
"subnet": {
|
||||||
"name": "name",
|
"name": "name",
|
||||||
@ -501,16 +501,16 @@ class QuantumSubnetTest(HeatTestCase):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
quantumclient.Client.delete_subnet(
|
neutronclient.Client.delete_subnet(
|
||||||
'91e47a57-7508-46fe-afc9-fc454e8580e1'
|
'91e47a57-7508-46fe-afc9-fc454e8580e1'
|
||||||
).AndReturn(None)
|
).AndReturn(None)
|
||||||
|
|
||||||
quantumclient.Client.show_subnet(
|
neutronclient.Client.show_subnet(
|
||||||
'91e47a57-7508-46fe-afc9-fc454e8580e1'
|
'91e47a57-7508-46fe-afc9-fc454e8580e1'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
t = template_format.parse(quantum_template)
|
t = template_format.parse(neutron_template)
|
||||||
t['Resources']['subnet']['Properties']['enable_dhcp'] = 'False'
|
t['Resources']['subnet']['Properties']['enable_dhcp'] = 'False'
|
||||||
stack = parse_stack(t)
|
stack = parse_stack(t)
|
||||||
rsrc = self.create_subnet(t, stack, 'subnet')
|
rsrc = self.create_subnet(t, stack, 'subnet')
|
||||||
@ -524,17 +524,17 @@ class QuantumSubnetTest(HeatTestCase):
|
|||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
|
||||||
|
|
||||||
@skipIf(quantumclient is None, 'quantumclient unavailable')
|
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||||
class QuantumRouterTest(HeatTestCase):
|
class NeutronRouterTest(HeatTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(QuantumRouterTest, self).setUp()
|
super(NeutronRouterTest, self).setUp()
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'create_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'delete_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'show_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'add_interface_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'add_interface_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'remove_interface_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'remove_interface_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'add_gateway_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'add_gateway_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'remove_gateway_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'remove_gateway_router')
|
||||||
self.m.StubOutWithMock(clients.OpenStackClients, 'keystone')
|
self.m.StubOutWithMock(clients.OpenStackClients, 'keystone')
|
||||||
setup_dummy_db()
|
setup_dummy_db()
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ class QuantumRouterTest(HeatTestCase):
|
|||||||
def test_router(self):
|
def test_router(self):
|
||||||
clients.OpenStackClients.keystone().AndReturn(
|
clients.OpenStackClients.keystone().AndReturn(
|
||||||
fakes.FakeKeystoneClient())
|
fakes.FakeKeystoneClient())
|
||||||
quantumclient.Client.create_router({
|
neutronclient.Client.create_router({
|
||||||
'router': {
|
'router': {
|
||||||
'name': utils.PhysName('test_stack', 'router'),
|
'name': utils.PhysName('test_stack', 'router'),
|
||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
@ -582,7 +582,7 @@ class QuantumRouterTest(HeatTestCase):
|
|||||||
"id": "3e46229d-8fce-4733-819a-b5fe630550f8"
|
"id": "3e46229d-8fce-4733-819a-b5fe630550f8"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
quantumclient.Client.show_router(
|
neutronclient.Client.show_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8').AndReturn({
|
'3e46229d-8fce-4733-819a-b5fe630550f8').AndReturn({
|
||||||
"router": {
|
"router": {
|
||||||
"status": "BUILD",
|
"status": "BUILD",
|
||||||
@ -594,7 +594,7 @@ class QuantumRouterTest(HeatTestCase):
|
|||||||
"id": "3e46229d-8fce-4733-819a-b5fe630550f8"
|
"id": "3e46229d-8fce-4733-819a-b5fe630550f8"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
quantumclient.Client.show_router(
|
neutronclient.Client.show_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8').AndReturn({
|
'3e46229d-8fce-4733-819a-b5fe630550f8').AndReturn({
|
||||||
"router": {
|
"router": {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
@ -607,10 +607,10 @@ class QuantumRouterTest(HeatTestCase):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
quantumclient.Client.show_router(
|
neutronclient.Client.show_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8').AndRaise(
|
'3e46229d-8fce-4733-819a-b5fe630550f8').AndRaise(
|
||||||
qe.QuantumClientException(status_code=404))
|
qe.NeutronClientException(status_code=404))
|
||||||
quantumclient.Client.show_router(
|
neutronclient.Client.show_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8').AndReturn({
|
'3e46229d-8fce-4733-819a-b5fe630550f8').AndReturn({
|
||||||
"router": {
|
"router": {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
@ -622,7 +622,7 @@ class QuantumRouterTest(HeatTestCase):
|
|||||||
"id": "3e46229d-8fce-4733-819a-b5fe630550f8"
|
"id": "3e46229d-8fce-4733-819a-b5fe630550f8"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
quantumclient.Client.show_router(
|
neutronclient.Client.show_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8').AndReturn({
|
'3e46229d-8fce-4733-819a-b5fe630550f8').AndReturn({
|
||||||
"router": {
|
"router": {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
@ -635,20 +635,20 @@ class QuantumRouterTest(HeatTestCase):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
quantumclient.Client.delete_router(
|
neutronclient.Client.delete_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8'
|
'3e46229d-8fce-4733-819a-b5fe630550f8'
|
||||||
).AndReturn(None)
|
).AndReturn(None)
|
||||||
|
|
||||||
quantumclient.Client.show_router(
|
neutronclient.Client.show_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8'
|
'3e46229d-8fce-4733-819a-b5fe630550f8'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
|
|
||||||
quantumclient.Client.delete_router(
|
neutronclient.Client.delete_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8'
|
'3e46229d-8fce-4733-819a-b5fe630550f8'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
t = template_format.parse(quantum_template)
|
t = template_format.parse(neutron_template)
|
||||||
stack = parse_stack(t)
|
stack = parse_stack(t)
|
||||||
rsrc = self.create_router(t, stack, 'router')
|
rsrc = self.create_router(t, stack, 'router')
|
||||||
|
|
||||||
@ -674,20 +674,20 @@ class QuantumRouterTest(HeatTestCase):
|
|||||||
def test_router_interface(self):
|
def test_router_interface(self):
|
||||||
clients.OpenStackClients.keystone().AndReturn(
|
clients.OpenStackClients.keystone().AndReturn(
|
||||||
fakes.FakeKeystoneClient())
|
fakes.FakeKeystoneClient())
|
||||||
quantumclient.Client.add_interface_router(
|
neutronclient.Client.add_interface_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
||||||
{'subnet_id': '91e47a57-7508-46fe-afc9-fc454e8580e1'}
|
{'subnet_id': '91e47a57-7508-46fe-afc9-fc454e8580e1'}
|
||||||
).AndReturn(None)
|
).AndReturn(None)
|
||||||
quantumclient.Client.remove_interface_router(
|
neutronclient.Client.remove_interface_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
||||||
{'subnet_id': '91e47a57-7508-46fe-afc9-fc454e8580e1'}
|
{'subnet_id': '91e47a57-7508-46fe-afc9-fc454e8580e1'}
|
||||||
).AndReturn(None)
|
).AndReturn(None)
|
||||||
quantumclient.Client.remove_interface_router(
|
neutronclient.Client.remove_interface_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
||||||
{'subnet_id': '91e47a57-7508-46fe-afc9-fc454e8580e1'}
|
{'subnet_id': '91e47a57-7508-46fe-afc9-fc454e8580e1'}
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
t = template_format.parse(quantum_template)
|
t = template_format.parse(neutron_template)
|
||||||
stack = parse_stack(t)
|
stack = parse_stack(t)
|
||||||
|
|
||||||
rsrc = self.create_router_interface(
|
rsrc = self.create_router_interface(
|
||||||
@ -704,18 +704,18 @@ class QuantumRouterTest(HeatTestCase):
|
|||||||
def test_gateway_router(self):
|
def test_gateway_router(self):
|
||||||
clients.OpenStackClients.keystone().AndReturn(
|
clients.OpenStackClients.keystone().AndReturn(
|
||||||
fakes.FakeKeystoneClient())
|
fakes.FakeKeystoneClient())
|
||||||
quantumclient.Client.add_gateway_router(
|
neutronclient.Client.add_gateway_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
||||||
{'network_id': 'fc68ea2c-b60b-4b4f-bd82-94ec81110766'}
|
{'network_id': 'fc68ea2c-b60b-4b4f-bd82-94ec81110766'}
|
||||||
).AndReturn(None)
|
).AndReturn(None)
|
||||||
quantumclient.Client.remove_gateway_router(
|
neutronclient.Client.remove_gateway_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8'
|
'3e46229d-8fce-4733-819a-b5fe630550f8'
|
||||||
).AndReturn(None)
|
).AndReturn(None)
|
||||||
quantumclient.Client.remove_gateway_router(
|
neutronclient.Client.remove_gateway_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8'
|
'3e46229d-8fce-4733-819a-b5fe630550f8'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
t = template_format.parse(quantum_template)
|
t = template_format.parse(neutron_template)
|
||||||
stack = parse_stack(t)
|
stack = parse_stack(t)
|
||||||
|
|
||||||
rsrc = self.create_gateway_router(
|
rsrc = self.create_gateway_router(
|
||||||
@ -730,18 +730,18 @@ class QuantumRouterTest(HeatTestCase):
|
|||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
|
||||||
|
|
||||||
@skipIf(quantumclient is None, 'quantumclient unavailable')
|
@skipIf(neutronclient is None, 'neutronclient unavailable')
|
||||||
class QuantumFloatingIPTest(HeatTestCase):
|
class NeutronFloatingIPTest(HeatTestCase):
|
||||||
@skipIf(net.clients.quantumclient is None, "Missing Quantum Client")
|
@skipIf(net.clients.neutronclient is None, "Missing Neutron Client")
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(QuantumFloatingIPTest, self).setUp()
|
super(NeutronFloatingIPTest, self).setUp()
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'create_floatingip')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_floatingip')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'delete_floatingip')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_floatingip')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'show_floatingip')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_floatingip')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'update_floatingip')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_floatingip')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'create_port')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_port')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'delete_port')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_port')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'show_port')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_port')
|
||||||
self.m.StubOutWithMock(clients.OpenStackClients, 'keystone')
|
self.m.StubOutWithMock(clients.OpenStackClients, 'keystone')
|
||||||
setup_dummy_db()
|
setup_dummy_db()
|
||||||
|
|
||||||
@ -749,31 +749,31 @@ class QuantumFloatingIPTest(HeatTestCase):
|
|||||||
|
|
||||||
clients.OpenStackClients.keystone().AndReturn(
|
clients.OpenStackClients.keystone().AndReturn(
|
||||||
fakes.FakeKeystoneClient())
|
fakes.FakeKeystoneClient())
|
||||||
quantumclient.Client.create_floatingip({
|
neutronclient.Client.create_floatingip({
|
||||||
'floatingip': {'floating_network_id': u'abcd1234'}
|
'floatingip': {'floating_network_id': u'abcd1234'}
|
||||||
}).AndReturn({'floatingip': {
|
}).AndReturn({'floatingip': {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
|
|
||||||
quantumclient.Client.show_floatingip(
|
neutronclient.Client.show_floatingip(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
quantumclient.Client.show_floatingip(
|
neutronclient.Client.show_floatingip(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).MultipleTimes().AndReturn({'floatingip': {
|
).MultipleTimes().AndReturn({'floatingip': {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
|
|
||||||
quantumclient.Client.delete_floatingip(
|
neutronclient.Client.delete_floatingip(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766').AndReturn(None)
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766').AndReturn(None)
|
||||||
quantumclient.Client.delete_floatingip(
|
neutronclient.Client.delete_floatingip(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766').AndRaise(
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766').AndRaise(
|
||||||
qe.QuantumClientException(status_code=404))
|
qe.NeutronClientException(status_code=404))
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
t = template_format.parse(quantum_floating_template)
|
t = template_format.parse(neutron_floating_template)
|
||||||
stack = parse_stack(t)
|
stack = parse_stack(t)
|
||||||
|
|
||||||
# assert the implicit dependency between the floating_ip
|
# assert the implicit dependency between the floating_ip
|
||||||
@ -811,7 +811,7 @@ class QuantumFloatingIPTest(HeatTestCase):
|
|||||||
|
|
||||||
clients.OpenStackClients.keystone().AndReturn(
|
clients.OpenStackClients.keystone().AndReturn(
|
||||||
fakes.FakeKeystoneClient())
|
fakes.FakeKeystoneClient())
|
||||||
quantumclient.Client.create_port({'port': {
|
neutronclient.Client.create_port({'port': {
|
||||||
'network_id': u'xyz1234',
|
'network_id': u'xyz1234',
|
||||||
'fixed_ips': [
|
'fixed_ips': [
|
||||||
{'subnet_id': u'12.12.12.0', 'ip_address': u'10.0.0.10'}
|
{'subnet_id': u'12.12.12.0', 'ip_address': u'10.0.0.10'}
|
||||||
@ -822,22 +822,22 @@ class QuantumFloatingIPTest(HeatTestCase):
|
|||||||
"status": "BUILD",
|
"status": "BUILD",
|
||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
quantumclient.Client.show_port(
|
neutronclient.Client.show_port(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndReturn({'port': {
|
).AndReturn({'port': {
|
||||||
"status": "BUILD",
|
"status": "BUILD",
|
||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
quantumclient.Client.show_port(
|
neutronclient.Client.show_port(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndReturn({'port': {
|
).AndReturn({'port': {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
quantumclient.Client.show_port(
|
neutronclient.Client.show_port(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
quantumclient.Client.show_port(
|
neutronclient.Client.show_port(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).MultipleTimes().AndReturn({'port': {
|
).MultipleTimes().AndReturn({'port': {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
@ -846,7 +846,7 @@ class QuantumFloatingIPTest(HeatTestCase):
|
|||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
t = template_format.parse(quantum_floating_template)
|
t = template_format.parse(neutron_floating_template)
|
||||||
stack = parse_stack(t)
|
stack = parse_stack(t)
|
||||||
|
|
||||||
p = stack['port_floating']
|
p = stack['port_floating']
|
||||||
@ -877,14 +877,14 @@ class QuantumFloatingIPTest(HeatTestCase):
|
|||||||
|
|
||||||
clients.OpenStackClients.keystone().AndReturn(
|
clients.OpenStackClients.keystone().AndReturn(
|
||||||
fakes.FakeKeystoneClient())
|
fakes.FakeKeystoneClient())
|
||||||
quantumclient.Client.create_floatingip({
|
neutronclient.Client.create_floatingip({
|
||||||
'floatingip': {'floating_network_id': u'abcd1234'}
|
'floatingip': {'floating_network_id': u'abcd1234'}
|
||||||
}).AndReturn({'floatingip': {
|
}).AndReturn({'floatingip': {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
|
|
||||||
quantumclient.Client.create_port({'port': {
|
neutronclient.Client.create_port({'port': {
|
||||||
'network_id': u'xyz1234',
|
'network_id': u'xyz1234',
|
||||||
'fixed_ips': [
|
'fixed_ips': [
|
||||||
{'subnet_id': u'12.12.12.0', 'ip_address': u'10.0.0.10'}
|
{'subnet_id': u'12.12.12.0', 'ip_address': u'10.0.0.10'}
|
||||||
@ -895,13 +895,13 @@ class QuantumFloatingIPTest(HeatTestCase):
|
|||||||
"status": "BUILD",
|
"status": "BUILD",
|
||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
quantumclient.Client.show_port(
|
neutronclient.Client.show_port(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndReturn({'port': {
|
).AndReturn({'port': {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
quantumclient.Client.update_floatingip(
|
neutronclient.Client.update_floatingip(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
|
||||||
{
|
{
|
||||||
'floatingip': {
|
'floatingip': {
|
||||||
@ -911,41 +911,41 @@ class QuantumFloatingIPTest(HeatTestCase):
|
|||||||
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
"id": "fc68ea2c-b60b-4b4f-bd82-94ec81110766"
|
||||||
}})
|
}})
|
||||||
|
|
||||||
quantumclient.Client.update_floatingip(
|
neutronclient.Client.update_floatingip(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
|
||||||
{'floatingip': {
|
{'floatingip': {
|
||||||
'port_id': None
|
'port_id': None
|
||||||
}}).AndReturn(None)
|
}}).AndReturn(None)
|
||||||
|
|
||||||
quantumclient.Client.delete_port(
|
neutronclient.Client.delete_port(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndReturn(None)
|
).AndReturn(None)
|
||||||
|
|
||||||
quantumclient.Client.show_port(
|
neutronclient.Client.show_port(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
|
|
||||||
quantumclient.Client.delete_floatingip(
|
neutronclient.Client.delete_floatingip(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndReturn(None)
|
).AndReturn(None)
|
||||||
|
|
||||||
quantumclient.Client.update_floatingip(
|
neutronclient.Client.update_floatingip(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
|
||||||
{'floatingip': {
|
{'floatingip': {
|
||||||
'port_id': None
|
'port_id': None
|
||||||
}}).AndRaise(qe.QuantumClientException(status_code=404))
|
}}).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
|
|
||||||
quantumclient.Client.delete_port(
|
neutronclient.Client.delete_port(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
|
|
||||||
quantumclient.Client.delete_floatingip(
|
neutronclient.Client.delete_floatingip(
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
||||||
).AndRaise(qe.QuantumClientException(status_code=404))
|
).AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
t = template_format.parse(quantum_floating_template)
|
t = template_format.parse(neutron_floating_template)
|
||||||
stack = parse_stack(t)
|
stack = parse_stack(t)
|
||||||
|
|
||||||
fip = stack['floating_ip']
|
fip = stack['floating_ip']
|
@ -28,8 +28,8 @@ from heat.tests.utils import stack_delete_after
|
|||||||
|
|
||||||
from novaclient.v1_1 import security_groups as nova_sg
|
from novaclient.v1_1 import security_groups as nova_sg
|
||||||
from novaclient.v1_1 import security_group_rules as nova_sgr
|
from novaclient.v1_1 import security_group_rules as nova_sgr
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
from quantumclient.v2_0 import client as quantumclient
|
from neutronclient.v2_0 import client as neutronclient
|
||||||
|
|
||||||
NovaSG = collections.namedtuple('NovaSG',
|
NovaSG = collections.namedtuple('NovaSG',
|
||||||
' '.join([
|
' '.join([
|
||||||
@ -60,7 +60,7 @@ Resources:
|
|||||||
CidrIp : 0.0.0.0/0
|
CidrIp : 0.0.0.0/0
|
||||||
'''
|
'''
|
||||||
|
|
||||||
test_template_quantum = '''
|
test_template_neutron = '''
|
||||||
HeatTemplateFormatVersion: '2012-12-12'
|
HeatTemplateFormatVersion: '2012-12-12'
|
||||||
Resources:
|
Resources:
|
||||||
the_sg:
|
the_sg:
|
||||||
@ -96,13 +96,13 @@ Resources:
|
|||||||
self.m.StubOutWithMock(nova_sg.SecurityGroupManager, 'get')
|
self.m.StubOutWithMock(nova_sg.SecurityGroupManager, 'get')
|
||||||
self.m.StubOutWithMock(nova_sg.SecurityGroupManager, 'list')
|
self.m.StubOutWithMock(nova_sg.SecurityGroupManager, 'list')
|
||||||
setup_dummy_db()
|
setup_dummy_db()
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'create_security_group')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_security_group')
|
||||||
self.m.StubOutWithMock(
|
self.m.StubOutWithMock(
|
||||||
quantumclient.Client, 'create_security_group_rule')
|
neutronclient.Client, 'create_security_group_rule')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'show_security_group')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_security_group')
|
||||||
self.m.StubOutWithMock(
|
self.m.StubOutWithMock(
|
||||||
quantumclient.Client, 'delete_security_group_rule')
|
neutronclient.Client, 'delete_security_group_rule')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'delete_security_group')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_security_group')
|
||||||
|
|
||||||
def create_stack(self, template):
|
def create_stack(self, template):
|
||||||
t = template_format.parse(template)
|
t = template_format.parse(template)
|
||||||
@ -275,12 +275,12 @@ Resources:
|
|||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
|
||||||
@stack_delete_after
|
@stack_delete_after
|
||||||
def test_security_group_quantum(self):
|
def test_security_group_neutron(self):
|
||||||
#create script
|
#create script
|
||||||
clients.OpenStackClients.keystone().AndReturn(
|
clients.OpenStackClients.keystone().AndReturn(
|
||||||
FakeKeystoneClient())
|
FakeKeystoneClient())
|
||||||
sg_name = utils.PhysName('test_stack', 'the_sg')
|
sg_name = utils.PhysName('test_stack', 'the_sg')
|
||||||
quantumclient.Client.create_security_group({
|
neutronclient.Client.create_security_group({
|
||||||
'security_group': {
|
'security_group': {
|
||||||
'name': sg_name,
|
'name': sg_name,
|
||||||
'description': 'HTTP and SSH access'
|
'description': 'HTTP and SSH access'
|
||||||
@ -295,7 +295,7 @@ Resources:
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
quantumclient.Client.create_security_group_rule({
|
neutronclient.Client.create_security_group_rule({
|
||||||
'security_group_rule': {
|
'security_group_rule': {
|
||||||
'direction': 'ingress',
|
'direction': 'ingress',
|
||||||
'remote_ip_prefix': '0.0.0.0/0',
|
'remote_ip_prefix': '0.0.0.0/0',
|
||||||
@ -317,7 +317,7 @@ Resources:
|
|||||||
'id': 'bbbb'
|
'id': 'bbbb'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
quantumclient.Client.create_security_group_rule({
|
neutronclient.Client.create_security_group_rule({
|
||||||
'security_group_rule': {
|
'security_group_rule': {
|
||||||
'direction': 'ingress',
|
'direction': 'ingress',
|
||||||
'remote_ip_prefix': '0.0.0.0/0',
|
'remote_ip_prefix': '0.0.0.0/0',
|
||||||
@ -339,7 +339,7 @@ Resources:
|
|||||||
'id': 'cccc'
|
'id': 'cccc'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
quantumclient.Client.create_security_group_rule({
|
neutronclient.Client.create_security_group_rule({
|
||||||
'security_group_rule': {
|
'security_group_rule': {
|
||||||
'direction': 'egress',
|
'direction': 'egress',
|
||||||
'remote_ip_prefix': '10.0.1.0/24',
|
'remote_ip_prefix': '10.0.1.0/24',
|
||||||
@ -363,7 +363,7 @@ Resources:
|
|||||||
})
|
})
|
||||||
|
|
||||||
# delete script
|
# delete script
|
||||||
quantumclient.Client.show_security_group('aaaa').AndReturn({
|
neutronclient.Client.show_security_group('aaaa').AndReturn({
|
||||||
'security_group': {
|
'security_group': {
|
||||||
'tenant_id': 'f18ca530cc05425e8bac0a5ff92f7e88',
|
'tenant_id': 'f18ca530cc05425e8bac0a5ff92f7e88',
|
||||||
'name': 'sc1',
|
'name': 'sc1',
|
||||||
@ -400,13 +400,13 @@ Resources:
|
|||||||
'port_range_min': 22
|
'port_range_min': 22
|
||||||
}],
|
}],
|
||||||
'id': 'aaaa'}})
|
'id': 'aaaa'}})
|
||||||
quantumclient.Client.delete_security_group_rule('bbbb').AndReturn(None)
|
neutronclient.Client.delete_security_group_rule('bbbb').AndReturn(None)
|
||||||
quantumclient.Client.delete_security_group_rule('cccc').AndReturn(None)
|
neutronclient.Client.delete_security_group_rule('cccc').AndReturn(None)
|
||||||
quantumclient.Client.delete_security_group_rule('dddd').AndReturn(None)
|
neutronclient.Client.delete_security_group_rule('dddd').AndReturn(None)
|
||||||
quantumclient.Client.delete_security_group('aaaa').AndReturn(None)
|
neutronclient.Client.delete_security_group('aaaa').AndReturn(None)
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
stack = self.create_stack(self.test_template_quantum)
|
stack = self.create_stack(self.test_template_neutron)
|
||||||
|
|
||||||
sg = stack['the_sg']
|
sg = stack['the_sg']
|
||||||
self.assertRaises(resource.UpdateReplace, sg.handle_update, {}, {}, {})
|
self.assertRaises(resource.UpdateReplace, sg.handle_update, {}, {}, {})
|
||||||
@ -417,12 +417,12 @@ Resources:
|
|||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
|
||||||
@stack_delete_after
|
@stack_delete_after
|
||||||
def test_security_group_quantum_exception(self):
|
def test_security_group_neutron_exception(self):
|
||||||
#create script
|
#create script
|
||||||
clients.OpenStackClients.keystone().AndReturn(
|
clients.OpenStackClients.keystone().AndReturn(
|
||||||
FakeKeystoneClient())
|
FakeKeystoneClient())
|
||||||
sg_name = utils.PhysName('test_stack', 'the_sg')
|
sg_name = utils.PhysName('test_stack', 'the_sg')
|
||||||
quantumclient.Client.create_security_group({
|
neutronclient.Client.create_security_group({
|
||||||
'security_group': {
|
'security_group': {
|
||||||
'name': sg_name,
|
'name': sg_name,
|
||||||
'description': 'HTTP and SSH access'
|
'description': 'HTTP and SSH access'
|
||||||
@ -437,7 +437,7 @@ Resources:
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
quantumclient.Client.create_security_group_rule({
|
neutronclient.Client.create_security_group_rule({
|
||||||
'security_group_rule': {
|
'security_group_rule': {
|
||||||
'direction': 'ingress',
|
'direction': 'ingress',
|
||||||
'remote_ip_prefix': '0.0.0.0/0',
|
'remote_ip_prefix': '0.0.0.0/0',
|
||||||
@ -448,8 +448,8 @@ Resources:
|
|||||||
'security_group_id': 'aaaa'
|
'security_group_id': 'aaaa'
|
||||||
}
|
}
|
||||||
}).AndRaise(
|
}).AndRaise(
|
||||||
QuantumClientException(status_code=409))
|
NeutronClientException(status_code=409))
|
||||||
quantumclient.Client.create_security_group_rule({
|
neutronclient.Client.create_security_group_rule({
|
||||||
'security_group_rule': {
|
'security_group_rule': {
|
||||||
'direction': 'ingress',
|
'direction': 'ingress',
|
||||||
'remote_ip_prefix': '0.0.0.0/0',
|
'remote_ip_prefix': '0.0.0.0/0',
|
||||||
@ -460,8 +460,8 @@ Resources:
|
|||||||
'security_group_id': 'aaaa'
|
'security_group_id': 'aaaa'
|
||||||
}
|
}
|
||||||
}).AndRaise(
|
}).AndRaise(
|
||||||
QuantumClientException(status_code=409))
|
NeutronClientException(status_code=409))
|
||||||
quantumclient.Client.create_security_group_rule({
|
neutronclient.Client.create_security_group_rule({
|
||||||
'security_group_rule': {
|
'security_group_rule': {
|
||||||
'direction': 'egress',
|
'direction': 'egress',
|
||||||
'remote_ip_prefix': '10.0.1.0/24',
|
'remote_ip_prefix': '10.0.1.0/24',
|
||||||
@ -472,10 +472,10 @@ Resources:
|
|||||||
'security_group_id': 'aaaa'
|
'security_group_id': 'aaaa'
|
||||||
}
|
}
|
||||||
}).AndRaise(
|
}).AndRaise(
|
||||||
QuantumClientException(status_code=409))
|
NeutronClientException(status_code=409))
|
||||||
|
|
||||||
# delete script
|
# delete script
|
||||||
quantumclient.Client.show_security_group('aaaa').AndReturn({
|
neutronclient.Client.show_security_group('aaaa').AndReturn({
|
||||||
'security_group': {
|
'security_group': {
|
||||||
'tenant_id': 'f18ca530cc05425e8bac0a5ff92f7e88',
|
'tenant_id': 'f18ca530cc05425e8bac0a5ff92f7e88',
|
||||||
'name': 'sc1',
|
'name': 'sc1',
|
||||||
@ -512,20 +512,20 @@ Resources:
|
|||||||
'port_range_min': 22
|
'port_range_min': 22
|
||||||
}],
|
}],
|
||||||
'id': 'aaaa'}})
|
'id': 'aaaa'}})
|
||||||
quantumclient.Client.delete_security_group_rule('bbbb').AndRaise(
|
neutronclient.Client.delete_security_group_rule('bbbb').AndRaise(
|
||||||
QuantumClientException(status_code=404))
|
NeutronClientException(status_code=404))
|
||||||
quantumclient.Client.delete_security_group_rule('cccc').AndRaise(
|
neutronclient.Client.delete_security_group_rule('cccc').AndRaise(
|
||||||
QuantumClientException(status_code=404))
|
NeutronClientException(status_code=404))
|
||||||
quantumclient.Client.delete_security_group_rule('dddd').AndRaise(
|
neutronclient.Client.delete_security_group_rule('dddd').AndRaise(
|
||||||
QuantumClientException(status_code=404))
|
NeutronClientException(status_code=404))
|
||||||
quantumclient.Client.delete_security_group('aaaa').AndRaise(
|
neutronclient.Client.delete_security_group('aaaa').AndRaise(
|
||||||
QuantumClientException(status_code=404))
|
NeutronClientException(status_code=404))
|
||||||
|
|
||||||
quantumclient.Client.show_security_group('aaaa').AndRaise(
|
neutronclient.Client.show_security_group('aaaa').AndRaise(
|
||||||
QuantumClientException(status_code=404))
|
NeutronClientException(status_code=404))
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
stack = self.create_stack(self.test_template_quantum)
|
stack = self.create_stack(self.test_template_neutron)
|
||||||
|
|
||||||
sg = stack['the_sg']
|
sg = stack['the_sg']
|
||||||
self.assertRaises(resource.UpdateReplace, sg.handle_update, {}, {}, {})
|
self.assertRaises(resource.UpdateReplace, sg.handle_update, {}, {}, {})
|
||||||
|
@ -151,9 +151,9 @@ class JsonYamlResolvedCompareTest(HeatTestCase):
|
|||||||
for key in stack1.resources:
|
for key in stack1.resources:
|
||||||
self.assertEqual(stack1.resources[key].t, stack2.resources[key].t)
|
self.assertEqual(stack1.resources[key].t, stack2.resources[key].t)
|
||||||
|
|
||||||
@skipIf(clients.quantumclient is None, 'quantumclient unavailable')
|
@skipIf(clients.neutronclient is None, 'neutronclient unavailable')
|
||||||
def test_quantum_resolved(self):
|
def test_neutron_resolved(self):
|
||||||
self.compare_stacks('Quantum.template', 'Quantum.yaml', {})
|
self.compare_stacks('Neutron.template', 'Neutron.yaml', {})
|
||||||
|
|
||||||
def test_wordpress_resolved(self):
|
def test_wordpress_resolved(self):
|
||||||
self.compare_stacks('WordPress_Single_Instance.template',
|
self.compare_stacks('WordPress_Single_Instance.template',
|
||||||
|
@ -26,42 +26,42 @@ from heat.tests.utils import dummy_context
|
|||||||
from heat.tests.utils import setup_dummy_db
|
from heat.tests.utils import setup_dummy_db
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from quantumclient.common.exceptions import QuantumClientException
|
from neutronclient.common.exceptions import NeutronClientException
|
||||||
from quantumclient.v2_0 import client as quantumclient
|
from neutronclient.v2_0 import client as neutronclient
|
||||||
except ImportError:
|
except ImportError:
|
||||||
quantumclient = None
|
neutronclient = None
|
||||||
|
|
||||||
|
|
||||||
class VPCTestBase(HeatTestCase):
|
class VPCTestBase(HeatTestCase):
|
||||||
|
|
||||||
@skipIf(quantumclient is None, 'quantumclient unavaialble')
|
@skipIf(neutronclient is None, 'neutronclient unavaialble')
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(VPCTestBase, self).setUp()
|
super(VPCTestBase, self).setUp()
|
||||||
setup_dummy_db()
|
setup_dummy_db()
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'add_interface_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'add_interface_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'add_gateway_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'add_gateway_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'create_network')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_network')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'create_port')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_port')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'create_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'create_subnet')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_subnet')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'delete_network')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_network')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'delete_port')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_port')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'delete_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'delete_subnet')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_subnet')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'list_networks')
|
self.m.StubOutWithMock(neutronclient.Client, 'list_networks')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'list_routers')
|
self.m.StubOutWithMock(neutronclient.Client, 'list_routers')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'remove_gateway_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'remove_gateway_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'remove_interface_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'remove_interface_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'show_subnet')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_subnet')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'show_network')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_network')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'show_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_router')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'create_security_group')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_security_group')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'show_security_group')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_security_group')
|
||||||
self.m.StubOutWithMock(quantumclient.Client, 'delete_security_group')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_security_group')
|
||||||
self.m.StubOutWithMock(
|
self.m.StubOutWithMock(
|
||||||
quantumclient.Client, 'create_security_group_rule')
|
neutronclient.Client, 'create_security_group_rule')
|
||||||
self.m.StubOutWithMock(
|
self.m.StubOutWithMock(
|
||||||
quantumclient.Client, 'delete_security_group_rule')
|
neutronclient.Client, 'delete_security_group_rule')
|
||||||
self.m.StubOutWithMock(clients.OpenStackClients, 'keystone')
|
self.m.StubOutWithMock(clients.OpenStackClients, 'keystone')
|
||||||
|
|
||||||
def create_stack(self, template):
|
def create_stack(self, template):
|
||||||
@ -83,7 +83,7 @@ class VPCTestBase(HeatTestCase):
|
|||||||
|
|
||||||
def mock_create_network(self):
|
def mock_create_network(self):
|
||||||
self.vpc_name = utils.PhysName('test_stack', 'the_vpc')
|
self.vpc_name = utils.PhysName('test_stack', 'the_vpc')
|
||||||
quantumclient.Client.create_network(
|
neutronclient.Client.create_network(
|
||||||
{
|
{
|
||||||
'network': {'name': self.vpc_name}
|
'network': {'name': self.vpc_name}
|
||||||
}).AndReturn({'network': {
|
}).AndReturn({'network': {
|
||||||
@ -95,7 +95,7 @@ class VPCTestBase(HeatTestCase):
|
|||||||
'tenant_id': 'c1210485b2424d48804aad5d39c61b8f',
|
'tenant_id': 'c1210485b2424d48804aad5d39c61b8f',
|
||||||
'id': 'aaaa'
|
'id': 'aaaa'
|
||||||
}})
|
}})
|
||||||
quantumclient.Client.show_network(
|
neutronclient.Client.show_network(
|
||||||
'aaaa'
|
'aaaa'
|
||||||
).AndReturn({"network": {
|
).AndReturn({"network": {
|
||||||
"status": "BUILD",
|
"status": "BUILD",
|
||||||
@ -107,7 +107,7 @@ class VPCTestBase(HeatTestCase):
|
|||||||
"id": "aaaa"
|
"id": "aaaa"
|
||||||
}})
|
}})
|
||||||
|
|
||||||
quantumclient.Client.show_network(
|
neutronclient.Client.show_network(
|
||||||
'aaaa'
|
'aaaa'
|
||||||
).MultipleTimes().AndReturn({"network": {
|
).MultipleTimes().AndReturn({"network": {
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
@ -118,7 +118,7 @@ class VPCTestBase(HeatTestCase):
|
|||||||
"tenant_id": "c1210485b2424d48804aad5d39c61b8f",
|
"tenant_id": "c1210485b2424d48804aad5d39c61b8f",
|
||||||
"id": "aaaa"
|
"id": "aaaa"
|
||||||
}})
|
}})
|
||||||
quantumclient.Client.create_router(
|
neutronclient.Client.create_router(
|
||||||
{'router': {'name': self.vpc_name}}).AndReturn({
|
{'router': {'name': self.vpc_name}}).AndReturn({
|
||||||
'router': {
|
'router': {
|
||||||
'status': 'BUILD',
|
'status': 'BUILD',
|
||||||
@ -127,7 +127,7 @@ class VPCTestBase(HeatTestCase):
|
|||||||
'tenant_id': 'c1210485b2424d48804aad5d39c61b8f',
|
'tenant_id': 'c1210485b2424d48804aad5d39c61b8f',
|
||||||
'id': 'bbbb'
|
'id': 'bbbb'
|
||||||
}})
|
}})
|
||||||
quantumclient.Client.list_routers(name=self.vpc_name).AndReturn({
|
neutronclient.Client.list_routers(name=self.vpc_name).AndReturn({
|
||||||
"routers": [{
|
"routers": [{
|
||||||
"status": "BUILD",
|
"status": "BUILD",
|
||||||
"external_gateway_info": None,
|
"external_gateway_info": None,
|
||||||
@ -142,7 +142,7 @@ class VPCTestBase(HeatTestCase):
|
|||||||
|
|
||||||
def mock_create_subnet(self):
|
def mock_create_subnet(self):
|
||||||
self.subnet_name = utils.PhysName('test_stack', 'the_subnet')
|
self.subnet_name = utils.PhysName('test_stack', 'the_subnet')
|
||||||
quantumclient.Client.create_subnet(
|
neutronclient.Client.create_subnet(
|
||||||
{'subnet': {
|
{'subnet': {
|
||||||
'network_id': u'aaaa',
|
'network_id': u'aaaa',
|
||||||
'cidr': u'10.0.0.0/24',
|
'cidr': u'10.0.0.0/24',
|
||||||
@ -155,12 +155,12 @@ class VPCTestBase(HeatTestCase):
|
|||||||
'tenant_id': 'c1210485b2424d48804aad5d39c61b8f',
|
'tenant_id': 'c1210485b2424d48804aad5d39c61b8f',
|
||||||
'id': 'cccc'}})
|
'id': 'cccc'}})
|
||||||
self.mock_router_for_vpc()
|
self.mock_router_for_vpc()
|
||||||
quantumclient.Client.add_interface_router(
|
neutronclient.Client.add_interface_router(
|
||||||
u'bbbb',
|
u'bbbb',
|
||||||
{'subnet_id': 'cccc'}).AndReturn(None)
|
{'subnet_id': 'cccc'}).AndReturn(None)
|
||||||
|
|
||||||
def mock_show_subnet(self):
|
def mock_show_subnet(self):
|
||||||
quantumclient.Client.show_subnet('cccc').AndReturn({
|
neutronclient.Client.show_subnet('cccc').AndReturn({
|
||||||
'subnet': {
|
'subnet': {
|
||||||
'name': self.subnet_name,
|
'name': self.subnet_name,
|
||||||
'network_id': 'aaaa',
|
'network_id': 'aaaa',
|
||||||
@ -176,7 +176,7 @@ class VPCTestBase(HeatTestCase):
|
|||||||
|
|
||||||
def mock_create_security_group(self):
|
def mock_create_security_group(self):
|
||||||
self.sg_name = utils.PhysName('test_stack', 'the_sg')
|
self.sg_name = utils.PhysName('test_stack', 'the_sg')
|
||||||
quantumclient.Client.create_security_group({
|
neutronclient.Client.create_security_group({
|
||||||
'security_group': {
|
'security_group': {
|
||||||
'name': self.sg_name,
|
'name': self.sg_name,
|
||||||
'description': 'SSH access'
|
'description': 'SSH access'
|
||||||
@ -191,7 +191,7 @@ class VPCTestBase(HeatTestCase):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
quantumclient.Client.create_security_group_rule({
|
neutronclient.Client.create_security_group_rule({
|
||||||
'security_group_rule': {
|
'security_group_rule': {
|
||||||
'direction': 'ingress',
|
'direction': 'ingress',
|
||||||
'remote_ip_prefix': '0.0.0.0/0',
|
'remote_ip_prefix': '0.0.0.0/0',
|
||||||
@ -216,7 +216,7 @@ class VPCTestBase(HeatTestCase):
|
|||||||
|
|
||||||
def mock_delete_security_group(self):
|
def mock_delete_security_group(self):
|
||||||
sg_name = utils.PhysName('test_stack', 'the_sg')
|
sg_name = utils.PhysName('test_stack', 'the_sg')
|
||||||
quantumclient.Client.show_security_group('eeee').AndReturn({
|
neutronclient.Client.show_security_group('eeee').AndReturn({
|
||||||
'security_group': {
|
'security_group': {
|
||||||
'tenant_id': 'c1210485b2424d48804aad5d39c61b8f',
|
'tenant_id': 'c1210485b2424d48804aad5d39c61b8f',
|
||||||
'name': sg_name,
|
'name': sg_name,
|
||||||
@ -233,11 +233,11 @@ class VPCTestBase(HeatTestCase):
|
|||||||
'port_range_min': 22
|
'port_range_min': 22
|
||||||
}],
|
}],
|
||||||
'id': 'eeee'}})
|
'id': 'eeee'}})
|
||||||
quantumclient.Client.delete_security_group_rule('bbbb').AndReturn(None)
|
neutronclient.Client.delete_security_group_rule('bbbb').AndReturn(None)
|
||||||
quantumclient.Client.delete_security_group('eeee').AndReturn(None)
|
neutronclient.Client.delete_security_group('eeee').AndReturn(None)
|
||||||
|
|
||||||
def mock_router_for_vpc(self):
|
def mock_router_for_vpc(self):
|
||||||
quantumclient.Client.list_routers(name=self.vpc_name).AndReturn({
|
neutronclient.Client.list_routers(name=self.vpc_name).AndReturn({
|
||||||
"routers": [{
|
"routers": [{
|
||||||
"status": "ACTIVE",
|
"status": "ACTIVE",
|
||||||
"external_gateway_info": {
|
"external_gateway_info": {
|
||||||
@ -253,19 +253,19 @@ class VPCTestBase(HeatTestCase):
|
|||||||
|
|
||||||
def mock_delete_network(self):
|
def mock_delete_network(self):
|
||||||
self.mock_router_for_vpc()
|
self.mock_router_for_vpc()
|
||||||
quantumclient.Client.delete_router('bbbb').AndReturn(None)
|
neutronclient.Client.delete_router('bbbb').AndReturn(None)
|
||||||
quantumclient.Client.delete_network('aaaa').AndReturn(None)
|
neutronclient.Client.delete_network('aaaa').AndReturn(None)
|
||||||
|
|
||||||
def mock_delete_subnet(self):
|
def mock_delete_subnet(self):
|
||||||
self.mock_router_for_vpc()
|
self.mock_router_for_vpc()
|
||||||
quantumclient.Client.remove_interface_router(
|
neutronclient.Client.remove_interface_router(
|
||||||
u'bbbb',
|
u'bbbb',
|
||||||
{'subnet_id': 'cccc'}).AndReturn(None)
|
{'subnet_id': 'cccc'}).AndReturn(None)
|
||||||
quantumclient.Client.delete_subnet('cccc').AndReturn(None)
|
neutronclient.Client.delete_subnet('cccc').AndReturn(None)
|
||||||
|
|
||||||
def mock_create_route_table(self):
|
def mock_create_route_table(self):
|
||||||
self.rt_name = utils.PhysName('test_stack', 'the_route_table')
|
self.rt_name = utils.PhysName('test_stack', 'the_route_table')
|
||||||
quantumclient.Client.create_router({
|
neutronclient.Client.create_router({
|
||||||
'router': {'name': self.rt_name}}).AndReturn({
|
'router': {'name': self.rt_name}}).AndReturn({
|
||||||
'router': {
|
'router': {
|
||||||
'status': 'BUILD',
|
'status': 'BUILD',
|
||||||
@ -275,7 +275,7 @@ class VPCTestBase(HeatTestCase):
|
|||||||
'id': 'ffff'
|
'id': 'ffff'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
quantumclient.Client.show_router('ffff').AndReturn({
|
neutronclient.Client.show_router('ffff').AndReturn({
|
||||||
'router': {
|
'router': {
|
||||||
'status': 'BUILD',
|
'status': 'BUILD',
|
||||||
'name': self.rt_name,
|
'name': self.rt_name,
|
||||||
@ -284,7 +284,7 @@ class VPCTestBase(HeatTestCase):
|
|||||||
'id': 'ffff'
|
'id': 'ffff'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
quantumclient.Client.show_router('ffff').AndReturn({
|
neutronclient.Client.show_router('ffff').AndReturn({
|
||||||
'router': {
|
'router': {
|
||||||
'status': 'ACTIVE',
|
'status': 'ACTIVE',
|
||||||
'name': self.rt_name,
|
'name': self.rt_name,
|
||||||
@ -294,32 +294,32 @@ class VPCTestBase(HeatTestCase):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
self.mock_router_for_vpc()
|
self.mock_router_for_vpc()
|
||||||
quantumclient.Client.add_gateway_router(
|
neutronclient.Client.add_gateway_router(
|
||||||
'ffff', {'network_id': 'zzzz'}).AndReturn(None)
|
'ffff', {'network_id': 'zzzz'}).AndReturn(None)
|
||||||
|
|
||||||
def mock_create_association(self):
|
def mock_create_association(self):
|
||||||
self.mock_show_subnet()
|
self.mock_show_subnet()
|
||||||
self.mock_router_for_vpc()
|
self.mock_router_for_vpc()
|
||||||
quantumclient.Client.remove_interface_router(
|
neutronclient.Client.remove_interface_router(
|
||||||
'bbbb',
|
'bbbb',
|
||||||
{'subnet_id': u'cccc'}).AndReturn(None)
|
{'subnet_id': u'cccc'}).AndReturn(None)
|
||||||
quantumclient.Client.add_interface_router(
|
neutronclient.Client.add_interface_router(
|
||||||
u'ffff',
|
u'ffff',
|
||||||
{'subnet_id': 'cccc'}).AndReturn(None)
|
{'subnet_id': 'cccc'}).AndReturn(None)
|
||||||
|
|
||||||
def mock_delete_association(self):
|
def mock_delete_association(self):
|
||||||
self.mock_show_subnet()
|
self.mock_show_subnet()
|
||||||
self.mock_router_for_vpc()
|
self.mock_router_for_vpc()
|
||||||
quantumclient.Client.remove_interface_router(
|
neutronclient.Client.remove_interface_router(
|
||||||
'ffff',
|
'ffff',
|
||||||
{'subnet_id': u'cccc'}).AndReturn(None)
|
{'subnet_id': u'cccc'}).AndReturn(None)
|
||||||
quantumclient.Client.add_interface_router(
|
neutronclient.Client.add_interface_router(
|
||||||
u'bbbb',
|
u'bbbb',
|
||||||
{'subnet_id': 'cccc'}).AndReturn(None)
|
{'subnet_id': 'cccc'}).AndReturn(None)
|
||||||
|
|
||||||
def mock_delete_route_table(self):
|
def mock_delete_route_table(self):
|
||||||
quantumclient.Client.delete_router('ffff').AndReturn(None)
|
neutronclient.Client.delete_router('ffff').AndReturn(None)
|
||||||
quantumclient.Client.remove_gateway_router('ffff').AndReturn(None)
|
neutronclient.Client.remove_gateway_router('ffff').AndReturn(None)
|
||||||
|
|
||||||
def assertResourceState(self, resource, ref_id):
|
def assertResourceState(self, resource, ref_id):
|
||||||
self.assertEqual(None, resource.validate())
|
self.assertEqual(None, resource.validate())
|
||||||
@ -378,12 +378,12 @@ Resources:
|
|||||||
|
|
||||||
# mock delete subnet which is already deleted
|
# mock delete subnet which is already deleted
|
||||||
self.mock_router_for_vpc()
|
self.mock_router_for_vpc()
|
||||||
quantumclient.Client.remove_interface_router(
|
neutronclient.Client.remove_interface_router(
|
||||||
u'bbbb',
|
u'bbbb',
|
||||||
{'subnet_id': 'cccc'}).AndRaise(
|
{'subnet_id': 'cccc'}).AndRaise(
|
||||||
QuantumClientException(status_code=404))
|
NeutronClientException(status_code=404))
|
||||||
quantumclient.Client.delete_subnet('cccc').AndRaise(
|
neutronclient.Client.delete_subnet('cccc').AndRaise(
|
||||||
QuantumClientException(status_code=404))
|
NeutronClientException(status_code=404))
|
||||||
|
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
stack = self.create_stack(self.test_template)
|
stack = self.create_stack(self.test_template)
|
||||||
@ -523,7 +523,7 @@ Resources:
|
|||||||
if security_groups:
|
if security_groups:
|
||||||
port['security_groups'] = security_groups
|
port['security_groups'] = security_groups
|
||||||
|
|
||||||
quantumclient.Client.create_port({'port': port}).AndReturn({
|
neutronclient.Client.create_port({'port': port}).AndReturn({
|
||||||
'port': {
|
'port': {
|
||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
'device_id': '',
|
'device_id': '',
|
||||||
@ -544,7 +544,7 @@ Resources:
|
|||||||
})
|
})
|
||||||
|
|
||||||
def mock_delete_network_interface(self):
|
def mock_delete_network_interface(self):
|
||||||
quantumclient.Client.delete_port('dddd').AndReturn(None)
|
neutronclient.Client.delete_port('dddd').AndReturn(None)
|
||||||
|
|
||||||
def test_network_interface(self):
|
def test_network_interface(self):
|
||||||
self.mock_keystone()
|
self.mock_keystone()
|
||||||
@ -659,7 +659,7 @@ Resources:
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def mock_create_internet_gateway(self):
|
def mock_create_internet_gateway(self):
|
||||||
quantumclient.Client.list_networks(
|
neutronclient.Client.list_networks(
|
||||||
**{'router:external': True}).AndReturn({'networks': [{
|
**{'router:external': True}).AndReturn({'networks': [{
|
||||||
'status': 'ACTIVE',
|
'status': 'ACTIVE',
|
||||||
'subnets': [],
|
'subnets': [],
|
||||||
@ -672,11 +672,11 @@ Resources:
|
|||||||
}]})
|
}]})
|
||||||
|
|
||||||
def mock_create_gateway_attachment(self):
|
def mock_create_gateway_attachment(self):
|
||||||
quantumclient.Client.add_gateway_router(
|
neutronclient.Client.add_gateway_router(
|
||||||
'ffff', {'network_id': 'eeee'}).AndReturn(None)
|
'ffff', {'network_id': 'eeee'}).AndReturn(None)
|
||||||
|
|
||||||
def mock_delete_gateway_attachment(self):
|
def mock_delete_gateway_attachment(self):
|
||||||
quantumclient.Client.remove_gateway_router('ffff').AndReturn(None)
|
neutronclient.Client.remove_gateway_router('ffff').AndReturn(None)
|
||||||
|
|
||||||
def test_internet_gateway(self):
|
def test_internet_gateway(self):
|
||||||
self.mock_keystone()
|
self.mock_keystone()
|
||||||
|
@ -18,7 +18,7 @@ SQLAlchemy>=0.7.8,<0.7.99
|
|||||||
WebOb==1.2.3
|
WebOb==1.2.3
|
||||||
python-keystoneclient>=0.2.1
|
python-keystoneclient>=0.2.1
|
||||||
python-swiftclient>=1.2
|
python-swiftclient>=1.2
|
||||||
python-quantumclient>=2.2.0
|
python-neutronclient>=2.2.3,<3
|
||||||
python-ceilometerclient>=1.0.1
|
python-ceilometerclient>=1.0.1
|
||||||
python-cinderclient>=1.0.4
|
python-cinderclient>=1.0.4
|
||||||
PyYAML>=3.1.0
|
PyYAML>=3.1.0
|
||||||
|
Loading…
Reference in New Issue
Block a user