5
from quantumclient.v2_0 import client as neutronclient
7
from neutronclient.v2_0 import client as neutronclient
9
from charmhelpers.contrib.openstack.amulet.deployment import (
10
OpenStackAmuletDeployment
13
from charmhelpers.contrib.openstack.amulet.utils import (
19
# Use DEBUG to turn on debug logging
20
u = OpenStackAmuletUtils(ERROR)
23
class QuantumGatewayBasicDeployment(OpenStackAmuletDeployment):
24
"""Amulet tests on a basic quantum-gateway deployment."""
26
def __init__(self, series, openstack=None, source=None):
27
"""Deploy the entire test environment."""
28
super(QuantumGatewayBasicDeployment, self).__init__(series, openstack,
32
self._configure_services()
34
self._initialize_tests()
36
def _add_services(self):
37
"""Add the service that we're testing, including the number of units,
38
where quantum-gateway is local, and the other charms are from
40
this_service = ('quantum-gateway', 1)
41
other_services = [('mysql', 1),
42
('rabbitmq-server', 1), ('keystone', 1),
43
('nova-cloud-controller', 1)]
44
super(QuantumGatewayBasicDeployment, self)._add_services(this_service,
47
def _add_relations(self):
48
"""Add all of the relations for the services."""
50
'keystone:shared-db': 'mysql:shared-db',
51
'quantum-gateway:shared-db': 'mysql:shared-db',
52
'quantum-gateway:amqp': 'rabbitmq-server:amqp',
53
'nova-cloud-controller:quantum-network-service': \
54
'quantum-gateway:quantum-network-service',
55
'nova-cloud-controller:shared-db': 'mysql:shared-db',
56
'nova-cloud-controller:identity-service': 'keystone:identity-service',
57
'nova-cloud-controller:amqp': 'rabbitmq-server:amqp'
59
super(QuantumGatewayBasicDeployment, self)._add_relations(relations)
61
def _configure_services(self):
62
"""Configure all of the services."""
63
keystone_config = {'admin-password': 'openstack',
64
'admin-token': 'ubuntutesting'}
65
nova_cc_config = {'network-manager': 'Quantum',
66
'quantum-security-groups': 'yes'}
67
configs = {'keystone': keystone_config,
68
'nova-cloud-controller': nova_cc_config}
69
super(QuantumGatewayBasicDeployment, self)._configure_services(configs)
71
def _initialize_tests(self):
72
"""Perform final initialization before tests get run."""
73
# Access the sentries for inspecting service units
74
self.mysql_sentry = self.d.sentry.unit['mysql/0']
75
self.keystone_sentry = self.d.sentry.unit['keystone/0']
76
self.rabbitmq_sentry = self.d.sentry.unit['rabbitmq-server/0']
77
self.nova_cc_sentry = self.d.sentry.unit['nova-cloud-controller/0']
78
self.quantum_gateway_sentry = self.d.sentry.unit['quantum-gateway/0']
80
# Authenticate admin with keystone
81
self.keystone = u.authenticate_keystone_admin(self.keystone_sentry,
87
# Authenticate admin with neutron
88
ep = self.keystone.service_catalog.url_for(service_type='identity',
89
endpoint_type='publicURL')
90
self.neutron = neutronclient.Client(auth_url=ep,
94
region_name='RegionOne')
96
def test_services(self):
97
"""Verify the expected services are running on the corresponding
99
if self._get_openstack_release() >= self.precise_havana:
100
neutron_services = ['status neutron-dhcp-agent',
101
'status neutron-lbaas-agent',
102
'status neutron-metadata-agent',
103
'status neutron-plugin-openvswitch-agent']
104
if self._get_openstack_release() == self.precise_havana:
105
neutron_services.append('status neutron-l3-agent')
107
neutron_services.append('status neutron-vpn-agent')
108
neutron_services.append('status neutron-metering-agent')
109
neutron_services.append('status neutron-ovs-cleanup')
111
neutron_services = ['status quantum-dhcp-agent',
112
'status quantum-l3-agent',
113
'status quantum-metadata-agent',
114
'status quantum-plugin-openvswitch-agent']
116
nova_cc_services = ['status nova-api-ec2',
117
'status nova-api-os-compute',
118
'status nova-objectstore',
120
'status nova-scheduler']
121
if self._get_openstack_release() >= self.precise_grizzly:
122
nova_cc_services.append('status nova-conductor')
125
self.mysql_sentry: ['status mysql'],
126
self.keystone_sentry: ['status keystone'],
127
self.nova_cc_sentry: nova_cc_services,
128
self.quantum_gateway_sentry: neutron_services
131
ret = u.validate_services(commands)
133
amulet.raise_status(amulet.FAIL, msg=ret)
135
def test_quantum_gateway_shared_db_relation(self):
136
"""Verify the quantum-gateway to mysql shared-db relation data"""
137
unit = self.quantum_gateway_sentry
138
relation = ['shared-db', 'mysql:shared-db']
140
'private-address': u.valid_ip,
143
'hostname': u.valid_ip
146
ret = u.validate_relation_data(unit, relation, expected)
148
message = u.relation_error('quantum-gateway shared-db', ret)
149
amulet.raise_status(amulet.FAIL, msg=message)
151
def test_mysql_shared_db_relation(self):
152
"""Verify the mysql to quantum-gateway shared-db relation data"""
153
unit = self.mysql_sentry
154
relation = ['shared-db', 'quantum-gateway:shared-db']
156
'private-address': u.valid_ip,
157
'password': u.not_null,
158
'db_host': u.valid_ip
161
ret = u.validate_relation_data(unit, relation, expected)
163
message = u.relation_error('mysql shared-db', ret)
164
amulet.raise_status(amulet.FAIL, msg=message)
166
def test_quantum_gateway_amqp_relation(self):
167
"""Verify the quantum-gateway to rabbitmq-server amqp relation data"""
168
unit = self.quantum_gateway_sentry
169
relation = ['amqp', 'rabbitmq-server:amqp']
171
'username': 'neutron',
172
'private-address': u.valid_ip,
176
ret = u.validate_relation_data(unit, relation, expected)
178
message = u.relation_error('quantum-gateway amqp', ret)
179
amulet.raise_status(amulet.FAIL, msg=message)
181
def test_rabbitmq_amqp_relation(self):
182
"""Verify the rabbitmq-server to quantum-gateway amqp relation data"""
183
unit = self.rabbitmq_sentry
184
relation = ['amqp', 'quantum-gateway:amqp']
186
'private-address': u.valid_ip,
187
'password': u.not_null,
188
'hostname': u.valid_ip
191
ret = u.validate_relation_data(unit, relation, expected)
193
message = u.relation_error('rabbitmq amqp', ret)
194
amulet.raise_status(amulet.FAIL, msg=message)
196
def test_quantum_gateway_network_service_relation(self):
197
"""Verify the quantum-gateway to nova-cc quantum-network-service
199
unit = self.quantum_gateway_sentry
200
relation = ['quantum-network-service',
201
'nova-cloud-controller:quantum-network-service']
203
'private-address': u.valid_ip
206
ret = u.validate_relation_data(unit, relation, expected)
208
message = u.relation_error('quantum-gateway network-service', ret)
209
amulet.raise_status(amulet.FAIL, msg=message)
211
def test_nova_cc_network_service_relation(self):
212
"""Verify the nova-cc to quantum-gateway quantum-network-service
214
unit = self.nova_cc_sentry
215
relation = ['quantum-network-service',
216
'quantum-gateway:quantum-network-service']
218
'service_protocol': 'http',
219
'service_tenant': 'services',
220
'quantum_url': u.valid_url,
221
'quantum_port': '9696',
222
'service_port': '5000',
223
'region': 'RegionOne',
224
'service_password': u.not_null,
225
'quantum_host': u.valid_ip,
226
'auth_port': '35357',
227
'auth_protocol': 'http',
228
'private-address': u.valid_ip,
229
'keystone_host': u.valid_ip,
230
'quantum_plugin': 'ovs',
231
'auth_host': u.valid_ip,
232
'service_username': 'quantum_s3_ec2_nova',
233
'service_tenant_name': 'services'
236
ret = u.validate_relation_data(unit, relation, expected)
238
message = u.relation_error('nova-cc network-service', ret)
239
amulet.raise_status(amulet.FAIL, msg=message)
241
def test_restart_on_config_change(self):
242
"""Verify that the specified services are restarted when the config
244
if self._get_openstack_release() >= self.precise_havana:
245
conf = '/etc/neutron/neutron.conf'
246
services = ['neutron-dhcp-agent', 'neutron-openvswitch-agent',
247
'neutron-metering-agent', 'neutron-lbaas-agent',
248
'neutron-metadata-agent']
249
if self._get_openstack_release() == self.precise_havana:
250
services.append('neutron-l3-agent')
252
services.append('neutron-vpn-agent')
254
conf = '/etc/quantum/quantum.conf'
255
services = ['quantum-dhcp-agent', 'quantum-openvswitch-agent',
256
'quantum-metadata-agent', 'quantum-l3-agent']
258
self.d.configure('quantum-gateway', {'debug': 'True'})
262
if not u.service_restarted(self.quantum_gateway_sentry, s, conf,
263
pgrep_full=True, sleep_time=time):
264
msg = "service {} didn't restart after config change".format(s)
265
amulet.raise_status(amulet.FAIL, msg=msg)
268
self.d.configure('quantum-gateway', {'debug': 'False'})
270
def test_neutron_config(self):
271
"""Verify the data in the neutron config file."""
272
unit = self.quantum_gateway_sentry
273
rabbitmq_relation = self.rabbitmq_sentry.relation('amqp',
274
'quantum-gateway:amqp')
276
if self._get_openstack_release() >= self.precise_havana:
277
conf = '/etc/neutron/neutron.conf'
282
'lock_path': '/var/lock/neutron',
283
'rabbit_userid': 'neutron',
284
'rabbit_virtual_host': 'openstack',
285
'rabbit_password': rabbitmq_relation['password'],
286
'rabbit_host': rabbitmq_relation['hostname'],
287
'control_exchange': 'neutron',
288
'notification_driver': 'neutron.openstack.common.notifier.'
290
'list_notifier_drivers': 'neutron.openstack.common.'
291
'notifier.rabbit_notifier'
294
'root_helper': 'sudo /usr/bin/neutron-rootwrap '
295
'/etc/neutron/rootwrap.conf'
299
conf = '/etc/quantum/quantum.conf'
304
'lock_path': '/var/lock/quantum',
305
'rabbit_userid': 'neutron',
306
'rabbit_virtual_host': 'openstack',
307
'rabbit_password': rabbitmq_relation['password'],
308
'rabbit_host': rabbitmq_relation['hostname'],
309
'control_exchange': 'quantum',
310
'notification_driver': 'quantum.openstack.common.notifier.'
312
'list_notifier_drivers': 'quantum.openstack.common.'
313
'notifier.rabbit_notifier'
316
'root_helper': 'sudo /usr/bin/quantum-rootwrap '
317
'/etc/quantum/rootwrap.conf'
321
if self._get_openstack_release() >= self.precise_icehouse:
322
expected['DEFAULT']['core_plugin'] = \
323
'neutron.plugins.ml2.plugin.Ml2Plugin'
324
elif self._get_openstack_release() >= self.precise_havana:
325
expected['DEFAULT']['core_plugin'] = \
326
'neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2'
328
expected['DEFAULT']['core_plugin'] = \
329
'quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2'
331
for section, pairs in expected.iteritems():
332
ret = u.validate_config_data(unit, conf, section, pairs)
334
message = "neutron config error: {}".format(ret)
335
amulet.raise_status(amulet.FAIL, msg=message)
337
def test_ml2_config(self):
338
"""Verify the data in the ml2 config file. This is only available
340
if self._get_openstack_release() < self.precise_icehouse:
343
unit = self.quantum_gateway_sentry
344
conf = '/etc/neutron/plugins/ml2/ml2_conf.ini'
345
quantum_gateway_relation = unit.relation('shared-db', 'mysql:shared-db')
348
'type_drivers': 'gre,vxlan',
349
'tenant_network_types': 'gre,vxlan',
350
'mechanism_drivers': 'openvswitch'
353
'tunnel_id_ranges': '1:1000'
356
'vni_ranges': '1001:2000'
359
'enable_tunneling': 'True',
360
'local_ip': quantum_gateway_relation['private-address']
363
'tunnel_types': 'gre'
366
'firewall_driver': 'neutron.agent.linux.iptables_firewall.'
367
'OVSHybridIptablesFirewallDriver'
371
for section, pairs in expected.iteritems():
372
ret = u.validate_config_data(unit, conf, section, pairs)
374
message = "ml2 config error: {}".format(ret)
375
amulet.raise_status(amulet.FAIL, msg=message)
377
def test_api_paste_config(self):
378
"""Verify the data in the api paste config file."""
379
unit = self.quantum_gateway_sentry
380
if self._get_openstack_release() >= self.precise_havana:
381
conf = '/etc/neutron/api-paste.ini'
383
'composite:neutron': {
384
'use': 'egg:Paste#urlmap',
385
'/': 'neutronversions',
386
'/v2.0': 'neutronapi_v2_0'
388
'filter:keystonecontext': {
389
'paste.filter_factory': 'neutron.auth:'
390
'NeutronKeystoneContext.factory'
392
'filter:authtoken': {
393
'paste.filter_factory': 'keystoneclient.middleware.'
394
'auth_token:filter_factory'
396
'filter:extensions': {
397
'paste.filter_factory': 'neutron.api.extensions:'
398
'plugin_aware_extension_middleware_'
401
'app:neutronversions': {
402
'paste.app_factory': 'neutron.api.versions:Versions.factory'
404
'app:neutronapiapp_v2_0': {
405
'paste.app_factory': 'neutron.api.v2.router:APIRouter.'
409
if self._get_openstack_release() == self.precise_havana:
410
expected_additional = {
411
'composite:neutronapi_v2_0': {
412
'use': 'call:neutron.auth:pipeline_factory',
413
'noauth': 'extensions neutronapiapp_v2_0',
414
'keystone': 'authtoken keystonecontext extensions '
419
expected_additional = {
420
'composite:neutronapi_v2_0': {
421
'use': 'call:neutron.auth:pipeline_factory',
422
'noauth': 'request_id catch_errors extensions '
423
'neutronapiapp_v2_0',
424
'keystone': 'request_id catch_errors authtoken '
425
'keystonecontext extensions '
429
expected = dict(expected.items() + expected_additional.items())
431
conf = '/etc/quantum/api-paste.ini'
433
'composite:quantum': {
434
'use': 'egg:Paste#urlmap',
435
'/': 'quantumversions',
436
'/v2.0': 'quantumapi_v2_0'
438
'composite:quantumapi_v2_0': {
439
'use': 'call:quantum.auth:pipeline_factory',
440
'noauth': 'extensions quantumapiapp_v2_0',
441
'keystone': 'authtoken keystonecontext extensions '
442
'quantumapiapp_v2_0',
444
'filter:keystonecontext': {
445
'paste.filter_factory': 'quantum.auth:'
446
'QuantumKeystoneContext.factory'
448
'filter:authtoken': {
449
'paste.filter_factory': 'keystoneclient.middleware.'
450
'auth_token:filter_factory'
452
'filter:extensions': {
453
'paste.filter_factory': 'quantum.api.extensions:'
454
'plugin_aware_extension_middleware_'
457
'app:quantumversions': {
458
'paste.app_factory': 'quantum.api.versions:Versions.factory'
460
'app:quantumapiapp_v2_0': {
461
'paste.app_factory': 'quantum.api.v2.router:APIRouter.'
466
for section, pairs in expected.iteritems():
467
ret = u.validate_config_data(unit, conf, section, pairs)
469
message = "api paste config error: {}".format(ret)
470
amulet.raise_status(amulet.FAIL, msg=message)
472
def test_dhcp_agent_config(self):
473
"""Verify the data in the dhcp agent config file."""
474
unit = self.quantum_gateway_sentry
475
if self._get_openstack_release() >= self.precise_havana:
476
conf = '/etc/neutron/dhcp_agent.ini'
478
'state_path': '/var/lib/neutron',
479
'interface_driver': 'neutron.agent.linux.interface.'
480
'OVSInterfaceDriver',
481
'dhcp_driver': 'neutron.agent.linux.dhcp.Dnsmasq',
482
'root_helper': 'sudo /usr/bin/neutron-rootwrap '
483
'/etc/neutron/rootwrap.conf',
484
'ovs_use_veth': 'True'
487
conf = '/etc/quantum/dhcp_agent.ini'
489
'state_path': '/var/lib/quantum',
490
'interface_driver': 'quantum.agent.linux.interface.'
491
'OVSInterfaceDriver',
492
'dhcp_driver': 'quantum.agent.linux.dhcp.Dnsmasq',
493
'root_helper': 'sudo /usr/bin/quantum-rootwrap '
494
'/etc/quantum/rootwrap.conf'
497
ret = u.validate_config_data(unit, conf, 'DEFAULT', expected)
499
message = "dhcp agent config error: {}".format(ret)
500
amulet.raise_status(amulet.FAIL, msg=message)
502
def test_fwaas_driver_config(self):
503
"""Verify the data in the fwaas driver config file. This is only
504
available since havana."""
505
if self._get_openstack_release() < self.precise_havana:
508
unit = self.quantum_gateway_sentry
509
conf = '/etc/neutron/fwaas_driver.ini'
511
'driver': 'neutron.services.firewall.drivers.linux.'
512
'iptables_fwaas.IptablesFwaasDriver',
516
ret = u.validate_config_data(unit, conf, 'fwaas', expected)
518
message = "fwaas driver config error: {}".format(ret)
519
amulet.raise_status(amulet.FAIL, msg=message)
521
def test_l3_agent_config(self):
522
"""Verify the data in the l3 agent config file."""
523
unit = self.quantum_gateway_sentry
524
nova_cc_relation = self.nova_cc_sentry.relation(\
525
'quantum-network-service',
526
'quantum-gateway:quantum-network-service')
527
ep = self.keystone.service_catalog.url_for(service_type='identity',
528
endpoint_type='publicURL')
530
if self._get_openstack_release() >= self.precise_havana:
531
conf = '/etc/neutron/l3_agent.ini'
533
'interface_driver': 'neutron.agent.linux.interface.'
534
'OVSInterfaceDriver',
536
'auth_region': 'RegionOne',
537
'admin_tenant_name': 'services',
538
'admin_user': 'quantum_s3_ec2_nova',
539
'admin_password': nova_cc_relation['service_password'],
540
'root_helper': 'sudo /usr/bin/neutron-rootwrap '
541
'/etc/neutron/rootwrap.conf',
542
'ovs_use_veth': 'True',
543
'handle_internal_only_routers': 'True'
546
conf = '/etc/quantum/l3_agent.ini'
548
'interface_driver': 'quantum.agent.linux.interface.'
549
'OVSInterfaceDriver',
551
'auth_region': 'RegionOne',
552
'admin_tenant_name': 'services',
553
'admin_user': 'quantum_s3_ec2_nova',
554
'admin_password': nova_cc_relation['service_password'],
555
'root_helper': 'sudo /usr/bin/quantum-rootwrap '
556
'/etc/quantum/rootwrap.conf'
559
ret = u.validate_config_data(unit, conf, 'DEFAULT', expected)
561
message = "l3 agent config error: {}".format(ret)
562
amulet.raise_status(amulet.FAIL, msg=message)
564
def test_lbaas_agent_config(self):
565
"""Verify the data in the lbaas agent config file. This is only
566
available since havana."""
567
if self._get_openstack_release() < self.precise_havana:
570
unit = self.quantum_gateway_sentry
571
conf = '/etc/neutron/lbaas_agent.ini'
574
'periodic_interval': '10',
575
'interface_driver': 'neutron.agent.linux.interface.'
576
'OVSInterfaceDriver',
577
'ovs_use_veth': 'False',
578
'device_driver': 'neutron.services.loadbalancer.drivers.'
579
'haproxy.namespace_driver.HaproxyNSDriver'
582
'loadbalancer_state_path': '$state_path/lbaas',
583
'user_group': 'nogroup'
587
for section, pairs in expected.iteritems():
588
ret = u.validate_config_data(unit, conf, section, pairs)
590
message = "lbaas agent config error: {}".format(ret)
591
amulet.raise_status(amulet.FAIL, msg=message)
593
def test_metadata_agent_config(self):
594
"""Verify the data in the metadata agent config file."""
595
unit = self.quantum_gateway_sentry
596
ep = self.keystone.service_catalog.url_for(service_type='identity',
597
endpoint_type='publicURL')
598
quantum_gateway_relation = unit.relation('shared-db', 'mysql:shared-db')
599
nova_cc_relation = self.nova_cc_sentry.relation(\
600
'quantum-network-service',
601
'quantum-gateway:quantum-network-service')
603
if self._get_openstack_release() >= self.precise_havana:
604
conf = '/etc/neutron/metadata_agent.ini'
607
'auth_region': 'RegionOne',
608
'admin_tenant_name': 'services',
609
'admin_user': 'quantum_s3_ec2_nova',
610
'admin_password': nova_cc_relation['service_password'],
611
'root_helper': 'sudo neutron-rootwrap '
612
'/etc/neutron/rootwrap.conf',
613
'state_path': '/var/lib/neutron',
614
'nova_metadata_ip': quantum_gateway_relation['private-address'],
615
'nova_metadata_port': '8775'
618
conf = '/etc/quantum/metadata_agent.ini'
621
'auth_region': 'RegionOne',
622
'admin_tenant_name': 'services',
623
'admin_user': 'quantum_s3_ec2_nova',
624
'admin_password': nova_cc_relation['service_password'],
625
'root_helper': 'sudo quantum-rootwrap '
626
'/etc/quantum/rootwrap.conf',
627
'state_path': '/var/lib/quantum',
628
'nova_metadata_ip': quantum_gateway_relation['private-address'],
629
'nova_metadata_port': '8775'
632
ret = u.validate_config_data(unit, conf, 'DEFAULT', expected)
634
message = "metadata agent config error: {}".format(ret)
635
amulet.raise_status(amulet.FAIL, msg=message)
637
def test_metering_agent_config(self):
638
"""Verify the data in the metering agent config file. This is only
639
available since havana."""
640
if self._get_openstack_release() < self.precise_havana:
643
unit = self.quantum_gateway_sentry
644
conf = '/etc/neutron/metering_agent.ini'
646
'driver': 'neutron.services.metering.drivers.iptables.'
647
'iptables_driver.IptablesMeteringDriver',
648
'measure_interval': '30',
649
'report_interval': '300',
650
'interface_driver': 'neutron.agent.linux.interface.'
651
'OVSInterfaceDriver',
652
'use_namespaces': 'True'
655
ret = u.validate_config_data(unit, conf, 'DEFAULT', expected)
657
message = "metering agent config error: {}".format(ret)
659
def test_nova_config(self):
660
"""Verify the data in the nova config file."""
661
unit = self.quantum_gateway_sentry
662
conf = '/etc/nova/nova.conf'
663
mysql_relation = self.mysql_sentry.relation('shared-db',
664
'quantum-gateway:shared-db')
665
db_uri = "mysql://{}:{}@{}/{}".format('nova',
666
mysql_relation['password'],
667
mysql_relation['db_host'],
669
rabbitmq_relation = self.rabbitmq_sentry.relation('amqp',
670
'quantum-gateway:amqp')
671
nova_cc_relation = self.nova_cc_sentry.relation(\
672
'quantum-network-service',
673
'quantum-gateway:quantum-network-service')
674
ep = self.keystone.service_catalog.url_for(service_type='identity',
675
endpoint_type='publicURL')
677
if self._get_openstack_release() >= self.precise_havana:
679
'logdir': '/var/log/nova',
680
'state_path': '/var/lib/nova',
681
'lock_path': '/var/lock/nova',
682
'root_helper': 'sudo nova-rootwrap /etc/nova/rootwrap.conf',
684
'use_syslog': 'False',
685
'api_paste_config': '/etc/nova/api-paste.ini',
686
'enabled_apis': 'metadata',
687
'multi_host': 'True',
688
'sql_connection': db_uri,
689
'service_neutron_metadata_proxy': 'True',
690
'rabbit_userid': 'neutron',
691
'rabbit_virtual_host': 'openstack',
692
'rabbit_password': rabbitmq_relation['password'],
693
'rabbit_host': rabbitmq_relation['hostname'],
694
'network_api_class': 'nova.network.neutronv2.api.API',
695
'neutron_auth_strategy': 'keystone',
696
'neutron_url': nova_cc_relation['quantum_url'],
697
'neutron_admin_tenant_name': 'services',
698
'neutron_admin_username': 'quantum_s3_ec2_nova',
699
'neutron_admin_password': nova_cc_relation['service_password'],
700
'neutron_admin_auth_url': ep
705
'logdir': '/var/log/nova',
706
'state_path': '/var/lib/nova',
707
'lock_path': '/var/lock/nova',
708
'root_helper': 'sudo nova-rootwrap /etc/nova/rootwrap.conf',
710
'api_paste_config': '/etc/nova/api-paste.ini',
711
'enabled_apis': 'metadata',
712
'multi_host': 'True',
713
'sql_connection': db_uri,
714
'service_quantum_metadata_proxy': 'True',
715
'rabbit_userid': 'neutron',
716
'rabbit_virtual_host': 'openstack',
717
'rabbit_password': rabbitmq_relation['password'],
718
'rabbit_host': rabbitmq_relation['hostname'],
719
'network_api_class': 'nova.network.quantumv2.api.API',
720
'quantum_auth_strategy': 'keystone',
721
'quantum_url': nova_cc_relation['quantum_url'],
722
'quantum_admin_tenant_name': 'services',
723
'quantum_admin_username': 'quantum_s3_ec2_nova',
724
'quantum_admin_password': nova_cc_relation['service_password'],
725
'quantum_admin_auth_url': ep
728
ret = u.validate_config_data(unit, conf, 'DEFAULT', expected)
730
message = "nova config error: {}".format(ret)
731
amulet.raise_status(amulet.FAIL, msg=message)
733
def test_ovs_neutron_plugin_config(self):
734
"""Verify the data in the ovs neutron plugin config file. The ovs
735
plugin is not used by default since icehouse."""
736
if self._get_openstack_release() >= self.precise_icehouse:
739
unit = self.quantum_gateway_sentry
740
quantum_gateway_relation = unit.relation('shared-db', 'mysql:shared-db')
742
if self._get_openstack_release() >= self.precise_havana:
743
conf = '/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini'
746
'local_ip': quantum_gateway_relation['private-address'],
747
'tenant_network_type': 'gre',
748
'enable_tunneling': 'True',
749
'tunnel_id_ranges': '1:1000'
752
if self._get_openstack_release() > self.precise_havana:
753
expected_additional = {
755
'polling_interval': '10',
756
'root_helper': 'sudo /usr/bin/neutron-rootwrap '
757
'/etc/neutron/rootwrap.conf'
760
expected = dict(expected.items() + expected_additional.items())
762
conf = '/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini'
765
'local_ip': quantum_gateway_relation['private-address'],
766
'tenant_network_type': 'gre',
767
'enable_tunneling': 'True',
768
'tunnel_id_ranges': '1:1000'
771
'polling_interval': '10',
772
'root_helper': 'sudo /usr/bin/quantum-rootwrap '
773
'/etc/quantum/rootwrap.conf'
777
for section, pairs in expected.iteritems():
778
ret = u.validate_config_data(unit, conf, section, pairs)
780
message = "ovs neutron plugin config error: {}".format(ret)
781
amulet.raise_status(amulet.FAIL, msg=message)
783
def test_vpn_agent_config(self):
784
"""Verify the data in the vpn agent config file. This isn't available
786
if self._get_openstack_release() < self.precise_havana:
789
unit = self.quantum_gateway_sentry
790
conf = '/etc/neutron/vpn_agent.ini'
793
'vpn_device_driver': 'neutron.services.vpn.device_drivers.'
794
'ipsec.OpenSwanDriver'
797
'ipsec_status_check_interval': '60'
801
for section, pairs in expected.iteritems():
802
ret = u.validate_config_data(unit, conf, section, pairs)
804
message = "vpn agent config error: {}".format(ret)
805
amulet.raise_status(amulet.FAIL, msg=message)
807
def test_create_network(self):
808
"""Create a network, verify that it exists, and then delete it."""
809
self.neutron.format = 'json'
812
#Verify that the network doesn't exist
813
networks = self.neutron.list_networks(name=net_name)
814
net_count = len(networks['networks'])
816
msg = "Expected zero networks, found {}".format(net_count)
817
amulet.raise_status(amulet.FAIL, msg=msg)
819
# Create a network and verify that it exists
820
network = {'name': net_name}
821
self.neutron.create_network({'network':network})
823
networks = self.neutron.list_networks(name=net_name)
824
net_len = len(networks['networks'])
826
msg = "Expected 1 network, found {}".format(net_len)
827
amulet.raise_status(amulet.FAIL, msg=msg)
829
network = networks['networks'][0]
830
if network['name'] != net_name:
831
amulet.raise_status(amulet.FAIL, msg="network ext_net not found")
834
self.neutron.delete_network(network['id'])