Merge lp:~bbaqar/charms/trusty/plumgrid-director/conflicts into lp:charms/trusty/plumgrid-director

Proposed by Bilal Baqar
Status: Merged
Merged at revision: 18
Proposed branch: lp:~bbaqar/charms/trusty/plumgrid-director/conflicts
Merge into: lp:charms/trusty/plumgrid-director
Diff against target: 780 lines (+206/-202)
12 files modified
Makefile (+1/-1)
config.yaml (+32/-0)
hooks/charmhelpers/contrib/openstack/neutron.py (+2/-2)
hooks/pg_dir_context.py (+7/-6)
hooks/pg_dir_hooks.py (+16/-4)
hooks/pg_dir_utils.py (+116/-29)
templates/kilo/ifcs.conf (+1/-1)
templates/kilo/nginx.conf (+17/-0)
tests/files/plumgrid-director-dense.yaml (+0/-133)
tests/test.yaml (+0/-2)
unit_tests/test_pg_dir_context.py (+11/-8)
unit_tests/test_pg_dir_hooks.py (+3/-16)
To merge this branch: bzr merge lp:~bbaqar/charms/trusty/plumgrid-director/conflicts
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+288021@code.launchpad.net

Description of the change

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2015-08-24 16:18:48 +0000
3+++ Makefile 2016-03-03 21:07:28 +0000
4@@ -7,7 +7,7 @@
5 netaddr jinja2
6
7 lint: virtualenv
8- .venv/bin/flake8 --exclude hooks/charmhelpers hooks unit_tests tests
9+ .venv/bin/flake8 --exclude hooks/charmhelpers hooks unit_tests tests --ignore E402
10 @charm proof
11
12 unit_test: virtualenv
13
14=== modified file 'config.yaml'
15--- config.yaml 2015-08-16 19:04:53 +0000
16+++ config.yaml 2016-03-03 21:07:28 +0000
17@@ -7,6 +7,28 @@
18 default: 'null'
19 type: string
20 description: Public SSH key of PLUMgrid LCM which is running PG-Tools.
21+ mgmt-interface:
22+ type: string
23+ default: 'juju-br0'
24+ description: The interface connected to PLUMgrid Managment network.
25+ os-data-network:
26+ type: string
27+ default:
28+ description: |
29+ The IP address and netmask of the OpenStack Data network (e.g.,
30+ 192.168.0.0/24)
31+ .
32+ This network will be used for tenant network traffic in overlay
33+ networks.
34+ fabric-interfaces:
35+ default: 'MANAGEMENT'
36+ type: string
37+ description: |
38+ Interfaces that will provide fabric connectivity on the director nodes.
39+ Provided in form of json in a string. These interfaces have to be connected
40+ to the os-data-network specified in the config. Default value is MANAGEMENT which
41+ will configure the management interface as the fabric interface on each
42+ director.
43 network-device-mtu:
44 type: string
45 default: '1580'
46@@ -19,6 +41,16 @@
47 default: null
48 type: string
49 description: Provide the respective keys of the install sources.
50+ plumgrid-build:
51+ default: 'latest'
52+ type: string
53+ description: |
54+ Provide the build version of PLUMgrid packages that needs to be installed
55+ iovisor-build:
56+ default: 'latest'
57+ type: string
58+ description: |
59+ Provide the build version of iovisor package that needs to be installed
60 plumgrid-license-key:
61 default: null
62 type: string
63
64=== modified file 'hooks/charmhelpers/contrib/openstack/neutron.py'
65--- hooks/charmhelpers/contrib/openstack/neutron.py 2015-07-29 18:07:31 +0000
66+++ hooks/charmhelpers/contrib/openstack/neutron.py 2016-03-03 21:07:28 +0000
67@@ -204,8 +204,8 @@
68 database=config('database'),
69 ssl_dir=NEUTRON_CONF_DIR)],
70 'services': [],
71- 'packages': [['plumgrid-lxc'],
72- ['iovisor-dkms']],
73+ 'packages': ['plumgrid-lxc',
74+ 'iovisor-dkms'],
75 'server_packages': ['neutron-server',
76 'neutron-plugin-plumgrid'],
77 'server_services': ['neutron-server']
78
79=== modified file 'hooks/pg_dir_context.py'
80--- hooks/pg_dir_context.py 2015-08-24 16:18:48 +0000
81+++ hooks/pg_dir_context.py 2016-03-03 21:07:28 +0000
82@@ -29,7 +29,7 @@
83 for rid in relation_ids('director'):
84 for unit in related_units(rid):
85 rdata = relation_get(rid=rid, unit=unit)
86- pg_dir_ips.append(rdata['private-address'])
87+ pg_dir_ips.append(get_host_ip(rdata['private-address']))
88 return pg_dir_ips
89
90
91@@ -82,11 +82,12 @@
92 pg_dir_ips_string = pg_dir_ips_string + ',' + str(ip)
93 pg_ctxt['director_ips_string'] = pg_dir_ips_string
94 pg_ctxt['virtual_ip'] = conf['plumgrid-virtual-ip']
95- pg_ctxt['pg_hostname'] = "pg-director"
96- from pg_dir_utils import check_interface_type
97- interface_type = check_interface_type()
98- pg_ctxt['interface'] = interface_type
99- pg_ctxt['label'] = get_unit_hostname()
100+ unit_hostname = get_unit_hostname()
101+ pg_ctxt['pg_hostname'] = unit_hostname
102+ from pg_dir_utils import get_mgmt_interface, get_fabric_interface
103+ pg_ctxt['interface'] = get_mgmt_interface()
104+ pg_ctxt['fabric_interface'] = get_fabric_interface()
105+ pg_ctxt['label'] = unit_hostname
106 pg_ctxt['fabric_mode'] = 'host'
107 virtual_ip_array = re.split('\.', conf['plumgrid-virtual-ip'])
108 pg_ctxt['virtual_router_id'] = virtual_ip_array[3]
109
110=== modified file 'hooks/pg_dir_hooks.py'
111--- hooks/pg_dir_hooks.py 2015-08-24 16:18:48 +0000
112+++ hooks/pg_dir_hooks.py 2016-03-03 21:07:28 +0000
113@@ -30,6 +30,7 @@
114 ensure_mtu,
115 add_lcm_key,
116 post_pg_license,
117+ fabric_interface_changed
118 )
119
120 hooks = Hooks()
121@@ -47,7 +48,7 @@
122 apt_install(pkg, options=['--force-yes'], fatal=True)
123 load_iovisor()
124 ensure_mtu()
125- add_lcm_key()
126+ CONFIGS.write_all()
127
128
129 @hooks.hook('director-relation-joined')
130@@ -65,17 +66,28 @@
131 This hook is run when a config parameter is changed.
132 It also runs on node reboot.
133 '''
134- if post_pg_license():
135- log("PLUMgrid License Posted")
136- return 1
137 if add_lcm_key():
138 log("PLUMgrid LCM Key added")
139 return 1
140+ charm_config = config()
141+ if charm_config.changed('plumgrid-license-key'):
142+ if post_pg_license():
143+ log("PLUMgrid License Posted")
144+ return 1
145+ if charm_config.changed('fabric-interfaces'):
146+ if not fabric_interface_changed():
147+ log("Fabric interface already set")
148+ return 1
149+ if charm_config.changed('os-data-network'):
150+ if charm_config['fabric-interfaces'] == 'MANAGEMENT':
151+ log('Fabric running on managment network')
152+ return 1
153 stop_pg()
154 configure_sources(update=True)
155 pkgs = determine_packages()
156 for pkg in pkgs:
157 apt_install(pkg, options=['--force-yes'], fatal=True)
158+ remove_iovisor()
159 load_iovisor()
160 ensure_mtu()
161 add_lcm_key()
162
163=== modified file 'hooks/pg_dir_utils.py'
164--- hooks/pg_dir_utils.py 2015-08-24 16:18:48 +0000
165+++ hooks/pg_dir_utils.py 2016-03-03 21:07:28 +0000
166@@ -7,6 +7,18 @@
167 from charmhelpers.core.hookenv import (
168 log,
169 config,
170+ unit_get,
171+)
172+from charmhelpers.contrib.network.ip import (
173+ get_iface_from_addr,
174+ get_bridges,
175+ get_bridge_nics,
176+ is_ip,
177+ is_address_in_network,
178+ get_iface_addr
179+)
180+from charmhelpers.fetch import (
181+ apt_cache
182 )
183 from charmhelpers.contrib.openstack import templating
184 from charmhelpers.core.host import set_nic_mtu
185@@ -19,11 +31,11 @@
186 service_start,
187 service_stop,
188 )
189+from socket import gethostname as get_unit_hostname
190 import pg_dir_context
191 import subprocess
192 import time
193 import os
194-import re
195 import json
196
197 LXC_CONF = '/etc/libvirt/lxc.conf'
198@@ -74,7 +86,25 @@
199 Returns list of packages required by PLUMgrid director as specified
200 in the neutron_plugins dictionary in charmhelpers.
201 '''
202- return neutron_plugin_attribute('plumgrid', 'packages', 'neutron')
203+ pkgs = []
204+ tag = 'latest'
205+ for pkg in neutron_plugin_attribute('plumgrid', 'packages', 'neutron'):
206+ if 'plumgrid' in pkg:
207+ tag = config('plumgrid-build')
208+ elif pkg == 'iovisor-dkms':
209+ tag = config('iovisor-build')
210+
211+ if tag == 'latest':
212+ pkgs.append(pkg)
213+ else:
214+ if tag in [i.ver_str for i in apt_cache()[pkg].version_list]:
215+ pkgs.append('%s=%s' % (pkg, tag))
216+ else:
217+ error_msg = \
218+ "Build version '%s' for package '%s' not available" \
219+ % (tag, pkg)
220+ raise ValueError(error_msg)
221+ return pkgs
222
223
224 def register_configs(release=None):
225@@ -139,38 +169,94 @@
226 '''
227 _exec_cmd(cmd=['rmmod', 'iovisor'],
228 error_msg='Error Loading IOVisor Kernel Module')
229-
230-
231-def check_interface_type():
232- '''
233- Checks the interface. Support added for AWS deployments. There are 2
234- possible interfaces "juju-br0" and "eth0". The default being juju-br0
235- '''
236- log("Checking Interface Type")
237- default_interface = "juju-br0"
238- AWS_interface = "eth0"
239- shell_output = subprocess.check_output(['brctl', 'show', 'juju-br0'])
240- output = re.split(' |\n|\t', shell_output)
241- if output[10] == '':
242- return AWS_interface
243- else:
244- return default_interface
245+ time.sleep(1)
246+
247+
248+def interface_exists(interface):
249+ '''
250+ Checks if interface exists on node.
251+ '''
252+ try:
253+ subprocess.check_call(['ip', 'link', 'show', interface],
254+ stdout=open(os.devnull, 'w'),
255+ stderr=subprocess.STDOUT)
256+ except subprocess.CalledProcessError:
257+ return False
258+ return True
259+
260+
261+def get_mgmt_interface():
262+ '''
263+ Returns the managment interface.
264+ '''
265+ mgmt_interface = config('mgmt-interface')
266+ if interface_exists(mgmt_interface):
267+ return mgmt_interface
268+ else:
269+ log('Provided managment interface %s does not exist'
270+ % mgmt_interface)
271+ return get_iface_from_addr(unit_get('private-address'))
272+
273+
274+def fabric_interface_changed():
275+ '''
276+ Returns true if interface for node changed.
277+ '''
278+ fabric_interface = get_fabric_interface()
279+ try:
280+ with open(PG_IFCS_CONF, 'r') as ifcs:
281+ for line in ifcs:
282+ if 'fabric_core' in line:
283+ if line.split()[0] == fabric_interface:
284+ return False
285+ except IOError:
286+ return True
287+ return True
288+
289+
290+def get_fabric_interface():
291+ '''
292+ Returns the fabric interface.
293+ '''
294+ fabric_interfaces = config('fabric-interfaces')
295+ if fabric_interfaces == 'MANAGEMENT':
296+ return get_mgmt_interface()
297+ else:
298+ try:
299+ all_fabric_interfaces = json.loads(fabric_interfaces)
300+ except ValueError:
301+ raise ValueError('Invalid json provided for fabric interfaces')
302+ hostname = get_unit_hostname()
303+ if hostname in all_fabric_interfaces:
304+ node_fabric_interface = all_fabric_interfaces[hostname]
305+ elif 'DEFAULT' in all_fabric_interfaces:
306+ node_fabric_interface = all_fabric_interfaces['DEFAULT']
307+ else:
308+ raise ValueError('No fabric interface provided for node')
309+ if interface_exists(node_fabric_interface):
310+ if is_address_in_network(config('os-data-network'),
311+ get_iface_addr(node_fabric_interface)[0]):
312+ return node_fabric_interface
313+ else:
314+ raise ValueError('Fabric interface not in fabric network')
315+ else:
316+ log('Provided fabric interface %s does not exist'
317+ % node_fabric_interface)
318+ raise ValueError('Provided fabric interface does not exist')
319+ return node_fabric_interface
320
321
322 def ensure_mtu():
323 '''
324 Ensures required MTU of the underlying networking of the node.
325 '''
326- log("Changing MTU of juju-br0 and all attached interfaces")
327 interface_mtu = config('network-device-mtu')
328- interface_type = check_interface_type()
329- if interface_type == "juju-br0":
330- cmd = subprocess.check_output(["brctl", "show", interface_type])
331- words = cmd.split()
332- for word in words:
333- if 'eth' in word:
334- set_nic_mtu(word, interface_mtu)
335- set_nic_mtu(interface_type, interface_mtu)
336+ fabric_interface = get_fabric_interface()
337+ if fabric_interface in get_bridges():
338+ attached_interfaces = get_bridge_nics(fabric_interface)
339+ for interface in attached_interfaces:
340+ set_nic_mtu(interface, interface_mtu)
341+ set_nic_mtu(fabric_interface, interface_mtu)
342
343
344 def _exec_cmd(cmd=None, error_msg='Command exited with ERRORs', fatal=False):
345@@ -229,6 +315,8 @@
346 log('PLUMgrid License Key not specified')
347 return 0
348 PG_VIP = config('plumgrid-virtual-ip')
349+ if not is_ip(PG_VIP):
350+ raise ValueError('Invalid IP Provided')
351 LICENSE_POST_PATH = 'https://%s/0/tenant_manager/license_key' % PG_VIP
352 LICENSE_GET_PATH = 'https://%s/0/tenant_manager/licenses' % PG_VIP
353 PG_CURL = '%s/opt/pg/scripts/pg_curl.sh' % PG_LXC_PATH
354@@ -239,8 +327,7 @@
355 'plumgrid:plumgrid',
356 LICENSE_POST_PATH,
357 '-d',
358- json.dumps(license)
359- ]
360+ json.dumps(license)]
361 licence_get_cmd = [PG_CURL, '-u', 'plumgrid:plumgrid', LICENSE_GET_PATH]
362 try:
363 old_license = subprocess.check_output(licence_get_cmd)
364
365=== modified file 'templates/kilo/ifcs.conf'
366--- templates/kilo/ifcs.conf 2015-07-29 18:11:14 +0000
367+++ templates/kilo/ifcs.conf 2016-03-03 21:07:28 +0000
368@@ -1,2 +1,2 @@
369-{{ interface }} = fabric_core host
370+{{ fabric_interface }} = fabric_core host
371
372
373=== modified file 'templates/kilo/nginx.conf'
374--- templates/kilo/nginx.conf 2015-08-10 10:06:33 +0000
375+++ templates/kilo/nginx.conf 2016-03-03 21:07:28 +0000
376@@ -12,6 +12,10 @@
377 server {{ virtual_ip }}:3000;
378 }
379
380+upstream pgMW {
381+ server 127.0.0.1:4000;
382+}
383+
384 map $http_upgrade $connection_upgrade {
385 default upgrade;
386 '' close;
387@@ -58,6 +62,19 @@
388 proxy_set_header Host $host;
389 }
390
391+ location /mwv0 {
392+ proxy_pass http://pgMW;
393+ proxy_redirect off;
394+ proxy_http_version 1.1;
395+ proxy_set_header Upgrade $http_upgrade;
396+ proxy_set_header Connection "upgrade";
397+ proxy_set_header Host $host;
398+ }
399+
400+ location /cloudApex/ {
401+ index index.html;
402+ }
403+
404 location /vtap/ {
405 alias /opt/pg/vtap;
406 }
407
408=== added file 'tests/files/plumgrid-director-dense.yaml'
409--- tests/files/plumgrid-director-dense.yaml 1970-01-01 00:00:00 +0000
410+++ tests/files/plumgrid-director-dense.yaml 2016-03-03 21:07:28 +0000
411@@ -0,0 +1,133 @@
412+test:
413+ series: 'trusty'
414+ relations:
415+ - - mysql
416+ - keystone
417+ - - nova-cloud-controller
418+ - mysql
419+ - - nova-cloud-controller
420+ - rabbitmq-server
421+ - - nova-cloud-controller
422+ - glance
423+ - - nova-cloud-controller
424+ - keystone
425+ - - nova-compute
426+ - nova-cloud-controller
427+ - - nova-compute
428+ - mysql
429+ - - nova-compute
430+ - rabbitmq-server
431+ - - nova-compute
432+ - glance
433+ - - glance
434+ - mysql
435+ - - glance
436+ - keystone
437+ - - glance
438+ - cinder
439+ - - mysql
440+ - cinder
441+ - - cinder
442+ - rabbitmq-server
443+ - - cinder
444+ - nova-cloud-controller
445+ - - cinder
446+ - keystone
447+ - - openstack-dashboard
448+ - keystone
449+ - - neutron-api
450+ - mysql
451+ - - neutron-api
452+ - keystone
453+ - - neutron-api
454+ - rabbitmq-server
455+ - - neutron-api
456+ - nova-cloud-controller
457+ - - neutron-api
458+ - neutron-api-plumgrid
459+ - - neutron-api-plumgrid
460+ - plumgrid-edge
461+ - - plumgrid-director
462+ - plumgrid-edge
463+ - - nova-compute
464+ - plumgrid-edge
465+ - - plumgrid-director
466+ - plumgrid-gateway
467+ services:
468+ mysql:
469+ charm: cs:trusty/mysql
470+ num_units: 1
471+ to: 'lxc:plumgrid-director=0'
472+ rabbitmq-server:
473+ charm: cs:trusty/rabbitmq-server
474+ num_units: 1
475+ to: 'lxc:plumgrid-director=0'
476+ keystone:
477+ charm: cs:trusty/keystone
478+ num_units: 1
479+ options:
480+ admin-password: plumgrid
481+ openstack-origin: cloud:trusty-kilo
482+ to: 'lxc:plumgrid-director=0'
483+ nova-cloud-controller:
484+ charm: cs:trusty/nova-cloud-controller
485+ num_units: 1
486+ options:
487+ console-access-protocol: novnc
488+ network-manager: Neutron
489+ openstack-origin: cloud:trusty-kilo
490+ quantum-security-groups: 'yes'
491+ to: 'lxc:plumgrid-director=0'
492+ glance:
493+ charm: cs:trusty/glance
494+ num_units: 1
495+ options:
496+ openstack-origin: cloud:trusty-kilo
497+ to: 'lxc:plumgrid-director=0'
498+ openstack-dashboard:
499+ charm: cs:trusty/openstack-dashboard
500+ num_units: 1
501+ options:
502+ openstack-origin: cloud:trusty-kilo
503+ to: 'lxc:plumgrid-director=0'
504+ cinder:
505+ charm: cs:trusty/cinder
506+ num_units: 1
507+ options:
508+ openstack-origin: cloud:trusty-kilo
509+ to: 'lxc:plumgrid-director=0'
510+ neutron-api:
511+ charm: cs:~plumgrid-team/trusty/neutron-api
512+ num_units: 1
513+ options:
514+ neutron-plugin: plumgrid
515+ neutron-security-groups: false
516+ openstack-origin: cloud:trusty-kilo
517+ plumgrid-password: plumgrid
518+ plumgrid-username: plumgrid
519+ plumgrid-virtual-ip: 192.168.100.250
520+ to: 'lxc:plumgrid-director=0'
521+ neutron-api-plumgrid:
522+ charm: cs:~plumgrid-team/trusty/neutron-api-plumgrid
523+ options:
524+ enable-metadata: True
525+ plumgrid-director:
526+ charm: cs:~plumgrid-team/trusty/plumgrid-director
527+ num_units: 1
528+ constraints: "root-disk=30G mem=8G cpu-cores=8"
529+ options:
530+ plumgrid-virtual-ip: 192.168.100.250
531+ nova-compute:
532+ charm: cs:~plumgrid-team/trusty/nova-compute
533+ num_units: 1
534+ options:
535+ enable-live-migration: true
536+ enable-resize: true
537+ migration-auth-type: ssh
538+ openstack-origin: cloud:trusty-kilo
539+ to: '0'
540+ plumgrid-edge:
541+ charm: cs:~plumgrid-team/trusty/plumgrid-edge
542+ plumgrid-gateway:
543+ charm: cs:~plumgrid-team/trusty/plumgrid-gateway
544+ num_units: 1
545
546=== removed file 'tests/files/plumgrid-director-dense.yaml'
547--- tests/files/plumgrid-director-dense.yaml 2015-09-01 17:31:26 +0000
548+++ tests/files/plumgrid-director-dense.yaml 1970-01-01 00:00:00 +0000
549@@ -1,133 +0,0 @@
550-test:
551- series: 'trusty'
552- relations:
553- - - mysql
554- - keystone
555- - - nova-cloud-controller
556- - mysql
557- - - nova-cloud-controller
558- - rabbitmq-server
559- - - nova-cloud-controller
560- - glance
561- - - nova-cloud-controller
562- - keystone
563- - - nova-compute
564- - nova-cloud-controller
565- - - nova-compute
566- - mysql
567- - - nova-compute
568- - rabbitmq-server
569- - - nova-compute
570- - glance
571- - - glance
572- - mysql
573- - - glance
574- - keystone
575- - - glance
576- - cinder
577- - - mysql
578- - cinder
579- - - cinder
580- - rabbitmq-server
581- - - cinder
582- - nova-cloud-controller
583- - - cinder
584- - keystone
585- - - openstack-dashboard
586- - keystone
587- - - neutron-api
588- - mysql
589- - - neutron-api
590- - keystone
591- - - neutron-api
592- - rabbitmq-server
593- - - neutron-api
594- - nova-cloud-controller
595- - - neutron-api
596- - neutron-api-plumgrid
597- - - neutron-api-plumgrid
598- - plumgrid-edge
599- - - plumgrid-director
600- - plumgrid-edge
601- - - nova-compute
602- - plumgrid-edge
603- - - plumgrid-director
604- - plumgrid-gateway
605- services:
606- mysql:
607- charm: cs:trusty/mysql
608- num_units: 1
609- to: 'lxc:plumgrid-director=0'
610- rabbitmq-server:
611- charm: cs:trusty/rabbitmq-server
612- num_units: 1
613- to: 'lxc:plumgrid-director=0'
614- keystone:
615- charm: cs:trusty/keystone
616- num_units: 1
617- options:
618- admin-password: plumgrid
619- openstack-origin: cloud:trusty-kilo
620- to: 'lxc:plumgrid-director=0'
621- nova-cloud-controller:
622- charm: cs:trusty/nova-cloud-controller
623- num_units: 1
624- options:
625- console-access-protocol: novnc
626- network-manager: Neutron
627- openstack-origin: cloud:trusty-kilo
628- quantum-security-groups: 'yes'
629- to: 'lxc:plumgrid-director=0'
630- glance:
631- charm: cs:trusty/glance
632- num_units: 1
633- options:
634- openstack-origin: cloud:trusty-kilo
635- to: 'lxc:plumgrid-director=0'
636- openstack-dashboard:
637- charm: cs:trusty/openstack-dashboard
638- num_units: 1
639- options:
640- openstack-origin: cloud:trusty-kilo
641- to: 'lxc:plumgrid-director=0'
642- cinder:
643- charm: cs:trusty/cinder
644- num_units: 1
645- options:
646- openstack-origin: cloud:trusty-kilo
647- to: 'lxc:plumgrid-director=0'
648- neutron-api:
649- charm: cs:~plumgrid-team/trusty/neutron-api
650- num_units: 1
651- options:
652- neutron-plugin: plumgrid
653- neutron-security-groups: false
654- openstack-origin: cloud:trusty-kilo
655- plumgrid-password: plumgrid
656- plumgrid-username: plumgrid
657- plumgrid-virtual-ip: 192.168.100.250
658- to: 'lxc:plumgrid-director=0'
659- neutron-api-plumgrid:
660- charm: cs:~plumgrid-team/trusty/neutron-api-plumgrid
661- options:
662- enable-metadata: True
663- plumgrid-director:
664- charm: cs:~plumgrid-team/trusty/plumgrid-director
665- num_units: 1
666- constraints: "root-disk=30G mem=8G cpu-cores=8"
667- options:
668- plumgrid-virtual-ip: 192.168.100.250
669- nova-compute:
670- charm: cs:~plumgrid-team/trusty/nova-compute
671- num_units: 1
672- options:
673- enable-live-migration: true
674- enable-resize: true
675- migration-auth-type: ssh
676- openstack-origin: cloud:trusty-kilo
677- to: '0'
678- plumgrid-edge:
679- charm: cs:~plumgrid-team/trusty/plumgrid-edge
680- plumgrid-gateway:
681- charm: cs:~plumgrid-team/trusty/plumgrid-gateway
682- num_units: 1
683
684=== added file 'tests/test.yaml'
685--- tests/test.yaml 1970-01-01 00:00:00 +0000
686+++ tests/test.yaml 2016-03-03 21:07:28 +0000
687@@ -0,0 +1,2 @@
688+makefile:
689+ - lint
690
691=== removed file 'tests/test.yaml'
692--- tests/test.yaml 2015-09-01 17:31:26 +0000
693+++ tests/test.yaml 1970-01-01 00:00:00 +0000
694@@ -1,2 +0,0 @@
695-makefile:
696- - lint
697
698=== modified file 'unit_tests/test_pg_dir_context.py'
699--- unit_tests/test_pg_dir_context.py 2015-08-24 16:18:48 +0000
700+++ unit_tests/test_pg_dir_context.py 2016-03-03 21:07:28 +0000
701@@ -45,12 +45,13 @@
702 'neutron_plugin_attribute')
703 @patch.object(charmhelpers.contrib.openstack.context, 'unit_private_ip')
704 @patch.object(context, '_pg_dir_ips')
705- @patch.object(utils, 'check_interface_type')
706- def test_neutroncc_context_api_rel(self, _int_type, _pg_dir_ips,
707- _unit_priv_ip, _npa, _ens_pkgs,
708- _save_ff, _https, _is_clus,
709- _unit_get, _config, _runits, _rids,
710- _rget):
711+ @patch.object(utils, 'get_mgmt_interface')
712+ @patch.object(utils, 'get_fabric_interface')
713+ def test_neutroncc_context_api_rel(self, _fabric_int, _mgmt_int,
714+ _pg_dir_ips, _unit_priv_ip, _npa,
715+ _ens_pkgs, _save_ff, _https,
716+ _is_clus, _unit_get, _config,
717+ _runits, _rids, _rget):
718 def mock_npa(plugin, section, manager):
719 if section == "driver":
720 return "neutron.randomdriver"
721@@ -73,7 +74,8 @@
722 self.get_unit_hostname.return_value = 'node0'
723 self.get_host_ip.return_value = '192.168.100.201'
724 _pg_dir_ips.return_value = ['192.168.100.202', '192.168.100.203']
725- _int_type.return_value = 'juju-br0'
726+ _mgmt_int.return_value = 'juju-br0'
727+ _fabric_int.return_value = 'juju-br0'
728 napi_ctxt = context.PGDirContext()
729 expect = {
730 'config': 'neutron.randomconfig',
731@@ -84,8 +86,9 @@
732 'neutron_security_groups': None,
733 'neutron_url': 'https://None:9696',
734 'virtual_ip': '192.168.100.250',
735- 'pg_hostname': 'pg-director',
736+ 'pg_hostname': 'node0',
737 'interface': 'juju-br0',
738+ 'fabric_interface': 'juju-br0',
739 'label': 'node0',
740 'fabric_mode': 'host',
741 'virtual_router_id': '250',
742
743=== modified file 'unit_tests/test_pg_dir_hooks.py'
744--- unit_tests/test_pg_dir_hooks.py 2015-08-24 16:18:48 +0000
745+++ unit_tests/test_pg_dir_hooks.py 2016-03-03 21:07:28 +0000
746@@ -1,5 +1,7 @@
747 from mock import MagicMock, patch, call
748+
749 from test_utils import CharmTestCase
750+
751 with patch('charmhelpers.core.hookenv.config') as config:
752 config.return_value = 'neutron'
753 import pg_dir_utils as utils
754@@ -58,25 +60,10 @@
755 ])
756 self.load_iovisor.assert_called_with()
757 self.ensure_mtu.assert_called_with()
758- self.add_lcm_key.assert_called_with()
759
760 def test_config_changed_hook(self):
761- _pkgs = ['plumgrid-lxc', 'iovisor-dkms']
762- self.add_lcm_key.return_value = 0
763- self.post_pg_license.return_value = 0
764- self.determine_packages.return_value = [_pkgs]
765+ self.add_lcm_key.return_value = 1
766 self._call_hook('config-changed')
767- self.stop_pg.assert_called_with()
768- self.configure_sources.assert_called_with(update=True)
769- self.apt_install.assert_has_calls([
770- call(_pkgs, fatal=True,
771- options=['--force-yes']),
772- ])
773- self.load_iovisor.assert_called_with()
774- self.ensure_mtu.assert_called_with()
775-
776- self.CONFIGS.write_all.assert_called_with()
777- self.restart_pg.assert_called_with()
778
779 def test_start(self):
780 self._call_hook('start')

Subscribers

People subscribed via source and target branches

to all changes: