Merge "Adds Container Network Model network_driver support"
This commit is contained in:
commit
68953be963
@ -214,6 +214,7 @@ class TestCommandLineArgument(utils.TestCase):
|
||||
'--dns-nameserver test_dns '
|
||||
'--flavor-id test_flavor '
|
||||
'--fixed-network public '
|
||||
'--network-driver test_driver '
|
||||
'--master-flavor-id test_flavor '
|
||||
'--docker-volume-size 10')
|
||||
self.assertTrue(mock_create.called)
|
||||
@ -260,6 +261,16 @@ class TestCommandLineArgument(utils.TestCase):
|
||||
'--coe swarm')
|
||||
self.assertTrue(mock_create.called)
|
||||
|
||||
@mock.patch('magnumclient.v1.baymodels.BayModelManager.create')
|
||||
def test_baymodel_create_network_driver_success(self, mock_create):
|
||||
self._test_arg_success('baymodel-create '
|
||||
'--name test --network-driver test_driver '
|
||||
'--keypair-id test_keypair '
|
||||
'--external-network-id test_net '
|
||||
'--image-id test_image '
|
||||
'--coe swarm')
|
||||
self.assertTrue(mock_create.called)
|
||||
|
||||
@mock.patch('magnumclient.v1.baymodels.BayModelManager.create')
|
||||
def test_baymodel_create_ssh_authorized_key_success(self, mock_create):
|
||||
self._test_arg_success('baymodel-create '
|
||||
|
@ -30,6 +30,7 @@ BAYMODEL1 = {'id': 123,
|
||||
'keypair_id': 'keypair1',
|
||||
'external_network_id': 'd1f02cfb-d27f-4068-9332-84d907cb0e21',
|
||||
'fixed_network': 'private',
|
||||
'network_driver': 'libnetwork',
|
||||
'dns_nameserver': '8.8.1.1',
|
||||
'docker_volume_size': '71',
|
||||
'ssh_authorized_key': 'ssh-rsa AAAAB3NaC1yc2EAAAADAABAAABAQC'
|
||||
@ -53,6 +54,7 @@ BAYMODEL2 = {'id': 124,
|
||||
'keypair_id': 'keypair2',
|
||||
'external_network_id': 'd1f02cfb-d27f-4068-9332-84d907cb0e22',
|
||||
'fixed_network': 'private2',
|
||||
'network_driver': 'flannel',
|
||||
'dns_nameserver': '8.8.1.2',
|
||||
'docker_volume_size': '50',
|
||||
'ssh_authorized_key': 'ssh-rsa AAAAB3NzaC1ycEAAAADAQABAAABAQC'
|
||||
@ -150,6 +152,7 @@ class BayModelManagerTest(testtools.TestCase):
|
||||
self.assertEqual(BAYMODEL1['http_proxy'], baymodel.http_proxy)
|
||||
self.assertEqual(BAYMODEL1['https_proxy'], baymodel.https_proxy)
|
||||
self.assertEqual(BAYMODEL1['no_proxy'], baymodel.no_proxy)
|
||||
self.assertEqual(BAYMODEL1['network_driver'], baymodel.network_driver)
|
||||
|
||||
def test_baymodel_show_by_name(self):
|
||||
baymodel = self.mgr.get(BAYMODEL1['name'])
|
||||
@ -168,6 +171,7 @@ class BayModelManagerTest(testtools.TestCase):
|
||||
self.assertEqual(BAYMODEL1['http_proxy'], baymodel.http_proxy)
|
||||
self.assertEqual(BAYMODEL1['https_proxy'], baymodel.https_proxy)
|
||||
self.assertEqual(BAYMODEL1['no_proxy'], baymodel.no_proxy)
|
||||
self.assertEqual(BAYMODEL1['network_driver'], baymodel.network_driver)
|
||||
|
||||
def test_baymodel_create(self):
|
||||
baymodel = self.mgr.create(**CREATE_BAYMODEL)
|
||||
|
@ -178,6 +178,8 @@ class ShellTest(base.TestCase):
|
||||
args.docker_volume_size = docker_volume_size
|
||||
fixed_network = "private"
|
||||
args.fixed_network = fixed_network
|
||||
network_driver = "test_driver"
|
||||
args.network_driver = network_driver
|
||||
ssh_authorized_key = "test_key"
|
||||
args.ssh_authorized_key = ssh_authorized_key
|
||||
coe = 'swarm'
|
||||
@ -188,6 +190,7 @@ class ShellTest(base.TestCase):
|
||||
args.https_proxy = 'https_proxy'
|
||||
no_proxy = 'no_proxy'
|
||||
args.no_proxy = no_proxy
|
||||
|
||||
shell.do_baymodel_create(client_mock, args)
|
||||
client_mock.baymodels.create.assert_called_once_with(
|
||||
name=name, image_id=image_id, flavor_id=flavor_id,
|
||||
@ -197,7 +200,7 @@ class ShellTest(base.TestCase):
|
||||
fixed_network=fixed_network, dns_nameserver=dns_nameserver,
|
||||
ssh_authorized_key=ssh_authorized_key, coe=coe,
|
||||
http_proxy=http_proxy, https_proxy=https_proxy,
|
||||
no_proxy=no_proxy)
|
||||
no_proxy=no_proxy, network_driver=network_driver)
|
||||
|
||||
def test_do_baymodel_delete(self):
|
||||
client_mock = mock.MagicMock()
|
||||
|
@ -19,7 +19,7 @@ CREATION_ATTRIBUTES = ['name', 'image_id', 'flavor_id', 'master_flavor_id',
|
||||
'keypair_id', 'external_network_id', 'fixed_network',
|
||||
'dns_nameserver', 'docker_volume_size',
|
||||
'ssh_authorized_key', 'coe', 'http_proxy',
|
||||
'https_proxy', 'no_proxy']
|
||||
'https_proxy', 'no_proxy', 'network_driver']
|
||||
|
||||
|
||||
class BayModel(base.Resource):
|
||||
|
@ -169,6 +169,10 @@ def do_bay_update(cs, args):
|
||||
metavar='<fixed-network>',
|
||||
help='The private Neutron network name to connect to this bay'
|
||||
' model.')
|
||||
@utils.arg('--network-driver',
|
||||
metavar='<network-driver>',
|
||||
help='The network driver name for instantiating container'
|
||||
' networks.')
|
||||
@utils.arg('--ssh-authorized-key',
|
||||
metavar='<ssh-authorized-key>',
|
||||
help='The SSH authorized key to use')
|
||||
@ -206,6 +210,7 @@ def do_baymodel_create(cs, args):
|
||||
opts['keypair_id'] = args.keypair_id
|
||||
opts['external_network_id'] = args.external_network_id
|
||||
opts['fixed_network'] = args.fixed_network
|
||||
opts['network_driver'] = args.network_driver
|
||||
opts['dns_nameserver'] = args.dns_nameserver
|
||||
opts['docker_volume_size'] = args.docker_volume_size
|
||||
opts['ssh_authorized_key'] = args.ssh_authorized_key
|
||||
|
Loading…
x
Reference in New Issue
Block a user