Merge lp:~openstack-charmers/charms/trusty/neutron-api/vpp into lp:~openstack-charmers-archive/charms/trusty/neutron-api/next
- Trusty Tahr (14.04)
- vpp
- Merge into next
Status: | Merged |
---|---|
Merged at revision: | 132 |
Proposed branch: | lp:~openstack-charmers/charms/trusty/neutron-api/vpp |
Merge into: | lp:~openstack-charmers-archive/charms/trusty/neutron-api/next |
Diff against target: |
499 lines (+305/-25) 10 files modified
config.yaml (+6/-0) hooks/neutron_api_context.py (+60/-0) hooks/neutron_api_hooks.py (+2/-1) hooks/neutron_api_utils.py (+34/-22) metadata.yaml (+3/-0) templates/icehouse/neutron.conf (+10/-0) templates/juno/neutron.conf (+6/-0) templates/kilo/neutron.conf (+10/-0) unit_tests/test_neutron_api_context.py (+133/-0) unit_tests/test_neutron_api_utils.py (+41/-2) |
To merge this branch: | bzr merge lp:~openstack-charmers/charms/trusty/neutron-api/vpp |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Page | Approve | ||
Review via email: mp+263224@code.launchpad.net |
Commit message
Description of the change
James Page (james-page) : | # |
uosci-testing-bot (uosci-testing-bot) wrote : | # |
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #7341 neutron-api-next for gnuoy mp263224
UNIT OK: passed
James Page (james-page) : | # |
- 134. By Liam Young
-
Fix kilo template ordering
- 135. By Liam Young
-
Fix lint and remove pointless comment from template
James Page (james-page) : | # |
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #5764 neutron-api-next for gnuoy mp263224
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
- 136. By Liam Young
-
Fix unit test
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #7924 neutron-api-next for gnuoy mp263224
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #7342 neutron-api-next for gnuoy mp263224
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #5765 neutron-api-next for gnuoy mp263224
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
Preview Diff
1 | === modified file 'config.yaml' |
2 | --- config.yaml 2015-07-10 14:14:33 +0000 |
3 | +++ config.yaml 2015-08-12 10:36:14 +0000 |
4 | @@ -368,3 +368,9 @@ |
5 | description: | |
6 | A comma-separated list of nagios servicegroups. |
7 | If left empty, the nagios_context will be used as the servicegroup |
8 | + manage-neutron-plugin-legacy-mode: |
9 | + type: boolean |
10 | + default: True |
11 | + description: | |
12 | + If True neutron-server will install neutron packages for the plugin |
13 | + configured. |
14 | |
15 | === added symlink 'hooks/neutron-plugin-api-subordinate-relation-changed' |
16 | === target is u'neutron_api_hooks.py' |
17 | === added symlink 'hooks/neutron-plugin-api-subordinate-relation-departed' |
18 | === target is u'neutron_api_hooks.py' |
19 | === added symlink 'hooks/neutron-plugin-api-subordinate-relation-joined' |
20 | === target is u'neutron_api_hooks.py' |
21 | === modified file 'hooks/neutron_api_context.py' |
22 | --- hooks/neutron_api_context.py 2015-05-06 11:40:21 +0000 |
23 | +++ hooks/neutron_api_context.py 2015-08-12 10:36:14 +0000 |
24 | @@ -234,3 +234,63 @@ |
25 | # for haproxy.conf |
26 | ctxt['service_ports'] = port_mapping |
27 | return ctxt |
28 | + |
29 | + |
30 | +class NeutronApiSDNContext(context.SubordinateConfigContext): |
31 | + interfaces = 'neutron-plugin-api-subordinate' |
32 | + |
33 | + def __init__(self): |
34 | + super(NeutronApiSDNContext, self).__init__( |
35 | + interface='neutron-plugin-api-subordinate', |
36 | + service='neutron-api', |
37 | + config_file='/etc/neutron/neutron.conf') |
38 | + |
39 | + def __call__(self): |
40 | + ctxt = super(NeutronApiSDNContext, self).__call__() |
41 | + defaults = { |
42 | + 'core-plugin': { |
43 | + 'templ_key': 'core_plugin', |
44 | + 'value': 'neutron.plugins.ml2.plugin.Ml2Plugin', |
45 | + }, |
46 | + 'neutron-plugin-config': { |
47 | + 'templ_key': 'neutron_plugin_config', |
48 | + 'value': '/etc/neutron/plugins/ml2/ml2_conf.ini', |
49 | + }, |
50 | + 'service-plugins': { |
51 | + 'templ_key': 'service_plugins', |
52 | + 'value': 'router,firewall,lbaas,vpnaas,metering', |
53 | + }, |
54 | + 'restart-trigger': { |
55 | + 'templ_key': 'restart_trigger', |
56 | + 'value': '', |
57 | + }, |
58 | + } |
59 | + for rid in relation_ids('neutron-plugin-api-subordinate'): |
60 | + for unit in related_units(rid): |
61 | + rdata = relation_get(rid=rid, unit=unit) |
62 | + plugin = rdata.get('neutron-plugin') |
63 | + if not plugin: |
64 | + continue |
65 | + ctxt['neutron_plugin'] = plugin |
66 | + for key in defaults.keys(): |
67 | + remote_value = rdata.get(key) |
68 | + ctxt_key = defaults[key]['templ_key'] |
69 | + if remote_value: |
70 | + ctxt[ctxt_key] = remote_value |
71 | + else: |
72 | + ctxt[ctxt_key] = defaults[key]['value'] |
73 | + return ctxt |
74 | + return ctxt |
75 | + |
76 | + |
77 | +class NeutronApiSDNConfigFileContext(context.OSContextGenerator): |
78 | + interfaces = ['neutron-plugin-api-subordinate'] |
79 | + |
80 | + def __call__(self): |
81 | + for rid in relation_ids('neutron-plugin-api-subordinate'): |
82 | + for unit in related_units(rid): |
83 | + rdata = relation_get(rid=rid, unit=unit) |
84 | + neutron_server_plugin_conf = rdata.get('neutron-plugin-config') |
85 | + if neutron_server_plugin_conf: |
86 | + return {'config': neutron_server_plugin_conf} |
87 | + return {'config': '/etc/neutron/plugins/ml2/ml2_conf.ini'} |
88 | |
89 | === modified file 'hooks/neutron_api_hooks.py' |
90 | --- hooks/neutron_api_hooks.py 2015-04-23 08:49:03 +0000 |
91 | +++ hooks/neutron_api_hooks.py 2015-08-12 10:36:14 +0000 |
92 | @@ -479,7 +479,8 @@ |
93 | users="neutron") |
94 | |
95 | |
96 | -@hooks.hook('zeromq-configuration-relation-changed') |
97 | +@hooks.hook('zeromq-configuration-relation-changed', |
98 | + 'neutron-plugin-api-subordinate-relation-changed') |
99 | @restart_on_change(restart_map(), stopstart=True) |
100 | def zeromq_configuration_relation_changed(): |
101 | CONFIGS.write_all() |
102 | |
103 | === modified file 'hooks/neutron_api_utils.py' |
104 | --- hooks/neutron_api_utils.py 2015-07-13 19:07:37 +0000 |
105 | +++ hooks/neutron_api_utils.py 2015-08-12 10:36:14 +0000 |
106 | @@ -160,16 +160,21 @@ |
107 | return API_PORTS[service] |
108 | |
109 | |
110 | +def manage_plugin(): |
111 | + return config('manage-neutron-plugin-legacy-mode') |
112 | + |
113 | + |
114 | def determine_packages(source=None): |
115 | # currently all packages match service names |
116 | packages = [] + BASE_PACKAGES |
117 | |
118 | for v in resource_map().values(): |
119 | packages.extend(v['services']) |
120 | - pkgs = neutron_plugin_attribute(config('neutron-plugin'), |
121 | - 'server_packages', |
122 | - 'neutron') |
123 | - packages.extend(pkgs) |
124 | + if manage_plugin(): |
125 | + pkgs = neutron_plugin_attribute(config('neutron-plugin'), |
126 | + 'server_packages', |
127 | + 'neutron') |
128 | + packages.extend(pkgs) |
129 | |
130 | if get_os_codename_install_source(source) >= 'kilo': |
131 | packages.extend(KILO_PACKAGES) |
132 | @@ -211,24 +216,31 @@ |
133 | else: |
134 | resource_map.pop(APACHE_24_CONF) |
135 | |
136 | - # add neutron plugin requirements. nova-c-c only needs the neutron-server |
137 | - # associated with configs, not the plugin agent. |
138 | - plugin = config('neutron-plugin') |
139 | - conf = neutron_plugin_attribute(plugin, 'config', 'neutron') |
140 | - ctxts = (neutron_plugin_attribute(plugin, 'contexts', 'neutron') |
141 | - or []) |
142 | - services = neutron_plugin_attribute(plugin, 'server_services', |
143 | - 'neutron') |
144 | - resource_map[conf] = {} |
145 | - resource_map[conf]['services'] = services |
146 | - resource_map[conf]['contexts'] = ctxts |
147 | - resource_map[conf]['contexts'].append( |
148 | - neutron_api_context.NeutronCCContext()) |
149 | - |
150 | - # update for postgres |
151 | - resource_map[conf]['contexts'].append( |
152 | - context.PostgresqlDBContext(database=config('database'))) |
153 | - |
154 | + if manage_plugin(): |
155 | + # add neutron plugin requirements. nova-c-c only needs the |
156 | + # neutron-server associated with configs, not the plugin agent. |
157 | + plugin = config('neutron-plugin') |
158 | + conf = neutron_plugin_attribute(plugin, 'config', 'neutron') |
159 | + ctxts = (neutron_plugin_attribute(plugin, 'contexts', 'neutron') |
160 | + or []) |
161 | + services = neutron_plugin_attribute(plugin, 'server_services', |
162 | + 'neutron') |
163 | + resource_map[conf] = {} |
164 | + resource_map[conf]['services'] = services |
165 | + resource_map[conf]['contexts'] = ctxts |
166 | + resource_map[conf]['contexts'].append( |
167 | + neutron_api_context.NeutronCCContext()) |
168 | + |
169 | + # update for postgres |
170 | + resource_map[conf]['contexts'].append( |
171 | + context.PostgresqlDBContext(database=config('database'))) |
172 | + |
173 | + else: |
174 | + resource_map[NEUTRON_CONF]['contexts'].append( |
175 | + neutron_api_context.NeutronApiSDNContext() |
176 | + ) |
177 | + resource_map[NEUTRON_DEFAULT]['contexts'] = \ |
178 | + [neutron_api_context.NeutronApiSDNConfigFileContext()] |
179 | return resource_map |
180 | |
181 | |
182 | |
183 | === modified file 'metadata.yaml' |
184 | --- metadata.yaml 2015-05-13 02:16:14 +0000 |
185 | +++ metadata.yaml 2015-08-12 10:36:14 +0000 |
186 | @@ -37,6 +37,9 @@ |
187 | zeromq-configuration: |
188 | interface: zeromq-configuration |
189 | scope: container |
190 | + neutron-plugin-api-subordinate: |
191 | + interface: neutron-plugin-api-subordinate |
192 | + scope: container |
193 | peers: |
194 | cluster: |
195 | interface: neutron-api-ha |
196 | |
197 | === modified file 'templates/icehouse/neutron.conf' |
198 | --- templates/icehouse/neutron.conf 2015-03-16 14:16:02 +0000 |
199 | +++ templates/icehouse/neutron.conf 2015-08-12 10:36:14 +0000 |
200 | @@ -27,10 +27,14 @@ |
201 | |
202 | {% if core_plugin -%} |
203 | core_plugin = {{ core_plugin }} |
204 | +{% if service_plugins -%} |
205 | +service_plugins = {{ service_plugins }} |
206 | +{% else -%} |
207 | {% if neutron_plugin in ['ovs', 'ml2'] -%} |
208 | service_plugins = neutron.services.l3_router.l3_router_plugin.L3RouterPlugin,neutron.services.firewall.fwaas_plugin.FirewallPlugin,neutron.services.loadbalancer.plugin.LoadBalancerPlugin,neutron.services.vpn.plugin.VPNDriverPlugin,neutron.services.metering.metering_plugin.MeteringPlugin |
209 | {% endif -%} |
210 | {% endif -%} |
211 | +{% endif -%} |
212 | |
213 | {% if neutron_security_groups -%} |
214 | allow_overlapping_ips = True |
215 | @@ -50,6 +54,12 @@ |
216 | nova_admin_auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}/v2.0 |
217 | {% endif -%} |
218 | |
219 | +{% if sections and 'DEFAULT' in sections -%} |
220 | +{% for key, value in sections['DEFAULT'] -%} |
221 | +{{ key }} = {{ value }} |
222 | +{% endfor -%} |
223 | +{% endif %} |
224 | + |
225 | [quotas] |
226 | quota_driver = neutron.db.quota_db.DbQuotaDriver |
227 | {% if neutron_security_groups -%} |
228 | |
229 | === modified file 'templates/juno/neutron.conf' |
230 | --- templates/juno/neutron.conf 2015-04-02 12:41:04 +0000 |
231 | +++ templates/juno/neutron.conf 2015-08-12 10:36:14 +0000 |
232 | @@ -54,6 +54,12 @@ |
233 | nova_admin_auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}/v2.0 |
234 | {% endif -%} |
235 | |
236 | +{% if sections and 'DEFAULT' in sections -%} |
237 | +{% for key, value in sections['DEFAULT'] -%} |
238 | +{{ key }} = {{ value }} |
239 | +{% endfor -%} |
240 | +{% endif %} |
241 | + |
242 | [quotas] |
243 | quota_driver = neutron.db.quota_db.DbQuotaDriver |
244 | {% if neutron_security_groups -%} |
245 | |
246 | === modified file 'templates/kilo/neutron.conf' |
247 | --- templates/kilo/neutron.conf 2015-03-31 14:54:38 +0000 |
248 | +++ templates/kilo/neutron.conf 2015-08-12 10:36:14 +0000 |
249 | @@ -31,10 +31,14 @@ |
250 | |
251 | {% if core_plugin -%} |
252 | core_plugin = {{ core_plugin }} |
253 | +{% if service_plugins -%} |
254 | +service_plugins = {{ service_plugins }} |
255 | +{% else -%} |
256 | {% if neutron_plugin in ['ovs', 'ml2'] -%} |
257 | service_plugins = router,firewall,lbaas,vpnaas,metering |
258 | {% endif -%} |
259 | {% endif -%} |
260 | +{% endif -%} |
261 | |
262 | {% if neutron_security_groups -%} |
263 | allow_overlapping_ips = True |
264 | @@ -52,6 +56,12 @@ |
265 | nova_admin_auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}/v2.0 |
266 | {% endif -%} |
267 | |
268 | +{% if sections and 'DEFAULT' in sections -%} |
269 | +{% for key, value in sections['DEFAULT'] -%} |
270 | +{{ key }} = {{ value }} |
271 | +{% endfor -%} |
272 | +{% endif %} |
273 | + |
274 | {% include "section-zeromq" %} |
275 | |
276 | [quotas] |
277 | |
278 | === modified file 'unit_tests/test_neutron_api_context.py' |
279 | --- unit_tests/test_neutron_api_context.py 2015-05-06 11:39:27 +0000 |
280 | +++ unit_tests/test_neutron_api_context.py 2015-08-12 10:36:14 +0000 |
281 | @@ -1,3 +1,4 @@ |
282 | +import json |
283 | from test_utils import CharmTestCase |
284 | from mock import patch |
285 | import neutron_api_context as context |
286 | @@ -432,3 +433,135 @@ |
287 | } |
288 | for key in expect.iterkeys(): |
289 | self.assertEquals(napi_ctxt[key], expect[key]) |
290 | + |
291 | + |
292 | +class NeutronApiSDNContextTest(CharmTestCase): |
293 | + |
294 | + def setUp(self): |
295 | + super(NeutronApiSDNContextTest, self).setUp(context, TO_PATCH) |
296 | + self.relation_get.side_effect = self.test_relation.get |
297 | + |
298 | + def tearDown(self): |
299 | + super(NeutronApiSDNContextTest, self).tearDown() |
300 | + |
301 | + def test_init(self): |
302 | + napisdn_ctxt = context.NeutronApiSDNContext() |
303 | + self.assertEquals( |
304 | + napisdn_ctxt.interfaces, |
305 | + 'neutron-plugin-api-subordinate' |
306 | + ) |
307 | + self.assertEquals(napisdn_ctxt.service, 'neutron-api') |
308 | + self.assertEquals( |
309 | + napisdn_ctxt.config_file, |
310 | + '/etc/neutron/neutron.conf' |
311 | + ) |
312 | + |
313 | + @patch.object(charmhelpers.contrib.openstack.context, 'log') |
314 | + @patch.object(charmhelpers.contrib.openstack.context, 'relation_get') |
315 | + @patch.object(charmhelpers.contrib.openstack.context, 'related_units') |
316 | + @patch.object(charmhelpers.contrib.openstack.context, 'relation_ids') |
317 | + def ctxt_check(self, rel_settings, expect, _rids, _runits, _rget, _log): |
318 | + self.test_relation.set(rel_settings) |
319 | + _runits.return_value = ['unit1'] |
320 | + _rids.return_value = ['rid2'] |
321 | + _rget.side_effect = self.test_relation.get |
322 | + self.relation_ids.return_value = ['rid2'] |
323 | + self.related_units.return_value = ['unit1'] |
324 | + napisdn_ctxt = context.NeutronApiSDNContext()() |
325 | + self.assertEquals(napisdn_ctxt, expect) |
326 | + |
327 | + def test_defaults(self): |
328 | + self.ctxt_check( |
329 | + {'neutron-plugin': 'ovs'}, |
330 | + { |
331 | + 'core_plugin': 'neutron.plugins.ml2.plugin.Ml2Plugin', |
332 | + 'neutron_plugin_config': ('/etc/neutron/plugins/ml2/' |
333 | + 'ml2_conf.ini'), |
334 | + 'service_plugins': 'router,firewall,lbaas,vpnaas,metering', |
335 | + 'restart_trigger': '', |
336 | + 'neutron_plugin': 'ovs', |
337 | + 'sections': {}, |
338 | + } |
339 | + ) |
340 | + |
341 | + def test_overrides(self): |
342 | + self.ctxt_check( |
343 | + { |
344 | + 'neutron-plugin': 'ovs', |
345 | + 'core-plugin': 'neutron.plugins.ml2.plugin.MidoPlumODL', |
346 | + 'neutron-plugin-config': '/etc/neutron/plugins/fl/flump.ini', |
347 | + 'service-plugins': 'router,unicorn,rainbows', |
348 | + 'restart-trigger': 'restartnow', |
349 | + }, |
350 | + { |
351 | + 'core_plugin': 'neutron.plugins.ml2.plugin.MidoPlumODL', |
352 | + 'neutron_plugin_config': '/etc/neutron/plugins/fl/flump.ini', |
353 | + 'service_plugins': 'router,unicorn,rainbows', |
354 | + 'restart_trigger': 'restartnow', |
355 | + 'neutron_plugin': 'ovs', |
356 | + 'sections': {}, |
357 | + } |
358 | + ) |
359 | + |
360 | + def test_subordinateconfig(self): |
361 | + principle_config = { |
362 | + "neutron-api": { |
363 | + "/etc/neutron/neutron.conf": { |
364 | + "sections": { |
365 | + 'DEFAULT': [ |
366 | + ('neutronboost', True) |
367 | + ], |
368 | + } |
369 | + } |
370 | + } |
371 | + } |
372 | + self.ctxt_check( |
373 | + { |
374 | + 'neutron-plugin': 'ovs', |
375 | + 'subordinate_configuration': json.dumps(principle_config), |
376 | + }, |
377 | + { |
378 | + 'core_plugin': 'neutron.plugins.ml2.plugin.Ml2Plugin', |
379 | + 'neutron_plugin_config': ('/etc/neutron/plugins/ml2/' |
380 | + 'ml2_conf.ini'), |
381 | + 'service_plugins': 'router,firewall,lbaas,vpnaas,metering', |
382 | + 'restart_trigger': '', |
383 | + 'neutron_plugin': 'ovs', |
384 | + 'sections': {u'DEFAULT': [[u'neutronboost', True]]}, |
385 | + } |
386 | + ) |
387 | + |
388 | + def test_empty(self): |
389 | + self.ctxt_check( |
390 | + {}, |
391 | + {'sections': {}}, |
392 | + ) |
393 | + |
394 | + |
395 | +class NeutronApiSDNConfigFileContextTest(CharmTestCase): |
396 | + |
397 | + def setUp(self): |
398 | + super(NeutronApiSDNConfigFileContextTest, self).setUp( |
399 | + context, TO_PATCH) |
400 | + self.relation_get.side_effect = self.test_relation.get |
401 | + |
402 | + def tearDown(self): |
403 | + super(NeutronApiSDNConfigFileContextTest, self).tearDown() |
404 | + |
405 | + def test_configset(self): |
406 | + self.test_relation.set({ |
407 | + 'neutron-plugin-config': '/etc/neutron/superplugin.ini' |
408 | + }) |
409 | + self.relation_ids.return_value = ['rid2'] |
410 | + self.related_units.return_value = ['unit1'] |
411 | + napisdn_ctxt = context.NeutronApiSDNConfigFileContext()() |
412 | + self.assertEquals(napisdn_ctxt, { |
413 | + 'config': '/etc/neutron/superplugin.ini' |
414 | + }) |
415 | + |
416 | + def test_default(self): |
417 | + self.relation_ids.return_value = [] |
418 | + napisdn_ctxt = context.NeutronApiSDNConfigFileContext()() |
419 | + self.assertEquals(napisdn_ctxt, { |
420 | + 'config': '/etc/neutron/plugins/ml2/ml2_conf.ini' |
421 | + }) |
422 | |
423 | === modified file 'unit_tests/test_neutron_api_utils.py' |
424 | --- unit_tests/test_neutron_api_utils.py 2015-06-29 11:33:36 +0000 |
425 | +++ unit_tests/test_neutron_api_utils.py 2015-08-12 10:36:14 +0000 |
426 | @@ -104,28 +104,57 @@ |
427 | expect.extend(nutils.KILO_PACKAGES) |
428 | self.assertItemsEqual(pkg_list, expect) |
429 | |
430 | + @patch.object(nutils, 'git_install_requested') |
431 | + def test_determine_packages_noplugin(self, git_requested): |
432 | + git_requested.return_value = False |
433 | + self.test_config.set('manage-neutron-plugin-legacy-mode', False) |
434 | + pkg_list = nutils.determine_packages() |
435 | + expect = deepcopy(nutils.BASE_PACKAGES) |
436 | + expect.extend(['neutron-server']) |
437 | + self.assertItemsEqual(pkg_list, expect) |
438 | + |
439 | def test_determine_ports(self): |
440 | port_list = nutils.determine_ports() |
441 | self.assertItemsEqual(port_list, [9696]) |
442 | |
443 | + @patch.object(nutils, 'manage_plugin') |
444 | @patch('os.path.exists') |
445 | - def test_resource_map(self, _path_exists): |
446 | + def test_resource_map(self, _path_exists, _manage_plugin): |
447 | _path_exists.return_value = False |
448 | + _manage_plugin.return_value = True |
449 | _map = nutils.resource_map() |
450 | confs = [nutils.NEUTRON_CONF, nutils.NEUTRON_DEFAULT, |
451 | nutils.APACHE_CONF] |
452 | [self.assertIn(q_conf, _map.keys()) for q_conf in confs] |
453 | self.assertTrue(nutils.APACHE_24_CONF not in _map.keys()) |
454 | |
455 | + @patch.object(nutils, 'manage_plugin') |
456 | @patch('os.path.exists') |
457 | - def test_resource_map_apache24(self, _path_exists): |
458 | + def test_resource_map_apache24(self, _path_exists, _manage_plugin): |
459 | _path_exists.return_value = True |
460 | + _manage_plugin.return_value = True |
461 | _map = nutils.resource_map() |
462 | confs = [nutils.NEUTRON_CONF, nutils.NEUTRON_DEFAULT, |
463 | nutils.APACHE_24_CONF] |
464 | [self.assertIn(q_conf, _map.keys()) for q_conf in confs] |
465 | self.assertTrue(nutils.APACHE_CONF not in _map.keys()) |
466 | |
467 | + @patch.object(nutils, 'manage_plugin') |
468 | + @patch('os.path.exists') |
469 | + def test_resource_map_noplugin(self, _path_exists, _manage_plugin): |
470 | + _path_exists.return_value = True |
471 | + _manage_plugin.return_value = False |
472 | + _map = nutils.resource_map() |
473 | + found_sdn_ctxt = False |
474 | + found_sdnconfig_ctxt = False |
475 | + for ctxt in _map[nutils.NEUTRON_CONF]['contexts']: |
476 | + if isinstance(ctxt, ncontext.NeutronApiSDNContext): |
477 | + found_sdn_ctxt = True |
478 | + for ctxt in _map[nutils.NEUTRON_DEFAULT]['contexts']: |
479 | + if isinstance(ctxt, ncontext.NeutronApiSDNConfigFileContext): |
480 | + found_sdnconfig_ctxt = True |
481 | + self.assertTrue(found_sdn_ctxt and found_sdnconfig_ctxt) |
482 | + |
483 | @patch('os.path.exists') |
484 | def test_restart_map(self, mock_path_exists): |
485 | mock_path_exists.return_value = False |
486 | @@ -520,3 +549,13 @@ |
487 | 'upgrade', |
488 | 'head'] |
489 | self.subprocess.check_output.assert_called_with(cmd) |
490 | + |
491 | + def test_manage_plugin_true(self): |
492 | + self.test_config.set('manage-neutron-plugin-legacy-mode', True) |
493 | + manage = nutils.manage_plugin() |
494 | + self.assertTrue(manage) |
495 | + |
496 | + def test_manage_plugin_false(self): |
497 | + self.test_config.set('manage-neutron-plugin-legacy-mode', False) |
498 | + manage = nutils.manage_plugin() |
499 | + self.assertFalse(manage) |
charm_lint_check #7923 neutron-api-next for gnuoy mp263224
LINT FAIL: lint-test failed
LINT Results (max last 2 lines):
make: *** [lint] Error 1
ERROR:root:Make target returned non-zero.
Full lint test output: http:// paste.ubuntu. com/12060702/ 10.245. 162.77: 8080/job/ charm_lint_ check/7923/
Build: http://