Merge "Refactor neutron constraints"
This commit is contained in:
commit
4c649151cf
@ -69,8 +69,13 @@ class NeutronClientPlugin(client_plugin.ClientPlugin):
|
|||||||
return isinstance(ex, exceptions.NeutronClientNoUniqueMatch)
|
return isinstance(ex, exceptions.NeutronClientNoUniqueMatch)
|
||||||
|
|
||||||
def find_neutron_resource(self, props, key, key_type):
|
def find_neutron_resource(self, props, key, key_type):
|
||||||
|
return self.find_resourceid_by_name_or_id(
|
||||||
|
key_type, props.get(key))
|
||||||
|
|
||||||
|
def find_resourceid_by_name_or_id(self, resource, name_or_id,
|
||||||
|
cmd_resource=None):
|
||||||
return neutronV20.find_resourceid_by_name_or_id(
|
return neutronV20.find_resourceid_by_name_or_id(
|
||||||
self.client(), key_type, props.get(key))
|
self.client(), resource, name_or_id, cmd_resource=cmd_resource)
|
||||||
|
|
||||||
@os_client.MEMOIZE
|
@os_client.MEMOIZE
|
||||||
def _list_extensions(self):
|
def _list_extensions(self):
|
||||||
@ -110,8 +115,8 @@ class NeutronClientPlugin(client_plugin.ClientPlugin):
|
|||||||
Args:
|
Args:
|
||||||
policy: ID or name of the policy.
|
policy: ID or name of the policy.
|
||||||
"""
|
"""
|
||||||
return neutronV20.find_resourceid_by_name_or_id(
|
return self.find_resourceid_by_name_or_id(
|
||||||
self.client(), 'policy', policy, cmd_resource='qos_policy')
|
'policy', policy, cmd_resource='qos_policy')
|
||||||
|
|
||||||
def get_secgroup_uuids(self, security_groups):
|
def get_secgroup_uuids(self, security_groups):
|
||||||
'''Returns a list of security group UUIDs.
|
'''Returns a list of security group UUIDs.
|
||||||
|
@ -14,38 +14,22 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2015 IBM Corp.
|
# Copyright 2015 IBM Corp.
|
||||||
|
|
||||||
from neutronclient.common import exceptions
|
from heat.engine.clients.os.neutron import neutron_constraints as nc
|
||||||
from neutronclient.neutron import v2_0 as neutronV20
|
|
||||||
|
|
||||||
from heat.engine import constraints
|
|
||||||
|
|
||||||
|
|
||||||
class LoadbalancerConstraint(constraints.BaseCustomConstraint):
|
class LoadbalancerConstraint(nc.NeutronConstraint):
|
||||||
|
resource_name = 'loadbalancer'
|
||||||
expected_exceptions = (exceptions.NeutronClientException,)
|
cmd_resource = 'lbaas_loadbalancer'
|
||||||
|
extension = 'lbaasv2'
|
||||||
def validate_with_client(self, client, value):
|
|
||||||
neutron_client = client.client('neutron')
|
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
|
||||||
neutron_client, 'loadbalancer', value)
|
|
||||||
|
|
||||||
|
|
||||||
class ListenerConstraint(constraints.BaseCustomConstraint):
|
class ListenerConstraint(nc.NeutronConstraint):
|
||||||
|
resource_name = 'listener'
|
||||||
expected_exceptions = (exceptions.NeutronClientException,)
|
extension = 'lbaasv2'
|
||||||
|
|
||||||
def validate_with_client(self, client, value):
|
|
||||||
neutron_client = client.client('neutron')
|
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
|
||||||
neutron_client, 'listener', value)
|
|
||||||
|
|
||||||
|
|
||||||
class PoolConstraint(constraints.BaseCustomConstraint):
|
class PoolConstraint(nc.NeutronConstraint):
|
||||||
|
# Pool constraint for lbaas v2
|
||||||
expected_exceptions = (exceptions.NeutronClientException,)
|
resource_name = 'pool'
|
||||||
|
cmd_resource = 'lbaas_pool'
|
||||||
def validate_with_client(self, client, value):
|
extension = 'lbaasv2'
|
||||||
neutron_client = client.client('neutron')
|
|
||||||
# v2 pool is called lbaas_pool to differentiate from v1 pool
|
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
|
||||||
neutron_client, 'lbaas_pool', value)
|
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2015 IBM Corp.
|
# Copyright 2015 IBM Corp.
|
||||||
|
|
||||||
from neutronclient.common import exceptions
|
from neutronclient.common import exceptions as qe
|
||||||
from neutronclient.neutron import v2_0 as neutronV20
|
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.engine import constraints
|
from heat.engine import constraints
|
||||||
@ -22,76 +21,62 @@ from heat.engine import constraints
|
|||||||
|
|
||||||
class NetworkConstraint(constraints.BaseCustomConstraint):
|
class NetworkConstraint(constraints.BaseCustomConstraint):
|
||||||
|
|
||||||
expected_exceptions = (exceptions.NeutronClientException,
|
expected_exceptions = (qe.NeutronClientException,
|
||||||
exception.EntityNotFound,
|
exception.EntityNotFound,
|
||||||
exception.PhysicalResourceNameAmbiguity)
|
exception.PhysicalResourceNameAmbiguity)
|
||||||
|
|
||||||
def validate_with_client(self, client, value):
|
def validate_with_client(self, client, value):
|
||||||
try:
|
try:
|
||||||
neutron_client = client.client('neutron')
|
client.client('neutron')
|
||||||
except Exception:
|
except Exception:
|
||||||
# is not using neutron
|
# is not using neutron
|
||||||
client.client_plugin('nova').get_nova_network_id(value)
|
client.client_plugin('nova').get_nova_network_id(value)
|
||||||
else:
|
else:
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutron_plugin = client.client_plugin('neutron')
|
||||||
neutron_client, 'network', value)
|
neutron_plugin.find_resourceid_by_name_or_id(
|
||||||
|
'network', value, cmd_resource=None)
|
||||||
|
|
||||||
|
|
||||||
class PortConstraint(constraints.BaseCustomConstraint):
|
class NeutronConstraint(constraints.BaseCustomConstraint):
|
||||||
|
|
||||||
expected_exceptions = (exceptions.NeutronClientException,)
|
expected_exceptions = (qe.NeutronClientException,
|
||||||
|
exception.EntityNotFound)
|
||||||
|
resource_name = None
|
||||||
|
cmd_resource = None
|
||||||
|
extension = None
|
||||||
|
|
||||||
def validate_with_client(self, client, value):
|
def validate_with_client(self, client, value):
|
||||||
neutron_client = client.client('neutron')
|
neutron_plugin = client.client_plugin('neutron')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
if (self.extension and
|
||||||
neutron_client, 'port', value)
|
not neutron_plugin.has_extension(self.extension)):
|
||||||
|
raise exception.EntityNotFound(entity='neutron extension',
|
||||||
|
name=self.extension)
|
||||||
|
neutron_plugin.find_resourceid_by_name_or_id(
|
||||||
|
self.resource_name, value, cmd_resource=self.cmd_resource)
|
||||||
|
|
||||||
|
|
||||||
class RouterConstraint(constraints.BaseCustomConstraint):
|
class PortConstraint(NeutronConstraint):
|
||||||
|
resource_name = 'port'
|
||||||
expected_exceptions = (exceptions.NeutronClientException,)
|
|
||||||
|
|
||||||
def validate_with_client(self, client, value):
|
|
||||||
neutron_client = client.client('neutron')
|
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
|
||||||
neutron_client, 'router', value)
|
|
||||||
|
|
||||||
|
|
||||||
class SubnetConstraint(constraints.BaseCustomConstraint):
|
class RouterConstraint(NeutronConstraint):
|
||||||
|
resource_name = 'router'
|
||||||
expected_exceptions = (exceptions.NeutronClientException,)
|
|
||||||
|
|
||||||
def validate_with_client(self, client, value):
|
|
||||||
neutron_client = client.client('neutron')
|
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
|
||||||
neutron_client, 'subnet', value)
|
|
||||||
|
|
||||||
|
|
||||||
class SubnetPoolConstraint(constraints.BaseCustomConstraint):
|
class SubnetConstraint(NeutronConstraint):
|
||||||
|
resource_name = 'subnet'
|
||||||
expected_exceptions = (exceptions.NeutronClientException,)
|
|
||||||
|
|
||||||
def validate_with_client(self, client, value):
|
|
||||||
neutron_client = client.client('neutron')
|
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
|
||||||
neutron_client, 'subnetpool', value)
|
|
||||||
|
|
||||||
|
|
||||||
class AddressScopeConstraint(constraints.BaseCustomConstraint):
|
class SubnetPoolConstraint(NeutronConstraint):
|
||||||
|
resource_name = 'subnetpool'
|
||||||
expected_exceptions = (exceptions.NeutronClientException,)
|
|
||||||
|
|
||||||
def validate_with_client(self, client, value):
|
|
||||||
neutron_client = client.client('neutron')
|
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
|
||||||
neutron_client, 'address_scope', value)
|
|
||||||
|
|
||||||
|
|
||||||
class QoSPolicyConstraint(constraints.BaseCustomConstraint):
|
class AddressScopeConstraint(NeutronConstraint):
|
||||||
|
resource_name = 'address_scope'
|
||||||
|
extension = 'address-scope'
|
||||||
|
|
||||||
expected_exceptions = (exceptions.NeutronClientException,)
|
|
||||||
|
|
||||||
def validate_with_client(self, client, value):
|
class QoSPolicyConstraint(NeutronConstraint):
|
||||||
neutron_client = client.client('neutron')
|
resource_name = 'policy'
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
cmd_resource = 'qos_policy'
|
||||||
neutron_client, 'policy', value, cmd_resource='qos_policy')
|
extension = 'qos'
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
# 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 neutronclient.neutron import v2_0 as neutronV20
|
|
||||||
from oslo_utils import netutils
|
from oslo_utils import netutils
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
@ -327,8 +326,9 @@ class Subnet(neutron.NeutronResource):
|
|||||||
self.client_plugin().resolve_network(props, self.NETWORK,
|
self.client_plugin().resolve_network(props, self.NETWORK,
|
||||||
'network_id')
|
'network_id')
|
||||||
if self.SUBNETPOOL in props and props[self.SUBNETPOOL]:
|
if self.SUBNETPOOL in props and props[self.SUBNETPOOL]:
|
||||||
props['subnetpool_id'] = neutronV20.find_resourceid_by_name_or_id(
|
props['subnetpool_id'] = self.client_plugin(
|
||||||
self.client(), 'subnetpool', props.pop('subnetpool'))
|
).find_resourceid_by_name_or_id(
|
||||||
|
'subnetpool', props.pop('subnetpool'))
|
||||||
self._null_gateway_ip(props)
|
self._null_gateway_ip(props)
|
||||||
subnet = self.client().create_subnet({'subnet': props})['subnet']
|
subnet = self.client().create_subnet({'subnet': props})['subnet']
|
||||||
self.resource_id_set(subnet['id'])
|
self.resource_id_set(subnet['id'])
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
# 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 neutronclient.neutron import v2_0 as nV20
|
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _
|
||||||
from heat.common import netutils
|
from heat.common import netutils
|
||||||
@ -174,8 +172,9 @@ class SubnetPool(neutron.NeutronResource):
|
|||||||
self.properties,
|
self.properties,
|
||||||
self.physical_resource_name())
|
self.physical_resource_name())
|
||||||
if self.ADDRESS_SCOPE in props and props[self.ADDRESS_SCOPE]:
|
if self.ADDRESS_SCOPE in props and props[self.ADDRESS_SCOPE]:
|
||||||
props['address_scope_id'] = nV20.find_resourceid_by_name_or_id(
|
props['address_scope_id'] = self.client_plugin(
|
||||||
self.client(), 'address_scope', props.pop(self.ADDRESS_SCOPE))
|
).find_resourceid_by_name_or_id(
|
||||||
|
'address_scope', props.pop(self.ADDRESS_SCOPE))
|
||||||
subnetpool = self.client().create_subnetpool(
|
subnetpool = self.client().create_subnetpool(
|
||||||
{'subnetpool': props})['subnetpool']
|
{'subnetpool': props})['subnetpool']
|
||||||
self.resource_id_set(subnetpool['id'])
|
self.resource_id_set(subnetpool['id'])
|
||||||
@ -195,7 +194,8 @@ class SubnetPool(neutron.NeutronResource):
|
|||||||
if self.ADDRESS_SCOPE in prop_diff:
|
if self.ADDRESS_SCOPE in prop_diff:
|
||||||
if prop_diff[self.ADDRESS_SCOPE]:
|
if prop_diff[self.ADDRESS_SCOPE]:
|
||||||
prop_diff[
|
prop_diff[
|
||||||
'address_scope_id'] = nV20.find_resourceid_by_name_or_id(
|
'address_scope_id'] = self.client_plugin(
|
||||||
|
).find_resourceid_by_name_or_id(
|
||||||
self.client(), 'address_scope',
|
self.client(), 'address_scope',
|
||||||
prop_diff.pop(self.ADDRESS_SCOPE))
|
prop_diff.pop(self.ADDRESS_SCOPE))
|
||||||
else:
|
else:
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from neutronclient.common import exceptions as qe
|
from neutronclient.common import exceptions as qe
|
||||||
|
|
||||||
@ -47,7 +49,8 @@ class NeutronClientPluginTests(NeutronClientPluginTestCase):
|
|||||||
'network')
|
'network')
|
||||||
self.assertEqual(42, res)
|
self.assertEqual(42, res)
|
||||||
self.mock_find.assert_called_once_with(self.neutron_client, 'network',
|
self.mock_find.assert_called_once_with(self.neutron_client, 'network',
|
||||||
'test_network')
|
'test_network',
|
||||||
|
cmd_resource=None)
|
||||||
|
|
||||||
def test_resolve_network(self):
|
def test_resolve_network(self):
|
||||||
props = {'net': 'test_network'}
|
props = {'net': 'test_network'}
|
||||||
@ -55,7 +58,8 @@ class NeutronClientPluginTests(NeutronClientPluginTestCase):
|
|||||||
res = self.neutron_plugin.resolve_network(props, 'net', 'net_id')
|
res = self.neutron_plugin.resolve_network(props, 'net', 'net_id')
|
||||||
self.assertEqual(42, res)
|
self.assertEqual(42, res)
|
||||||
self.mock_find.assert_called_once_with(self.neutron_client, 'network',
|
self.mock_find.assert_called_once_with(self.neutron_client, 'network',
|
||||||
'test_network')
|
'test_network',
|
||||||
|
cmd_resource=None)
|
||||||
|
|
||||||
# check resolve if was send id instead of name
|
# check resolve if was send id instead of name
|
||||||
props = {'net_id': 77}
|
props = {'net_id': 77}
|
||||||
@ -63,7 +67,8 @@ class NeutronClientPluginTests(NeutronClientPluginTestCase):
|
|||||||
self.assertEqual(77, res)
|
self.assertEqual(77, res)
|
||||||
# in this case find_resourceid_by_name_or_id is not called
|
# in this case find_resourceid_by_name_or_id is not called
|
||||||
self.mock_find.assert_called_once_with(self.neutron_client, 'network',
|
self.mock_find.assert_called_once_with(self.neutron_client, 'network',
|
||||||
'test_network')
|
'test_network',
|
||||||
|
cmd_resource=None)
|
||||||
|
|
||||||
def test_resolve_subnet(self):
|
def test_resolve_subnet(self):
|
||||||
props = {'snet': 'test_subnet'}
|
props = {'snet': 'test_subnet'}
|
||||||
@ -71,7 +76,8 @@ class NeutronClientPluginTests(NeutronClientPluginTestCase):
|
|||||||
res = self.neutron_plugin.resolve_subnet(props, 'snet', 'snet_id')
|
res = self.neutron_plugin.resolve_subnet(props, 'snet', 'snet_id')
|
||||||
self.assertEqual(42, res)
|
self.assertEqual(42, res)
|
||||||
self.mock_find.assert_called_once_with(self.neutron_client, 'subnet',
|
self.mock_find.assert_called_once_with(self.neutron_client, 'subnet',
|
||||||
'test_subnet')
|
'test_subnet',
|
||||||
|
cmd_resource=None)
|
||||||
|
|
||||||
# check resolve if was send id instead of name
|
# check resolve if was send id instead of name
|
||||||
props = {'snet_id': 77}
|
props = {'snet_id': 77}
|
||||||
@ -79,7 +85,8 @@ class NeutronClientPluginTests(NeutronClientPluginTestCase):
|
|||||||
self.assertEqual(77, res)
|
self.assertEqual(77, res)
|
||||||
# in this case find_resourceid_by_name_or_id is not called
|
# in this case find_resourceid_by_name_or_id is not called
|
||||||
self.mock_find.assert_called_once_with(self.neutron_client, 'subnet',
|
self.mock_find.assert_called_once_with(self.neutron_client, 'subnet',
|
||||||
'test_subnet')
|
'test_subnet',
|
||||||
|
cmd_resource=None)
|
||||||
|
|
||||||
def test_get_secgroup_uuids(self):
|
def test_get_secgroup_uuids(self):
|
||||||
# test get from uuids
|
# test get from uuids
|
||||||
@ -182,15 +189,15 @@ class NeutronConstraintsValidate(common.HeatTestCase):
|
|||||||
('validate_loadbalancer',
|
('validate_loadbalancer',
|
||||||
dict(constraint_class=lc.LoadbalancerConstraint,
|
dict(constraint_class=lc.LoadbalancerConstraint,
|
||||||
resource_type='loadbalancer',
|
resource_type='loadbalancer',
|
||||||
cmd_resource=None)),
|
cmd_resource='lbaas_loadbalancer')),
|
||||||
('validate_listener',
|
('validate_listener',
|
||||||
dict(constraint_class=lc.ListenerConstraint,
|
dict(constraint_class=lc.ListenerConstraint,
|
||||||
resource_type='listener',
|
resource_type='listener',
|
||||||
cmd_resource=None)),
|
cmd_resource=None)),
|
||||||
('validate_pool',
|
('validate_pool',
|
||||||
dict(constraint_class=lc.PoolConstraint,
|
dict(constraint_class=lc.PoolConstraint,
|
||||||
resource_type='lbaas_pool',
|
resource_type='pool',
|
||||||
cmd_resource=None)),
|
cmd_resource='lbaas_pool')),
|
||||||
('validate_qos_policy',
|
('validate_qos_policy',
|
||||||
dict(constraint_class=nc.QoSPolicyConstraint,
|
dict(constraint_class=nc.QoSPolicyConstraint,
|
||||||
resource_type='policy',
|
resource_type='policy',
|
||||||
@ -198,27 +205,40 @@ class NeutronConstraintsValidate(common.HeatTestCase):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def test_validate(self):
|
def test_validate(self):
|
||||||
|
mock_extension = self.patchobject(
|
||||||
|
neutron.NeutronClientPlugin, 'has_extension', return_value=True)
|
||||||
nc = mock.Mock()
|
nc = mock.Mock()
|
||||||
mock_create = self.patchobject(neutron.NeutronClientPlugin, '_create')
|
mock_create = self.patchobject(neutron.NeutronClientPlugin, '_create')
|
||||||
mock_create.return_value = nc
|
mock_create.return_value = nc
|
||||||
mock_find = self.patchobject(neutron.neutronV20,
|
mock_find = self.patchobject(neutron.NeutronClientPlugin,
|
||||||
'find_resourceid_by_name_or_id')
|
'find_resourceid_by_name_or_id')
|
||||||
mock_find.side_effect = ['foo',
|
mock_find.side_effect = [
|
||||||
qe.NeutronClientException(status_code=404)]
|
'foo',
|
||||||
|
qe.NeutronClientException(status_code=404)
|
||||||
|
]
|
||||||
|
|
||||||
constraint = self.constraint_class()
|
constraint = self.constraint_class()
|
||||||
ctx = utils.dummy_context()
|
ctx = utils.dummy_context()
|
||||||
|
if hasattr(constraint, 'extension') and constraint.extension:
|
||||||
|
mock_extension.side_effect = [
|
||||||
|
False,
|
||||||
|
True,
|
||||||
|
True,
|
||||||
|
]
|
||||||
|
ex = self.assertRaises(
|
||||||
|
exception.EntityNotFound,
|
||||||
|
constraint.validate_with_client, ctx.clients, "foo"
|
||||||
|
)
|
||||||
|
expected = ("The neutron extension (%s) could not be found." %
|
||||||
|
constraint.extension)
|
||||||
|
self.assertEqual(expected, six.text_type(ex))
|
||||||
self.assertTrue(constraint.validate("foo", ctx))
|
self.assertTrue(constraint.validate("foo", ctx))
|
||||||
self.assertFalse(constraint.validate("bar", ctx))
|
self.assertFalse(constraint.validate("bar", ctx))
|
||||||
if self.cmd_resource:
|
mock_find.assert_has_calls(
|
||||||
mock_calls = [mock.call(nc, self.resource_type, 'foo',
|
[mock.call(self.resource_type, 'foo',
|
||||||
cmd_resource=self.cmd_resource),
|
cmd_resource=self.cmd_resource),
|
||||||
mock.call(nc, self.resource_type, 'bar',
|
mock.call(self.resource_type, 'bar',
|
||||||
cmd_resource=self.cmd_resource)]
|
cmd_resource=self.cmd_resource)])
|
||||||
else:
|
|
||||||
mock_calls = [mock.call(nc, self.resource_type, 'foo'),
|
|
||||||
mock.call(nc, self.resource_type, 'bar')]
|
|
||||||
mock_find.assert_has_calls(mock_calls)
|
|
||||||
|
|
||||||
|
|
||||||
class NeutronClientPluginExtensionsTests(NeutronClientPluginTestCase):
|
class NeutronClientPluginExtensionsTests(NeutronClientPluginTestCase):
|
||||||
|
@ -163,7 +163,8 @@ class NeutronFloatingIPTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'abcd1234'
|
'abcd1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('abcd1234')
|
).MultipleTimes().AndReturn('abcd1234')
|
||||||
self._test_floating_ip(t, resolve_neutron=False)
|
self._test_floating_ip(t, resolve_neutron=False)
|
||||||
|
|
||||||
@ -173,7 +174,8 @@ class NeutronFloatingIPTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'abcd1234'
|
'abcd1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('abcd1234')
|
).MultipleTimes().AndReturn('abcd1234')
|
||||||
self._test_floating_ip(t, resolve_neutron=False, r_iface=False)
|
self._test_floating_ip(t, resolve_neutron=False, r_iface=False)
|
||||||
|
|
||||||
@ -205,7 +207,8 @@ class NeutronFloatingIPTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'abcd1234'
|
'abcd1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('abcd1234')
|
).MultipleTimes().AndReturn('abcd1234')
|
||||||
|
|
||||||
stack = utils.parse_stack(tmpl)
|
stack = utils.parse_stack(tmpl)
|
||||||
@ -269,17 +272,20 @@ class NeutronFloatingIPTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'abcd1234'
|
'abcd1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('abcd1234')
|
).MultipleTimes().AndReturn('abcd1234')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'xyz1234'
|
'xyz1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('xyz1234')
|
).MultipleTimes().AndReturn('xyz1234')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub1234'
|
'sub1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub1234')
|
).MultipleTimes().AndReturn('sub1234')
|
||||||
neutronclient.Client.create_floatingip({
|
neutronclient.Client.create_floatingip({
|
||||||
'floatingip': {'floating_network_id': u'abcd1234'}
|
'floatingip': {'floating_network_id': u'abcd1234'}
|
||||||
@ -497,7 +503,8 @@ class NeutronFloatingIPTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'abcd1234'
|
'abcd1234',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('xyz1234')
|
).AndReturn('xyz1234')
|
||||||
neutronclient.Client.create_floatingip({
|
neutronclient.Client.create_floatingip({
|
||||||
'floatingip': {'floating_network_id': u'xyz1234',
|
'floatingip': {'floating_network_id': u'xyz1234',
|
||||||
@ -527,17 +534,20 @@ class NeutronFloatingIPTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'xyz1234'
|
'xyz1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('xyz1234')
|
).MultipleTimes().AndReturn('xyz1234')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub1234'
|
'sub1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub1234')
|
).MultipleTimes().AndReturn('sub1234')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'router',
|
'router',
|
||||||
'None'
|
'None',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('None')
|
).MultipleTimes().AndReturn('None')
|
||||||
|
|
||||||
neutronclient.Client.create_port({'port': {
|
neutronclient.Client.create_port({'port': {
|
||||||
@ -560,7 +570,8 @@ class NeutronFloatingIPTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'abcd1234'
|
'abcd1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('abcd1234')
|
).MultipleTimes().AndReturn('abcd1234')
|
||||||
neutronclient.Client.create_floatingip({
|
neutronclient.Client.create_floatingip({
|
||||||
'floatingip': {
|
'floatingip': {
|
||||||
|
@ -342,13 +342,15 @@ class PoolTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub123'
|
'sub123',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('sub123')
|
).AndReturn('sub123')
|
||||||
if resolve_neutron and with_vip_subnet:
|
if resolve_neutron and with_vip_subnet:
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub9999'
|
'sub9999',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('sub9999')
|
).AndReturn('sub9999')
|
||||||
snippet = template_format.parse(pool_template_with_vip_subnet)
|
snippet = template_format.parse(pool_template_with_vip_subnet)
|
||||||
neutronclient.Client.create_vip(stvipvsn
|
neutronclient.Client.create_vip(stvipvsn
|
||||||
@ -391,7 +393,8 @@ class PoolTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub123'
|
'sub123',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub123')
|
).MultipleTimes().AndReturn('sub123')
|
||||||
|
|
||||||
neutronclient.Client.create_pool({
|
neutronclient.Client.create_pool({
|
||||||
@ -431,7 +434,8 @@ class PoolTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub123'
|
'sub123',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub123')
|
).MultipleTimes().AndReturn('sub123')
|
||||||
|
|
||||||
neutronclient.Client.create_pool({
|
neutronclient.Client.create_pool({
|
||||||
@ -468,7 +472,8 @@ class PoolTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub123'
|
'sub123',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub123')
|
).MultipleTimes().AndReturn('sub123')
|
||||||
|
|
||||||
neutronclient.Client.create_pool({
|
neutronclient.Client.create_pool({
|
||||||
@ -507,7 +512,8 @@ class PoolTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub123'
|
'sub123',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub123')
|
).MultipleTimes().AndReturn('sub123')
|
||||||
|
|
||||||
neutronclient.Client.create_pool({
|
neutronclient.Client.create_pool({
|
||||||
@ -536,7 +542,8 @@ class PoolTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub123'
|
'sub123',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub123')
|
).MultipleTimes().AndReturn('sub123')
|
||||||
neutronclient.Client.create_pool({
|
neutronclient.Client.create_pool({
|
||||||
'pool': {
|
'pool': {
|
||||||
@ -572,7 +579,8 @@ class PoolTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub123'
|
'sub123',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub123')
|
).MultipleTimes().AndReturn('sub123')
|
||||||
neutronclient.Client.create_pool({
|
neutronclient.Client.create_pool({
|
||||||
'pool': {
|
'pool': {
|
||||||
@ -638,7 +646,8 @@ class PoolTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub123'
|
'sub123',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub123')
|
).MultipleTimes().AndReturn('sub123')
|
||||||
|
|
||||||
neutronclient.Client.create_pool({
|
neutronclient.Client.create_pool({
|
||||||
@ -792,7 +801,8 @@ class PoolTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub123'
|
'sub123',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub123')
|
).MultipleTimes().AndReturn('sub123')
|
||||||
neutronclient.Client.create_pool({
|
neutronclient.Client.create_pool({
|
||||||
'pool': {
|
'pool': {
|
||||||
@ -1064,7 +1074,8 @@ class PoolUpdateHealthMonitorsTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub123'
|
'sub123',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('sub123')
|
).AndReturn('sub123')
|
||||||
neutronclient.Client.create_pool({
|
neutronclient.Client.create_pool({
|
||||||
'pool': {
|
'pool': {
|
||||||
|
@ -106,7 +106,8 @@ class NeutronNetTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'router',
|
'router',
|
||||||
'None'
|
'None',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('None')
|
).AndReturn('None')
|
||||||
|
|
||||||
# Create script
|
# Create script
|
||||||
|
@ -117,7 +117,8 @@ class NeutronNetworkGatewayTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'6af055d3-26f6-48dd-a597-7611d7e58d35'
|
'6af055d3-26f6-48dd-a597-7611d7e58d35',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndRaise(qe.NeutronClientException(status_code=404))
|
).MultipleTimes().AndRaise(qe.NeutronClientException(status_code=404))
|
||||||
# mock successful to delete the network_gateway
|
# mock successful to delete the network_gateway
|
||||||
neutronclient.Client.delete_network_gateway(
|
neutronclient.Client.delete_network_gateway(
|
||||||
@ -174,7 +175,8 @@ class NeutronNetworkGatewayTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'6af055d3-26f6-48dd-a597-7611d7e58d35'
|
'6af055d3-26f6-48dd-a597-7611d7e58d35',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
||||||
t = template_format.parse(gw_template)
|
t = template_format.parse(gw_template)
|
||||||
else:
|
else:
|
||||||
@ -192,7 +194,8 @@ class NeutronNetworkGatewayTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'6af055d3-26f6-48dd-a597-7611d7e58d35'
|
'6af055d3-26f6-48dd-a597-7611d7e58d35',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn(
|
).MultipleTimes().AndReturn(
|
||||||
'6af055d3-26f6-48dd-a597-7611d7e58d35')
|
'6af055d3-26f6-48dd-a597-7611d7e58d35')
|
||||||
|
|
||||||
@ -278,32 +281,38 @@ class NeutronNetworkGatewayTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'6af055d3-26f6-48dd-a597-7611d7e58d35'
|
'6af055d3-26f6-48dd-a597-7611d7e58d35',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'6af055d3-26f6-48dd-a597-7611d7e58d35'
|
'6af055d3-26f6-48dd-a597-7611d7e58d35',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'6af055d3-26f6-48dd-a597-7611d7e58d35'
|
'6af055d3-26f6-48dd-a597-7611d7e58d35',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'6af055d3-26f6-48dd-a597-7611d7e58d35'
|
'6af055d3-26f6-48dd-a597-7611d7e58d35',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'6af055d3-26f6-48dd-a597-7611d7e58d35'
|
'6af055d3-26f6-48dd-a597-7611d7e58d35',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'6af055d3-26f6-48dd-a597-7611d7e58d35'
|
'6af055d3-26f6-48dd-a597-7611d7e58d35',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
).AndReturn('6af055d3-26f6-48dd-a597-7611d7e58d35')
|
||||||
|
|
||||||
neutronclient.Client.update_network_gateway(
|
neutronclient.Client.update_network_gateway(
|
||||||
|
@ -82,7 +82,8 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'net1234'
|
'net1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('net1234')
|
).MultipleTimes().AndReturn('net1234')
|
||||||
neutronclient.Client.create_port({'port': {
|
neutronclient.Client.create_port({'port': {
|
||||||
'network_id': u'net1234',
|
'network_id': u'net1234',
|
||||||
@ -118,12 +119,14 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'net1234'
|
'net1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('net1234')
|
).MultipleTimes().AndReturn('net1234')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub1234'
|
'sub1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub1234')
|
).MultipleTimes().AndReturn('sub1234')
|
||||||
|
|
||||||
neutronclient.Client.create_port({'port': {
|
neutronclient.Client.create_port({'port': {
|
||||||
@ -159,7 +162,8 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'net1234'
|
'net1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('net1234')
|
).MultipleTimes().AndReturn('net1234')
|
||||||
neutronclient.Client.create_port({'port': {
|
neutronclient.Client.create_port({'port': {
|
||||||
'network_id': u'net1234',
|
'network_id': u'net1234',
|
||||||
@ -195,7 +199,8 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'abcd1234'
|
'abcd1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('abcd1234')
|
).MultipleTimes().AndReturn('abcd1234')
|
||||||
neutronclient.Client.create_port({'port': {
|
neutronclient.Client.create_port({'port': {
|
||||||
'network_id': u'abcd1234',
|
'network_id': u'abcd1234',
|
||||||
@ -229,7 +234,8 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'abcd1234'
|
'abcd1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('abcd1234')
|
).MultipleTimes().AndReturn('abcd1234')
|
||||||
|
|
||||||
neutronclient.Client.create_port({'port': {
|
neutronclient.Client.create_port({'port': {
|
||||||
@ -262,7 +268,8 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'abcd1234'
|
'abcd1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('abcd1234')
|
).MultipleTimes().AndReturn('abcd1234')
|
||||||
neutronclient.Client.create_port({'port': {
|
neutronclient.Client.create_port({'port': {
|
||||||
'network_id': u'abcd1234',
|
'network_id': u'abcd1234',
|
||||||
@ -298,7 +305,8 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'abcd1234'
|
'abcd1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('abcd1234')
|
).MultipleTimes().AndReturn('abcd1234')
|
||||||
neutronclient.Client.create_port({'port': {
|
neutronclient.Client.create_port({'port': {
|
||||||
'network_id': u'abcd1234',
|
'network_id': u'abcd1234',
|
||||||
@ -334,12 +342,14 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'net1234'
|
'net1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('net1234')
|
).MultipleTimes().AndReturn('net1234')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub1234'
|
'sub1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub1234')
|
).MultipleTimes().AndReturn('sub1234')
|
||||||
neutronclient.Client.create_port({'port': port_prop}).AndReturn(
|
neutronclient.Client.create_port({'port': port_prop}).AndReturn(
|
||||||
{'port': {
|
{'port': {
|
||||||
@ -422,7 +432,8 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'net1234'
|
'net1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('net1234')
|
).MultipleTimes().AndReturn('net1234')
|
||||||
neutronclient.Client.create_port(
|
neutronclient.Client.create_port(
|
||||||
{'port': props}
|
{'port': props}
|
||||||
@ -495,7 +506,8 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'net1234'
|
'net1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('net1234')
|
).MultipleTimes().AndReturn('net1234')
|
||||||
neutronclient.Client.create_port(
|
neutronclient.Client.create_port(
|
||||||
{'port': props}
|
{'port': props}
|
||||||
@ -557,7 +569,8 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'net1234'
|
'net1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('net1234')
|
).MultipleTimes().AndReturn('net1234')
|
||||||
neutronclient.Client.create_port({'port': {
|
neutronclient.Client.create_port({'port': {
|
||||||
'network_id': u'net1234',
|
'network_id': u'net1234',
|
||||||
@ -619,7 +632,8 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'net1234'
|
'net1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('net1234')
|
).MultipleTimes().AndReturn('net1234')
|
||||||
neutronclient.Client.create_port({'port': {
|
neutronclient.Client.create_port({'port': {
|
||||||
'network_id': u'net1234',
|
'network_id': u'net1234',
|
||||||
@ -688,12 +702,14 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'net1234'
|
'net1234',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('net1234')
|
).AndReturn('net1234')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub1234'
|
'sub1234',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub1234')
|
).MultipleTimes().AndReturn('sub1234')
|
||||||
neutronclient.Client.create_port({'port': port_prop}).AndReturn(
|
neutronclient.Client.create_port({'port': port_prop}).AndReturn(
|
||||||
{'port': {
|
{'port': {
|
||||||
|
@ -465,13 +465,15 @@ class NeutronRouterTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'router',
|
'router',
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8'
|
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('3e46229d-8fce-4733-819a-b5fe630550f8')
|
).AndReturn('3e46229d-8fce-4733-819a-b5fe630550f8')
|
||||||
router_key = 'router'
|
router_key = 'router'
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'91e47a57-7508-46fe-afc9-fc454e8580e1'
|
'91e47a57-7508-46fe-afc9-fc454e8580e1',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('91e47a57-7508-46fe-afc9-fc454e8580e1')
|
).AndReturn('91e47a57-7508-46fe-afc9-fc454e8580e1')
|
||||||
subnet_key = 'subnet'
|
subnet_key = 'subnet'
|
||||||
|
|
||||||
@ -499,13 +501,15 @@ class NeutronRouterTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'router',
|
'router',
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8'
|
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('3e46229d-8fce-4733-819a-b5fe630550f8')
|
).AndReturn('3e46229d-8fce-4733-819a-b5fe630550f8')
|
||||||
|
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'91e47a57-7508-46fe-afc9-fc454e8580e1'
|
'91e47a57-7508-46fe-afc9-fc454e8580e1',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('91e47a57-7508-46fe-afc9-fc454e8580e1')
|
).AndReturn('91e47a57-7508-46fe-afc9-fc454e8580e1')
|
||||||
neutronclient.Client.add_interface_router(
|
neutronclient.Client.add_interface_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
||||||
@ -552,13 +556,15 @@ class NeutronRouterTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'router',
|
'router',
|
||||||
'ae478782-53c0-4434-ab16-49900c88016c'
|
'ae478782-53c0-4434-ab16-49900c88016c',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('ae478782-53c0-4434-ab16-49900c88016c')
|
).AndReturn('ae478782-53c0-4434-ab16-49900c88016c')
|
||||||
port_key = 'port'
|
port_key = 'port'
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'port',
|
'port',
|
||||||
'9577cafd-8e98-4059-a2e6-8a771b4d318e'
|
'9577cafd-8e98-4059-a2e6-8a771b4d318e',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('9577cafd-8e98-4059-a2e6-8a771b4d318e')
|
).AndReturn('9577cafd-8e98-4059-a2e6-8a771b4d318e')
|
||||||
|
|
||||||
neutronclient.Client.add_interface_router(
|
neutronclient.Client.add_interface_router(
|
||||||
@ -646,7 +652,8 @@ class NeutronRouterTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'fc68ea2c-b60b-4b4f-bd82-94ec81110766'
|
'fc68ea2c-b60b-4b4f-bd82-94ec81110766',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('fc68ea2c-b60b-4b4f-bd82-94ec81110766')
|
).MultipleTimes().AndReturn('fc68ea2c-b60b-4b4f-bd82-94ec81110766')
|
||||||
neutronclient.Client.add_gateway_router(
|
neutronclient.Client.add_gateway_router(
|
||||||
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
'3e46229d-8fce-4733-819a-b5fe630550f8',
|
||||||
@ -679,7 +686,8 @@ class NeutronRouterTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'public'
|
'public',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('fc68ea2c-b60b-4b4f-bd82-94ec81110766')
|
).MultipleTimes().AndReturn('fc68ea2c-b60b-4b4f-bd82-94ec81110766')
|
||||||
|
|
||||||
neutronclient.Client.create_router({
|
neutronclient.Client.create_router({
|
||||||
@ -758,7 +766,8 @@ class NeutronRouterTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'public'
|
'public',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('fc68ea2c-b60b-4b4f-bd82-94ec81110766')
|
).AndReturn('fc68ea2c-b60b-4b4f-bd82-94ec81110766')
|
||||||
|
|
||||||
neutronclient.Client.create_router({
|
neutronclient.Client.create_router({
|
||||||
@ -819,7 +828,8 @@ class NeutronRouterTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'other_public'
|
'other_public',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('91e47a57-7508-46fe-afc9-fc454e8580e1')
|
).AndReturn('91e47a57-7508-46fe-afc9-fc454e8580e1')
|
||||||
|
|
||||||
neutronclient.Client.update_router(
|
neutronclient.Client.update_router(
|
||||||
|
@ -128,12 +128,14 @@ class NeutronSubnetTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'None'
|
'None',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('None')
|
).AndReturn('None')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'router',
|
'router',
|
||||||
'None'
|
'None',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('None')
|
).AndReturn('None')
|
||||||
stack = utils.parse_stack(t)
|
stack = utils.parse_stack(t)
|
||||||
rsrc = self.create_subnet(t, stack, 'sub_net')
|
rsrc = self.create_subnet(t, stack, 'sub_net')
|
||||||
@ -201,17 +203,20 @@ class NeutronSubnetTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnetpool',
|
'subnetpool',
|
||||||
'None'
|
'None',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('None')
|
).AndReturn('None')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'None'
|
'None',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('None')
|
).AndReturn('None')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnetpool',
|
'subnetpool',
|
||||||
'None'
|
'None',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('None')
|
).AndReturn('None')
|
||||||
neutronclient.Client.create_subnet({
|
neutronclient.Client.create_subnet({
|
||||||
'subnet': {
|
'subnet': {
|
||||||
@ -267,12 +272,14 @@ class NeutronSubnetTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'None'
|
'None',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('None')
|
).AndReturn('None')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'router',
|
'router',
|
||||||
'None'
|
'None',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('None')
|
).AndReturn('None')
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
scheduler.TaskRunner(rsrc.create)()
|
scheduler.TaskRunner(rsrc.create)()
|
||||||
@ -389,7 +396,8 @@ class NeutronSubnetTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'None'
|
'None',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('None')
|
).AndReturn('None')
|
||||||
neutronclient.Client.create_subnet({
|
neutronclient.Client.create_subnet({
|
||||||
'subnet': {
|
'subnet': {
|
||||||
@ -513,7 +521,8 @@ class NeutronSubnetTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'network',
|
'network',
|
||||||
'None'
|
'None',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('None')
|
).AndReturn('None')
|
||||||
neutronclient.Client.create_subnet({
|
neutronclient.Client.create_subnet({
|
||||||
'subnet': {
|
'subnet': {
|
||||||
|
@ -137,12 +137,14 @@ class VPNServiceTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub123'
|
'sub123',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('sub123')
|
).AndReturn('sub123')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'router',
|
'router',
|
||||||
'rou123'
|
'rou123',
|
||||||
|
cmd_resource=None,
|
||||||
).AndReturn('rou123')
|
).AndReturn('rou123')
|
||||||
if resolve_neutron:
|
if resolve_neutron:
|
||||||
snippet = template_format.parse(vpnservice_template)
|
snippet = template_format.parse(vpnservice_template)
|
||||||
@ -186,12 +188,14 @@ class VPNServiceTest(common.HeatTestCase):
|
|||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'subnet',
|
'subnet',
|
||||||
'sub123'
|
'sub123',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('sub123')
|
).MultipleTimes().AndReturn('sub123')
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
mox.IsA(neutronclient.Client),
|
mox.IsA(neutronclient.Client),
|
||||||
'router',
|
'router',
|
||||||
'rou123'
|
'rou123',
|
||||||
|
cmd_resource=None,
|
||||||
).MultipleTimes().AndReturn('rou123')
|
).MultipleTimes().AndReturn('rou123')
|
||||||
self.stub_RouterConstraint_validate()
|
self.stub_RouterConstraint_validate()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user