Merge lp:~james-page/charms/trusty/neutron-agents-midonet/trunk into lp:~celebdor/charms/trusty/neutron-agents-midonet/split
- Trusty Tahr (14.04)
- trunk
- Merge into split
Proposed by
James Page
Status: | Superseded |
---|---|
Proposed branch: | lp:~james-page/charms/trusty/neutron-agents-midonet/trunk |
Merge into: | lp:~celebdor/charms/trusty/neutron-agents-midonet/split |
Diff against target: |
553 lines (+159/-179) 7 files modified
hooks/services.py (+9/-3) tests/006-minimal-trusty-kilo-mem (+29/-0) tests/010-basic-trusty-juno (+3/-6) tests/011-basic-trusty-kilo (+3/-6) tests/012-basic-trusty-liberty (+22/-0) tests/basic_deployment.py (+71/-100) unit_tests/test_context.py (+22/-64) |
To merge this branch: | bzr merge lp:~james-page/charms/trusty/neutron-agents-midonet/trunk |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Antoni Segura Puimedon | Pending | ||
Review via email: mp+286180@code.launchpad.net |
This proposal has been superseded by a proposal from 2016-02-16.
Commit message
Description of the change
To post a comment you must log in.
Unmerged revisions
- 51. By James Page
-
Misc updates
- 50. By James Page
-
Tweak charm sources
- 49. By James Page
-
Fully mock out unit tests from underlying os
- 48. By Antoni Segura Puimedon <email address hidden>
-
amulet: remove old tests and add check for nova-api-metadata
- 47. By Antoni Segura Puimedon <email address hidden>
-
Fix unit tests
- 46. By Antoni Segura Puimedon <email address hidden>
-
linting fix
- 45. By Antoni Segura Puimedon <email address hidden>
-
use the right midonet plugin for Liberty and above
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'hooks/services.py' | |||
2 | --- hooks/services.py 2016-02-04 11:42:36 +0000 | |||
3 | +++ hooks/services.py 2016-02-16 14:28:40 +0000 | |||
4 | @@ -18,9 +18,9 @@ | |||
5 | 18 | from charmhelpers.contrib.openstack import utils | 18 | from charmhelpers.contrib.openstack import utils |
6 | 19 | from charmhelpers.core import hookenv | 19 | from charmhelpers.core import hookenv |
7 | 20 | from charmhelpers.core import host | 20 | from charmhelpers.core import host |
8 | 21 | from charmhelpers.core import unitdata | ||
9 | 22 | from charmhelpers.core.services import base | 21 | from charmhelpers.core.services import base |
10 | 23 | from charmhelpers.core.services import helpers | 22 | from charmhelpers.core.services import helpers |
11 | 23 | from charmhelpers.core import unitdata | ||
12 | 24 | from midonet_helpers import puppet | 24 | from midonet_helpers import puppet |
13 | 25 | from midonet_helpers import relations as common_relations | 25 | from midonet_helpers import relations as common_relations |
14 | 26 | from midonet_helpers import repositories | 26 | from midonet_helpers import repositories |
15 | @@ -86,6 +86,10 @@ | |||
16 | 86 | amqp = context.AMQPContext() | 86 | amqp = context.AMQPContext() |
17 | 87 | network_service = MidonetNetworkServiceContext(rel_name='neutron_agents') | 87 | network_service = MidonetNetworkServiceContext(rel_name='neutron_agents') |
18 | 88 | midonet = common_relations.MidonetApiRelation() | 88 | midonet = common_relations.MidonetApiRelation() |
19 | 89 | if ost_release in ('juno', 'kilo'): | ||
20 | 90 | midonet_plugin = 'python-neutron-plugin-midonet' | ||
21 | 91 | else: | ||
22 | 92 | midonet_plugin = 'python-networking-midonet' | ||
23 | 89 | 93 | ||
24 | 90 | manager = base.ServiceManager([ | 94 | manager = base.ServiceManager([ |
25 | 91 | { | 95 | { |
26 | @@ -102,7 +106,7 @@ | |||
27 | 102 | source='dhcp_agent.ini', | 106 | source='dhcp_agent.ini', |
28 | 103 | target='/etc/neutron/dhcp_agent.ini'), | 107 | target='/etc/neutron/dhcp_agent.ini'), |
29 | 104 | puppet.InstallPackagesCallback( | 108 | puppet.InstallPackagesCallback( |
31 | 105 | ('python-neutron-plugin-midonet',)), | 109 | (midonet_plugin,)), |
32 | 106 | OSTRenderer('/etc/neutron/neutron.conf', | 110 | OSTRenderer('/etc/neutron/neutron.conf', |
33 | 107 | [amqp]), | 111 | [amqp]), |
34 | 108 | ], | 112 | ], |
35 | @@ -127,8 +131,10 @@ | |||
36 | 127 | ], | 131 | ], |
37 | 128 | }, | 132 | }, |
38 | 129 | ]) | 133 | ]) |
39 | 134 | |||
40 | 130 | manager.manage() | 135 | manager.manage() |
41 | 131 | if (host.service_running('neutron-dhcp-agent') and | 136 | if (host.service_running('neutron-dhcp-agent') and |
42 | 132 | host.service_running('neutron-metadata-agent') and | 137 | host.service_running('neutron-metadata-agent') and |
43 | 133 | host.service_running('nova-api-metadata')): | 138 | host.service_running('nova-api-metadata')): |
45 | 134 | hookenv.status_set('active', 'All nova and neutron agents up and running') | 139 | hookenv.status_set('active', |
46 | 140 | 'All nova and neutron agents up and running') | ||
47 | 135 | 141 | ||
48 | === modified file 'tests/00-setup' (properties changed: +x to -x) | |||
49 | === added file 'tests/006-minimal-trusty-kilo-mem' | |||
50 | --- tests/006-minimal-trusty-kilo-mem 1970-01-01 00:00:00 +0000 | |||
51 | +++ tests/006-minimal-trusty-kilo-mem 2016-02-16 14:28:40 +0000 | |||
52 | @@ -0,0 +1,29 @@ | |||
53 | 1 | #!/usr/bin/env python | ||
54 | 2 | # | ||
55 | 3 | # Copyright (c) 2015 Midokura SARL, All Rights Reserved. | ||
56 | 4 | # | ||
57 | 5 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
58 | 6 | # you may not use this file except in compliance with the License. | ||
59 | 7 | # You may obtain a copy of the License at | ||
60 | 8 | # | ||
61 | 9 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
62 | 10 | # | ||
63 | 11 | # Unless required by applicable law or agreed to in writing, software | ||
64 | 12 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
65 | 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
66 | 14 | # See the License for the specific language governing permissions and | ||
67 | 15 | # limitations under the License. | ||
68 | 16 | import os | ||
69 | 17 | |||
70 | 18 | import basic_deployment | ||
71 | 19 | |||
72 | 20 | if __name__ == '__main__': | ||
73 | 21 | if None in (os.getenv('MEM_USERNAME'), os.getenv('MEM_PWD')): | ||
74 | 22 | print('Missing MEM_USERNAME and MEM_PWD environment variables for ' | ||
75 | 23 | 'running Midokura Enterprise MidoNet tests. Skipping test') | ||
76 | 24 | else: | ||
77 | 25 | deployment = basic_deployment.AgentMinimumDeployment( | ||
78 | 26 | ubuntu_series='trusty', | ||
79 | 27 | openstack_origin='cloud:trusty-kilo', | ||
80 | 28 | midonet_origin='mem-1.9') | ||
81 | 29 | deployment.run_tests() | ||
82 | 0 | 30 | ||
83 | === modified file 'tests/010-basic-trusty-juno' | |||
84 | --- tests/010-basic-trusty-juno 2016-01-27 17:01:34 +0000 | |||
85 | +++ tests/010-basic-trusty-juno 2016-02-16 14:28:40 +0000 | |||
86 | @@ -1,4 +1,4 @@ | |||
88 | 1 | #!/usr/bin/python | 1 | #!/usr/bin/env python |
89 | 2 | # | 2 | # |
90 | 3 | # Copyright (c) 2015 Midokura SARL, All Rights Reserved. | 3 | # Copyright (c) 2015 Midokura SARL, All Rights Reserved. |
91 | 4 | # | 4 | # |
92 | @@ -13,13 +13,10 @@ | |||
93 | 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
94 | 14 | # See the License for the specific language governing permissions and | 14 | # See the License for the specific language governing permissions and |
95 | 15 | # limitations under the License. | 15 | # limitations under the License. |
99 | 16 | 16 | import basic_deployment | |
97 | 17 | |||
98 | 18 | from basic_deployment import MidonetBasicDeployment | ||
100 | 19 | 17 | ||
101 | 20 | if __name__ == '__main__': | 18 | if __name__ == '__main__': |
103 | 21 | deployment = MidonetBasicDeployment( | 19 | deployment = basic_deployment.AgentMinimumDeployment( |
104 | 22 | ubuntu_series='trusty', | 20 | ubuntu_series='trusty', |
105 | 23 | openstack_origin='cloud:trusty-juno', | 21 | openstack_origin='cloud:trusty-juno', |
106 | 24 | midonet_origin='midonet-2015.06') | 22 | midonet_origin='midonet-2015.06') |
107 | 25 | deployment.run_tests() | ||
108 | 26 | 23 | ||
109 | === modified file 'tests/011-basic-trusty-kilo' | |||
110 | --- tests/011-basic-trusty-kilo 2016-01-27 17:01:34 +0000 | |||
111 | +++ tests/011-basic-trusty-kilo 2016-02-16 14:28:40 +0000 | |||
112 | @@ -1,4 +1,4 @@ | |||
114 | 1 | #!/usr/bin/python | 1 | #!/usr/bin/env python |
115 | 2 | # | 2 | # |
116 | 3 | # Copyright (c) 2015 Midokura SARL, All Rights Reserved. | 3 | # Copyright (c) 2015 Midokura SARL, All Rights Reserved. |
117 | 4 | # | 4 | # |
118 | @@ -13,13 +13,10 @@ | |||
119 | 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
120 | 14 | # See the License for the specific language governing permissions and | 14 | # See the License for the specific language governing permissions and |
121 | 15 | # limitations under the License. | 15 | # limitations under the License. |
125 | 16 | 16 | import basic_deployment | |
123 | 17 | |||
124 | 18 | from basic_deployment import MidonetBasicDeployment | ||
126 | 19 | 17 | ||
127 | 20 | if __name__ == '__main__': | 18 | if __name__ == '__main__': |
129 | 21 | deployment = MidonetBasicDeployment( | 19 | deployment = basic_deployment.AgentMinimumDeployment( |
130 | 22 | ubuntu_series='trusty', | 20 | ubuntu_series='trusty', |
131 | 23 | openstack_origin='cloud:trusty-kilo', | 21 | openstack_origin='cloud:trusty-kilo', |
132 | 24 | midonet_origin='midonet-2015.06') | 22 | midonet_origin='midonet-2015.06') |
133 | 25 | deployment.run_tests() | ||
134 | 26 | 23 | ||
135 | === added file 'tests/012-basic-trusty-liberty' | |||
136 | --- tests/012-basic-trusty-liberty 1970-01-01 00:00:00 +0000 | |||
137 | +++ tests/012-basic-trusty-liberty 2016-02-16 14:28:40 +0000 | |||
138 | @@ -0,0 +1,22 @@ | |||
139 | 1 | #!/usr/bin/env python | ||
140 | 2 | # | ||
141 | 3 | # Copyright (c) 2015 Midokura SARL, All Rights Reserved. | ||
142 | 4 | # | ||
143 | 5 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
144 | 6 | # you may not use this file except in compliance with the License. | ||
145 | 7 | # You may obtain a copy of the License at | ||
146 | 8 | # | ||
147 | 9 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
148 | 10 | # | ||
149 | 11 | # Unless required by applicable law or agreed to in writing, software | ||
150 | 12 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
151 | 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
152 | 14 | # See the License for the specific language governing permissions and | ||
153 | 15 | # limitations under the License. | ||
154 | 16 | import basic_deployment | ||
155 | 17 | |||
156 | 18 | if __name__ == '__main__': | ||
157 | 19 | deployment = basic_deployment.AgentMinimumDeployment( | ||
158 | 20 | ubuntu_series='trusty', | ||
159 | 21 | openstack_origin='cloud:trusty-liberty', | ||
160 | 22 | midonet_origin='midonet-2015.06') | ||
161 | 0 | 23 | ||
162 | === modified file 'tests/basic_deployment.py' | |||
163 | --- tests/basic_deployment.py 2016-02-04 11:42:36 +0000 | |||
164 | +++ tests/basic_deployment.py 2016-02-16 14:28:40 +0000 | |||
165 | @@ -31,7 +31,7 @@ | |||
166 | 31 | SETUP_TIMEOUT = 9600 | 31 | SETUP_TIMEOUT = 9600 |
167 | 32 | 32 | ||
168 | 33 | 33 | ||
170 | 34 | class MidonetBasicDeployment(): | 34 | class AgentMinimumDeployment(): |
171 | 35 | def __init__(self, ubuntu_series, openstack_origin=None, | 35 | def __init__(self, ubuntu_series, openstack_origin=None, |
172 | 36 | midonet_origin=None): | 36 | midonet_origin=None): |
173 | 37 | self.os_release = openstack_origin | 37 | self.os_release = openstack_origin |
174 | @@ -43,6 +43,16 @@ | |||
175 | 43 | self.d = amulet.Deployment(series=self.series) | 43 | self.d = amulet.Deployment(series=self.series) |
176 | 44 | self.d.charm_name = 'neutron-agents-midonet' | 44 | self.d.charm_name = 'neutron-agents-midonet' |
177 | 45 | 45 | ||
178 | 46 | # Sentries | ||
179 | 47 | self.zookeeper_sentry = None | ||
180 | 48 | self.keystone_sentry = None | ||
181 | 49 | self.cassandra_sentry = None | ||
182 | 50 | self.nova_compute_sentry = None | ||
183 | 51 | self.mn_api_sentry = None | ||
184 | 52 | self.agents_mn_sentry = None | ||
185 | 53 | self.keystone_api_relation = None | ||
186 | 54 | self.zookeeper_api_relation = None | ||
187 | 55 | |||
188 | 46 | self._add_services() | 56 | self._add_services() |
189 | 47 | self._add_relations() | 57 | self._add_relations() |
190 | 48 | self._configure_services() | 58 | self._configure_services() |
191 | @@ -50,37 +60,28 @@ | |||
192 | 50 | self._initialize_tests() | 60 | self._initialize_tests() |
193 | 51 | 61 | ||
194 | 52 | def _add_services(self): | 62 | def _add_services(self): |
196 | 53 | self.d.add('mysql', charm='cs:trusty/mysql', units=1, | 63 | self.d.add('mysql', charm='mysql', units=1, |
197 | 54 | series=self.series) | 64 | series=self.series) |
199 | 55 | self.d.add('rabbitmq-server', charm='cs:trusty/rabbitmq-server', | 65 | self.d.add('keystone', charm='keystone', units=1, series=self.series) |
200 | 66 | self.d.add('cassandra', charm='cassandra', | ||
201 | 56 | units=1, series=self.series) | 67 | units=1, series=self.series) |
223 | 57 | self.d.add('cassandra', charm='cassandra', units=1, | 68 | self.d.add('zookeeper', charm='zookeeper', units=1, |
224 | 58 | branch='cs:trusty/cassandra', series=self.series) | 69 | series=self.series) |
225 | 59 | self.d.add('keystone', charm='keystone', units=1, series=self.series, | 70 | self.d.add('rabbitmq', charm='rabbitmq-server', units=1, |
226 | 60 | branch='cs:trusty/keystone') | 71 | series=self.series) |
227 | 61 | self.d.add('compute', charm='nova-compute', units=1, | 72 | self.d.add('nova', charm='nova-cloud-controller', units=1, |
228 | 62 | branch='cs:trusty/nova-compute', series=self.series, | 73 | series=self.series) |
229 | 63 | constraints={'mem': '8G'}) | 74 | self.d.add('neutron', |
230 | 64 | self.d.add('neutron', charm='neutron-api', units=1, | 75 | charm='cs:~openstack-charmers-next/trusty/neutron-api', |
231 | 65 | branch='lp:~celebdor/charms/trusty/neutron-api/liberty', | 76 | units=1, |
232 | 66 | series=self.series) | 77 | series=self.series) |
233 | 67 | self.d.add('nova', charm='nova-cloud-controller', | 78 | self.d.add('midonet-api', charm='midonet-api', |
213 | 68 | units=1, series=self.series) | ||
214 | 69 | self.d.add('glance', charm='glance', | ||
215 | 70 | branch='cs:trusty/glance', | ||
216 | 71 | units=1, series=self.series) | ||
217 | 72 | self.d.add('cinder', charm='cinder', | ||
218 | 73 | branch='cs:trusty/glance', | ||
219 | 74 | units=1, series=self.series) | ||
220 | 75 | self.d.add('zookeeper', charm='cs:trusty/zookeeper', units=1, | ||
221 | 76 | series=self.series) | ||
222 | 77 | self.d.add('midonet-api', charm='midonet-api', units=1, | ||
234 | 78 | branch='lp:~celebdor/charms/trusty/midonet-api/trunk', | 79 | branch='lp:~celebdor/charms/trusty/midonet-api/trunk', |
235 | 79 | series=self.series) | 80 | series=self.series) |
237 | 80 | self.d.add('midonet-agent', charm='midonet-agent', units=1, | 81 | self.d.add('midonet-agent', charm='midonet-agent', |
238 | 81 | branch='lp:~celebdor/charms/trusty/midonet-agent/trunk', | 82 | branch='lp:~celebdor/charms/trusty/midonet-agent/trunk', |
239 | 82 | series=self.series) | 83 | series=self.series) |
241 | 83 | self.d.add('neutron-agents-midonet', constraints={'mem': '4G'}) | 84 | self.d.add('neutron-agents-midonet', constraints={'mem': "4G"}) |
242 | 84 | 85 | ||
243 | 85 | def _add_relations(self): | 86 | def _add_relations(self): |
244 | 86 | # Keystone | 87 | # Keystone |
245 | @@ -89,65 +90,53 @@ | |||
246 | 89 | # Nova | 90 | # Nova |
247 | 90 | self.d.relate('mysql:shared-db', 'nova:shared-db') | 91 | self.d.relate('mysql:shared-db', 'nova:shared-db') |
248 | 91 | self.d.relate('keystone:identity-service', 'nova:identity-service') | 92 | self.d.relate('keystone:identity-service', 'nova:identity-service') |
250 | 92 | self.d.relate('rabbitmq-server:amqp', 'nova:amqp') | 93 | self.d.relate('rabbitmq:amqp', 'nova:amqp') |
251 | 93 | self.d.relate('neutron-agents-midonet:neutron_agents', | 94 | self.d.relate('neutron-agents-midonet:neutron_agents', |
252 | 94 | 'nova:quantum-network-service') | 95 | 'nova:quantum-network-service') |
253 | 95 | self.d.relate('neutron:neutron-api', 'nova:neutron-api') | 96 | self.d.relate('neutron:neutron-api', 'nova:neutron-api') |
254 | 96 | self.d.relate('compute:cloud-compute', 'nova:cloud-compute') | ||
255 | 97 | self.d.relate('glance:image-service', 'nova:image-service') | ||
256 | 98 | self.d.relate('cinder:cinder-volume-service', | ||
257 | 99 | 'nova:cinder-volume-service') | ||
258 | 100 | |||
259 | 101 | # Cinder | ||
260 | 102 | self.d.relate('keystone:identity-service', 'cinder:identity-service') | ||
261 | 103 | self.d.relate('mysql:shared-db', 'cinder:shared-db') | ||
262 | 104 | self.d.relate('rabbitmq-server:amqp', 'cinder:amqp') | ||
263 | 105 | self.d.relate('glance:image-service', 'cinder:image-service') | ||
264 | 106 | |||
265 | 107 | # Glance | ||
266 | 108 | self.d.relate('keystone:identity-service', 'glance:identity-service') | ||
267 | 109 | self.d.relate('mysql:shared-db', 'glance:shared-db') | ||
268 | 110 | self.d.relate('rabbitmq-server:amqp', 'glance:amqp') | ||
269 | 111 | 97 | ||
270 | 112 | # Neutron | 98 | # Neutron |
271 | 113 | self.d.relate('mysql:shared-db', 'neutron:shared-db') | 99 | self.d.relate('mysql:shared-db', 'neutron:shared-db') |
272 | 114 | self.d.relate('keystone:identity-service', 'neutron:identity-service') | 100 | self.d.relate('keystone:identity-service', 'neutron:identity-service') |
274 | 115 | self.d.relate('rabbitmq-server:amqp', 'neutron:amqp') | 101 | self.d.relate('rabbitmq:amqp', 'neutron:amqp') |
275 | 116 | self.d.relate('neutron-agents-midonet:neutron-plugin-api', | 102 | self.d.relate('neutron-agents-midonet:neutron-plugin-api', |
276 | 117 | 'neutron:neutron-plugin-api') | 103 | 'neutron:neutron-plugin-api') |
277 | 104 | self.d.relate('midonet-api:midonet-api', 'neutron:midonet') | ||
278 | 118 | 105 | ||
279 | 119 | # MidoNet | 106 | # MidoNet |
280 | 120 | self.d.relate('keystone:identity-service', 'midonet-api:keystone') | 107 | self.d.relate('keystone:identity-service', 'midonet-api:keystone') |
281 | 121 | self.d.relate('zookeeper:zookeeper', 'midonet-api:zookeeper') | 108 | self.d.relate('zookeeper:zookeeper', 'midonet-api:zookeeper') |
282 | 122 | self.d.relate('midonet-agent:host', 'midonet-api:host') | 109 | self.d.relate('midonet-agent:host', 'midonet-api:host') |
285 | 123 | self.d.relate('neutron:midonet', 'midonet-api:midonet-api') | 110 | self.d.relate('rabbitmq:amqp', 'neutron-agents-midonet:amqp') |
284 | 124 | self.d.relate('rabbitmq-server:amqp', 'neutron-gents-midonet:amqp') | ||
286 | 125 | self.d.relate('midonet-agent:host', 'neutron-agents-midonet:agent') | 111 | self.d.relate('midonet-agent:host', 'neutron-agents-midonet:agent') |
287 | 112 | self.d.relate('midonet-api:midonet-api', | ||
288 | 113 | 'neutron-agents-midonet:midonet') | ||
289 | 126 | self.d.relate('cassandra:database', 'midonet-agent:cassandra') | 114 | self.d.relate('cassandra:database', 'midonet-agent:cassandra') |
290 | 127 | self.d.relate('zookeeper:zookeeper', 'midonet-agent:zookeeper') | 115 | self.d.relate('zookeeper:zookeeper', 'midonet-agent:zookeeper') |
291 | 128 | self.d.relate('midonet-api:midonet-api', | ||
292 | 129 | 'neutron-agents-midonet:midonet') | ||
293 | 130 | |||
294 | 131 | # Compute | ||
295 | 132 | self.d.relate('rabbitmq-server:amqp', 'compute:amqp') | ||
296 | 133 | self.d.relate('midonet-agent:neutron-plugin', 'compute:neutron-plugin') | ||
297 | 134 | self.d.relate('glance:image-service', 'compute:image-service') | ||
298 | 135 | 116 | ||
299 | 136 | def _configure_services(self): | 117 | def _configure_services(self): |
300 | 137 | repo_config = {'midonet-origin': self.midonet_origin, | ||
301 | 138 | 'openstack-origin': self.os_release} | ||
302 | 139 | if self.mem: | ||
303 | 140 | repo_config.update(self.mem_credentials) | ||
304 | 141 | |||
305 | 142 | self.d.configure('keystone', { | 118 | self.d.configure('keystone', { |
314 | 143 | 'admin-user': 'admin', | 119 | 'admin-user': 'admin', |
315 | 144 | 'admin-password': 'openstack', | 120 | 'admin-password': 'openstack', |
316 | 145 | 'admin-token': 'osttesting', | 121 | 'admin-token': 'osttesting', |
317 | 146 | 'enable-pki': 'false', | 122 | 'enable-pki': 'false', |
318 | 147 | 'openstack-origin': self.os_release}) | 123 | 'openstack-origin': self.os_release}) |
319 | 148 | 124 | ||
320 | 149 | self.d.configure('mysql', { | 125 | self.d.configure('nova', { |
321 | 150 | 'max-connections': 500}) | 126 | 'network-manager': 'Neutron', |
322 | 127 | 'openstack-origin': self.os_release}) | ||
323 | 128 | |||
324 | 129 | neutron_conf = { | ||
325 | 130 | 'l2-population': 'false', | ||
326 | 131 | 'neutron-security-groups': 'true', | ||
327 | 132 | 'neutron-plugin': 'midonet', | ||
328 | 133 | 'neutron-external-network': 'Public_Network', | ||
329 | 134 | 'midonet-origin': self.midonet_origin, | ||
330 | 135 | 'openstack-origin': self.os_release} | ||
331 | 136 | if self.mem: | ||
332 | 137 | neutron_conf.update(self.mem_credentials) | ||
333 | 138 | |||
334 | 139 | self.d.configure('neutron', neutron_conf) | ||
335 | 151 | 140 | ||
336 | 152 | self.d.configure('cassandra', { | 141 | self.d.configure('cassandra', { |
337 | 153 | 'authenticator': 'AllowAllAuthenticator', | 142 | 'authenticator': 'AllowAllAuthenticator', |
338 | @@ -157,33 +146,16 @@ | |||
339 | 157 | 'deb http://debian.datastax.com/community 2.0 main', | 146 | 'deb http://debian.datastax.com/community 2.0 main', |
340 | 158 | 'extra_packages': 'dsc20'}) | 147 | 'extra_packages': 'dsc20'}) |
341 | 159 | 148 | ||
369 | 160 | self.d.configure('compute', { | 149 | self.d.configure('mysql', {'max-connections': 500}) |
370 | 161 | 'openstack-origin': self.os_release, | 150 | |
371 | 162 | 'virt-type': 'qemu', | 151 | api_config = {'midonet-origin': self.midonet_origin, |
372 | 163 | 'flat-interface': 'eth0', | 152 | 'openstack-origin': self.os_release} |
373 | 164 | 'manage-neutron-plugin-legacy-mode': 'false'}) | 153 | if self.mem: |
374 | 165 | 154 | api_config.update(self.mem_credentials) | |
375 | 166 | self.d.configure('nova', { | 155 | self.d.configure('midonet-api', api_config) |
376 | 167 | 'openstack-origin': self.os_release, | 156 | self.d.configure('midonet-agent', api_config) |
377 | 168 | 'network-manager': 'Neutron', | 157 | self.d.configure('neutron-agents-midonet', api_config) |
378 | 169 | 'shared-secret': 'secret'}) | 158 | |
352 | 170 | |||
353 | 171 | self.d.configure('neutron', { | ||
354 | 172 | 'neutron-plugin': 'midonet', | ||
355 | 173 | 'neutron-security-groups': 'True', | ||
356 | 174 | 'neutron-external-network': 'Public_Network', | ||
357 | 175 | 'l2-population': 'False', | ||
358 | 176 | 'openstack-origin': self.os_release, | ||
359 | 177 | 'midonet-origin': self.midonet_origin}) | ||
360 | 178 | |||
361 | 179 | |||
362 | 180 | self.d.configure('midonet-api', repo_config) | ||
363 | 181 | |||
364 | 182 | neutron_agts_midonet_config = {'shared-secret': 'secret'} | ||
365 | 183 | neutron_agts_midonet_config.update(repo_config) | ||
366 | 184 | self.d.configure('neutron-agents-midonet', neutron_agts_midonet_config) | ||
367 | 185 | |||
368 | 186 | self.d.configure('midonet-agent', repo_config) | ||
379 | 187 | 159 | ||
380 | 188 | def _deploy(self): | 160 | def _deploy(self): |
381 | 189 | try: | 161 | try: |
382 | @@ -196,8 +168,6 @@ | |||
383 | 196 | def _initialize_tests(self): | 168 | def _initialize_tests(self): |
384 | 197 | self.zookeeper_sentry = self.d.sentry.unit['zookeeper/0'] | 169 | self.zookeeper_sentry = self.d.sentry.unit['zookeeper/0'] |
385 | 198 | self.keystone_sentry = self.d.sentry.unit['keystone/0'] | 170 | self.keystone_sentry = self.d.sentry.unit['keystone/0'] |
386 | 199 | self.cassandra_sentry = self.d.sentry.unit['cassandra/0'] | ||
387 | 200 | self.nova_compute_sentry = self.d.sentry.unit['compute/0'] | ||
388 | 201 | self.mn_api_sentry = self.d.sentry.unit['midonet-api/0'] | 171 | self.mn_api_sentry = self.d.sentry.unit['midonet-api/0'] |
389 | 202 | self.mn_agent_sentry = self.d.sentry.unit['midonet-agent/0'] | 172 | self.mn_agent_sentry = self.d.sentry.unit['midonet-agent/0'] |
390 | 203 | self.agents_mn_sentry = self.d.sentry.unit['neutron-agents-midonet/0'] | 173 | self.agents_mn_sentry = self.d.sentry.unit['neutron-agents-midonet/0'] |
391 | @@ -206,12 +176,6 @@ | |||
392 | 206 | 'identity-service', 'midonet-api:keystone') | 176 | 'identity-service', 'midonet-api:keystone') |
393 | 207 | self.zookeeper_api_relation = self.zookeeper_sentry.relation( | 177 | self.zookeeper_api_relation = self.zookeeper_sentry.relation( |
394 | 208 | 'zookeeper', 'midonet-api:zookeeper') | 178 | 'zookeeper', 'midonet-api:zookeeper') |
395 | 209 | self.zk_host_relation = self.zookeeper_sentry.relation( | ||
396 | 210 | 'zookeeper', 'midonet-agent:zookeeper') | ||
397 | 211 | self.cs_host_relation = self.cassandra_sentry.relation( | ||
398 | 212 | 'database', 'midonet-agent:cassandra') | ||
399 | 213 | self.api_host_relation = self.mn_api_sentry.relation( | ||
400 | 214 | 'host', 'midonet-agent:host') | ||
401 | 215 | 179 | ||
402 | 216 | def run_tests(self): | 180 | def run_tests(self): |
403 | 217 | for test in dir(self): | 181 | for test in dir(self): |
404 | @@ -249,3 +213,10 @@ | |||
405 | 249 | amulet.raise_status(amulet.FAIL, | 213 | amulet.raise_status(amulet.FAIL, |
406 | 250 | msg="neutron-metadata-agent not running: %s" % | 214 | msg="neutron-metadata-agent not running: %s" % |
407 | 251 | meta_agent_out) | 215 | meta_agent_out) |
408 | 216 | u.log.debug('Checking nova-api-metadata...') | ||
409 | 217 | meta_agent_out, _ = self.agents_mn_sentry.run( | ||
410 | 218 | 'service nova-api-metadata status') | ||
411 | 219 | if 'running' not in meta_agent_out: | ||
412 | 220 | amulet.raise_status(amulet.FAIL, | ||
413 | 221 | msg="nova-api-metadata not running: %s" % | ||
414 | 222 | meta_agent_out) | ||
415 | 252 | 223 | ||
416 | === modified file 'unit_tests/test_context.py' | |||
417 | --- unit_tests/test_context.py 2016-01-28 00:53:03 +0000 | |||
418 | +++ unit_tests/test_context.py 2016-02-16 14:28:40 +0000 | |||
419 | @@ -18,7 +18,7 @@ | |||
420 | 18 | import shutil | 18 | import shutil |
421 | 19 | import tempfile | 19 | import tempfile |
422 | 20 | 20 | ||
424 | 21 | import mock | 21 | import services |
425 | 22 | 22 | ||
426 | 23 | from .midonet_helpers import test | 23 | from .midonet_helpers import test |
427 | 24 | 24 | ||
428 | @@ -55,38 +55,20 @@ | |||
429 | 55 | '10.10.10.11'] | 55 | '10.10.10.11'] |
430 | 56 | test.CharmTestCase.__init__(self, *args, **kwargs) | 56 | test.CharmTestCase.__init__(self, *args, **kwargs) |
431 | 57 | 57 | ||
437 | 58 | @mock.patch('charmhelpers.fetch.apt_install') | 58 | def setUp(self): |
433 | 59 | def setUp(self, apt_install): | ||
434 | 60 | |||
435 | 61 | import services | ||
436 | 62 | |||
438 | 63 | self.relations = test.FakeRelation(self._full_relation_data()) | 59 | self.relations = test.FakeRelation(self._full_relation_data()) |
439 | 64 | self.services = services | ||
440 | 65 | test.CharmTestCase.setUp(self, services.hookenv, HOOKENV_PATCHES) | 60 | test.CharmTestCase.setUp(self, services.hookenv, HOOKENV_PATCHES) |
441 | 66 | 61 | ||
442 | 67 | def lsb_release(): | 62 | def lsb_release(): |
444 | 68 | ubuntu_trusty = { | 63 | return { |
445 | 69 | 'DISTRIB_ID': 'Ubuntu', | 64 | 'DISTRIB_ID': 'Ubuntu', |
446 | 70 | 'DISTRIB_RELEASE': '14.04', | 65 | 'DISTRIB_RELEASE': '14.04', |
447 | 71 | 'DISTRIB_CODENAME': 'trusty', | 66 | 'DISTRIB_CODENAME': 'trusty', |
448 | 72 | 'DISTRIB_DESCRIPTION': "Ubuntu 14.04.3 LTS", | 67 | 'DISTRIB_DESCRIPTION': "Ubuntu 14.04.3 LTS", |
449 | 73 | } | 68 | } |
450 | 74 | 69 | ||
451 | 75 | try: | ||
452 | 76 | data = services.host.lsb_release() | ||
453 | 77 | except Exception: | ||
454 | 78 | return ubuntu_trusty | ||
455 | 79 | if data.get('DISTRIB_ID') != 'Ubuntu': | ||
456 | 80 | return ubuntu_trusty | ||
457 | 81 | return data | ||
458 | 82 | |||
459 | 83 | def get_os_codename_package(pkg, fatal=True): | 70 | def get_os_codename_package(pkg, fatal=True): |
466 | 84 | version = 'liberty' | 71 | return 'liberty' |
461 | 85 | try: | ||
462 | 86 | ret_vers = services.utils.get_os_codename_package(pkg, fatal) | ||
463 | 87 | except Exception: | ||
464 | 88 | return version | ||
465 | 89 | return ret_vers | ||
467 | 90 | 72 | ||
468 | 91 | self.patch_all(services.utils, | 73 | self.patch_all(services.utils, |
469 | 92 | ('get_os_codename_package', | 74 | ('get_os_codename_package', |
470 | @@ -94,38 +76,21 @@ | |||
471 | 94 | self.lsb_release.side_effect = lsb_release | 76 | self.lsb_release.side_effect = lsb_release |
472 | 95 | self.get_os_codename_package.side_effect = get_os_codename_package | 77 | self.get_os_codename_package.side_effect = get_os_codename_package |
473 | 96 | 78 | ||
474 | 79 | self.patch_all(services.base, ('service_restart', 'service_stop')) | ||
475 | 80 | self.patch_all(services.helpers, ('render_template',)) | ||
476 | 97 | self.patch_all(services.host, ('service_running',)) | 81 | self.patch_all(services.host, ('service_running',)) |
503 | 98 | self.service_running.return_value = True | 82 | self.patch_all(services.puppet, ('_apply',)) |
504 | 99 | 83 | self.patch_all(services.templating.OSConfigRenderer, ('write_all',)) | |
479 | 100 | _templating = mock.patch.object(services.helpers, 'render_template') | ||
480 | 101 | setattr(self, 'render_template', _templating.start()) | ||
481 | 102 | self.addCleanup(_templating.stop) | ||
482 | 103 | |||
483 | 104 | _check_call = mock.patch.object(services.hookenv.subprocess, | ||
484 | 105 | 'check_call') | ||
485 | 106 | setattr(self, 'check_call', _check_call.start()) | ||
486 | 107 | self.addCleanup(_check_call.stop) | ||
487 | 108 | |||
488 | 109 | _service_restart = mock.patch.object(services.base, 'service_restart') | ||
489 | 110 | setattr(self, 'service_restart', _service_restart.start()) | ||
490 | 111 | self.addCleanup(_service_restart.stop) | ||
491 | 112 | |||
492 | 113 | _service_stop = mock.patch.object(services.base, 'service_stop') | ||
493 | 114 | setattr(self, 'service_stop', _service_stop.start()) | ||
494 | 115 | self.addCleanup(_service_stop.stop) | ||
495 | 116 | |||
496 | 117 | _relation_helpers = mock.patch.object( | ||
497 | 118 | services.relations.helpers, 'hookenv', spec=[ | ||
498 | 119 | 'relation_ids', | ||
499 | 120 | 'related_units', | ||
500 | 121 | 'relation_get']) | ||
501 | 122 | setattr(self, 'relation_helpers', _relation_helpers.start()) | ||
502 | 123 | self.addCleanup(_relation_helpers.stop) | ||
505 | 124 | 84 | ||
506 | 125 | self.test_config.config['openstack-origin'] = 'cloud:trusty-liberty' | 85 | self.test_config.config['openstack-origin'] = 'cloud:trusty-liberty' |
507 | 126 | self.config.side_effect = self.test_config.get | 86 | self.config.side_effect = self.test_config.get |
509 | 127 | self.relation_get.side_effect = self.test_relation.get | 87 | self.related_units.side_effect = self.relations.related_units |
510 | 88 | self.relation_get.side_effect = self.relations.get | ||
511 | 89 | self.relation_ids.side_effect = self.relations.relation_ids | ||
512 | 128 | 90 | ||
513 | 91 | services.context.related_units = self.related_units | ||
514 | 92 | services.context.relation_get = self.relation_get | ||
515 | 93 | services.context.relation_ids = self.relation_ids | ||
516 | 129 | services.context.config = self.config | 94 | services.context.config = self.config |
517 | 130 | 95 | ||
518 | 131 | self.charm_dir.return_value = tempfile.mkdtemp() | 96 | self.charm_dir.return_value = tempfile.mkdtemp() |
519 | @@ -135,21 +100,7 @@ | |||
520 | 135 | test.CharmTestCase.tearDown(self) | 100 | test.CharmTestCase.tearDown(self) |
521 | 136 | 101 | ||
522 | 137 | def test_config_change(self): | 102 | def test_config_change(self): |
538 | 138 | 103 | services.manage() | |
524 | 139 | self.data = self._full_relation_data() | ||
525 | 140 | |||
526 | 141 | self.relation_helpers.relation_ids.side_effect = ( | ||
527 | 142 | self.relations.relation_ids) | ||
528 | 143 | |||
529 | 144 | import services | ||
530 | 145 | services.context.relation_ids = self.relation_helpers.relation_ids | ||
531 | 146 | |||
532 | 147 | self.relation_helpers.related_units.side_effect = ( | ||
533 | 148 | self.relations.related_units) | ||
534 | 149 | self.relation_helpers.relation_get.side_effect = ( | ||
535 | 150 | self.relations.get) | ||
536 | 151 | |||
537 | 152 | self.services.manage() | ||
539 | 153 | 104 | ||
540 | 154 | self.assertTrue(self.render_template.called) | 105 | self.assertTrue(self.render_template.called) |
541 | 155 | self.assertTrue(self.service_restart.called) | 106 | self.assertTrue(self.service_restart.called) |
542 | @@ -181,4 +132,11 @@ | |||
543 | 181 | 'port': 8080, | 132 | 'port': 8080, |
544 | 182 | }, | 133 | }, |
545 | 183 | }, | 134 | }, |
546 | 135 | 'amqp:2': { | ||
547 | 136 | 'rabbitmq/0': { | ||
548 | 137 | 'clustered': False, | ||
549 | 138 | 'private-address': '10.0.30.14', | ||
550 | 139 | 'password': 'foopass', | ||
551 | 140 | }, | ||
552 | 141 | }, | ||
553 | 184 | } | 142 | } |