Merge "Update Baymodel in Magnum resources"
This commit is contained in:
@@ -26,11 +26,13 @@ class BayModel(resource.Resource):
|
|||||||
PROPERTIES = (
|
PROPERTIES = (
|
||||||
NAME, IMAGE, FLAVOR, MASTER_FLAVOR, KEYPAIR,
|
NAME, IMAGE, FLAVOR, MASTER_FLAVOR, KEYPAIR,
|
||||||
EXTERNAL_NETWORK, FIXED_NETWORK, DNS_NAMESERVER,
|
EXTERNAL_NETWORK, FIXED_NETWORK, DNS_NAMESERVER,
|
||||||
DOCKER_VOLUME_SIZE, SSH_AUTHORIZED_KEY, COE
|
DOCKER_VOLUME_SIZE, SSH_AUTHORIZED_KEY, COE, NETWORK_DRIVER,
|
||||||
|
HTTP_PROXY, HTTPS_PROXY, NO_PROXY, LABELS, INSECURE
|
||||||
) = (
|
) = (
|
||||||
'name', 'image', 'flavor', 'master_flavor', 'keypair',
|
'name', 'image', 'flavor', 'master_flavor', 'keypair',
|
||||||
'external_network', 'fixed_network', 'dns_nameserver',
|
'external_network', 'fixed_network', 'dns_nameserver',
|
||||||
'docker_volume_size', 'ssh_authorized_key', 'coe'
|
'docker_volume_size', 'ssh_authorized_key', 'coe', 'network_driver',
|
||||||
|
'http_proxy', 'https_proxy', 'no_proxy', 'labels', 'insecure'
|
||||||
)
|
)
|
||||||
|
|
||||||
properties_schema = {
|
properties_schema = {
|
||||||
@@ -110,7 +112,43 @@ class BayModel(resource.Resource):
|
|||||||
constraints.AllowedValues(['kubernetes', 'swarm'])
|
constraints.AllowedValues(['kubernetes', 'swarm'])
|
||||||
],
|
],
|
||||||
required=True
|
required=True
|
||||||
)
|
),
|
||||||
|
NETWORK_DRIVER: properties.Schema(
|
||||||
|
properties.Schema.STRING,
|
||||||
|
_('The name of the driver used for instantiating '
|
||||||
|
'container networks.'),
|
||||||
|
required=True,
|
||||||
|
support_status=support.SupportStatus(version='6.0.0')
|
||||||
|
),
|
||||||
|
HTTP_PROXY: properties.Schema(
|
||||||
|
properties.Schema.STRING,
|
||||||
|
_('The http_proxy address to use for nodes in bay.'),
|
||||||
|
support_status=support.SupportStatus(version='6.0.0')
|
||||||
|
),
|
||||||
|
HTTPS_PROXY: properties.Schema(
|
||||||
|
properties.Schema.STRING,
|
||||||
|
_('The https_proxy address to use for nodes in bay.'),
|
||||||
|
support_status=support.SupportStatus(version='6.0.0')
|
||||||
|
),
|
||||||
|
NO_PROXY: properties.Schema(
|
||||||
|
properties.Schema.STRING,
|
||||||
|
_('A comma separated list of addresses for which proxies should '
|
||||||
|
'not be used in the bay.'),
|
||||||
|
support_status=support.SupportStatus(version='6.0.0')
|
||||||
|
),
|
||||||
|
LABELS: properties.Schema(
|
||||||
|
properties.Schema.MAP,
|
||||||
|
_('Arbitrary labels in the form of key=value pairs to '
|
||||||
|
'associate with a baymodel.'),
|
||||||
|
support_status=support.SupportStatus(version='6.0.0')
|
||||||
|
),
|
||||||
|
INSECURE: properties.Schema(
|
||||||
|
properties.Schema.BOOLEAN,
|
||||||
|
_('Disable TLS in the Bay.'),
|
||||||
|
default=False,
|
||||||
|
support_status=support.SupportStatus(version='6.0.0')
|
||||||
|
),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default_client_name = 'magnum'
|
default_client_name = 'magnum'
|
||||||
@@ -129,8 +167,15 @@ class BayModel(resource.Resource):
|
|||||||
'dns_nameserver': self.properties[self.DNS_NAMESERVER],
|
'dns_nameserver': self.properties[self.DNS_NAMESERVER],
|
||||||
'docker_volume_size': self.properties[self.DOCKER_VOLUME_SIZE],
|
'docker_volume_size': self.properties[self.DOCKER_VOLUME_SIZE],
|
||||||
'ssh_authorized_key': self.properties[self.SSH_AUTHORIZED_KEY],
|
'ssh_authorized_key': self.properties[self.SSH_AUTHORIZED_KEY],
|
||||||
'coe': self.properties[self.COE]
|
'coe': self.properties[self.COE],
|
||||||
|
'network_driver': self.properties[self.NETWORK_DRIVER],
|
||||||
|
'http_proxy': self.properties[self. HTTP_PROXY],
|
||||||
|
'https_proxy': self.properties[self.HTTPS_PROXY],
|
||||||
|
'no_proxy': self.properties[self.NO_PROXY],
|
||||||
|
'labels': self.properties[self.LABELS],
|
||||||
|
'insecure': self.properties[self.INSECURE]
|
||||||
}
|
}
|
||||||
|
|
||||||
bm = self.client().baymodels.create(**args)
|
bm = self.client().baymodels.create(**args)
|
||||||
self.resource_id_set(bm.uuid)
|
self.resource_id_set(bm.uuid)
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,11 @@ from heat.tests import common
|
|||||||
from heat.tests import utils
|
from heat.tests import utils
|
||||||
|
|
||||||
|
|
||||||
magnum_template = '''
|
RESOURCE_TYPE = 'OS::Magnum::BayModel'
|
||||||
|
|
||||||
|
|
||||||
|
class TestMagnumBayModel(common.HeatTestCase):
|
||||||
|
magnum_template = '''
|
||||||
heat_template_version: 2015-04-30
|
heat_template_version: 2015-04-30
|
||||||
resources:
|
resources:
|
||||||
test_baymodel:
|
test_baymodel:
|
||||||
@@ -38,22 +42,14 @@ magnum_template = '''
|
|||||||
docker_volume_size: 5
|
docker_volume_size: 5
|
||||||
ssh_authorized_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB
|
ssh_authorized_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB
|
||||||
coe: 'swarm'
|
coe: 'swarm'
|
||||||
|
network_driver: 'flannel'
|
||||||
'''
|
'''
|
||||||
|
|
||||||
RESOURCE_TYPE = 'OS::Magnum::BayModel'
|
|
||||||
|
|
||||||
|
|
||||||
class FakeBayModel(object):
|
|
||||||
def __init__(self):
|
|
||||||
self.to_dict = lambda: {'attr': 'val'}
|
|
||||||
|
|
||||||
|
|
||||||
class TestMagnumBayModel(common.HeatTestCase):
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestMagnumBayModel, self).setUp()
|
super(TestMagnumBayModel, self).setUp()
|
||||||
self.ctx = utils.dummy_context()
|
self.ctx = utils.dummy_context()
|
||||||
resource._register_class(RESOURCE_TYPE, baymodel.BayModel)
|
resource._register_class(RESOURCE_TYPE, baymodel.BayModel)
|
||||||
t = template_format.parse(magnum_template)
|
t = template_format.parse(self.magnum_template)
|
||||||
self.stack = utils.parse_stack(t)
|
self.stack = utils.parse_stack(t)
|
||||||
|
|
||||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||||
@@ -85,7 +81,29 @@ class TestMagnumBayModel(common.HeatTestCase):
|
|||||||
self.assertEqual(1, len(mapping))
|
self.assertEqual(1, len(mapping))
|
||||||
self.assertEqual(baymodel.BayModel, mapping[RESOURCE_TYPE])
|
self.assertEqual(baymodel.BayModel, mapping[RESOURCE_TYPE])
|
||||||
|
|
||||||
def test_show_resource(self):
|
|
||||||
bm = self._create_resource('bm', self.rsrc_defn, self.stack)
|
class TestMagnumBayModelWithAddedProperties(TestMagnumBayModel):
|
||||||
self.client.baymodels.get.return_value = FakeBayModel()
|
magnum_template = '''
|
||||||
self.assertEqual({'attr': 'val'}, bm.FnGetAtt('show'))
|
heat_template_version: 2015-04-30
|
||||||
|
resources:
|
||||||
|
test_baymodel:
|
||||||
|
type: OS::Magnum::BayModel
|
||||||
|
properties:
|
||||||
|
name: test_bay_model
|
||||||
|
image: fedora-21-atomic-2
|
||||||
|
flavor: m1.small
|
||||||
|
master_flavor: m1.medium
|
||||||
|
keypair: heat_key
|
||||||
|
external_network: 0244b54d-ae1f-44f0-a24a-442760f1d681
|
||||||
|
fixed_network: 0f59a3dd-fac1-4d03-b41a-d4115fbffa89
|
||||||
|
dns_nameserver: 8.8.8.8
|
||||||
|
docker_volume_size: 5
|
||||||
|
ssh_authorized_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB
|
||||||
|
coe: 'swarm'
|
||||||
|
network_driver: 'flannel'
|
||||||
|
http_proxy: 'http://proxy.com:123'
|
||||||
|
https_proxy: 'https://proxy.com:123'
|
||||||
|
no_proxy: '192.168.0.1'
|
||||||
|
labels: {'flannel_cidr': ['10.101.0.0/16', '10.102.0.0/16']}
|
||||||
|
insecure: True
|
||||||
|
'''
|
||||||
|
|||||||
Reference in New Issue
Block a user