From 0c3387dc3cc19444a55a97c9aa535d3228a6093b Mon Sep 17 00:00:00 2001 From: "james.page@ubuntu.com" <> Date: Thu, 7 May 2015 10:27:07 +0100 Subject: [PATCH] Rename charm to neutron-gateway including code --- .coveragerc | 2 +- Makefile | 4 +- README.md | 50 ++-- actions/git_reinstall.py | 4 +- hooks/amqp-nova-relation-changed | 2 +- hooks/amqp-nova-relation-departed | 2 +- hooks/amqp-nova-relation-joined | 2 +- hooks/amqp-relation-changed | 2 +- hooks/amqp-relation-departed | 2 +- hooks/amqp-relation-joined | 2 +- hooks/cluster-relation-broken | 2 +- hooks/cluster-relation-departed | 2 +- hooks/config-changed | 2 +- hooks/ha-relation-departed | 2 +- hooks/ha-relation-joined | 2 +- hooks/install | 2 +- hooks/neutron-plugin-api-relation-broken | 2 +- hooks/neutron-plugin-api-relation-changed | 2 +- hooks/neutron-plugin-api-relation-departed | 2 +- hooks/neutron-plugin-api-relation-joined | 2 +- ...uantum_contexts.py => neutron_contexts.py} | 0 hooks/{quantum_hooks.py => neutron_hooks.py} | 2 +- hooks/{quantum_utils.py => neutron_utils.py} | 2 +- hooks/nrpe-external-master-relation-changed | 2 +- hooks/nrpe-external-master-relation-joined | 2 +- hooks/pgsql-db-relation-changed | 2 +- hooks/pgsql-db-relation-joined | 2 +- .../quantum-network-service-relation-changed | 2 +- hooks/shared-db-relation-changed | 2 +- hooks/shared-db-relation-joined | 2 +- hooks/start | 2 +- hooks/stop | 2 +- hooks/upgrade-charm | 2 +- hooks/zeromq-configuration-relation-changed | 2 +- hooks/zeromq-configuration-relation-joined | 2 +- metadata.yaml | 2 +- unit_tests/test_actions_git_reinstall.py | 2 +- ...m_contexts.py => test_neutron_contexts.py} | 72 +++--- ...quantum_hooks.py => test_neutron_hooks.py} | 4 +- ...quantum_utils.py => test_neutron_utils.py} | 244 +++++++++--------- 40 files changed, 217 insertions(+), 227 deletions(-) rename hooks/{quantum_contexts.py => neutron_contexts.py} (100%) rename hooks/{quantum_hooks.py => neutron_hooks.py} (99%) rename hooks/{quantum_utils.py => neutron_utils.py} (99%) rename unit_tests/{test_quantum_contexts.py => test_neutron_contexts.py} (79%) rename unit_tests/{test_quantum_hooks.py => test_neutron_hooks.py} (99%) rename unit_tests/{test_quantum_utils.py => test_neutron_utils.py} (86%) diff --git a/.coveragerc b/.coveragerc index 79621058..4d95df15 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,4 +3,4 @@ exclude_lines = if __name__ == .__main__.: include= - hooks/quantum_* + hooks/neutron_* diff --git a/Makefile b/Makefile index 61937885..3b09f3ef 100644 --- a/Makefile +++ b/Makefile @@ -26,5 +26,5 @@ test: @juju test -v -p AMULET_HTTP_PROXY,AMULET_OS_VIP --timeout 2700 publish: lint unit_test - bzr push lp:charms/quantum-gateway - bzr push lp:charms/trusty/quantum-gateway + bzr push lp:charms/neutron-gateway + bzr push lp:charms/trusty/neutron-gateway diff --git a/README.md b/README.md index a16dee0f..35108194 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,9 @@ be suitable for all. Neutron supports a rich plugin/extension framework for propriety networking solutions and supports (in core) Nicira NVP, NEC, Cisco and others... -The Openstack charms currently only support the fully free OpenvSwitch plugin -and implements the 'Provider Router with Private Networks' use case. - See the upstream [Neutron documentation](http://docs.openstack.org/trunk/openstack-network/admin/content/use_cases_single_router.html) for more details. - Usage ----- @@ -40,10 +36,10 @@ Neutron is deployed baked into these charms from install onwards: The Neutron Gateway can then be added to the deploying: - juju deploy quantum-gateway - juju add-relation quantum-gateway mysql - juju add-relation quantum-gateway rabbitmq-server - juju add-relation quantum-gateway nova-cloud-controller + juju deploy neutron-gateway + juju add-relation neutron-gateway mysql + juju add-relation neutron-gateway rabbitmq-server + juju add-relation neutron-gateway nova-cloud-controller The gateway provides two key services; L3 network routing and DHCP services. @@ -60,13 +56,13 @@ External Port Configuration If the port to be used for external traffic is consistent accross all physical servers then is can be specified by simply setting ext-port to the nic id: - quantum-gateway: + neutron-gateway: ext-port: eth2 However, if it varies between hosts then the mac addresses of the external nics for each host can be passed as a space seperated list: - quantum-gateway: + neutron-gateway: ext-port: @@ -74,25 +70,25 @@ Multiple Floating Pools ======================= If multiple floating pools are needed then an L3 agent (which corresponds to -a quantum-gateway for the sake of this charm) is needed for each one. Each +a neutron-gateway for the sake of this charm) is needed for each one. Each gateway needs to be deployed as a seperate service so that the external network id can be set differently for each gateway e.g. - juju deploy quantum-gateway quantum-gateway-extnet1 - juju add-relation quantum-gateway-extnet1 mysql - juju add-relation quantum-gateway-extnet1 rabbitmq-server - juju add-relation quantum-gateway-extnet1 nova-cloud-controller - juju deploy quantum-gateway quantum-gateway-extnet2 - juju add-relation quantum-gateway-extnet2 mysql - juju add-relation quantum-gateway-extnet2 rabbitmq-server - juju add-relation quantum-gateway-extnet2 nova-cloud-controller + juju deploy neutron-gateway neutron-gateway-extnet1 + juju add-relation neutron-gateway-extnet1 mysql + juju add-relation neutron-gateway-extnet1 rabbitmq-server + juju add-relation neutron-gateway-extnet1 nova-cloud-controller + juju deploy neutron-gateway neutron-gateway-extnet2 + juju add-relation neutron-gateway-extnet2 mysql + juju add-relation neutron-gateway-extnet2 rabbitmq-server + juju add-relation neutron-gateway-extnet2 nova-cloud-controller Create extnet1 and extnet2 via neutron client and take a note of their ids - juju set quantum-gateway-extnet1 "run-internal-router=leader" - juju set quantum-gateway-extnet2 "run-internal-router=none" - juju set quantum-gateway-extnet1 "external-network-id=" - juju set quantum-gateway-extnet2 "external-network-id=" + juju set neutron-gateway-extnet1 "run-internal-router=leader" + juju set neutron-gateway-extnet2 "run-internal-router=none" + juju set neutron-gateway-extnet1 "external-network-id=" + juju set neutron-gateway-extnet2 "external-network-id=" Instance MTU ============ @@ -102,7 +98,7 @@ packet fragmentation due to GRE overhead. One solution is to increase the MTU on physical hosts and network equipment. When this is not possible or practical the charm's instance-mtu option can be used to reduce instance MTU via DHCP. - juju set quantum-gateway instance-mtu=1400 + juju set neutron-gateway instance-mtu=1400 OpenStack upstream documentation recomments a MTU value of 1400: [Openstack documentation](http://docs.openstack.org/admin-guide-cloud/content/openvswitch_plugin.html) @@ -202,9 +198,3 @@ The following is a full list of current tip repos (may not be up-to-date): - {name: neutron, repository: 'git://github.com/openstack/neutron', branch: master} - -TODO ----- - - * Provide more network configuration use cases. - * Support VLAN in addition to GRE+OpenFlow for L2 separation. diff --git a/actions/git_reinstall.py b/actions/git_reinstall.py index 3feb17f7..4e12b1bb 100755 --- a/actions/git_reinstall.py +++ b/actions/git_reinstall.py @@ -14,11 +14,11 @@ from charmhelpers.core.hookenv import ( config, ) -from quantum_utils import ( +from neutron_utils import ( git_install, ) -from quantum_hooks import ( +from neutron_hooks import ( config_changed, ) diff --git a/hooks/amqp-nova-relation-changed b/hooks/amqp-nova-relation-changed index 9a2da58e..fed1c963 120000 --- a/hooks/amqp-nova-relation-changed +++ b/hooks/amqp-nova-relation-changed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/amqp-nova-relation-departed b/hooks/amqp-nova-relation-departed index 9a2da58e..fed1c963 120000 --- a/hooks/amqp-nova-relation-departed +++ b/hooks/amqp-nova-relation-departed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/amqp-nova-relation-joined b/hooks/amqp-nova-relation-joined index 9a2da58e..fed1c963 120000 --- a/hooks/amqp-nova-relation-joined +++ b/hooks/amqp-nova-relation-joined @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/amqp-relation-changed b/hooks/amqp-relation-changed index 9a2da58e..fed1c963 120000 --- a/hooks/amqp-relation-changed +++ b/hooks/amqp-relation-changed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/amqp-relation-departed b/hooks/amqp-relation-departed index 9a2da58e..fed1c963 120000 --- a/hooks/amqp-relation-departed +++ b/hooks/amqp-relation-departed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/amqp-relation-joined b/hooks/amqp-relation-joined index 9a2da58e..fed1c963 120000 --- a/hooks/amqp-relation-joined +++ b/hooks/amqp-relation-joined @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/cluster-relation-broken b/hooks/cluster-relation-broken index 9a2da58e..fed1c963 120000 --- a/hooks/cluster-relation-broken +++ b/hooks/cluster-relation-broken @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/cluster-relation-departed b/hooks/cluster-relation-departed index 9a2da58e..fed1c963 120000 --- a/hooks/cluster-relation-departed +++ b/hooks/cluster-relation-departed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/config-changed b/hooks/config-changed index 9a2da58e..fed1c963 120000 --- a/hooks/config-changed +++ b/hooks/config-changed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/ha-relation-departed b/hooks/ha-relation-departed index 9a2da58e..fed1c963 120000 --- a/hooks/ha-relation-departed +++ b/hooks/ha-relation-departed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/ha-relation-joined b/hooks/ha-relation-joined index 9a2da58e..fed1c963 120000 --- a/hooks/ha-relation-joined +++ b/hooks/ha-relation-joined @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/install b/hooks/install index 9a2da58e..fed1c963 120000 --- a/hooks/install +++ b/hooks/install @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/neutron-plugin-api-relation-broken b/hooks/neutron-plugin-api-relation-broken index 9a2da58e..fed1c963 120000 --- a/hooks/neutron-plugin-api-relation-broken +++ b/hooks/neutron-plugin-api-relation-broken @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/neutron-plugin-api-relation-changed b/hooks/neutron-plugin-api-relation-changed index 9a2da58e..fed1c963 120000 --- a/hooks/neutron-plugin-api-relation-changed +++ b/hooks/neutron-plugin-api-relation-changed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/neutron-plugin-api-relation-departed b/hooks/neutron-plugin-api-relation-departed index 9a2da58e..fed1c963 120000 --- a/hooks/neutron-plugin-api-relation-departed +++ b/hooks/neutron-plugin-api-relation-departed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/neutron-plugin-api-relation-joined b/hooks/neutron-plugin-api-relation-joined index 9a2da58e..fed1c963 120000 --- a/hooks/neutron-plugin-api-relation-joined +++ b/hooks/neutron-plugin-api-relation-joined @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/quantum_contexts.py b/hooks/neutron_contexts.py similarity index 100% rename from hooks/quantum_contexts.py rename to hooks/neutron_contexts.py diff --git a/hooks/quantum_hooks.py b/hooks/neutron_hooks.py similarity index 99% rename from hooks/quantum_hooks.py rename to hooks/neutron_hooks.py index 5eef9426..d63ba213 100755 --- a/hooks/quantum_hooks.py +++ b/hooks/neutron_hooks.py @@ -41,7 +41,7 @@ from charmhelpers.core.sysctl import create as create_sysctl from charmhelpers.contrib.charmsupport import nrpe import sys -from quantum_utils import ( +from neutron_utils import ( L3HA_PACKAGES, register_configs, restart_map, diff --git a/hooks/quantum_utils.py b/hooks/neutron_utils.py similarity index 99% rename from hooks/quantum_utils.py rename to hooks/neutron_utils.py index 3be8aa2b..6d95aa0a 100644 --- a/hooks/quantum_utils.py +++ b/hooks/neutron_utils.py @@ -60,7 +60,7 @@ from charmhelpers.contrib.openstack.context import ( ) import charmhelpers.contrib.openstack.templating as templating from charmhelpers.contrib.openstack.neutron import headers_package -from quantum_contexts import ( +from neutron_contexts import ( CORE_PLUGIN, OVS, NVP, NSX, N1KV, NEUTRON, QUANTUM, networking_name, diff --git a/hooks/nrpe-external-master-relation-changed b/hooks/nrpe-external-master-relation-changed index 9a2da58e..fed1c963 120000 --- a/hooks/nrpe-external-master-relation-changed +++ b/hooks/nrpe-external-master-relation-changed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/nrpe-external-master-relation-joined b/hooks/nrpe-external-master-relation-joined index 9a2da58e..fed1c963 120000 --- a/hooks/nrpe-external-master-relation-joined +++ b/hooks/nrpe-external-master-relation-joined @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/pgsql-db-relation-changed b/hooks/pgsql-db-relation-changed index 9a2da58e..fed1c963 120000 --- a/hooks/pgsql-db-relation-changed +++ b/hooks/pgsql-db-relation-changed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/pgsql-db-relation-joined b/hooks/pgsql-db-relation-joined index 9a2da58e..fed1c963 120000 --- a/hooks/pgsql-db-relation-joined +++ b/hooks/pgsql-db-relation-joined @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/quantum-network-service-relation-changed b/hooks/quantum-network-service-relation-changed index 9a2da58e..fed1c963 120000 --- a/hooks/quantum-network-service-relation-changed +++ b/hooks/quantum-network-service-relation-changed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/shared-db-relation-changed b/hooks/shared-db-relation-changed index 9a2da58e..fed1c963 120000 --- a/hooks/shared-db-relation-changed +++ b/hooks/shared-db-relation-changed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/shared-db-relation-joined b/hooks/shared-db-relation-joined index 9a2da58e..fed1c963 120000 --- a/hooks/shared-db-relation-joined +++ b/hooks/shared-db-relation-joined @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/start b/hooks/start index 9a2da58e..fed1c963 120000 --- a/hooks/start +++ b/hooks/start @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/stop b/hooks/stop index 9a2da58e..fed1c963 120000 --- a/hooks/stop +++ b/hooks/stop @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/upgrade-charm b/hooks/upgrade-charm index 9a2da58e..fed1c963 120000 --- a/hooks/upgrade-charm +++ b/hooks/upgrade-charm @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/zeromq-configuration-relation-changed b/hooks/zeromq-configuration-relation-changed index 9a2da58e..fed1c963 120000 --- a/hooks/zeromq-configuration-relation-changed +++ b/hooks/zeromq-configuration-relation-changed @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/hooks/zeromq-configuration-relation-joined b/hooks/zeromq-configuration-relation-joined index 9a2da58e..fed1c963 120000 --- a/hooks/zeromq-configuration-relation-joined +++ b/hooks/zeromq-configuration-relation-joined @@ -1 +1 @@ -quantum_hooks.py \ No newline at end of file +neutron_hooks.py \ No newline at end of file diff --git a/metadata.yaml b/metadata.yaml index 8f6b4ff0..49b46048 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -1,4 +1,4 @@ -name: quantum-gateway +name: neutron-gateway summary: Virtual Networking for OpenStack - Neutron Gateway maintainer: James Page description: | diff --git a/unit_tests/test_actions_git_reinstall.py b/unit_tests/test_actions_git_reinstall.py index 7a5fab70..1f56c7f8 100644 --- a/unit_tests/test_actions_git_reinstall.py +++ b/unit_tests/test_actions_git_reinstall.py @@ -2,7 +2,7 @@ from mock import patch, MagicMock with patch('charmhelpers.core.hookenv.config') as config: config.return_value = 'neutron' - import quantum_utils as utils # noqa + import neutron_utils as utils # noqa # Need to do some early patching to get the module loaded. _register_configs = utils.register_configs diff --git a/unit_tests/test_quantum_contexts.py b/unit_tests/test_neutron_contexts.py similarity index 79% rename from unit_tests/test_quantum_contexts.py rename to unit_tests/test_neutron_contexts.py index 17a0e95e..0a11ffe3 100644 --- a/unit_tests/test_quantum_contexts.py +++ b/unit_tests/test_neutron_contexts.py @@ -3,7 +3,7 @@ from mock import ( MagicMock, patch ) -import quantum_contexts +import neutron_contexts import sys from contextlib import contextmanager @@ -50,60 +50,60 @@ class DummyNeutronAPIContext(): class TestL3AgentContext(CharmTestCase): def setUp(self): - super(TestL3AgentContext, self).setUp(quantum_contexts, + super(TestL3AgentContext, self).setUp(neutron_contexts, TO_PATCH) self.config.side_effect = self.test_config.get - @patch('quantum_contexts.NeutronAPIContext') + @patch('neutron_contexts.NeutronAPIContext') def test_no_ext_netid(self, _NeutronAPIContext): _NeutronAPIContext.return_value = \ DummyNeutronAPIContext(return_value={'enable_dvr': False}) self.test_config.set('run-internal-router', 'none') self.test_config.set('external-network-id', '') self.eligible_leader.return_value = False - self.assertEquals(quantum_contexts.L3AgentContext()(), + self.assertEquals(neutron_contexts.L3AgentContext()(), {'agent_mode': 'legacy', 'handle_internal_only_router': False, 'plugin': 'ovs'}) - @patch('quantum_contexts.NeutronAPIContext') + @patch('neutron_contexts.NeutronAPIContext') def test_hior_leader(self, _NeutronAPIContext): _NeutronAPIContext.return_value = \ DummyNeutronAPIContext(return_value={'enable_dvr': False}) self.test_config.set('run-internal-router', 'leader') self.test_config.set('external-network-id', 'netid') self.eligible_leader.return_value = True - self.assertEquals(quantum_contexts.L3AgentContext()(), + self.assertEquals(neutron_contexts.L3AgentContext()(), {'agent_mode': 'legacy', 'handle_internal_only_router': True, 'ext_net_id': 'netid', 'plugin': 'ovs'}) - @patch('quantum_contexts.NeutronAPIContext') + @patch('neutron_contexts.NeutronAPIContext') def test_hior_all(self, _NeutronAPIContext): _NeutronAPIContext.return_value = \ DummyNeutronAPIContext(return_value={'enable_dvr': False}) self.test_config.set('run-internal-router', 'all') self.test_config.set('external-network-id', 'netid') self.eligible_leader.return_value = True - self.assertEquals(quantum_contexts.L3AgentContext()(), + self.assertEquals(neutron_contexts.L3AgentContext()(), {'agent_mode': 'legacy', 'handle_internal_only_router': True, 'ext_net_id': 'netid', 'plugin': 'ovs'}) - @patch('quantum_contexts.NeutronAPIContext') + @patch('neutron_contexts.NeutronAPIContext') def test_dvr(self, _NeutronAPIContext): _NeutronAPIContext.return_value = \ DummyNeutronAPIContext(return_value={'enable_dvr': True}) - self.assertEquals(quantum_contexts.L3AgentContext()()['agent_mode'], + self.assertEquals(neutron_contexts.L3AgentContext()()['agent_mode'], 'dvr_snat') class TestQuantumGatewayContext(CharmTestCase): def setUp(self): - super(TestQuantumGatewayContext, self).setUp(quantum_contexts, + super(TestQuantumGatewayContext, self).setUp(neutron_contexts, TO_PATCH) self.config.side_effect = self.test_config.get self.maxDiff = None @@ -111,8 +111,8 @@ class TestQuantumGatewayContext(CharmTestCase): @patch('charmhelpers.contrib.openstack.context.relation_get') @patch('charmhelpers.contrib.openstack.context.related_units') @patch('charmhelpers.contrib.openstack.context.relation_ids') - @patch.object(quantum_contexts, 'get_shared_secret') - @patch.object(quantum_contexts, 'get_host_ip') + @patch.object(neutron_contexts, 'get_shared_secret') + @patch.object(neutron_contexts, 'get_host_ip') def test_all(self, _host_ip, _secret, _rids, _runits, _rget): rdata = {'l2-population': 'True', 'enable-dvr': 'True', @@ -133,7 +133,7 @@ class TestQuantumGatewayContext(CharmTestCase): self.get_os_codename_install_source.return_value = 'folsom' _host_ip.return_value = '10.5.0.1' _secret.return_value = 'testsecret' - ctxt = quantum_contexts.QuantumGatewayContext()() + ctxt = neutron_contexts.QuantumGatewayContext()() self.assertEquals(ctxt, { 'shared_secret': 'testsecret', 'enable_dvr': True, @@ -158,7 +158,7 @@ class TestQuantumGatewayContext(CharmTestCase): class TestSharedSecret(CharmTestCase): def setUp(self): - super(TestSharedSecret, self).setUp(quantum_contexts, + super(TestSharedSecret, self).setUp(neutron_contexts, TO_PATCH) self.config.side_effect = self.test_config.get @@ -168,10 +168,10 @@ class TestSharedSecret(CharmTestCase): _path.exists.return_value = False _uuid4.return_value = 'secret_thing' with patch_open() as (_open, _file): - self.assertEquals(quantum_contexts.get_shared_secret(), + self.assertEquals(neutron_contexts.get_shared_secret(), 'secret_thing') _open.assert_called_with( - quantum_contexts.SHARED_SECRET.format('quantum'), 'w') + neutron_contexts.SHARED_SECRET.format('quantum'), 'w') _file.write.assert_called_with('secret_thing') @patch('os.path') @@ -179,16 +179,16 @@ class TestSharedSecret(CharmTestCase): _path.exists.return_value = True with patch_open() as (_open, _file): _file.read.return_value = 'secret_thing\n' - self.assertEquals(quantum_contexts.get_shared_secret(), + self.assertEquals(neutron_contexts.get_shared_secret(), 'secret_thing') _open.assert_called_with( - quantum_contexts.SHARED_SECRET.format('quantum'), 'r') + neutron_contexts.SHARED_SECRET.format('quantum'), 'r') class TestHostIP(CharmTestCase): def setUp(self): - super(TestHostIP, self).setUp(quantum_contexts, + super(TestHostIP, self).setUp(neutron_contexts, TO_PATCH) self.config.side_effect = self.test_config.get # Save and inject @@ -206,12 +206,12 @@ class TestHostIP(CharmTestCase): del sys.modules[mod] def test_get_host_ip_already_ip(self): - self.assertEquals(quantum_contexts.get_host_ip('10.5.0.1'), + self.assertEquals(neutron_contexts.get_host_ip('10.5.0.1'), '10.5.0.1') def test_get_host_ip_noarg(self): self.unit_get.return_value = "10.5.0.1" - self.assertEquals(quantum_contexts.get_host_ip(), + self.assertEquals(neutron_contexts.get_host_ip(), '10.5.0.1') @patch('dns.resolver.query') @@ -219,7 +219,7 @@ class TestHostIP(CharmTestCase): class NXDOMAIN(Exception): pass _query.side_effect = NXDOMAIN() - self.assertRaises(NXDOMAIN, quantum_contexts.get_host_ip, + self.assertRaises(NXDOMAIN, neutron_contexts.get_host_ip, 'missing.example.com') @patch('dns.resolver.query') @@ -227,7 +227,7 @@ class TestHostIP(CharmTestCase): data = MagicMock() data.address = '10.5.0.1' _query.return_value = [data] - self.assertEquals(quantum_contexts.get_host_ip('myhost.example.com'), + self.assertEquals(neutron_contexts.get_host_ip('myhost.example.com'), '10.5.0.1') _query.assert_called_with('myhost.example.com', 'A') @@ -236,39 +236,39 @@ class TestMisc(CharmTestCase): def setUp(self): super(TestMisc, - self).setUp(quantum_contexts, + self).setUp(neutron_contexts, TO_PATCH) def test_lt_havana(self): self.get_os_codename_install_source.return_value = 'folsom' - self.assertEquals(quantum_contexts.networking_name(), 'quantum') + self.assertEquals(neutron_contexts.networking_name(), 'quantum') def test_ge_havana(self): self.get_os_codename_install_source.return_value = 'havana' - self.assertEquals(quantum_contexts.networking_name(), 'neutron') + self.assertEquals(neutron_contexts.networking_name(), 'neutron') def test_remap_plugin(self): self.get_os_codename_install_source.return_value = 'havana' - self.assertEquals(quantum_contexts.remap_plugin('nvp'), 'nvp') - self.assertEquals(quantum_contexts.remap_plugin('nsx'), 'nvp') + self.assertEquals(neutron_contexts.remap_plugin('nvp'), 'nvp') + self.assertEquals(neutron_contexts.remap_plugin('nsx'), 'nvp') def test_remap_plugin_icehouse(self): self.get_os_codename_install_source.return_value = 'icehouse' - self.assertEquals(quantum_contexts.remap_plugin('nvp'), 'nsx') - self.assertEquals(quantum_contexts.remap_plugin('nsx'), 'nsx') + self.assertEquals(neutron_contexts.remap_plugin('nvp'), 'nsx') + self.assertEquals(neutron_contexts.remap_plugin('nsx'), 'nsx') def test_remap_plugin_noop(self): self.get_os_codename_install_source.return_value = 'icehouse' - self.assertEquals(quantum_contexts.remap_plugin('ovs'), 'ovs') + self.assertEquals(neutron_contexts.remap_plugin('ovs'), 'ovs') def test_core_plugin(self): self.get_os_codename_install_source.return_value = 'havana' self.config.return_value = 'ovs' - self.assertEquals(quantum_contexts.core_plugin(), - quantum_contexts.NEUTRON_OVS_PLUGIN) + self.assertEquals(neutron_contexts.core_plugin(), + neutron_contexts.NEUTRON_OVS_PLUGIN) def test_core_plugin_ml2(self): self.get_os_codename_install_source.return_value = 'icehouse' self.config.return_value = 'ovs' - self.assertEquals(quantum_contexts.core_plugin(), - quantum_contexts.NEUTRON_ML2_PLUGIN) + self.assertEquals(neutron_contexts.core_plugin(), + neutron_contexts.NEUTRON_ML2_PLUGIN) diff --git a/unit_tests/test_quantum_hooks.py b/unit_tests/test_neutron_hooks.py similarity index 99% rename from unit_tests/test_quantum_hooks.py rename to unit_tests/test_neutron_hooks.py index a530352e..a8828564 100644 --- a/unit_tests/test_quantum_hooks.py +++ b/unit_tests/test_neutron_hooks.py @@ -2,12 +2,12 @@ from mock import MagicMock, patch, call import yaml import charmhelpers.core.hookenv as hookenv hookenv.config = MagicMock() -import quantum_utils as utils +import neutron_utils as utils _register_configs = utils.register_configs _restart_map = utils.restart_map utils.register_configs = MagicMock() utils.restart_map = MagicMock() -import quantum_hooks as hooks +import neutron_hooks as hooks utils.register_configs = _register_configs utils.restart_map = _restart_map diff --git a/unit_tests/test_quantum_utils.py b/unit_tests/test_neutron_utils.py similarity index 86% rename from unit_tests/test_quantum_utils.py rename to unit_tests/test_neutron_utils.py index 2a72721f..befa9eb3 100644 --- a/unit_tests/test_quantum_utils.py +++ b/unit_tests/test_neutron_utils.py @@ -4,7 +4,7 @@ import charmhelpers.contrib.openstack.templating as templating templating.OSConfigRenderer = MagicMock() -import quantum_utils +import neutron_utils try: @@ -72,7 +72,7 @@ class TestQuantumUtils(CharmTestCase): self.assertEqual(v1, v2, msg) def setUp(self): - super(TestQuantumUtils, self).setUp(quantum_utils, TO_PATCH) + super(TestQuantumUtils, self).setUp(neutron_utils, TO_PATCH) self.networking_name.return_value = 'neutron' self.headers_package.return_value = 'linux-headers-2.6.18' self._set_distrib_codename('trusty') @@ -90,92 +90,92 @@ class TestQuantumUtils(CharmTestCase): def test_valid_plugin(self): self.config.return_value = 'ovs' - self.assertTrue(quantum_utils.valid_plugin()) + self.assertTrue(neutron_utils.valid_plugin()) self.config.return_value = 'nvp' - self.assertTrue(quantum_utils.valid_plugin()) + self.assertTrue(neutron_utils.valid_plugin()) self.config.return_value = 'nsx' - self.assertTrue(quantum_utils.valid_plugin()) + self.assertTrue(neutron_utils.valid_plugin()) def test_invalid_plugin(self): self.config.return_value = 'invalid' - self.assertFalse(quantum_utils.valid_plugin()) + self.assertFalse(neutron_utils.valid_plugin()) def test_get_early_packages_ovs(self): self.config.return_value = 'ovs' self.determine_dkms_package.return_value = [ 'openvswitch-datapath-dkms'] self.assertEquals( - quantum_utils.get_early_packages(), + neutron_utils.get_early_packages(), ['openvswitch-datapath-dkms', 'linux-headers-2.6.18']) def test_get_early_packages_nvp(self): self.config.return_value = 'nvp' self.assertEquals( - quantum_utils.get_early_packages(), + neutron_utils.get_early_packages(), []) def test_get_early_packages_empty(self): self.config.return_value = 'noop' - self.assertEquals(quantum_utils.get_early_packages(), + self.assertEquals(neutron_utils.get_early_packages(), []) - @patch.object(quantum_utils, 'git_install_requested') + @patch.object(neutron_utils, 'git_install_requested') def test_get_packages_ovs(self, git_requested): git_requested.return_value = False self.config.return_value = 'ovs' self.get_os_codename_install_source.return_value = 'havana' - self.assertNotEqual(quantum_utils.get_packages(), []) + self.assertNotEqual(neutron_utils.get_packages(), []) - @patch.object(quantum_utils, 'git_install_requested') + @patch.object(neutron_utils, 'git_install_requested') def test_get_packages_ovs_icehouse(self, git_requested): git_requested.return_value = False self.config.return_value = 'ovs' self.get_os_codename_install_source.return_value = 'icehouse' - self.assertTrue('neutron-vpn-agent' in quantum_utils.get_packages()) - self.assertFalse('neutron-l3-agent' in quantum_utils.get_packages()) + self.assertTrue('neutron-vpn-agent' in neutron_utils.get_packages()) + self.assertFalse('neutron-l3-agent' in neutron_utils.get_packages()) - @patch.object(quantum_utils, 'git_install_requested') + @patch.object(neutron_utils, 'git_install_requested') def test_get_packages_ovs_juno_utopic(self, git_requested): git_requested.return_value = False self.config.return_value = 'ovs' self.get_os_codename_install_source.return_value = 'juno' self._set_distrib_codename('utopic') - self.assertFalse('neutron-vpn-agent' in quantum_utils.get_packages()) - self.assertTrue('neutron-l3-agent' in quantum_utils.get_packages()) + self.assertFalse('neutron-vpn-agent' in neutron_utils.get_packages()) + self.assertTrue('neutron-l3-agent' in neutron_utils.get_packages()) - @patch.object(quantum_utils, 'git_install_requested') + @patch.object(neutron_utils, 'git_install_requested') def test_get_packages_ovs_juno_trusty(self, git_requested): git_requested.return_value = False self.config.return_value = 'ovs' self.get_os_codename_install_source.return_value = 'juno' - self.assertTrue('neutron-vpn-agent' in quantum_utils.get_packages()) - self.assertFalse('neutron-l3-agent' in quantum_utils.get_packages()) + self.assertTrue('neutron-vpn-agent' in neutron_utils.get_packages()) + self.assertFalse('neutron-l3-agent' in neutron_utils.get_packages()) - @patch.object(quantum_utils, 'git_install_requested') + @patch.object(neutron_utils, 'git_install_requested') def test_get_packages_ovs_kilo(self, git_requested): git_requested.return_value = False self.config.return_value = 'ovs' self.get_os_codename_install_source.return_value = 'kilo' - self.assertTrue('python-neutron-fwaas' in quantum_utils.get_packages()) + self.assertTrue('python-neutron-fwaas' in neutron_utils.get_packages()) - @patch.object(quantum_utils, 'git_install_requested') + @patch.object(neutron_utils, 'git_install_requested') def test_get_packages_l3ha(self, git_requested): git_requested.return_value = False self.config.return_value = 'ovs' self.get_os_codename_install_source.return_value = 'juno' - self.assertTrue('keepalived' in quantum_utils.get_packages()) + self.assertTrue('keepalived' in neutron_utils.get_packages()) @patch('charmhelpers.contrib.openstack.context.config') def test_configure_ovs_starts_service_if_required(self, mock_config): mock_config.side_effect = self.test_config.get self.config.return_value = 'ovs' self.service_running.return_value = False - quantum_utils.configure_ovs() + neutron_utils.configure_ovs() self.assertTrue(self.full_restart.called) def test_configure_ovs_doesnt_restart_service(self): self.service_running.return_value = True - quantum_utils.configure_ovs() + neutron_utils.configure_ovs() self.assertFalse(self.full_restart.called) @patch('charmhelpers.contrib.openstack.context.config') @@ -186,7 +186,7 @@ class TestQuantumUtils(CharmTestCase): self.test_config.set('ext-port', 'eth0') self.ExternalPortContext.return_value = \ DummyExternalPortContext(return_value={'ext_port': 'eth0'}) - quantum_utils.configure_ovs() + neutron_utils.configure_ovs() self.add_bridge.assert_has_calls([ call('br-int'), call('br-ex'), @@ -204,7 +204,7 @@ class TestQuantumUtils(CharmTestCase): # Test back-compatibility i.e. port but no bridge (so br-data is # assumed) self.test_config.set('data-port', 'eth0') - quantum_utils.configure_ovs() + neutron_utils.configure_ovs() self.add_bridge.assert_has_calls([ call('br-int'), call('br-ex'), @@ -216,7 +216,7 @@ class TestQuantumUtils(CharmTestCase): self.test_config.set('data-port', 'br-foo:eth0') self.add_bridge.reset_mock() self.add_bridge_port.reset_mock() - quantum_utils.configure_ovs() + neutron_utils.configure_ovs() self.add_bridge.assert_has_calls([ call('br-int'), call('br-ex'), @@ -225,7 +225,7 @@ class TestQuantumUtils(CharmTestCase): # Not called since we have a bogus bridge in data-ports self.assertFalse(self.add_bridge_port.called) - @patch.object(quantum_utils, 'git_install_requested') + @patch.object(neutron_utils, 'git_install_requested') def test_do_openstack_upgrade(self, git_requested): git_requested.return_value = False self.config.side_effect = self.test_config.get @@ -233,7 +233,7 @@ class TestQuantumUtils(CharmTestCase): self.test_config.set('openstack-origin', 'cloud:precise-havana') self.test_config.set('plugin', 'ovs') self.get_os_codename_install_source.return_value = 'havana' - quantum_utils.do_openstack_upgrade() + neutron_utils.do_openstack_upgrade() self.assertTrue(self.log.called) self.apt_update.assert_called_with(fatal=True) dpkg_opts = [ @@ -250,36 +250,36 @@ class TestQuantumUtils(CharmTestCase): def test_register_configs_ovs(self): self.config.return_value = 'ovs' self.is_relation_made.return_value = False - configs = quantum_utils.register_configs() - confs = [quantum_utils.NEUTRON_DHCP_AGENT_CONF, - quantum_utils.NEUTRON_METADATA_AGENT_CONF, - quantum_utils.NOVA_CONF, - quantum_utils.NEUTRON_CONF, - quantum_utils.NEUTRON_L3_AGENT_CONF, - quantum_utils.NEUTRON_OVS_PLUGIN_CONF, - quantum_utils.EXT_PORT_CONF] + configs = neutron_utils.register_configs() + confs = [neutron_utils.NEUTRON_DHCP_AGENT_CONF, + neutron_utils.NEUTRON_METADATA_AGENT_CONF, + neutron_utils.NOVA_CONF, + neutron_utils.NEUTRON_CONF, + neutron_utils.NEUTRON_L3_AGENT_CONF, + neutron_utils.NEUTRON_OVS_PLUGIN_CONF, + neutron_utils.EXT_PORT_CONF] for conf in confs: configs.register.assert_any_call( conf, - quantum_utils.CONFIG_FILES['neutron'][quantum_utils.OVS][conf] + neutron_utils.CONFIG_FILES['neutron'][neutron_utils.OVS][conf] ['hook_contexts'] ) def test_register_configs_amqp_nova(self): self.config.return_value = 'ovs' self.is_relation_made.return_value = True - configs = quantum_utils.register_configs() - confs = [quantum_utils.NEUTRON_DHCP_AGENT_CONF, - quantum_utils.NEUTRON_METADATA_AGENT_CONF, - quantum_utils.NOVA_CONF, - quantum_utils.NEUTRON_CONF, - quantum_utils.NEUTRON_L3_AGENT_CONF, - quantum_utils.NEUTRON_OVS_PLUGIN_CONF, - quantum_utils.EXT_PORT_CONF] + configs = neutron_utils.register_configs() + confs = [neutron_utils.NEUTRON_DHCP_AGENT_CONF, + neutron_utils.NEUTRON_METADATA_AGENT_CONF, + neutron_utils.NOVA_CONF, + neutron_utils.NEUTRON_CONF, + neutron_utils.NEUTRON_L3_AGENT_CONF, + neutron_utils.NEUTRON_OVS_PLUGIN_CONF, + neutron_utils.EXT_PORT_CONF] for conf in confs: configs.register.assert_any_call( conf, - quantum_utils.CONFIG_FILES['neutron'][quantum_utils.OVS][conf] + neutron_utils.CONFIG_FILES['neutron'][neutron_utils.OVS][conf] ['hook_contexts'] ) @@ -287,7 +287,7 @@ class TestQuantumUtils(CharmTestCase): self.config.return_value = 'ovs' self.get_os_codename_install_source.return_value = 'havana' ex_map = { - quantum_utils.NEUTRON_CONF: ['neutron-l3-agent', + neutron_utils.NEUTRON_CONF: ['neutron-l3-agent', 'neutron-dhcp-agent', 'neutron-metadata-agent', 'neutron-plugin-openvswitch-agent', @@ -296,62 +296,62 @@ class TestQuantumUtils(CharmTestCase): 'neutron-lbaas-agent', 'neutron-plugin-vpn-agent', 'neutron-vpn-agent'], - quantum_utils.NEUTRON_DNSMASQ_CONF: ['neutron-dhcp-agent'], - quantum_utils.NEUTRON_LBAAS_AGENT_CONF: + neutron_utils.NEUTRON_DNSMASQ_CONF: ['neutron-dhcp-agent'], + neutron_utils.NEUTRON_LBAAS_AGENT_CONF: ['neutron-lbaas-agent'], - quantum_utils.NEUTRON_OVS_PLUGIN_CONF: + neutron_utils.NEUTRON_OVS_PLUGIN_CONF: ['neutron-plugin-openvswitch-agent'], - quantum_utils.NEUTRON_METADATA_AGENT_CONF: + neutron_utils.NEUTRON_METADATA_AGENT_CONF: ['neutron-metadata-agent'], - quantum_utils.NEUTRON_VPNAAS_AGENT_CONF: [ + neutron_utils.NEUTRON_VPNAAS_AGENT_CONF: [ 'neutron-plugin-vpn-agent', 'neutron-vpn-agent'], - quantum_utils.NEUTRON_L3_AGENT_CONF: ['neutron-l3-agent', + neutron_utils.NEUTRON_L3_AGENT_CONF: ['neutron-l3-agent', 'neutron-vpn-agent'], - quantum_utils.NEUTRON_DHCP_AGENT_CONF: ['neutron-dhcp-agent'], - quantum_utils.NEUTRON_FWAAS_CONF: ['neutron-l3-agent', + neutron_utils.NEUTRON_DHCP_AGENT_CONF: ['neutron-dhcp-agent'], + neutron_utils.NEUTRON_FWAAS_CONF: ['neutron-l3-agent', 'neutron-vpn-agent'], - quantum_utils.NEUTRON_METERING_AGENT_CONF: + neutron_utils.NEUTRON_METERING_AGENT_CONF: ['neutron-metering-agent', 'neutron-plugin-metering-agent'], - quantum_utils.NOVA_CONF: ['nova-api-metadata'], - quantum_utils.EXT_PORT_CONF: ['ext-port'], - quantum_utils.PHY_NIC_MTU_CONF: ['os-charm-phy-nic-mtu'], + neutron_utils.NOVA_CONF: ['nova-api-metadata'], + neutron_utils.EXT_PORT_CONF: ['ext-port'], + neutron_utils.PHY_NIC_MTU_CONF: ['os-charm-phy-nic-mtu'], } - self.assertDictEqual(quantum_utils.restart_map(), ex_map) + self.assertDictEqual(neutron_utils.restart_map(), ex_map) def test_register_configs_nvp(self): self.config.return_value = 'nvp' self.is_relation_made.return_value = False - configs = quantum_utils.register_configs() - confs = [quantum_utils.NEUTRON_DHCP_AGENT_CONF, - quantum_utils.NEUTRON_METADATA_AGENT_CONF, - quantum_utils.NOVA_CONF, - quantum_utils.NEUTRON_CONF] + configs = neutron_utils.register_configs() + confs = [neutron_utils.NEUTRON_DHCP_AGENT_CONF, + neutron_utils.NEUTRON_METADATA_AGENT_CONF, + neutron_utils.NOVA_CONF, + neutron_utils.NEUTRON_CONF] for conf in confs: configs.register.assert_any_call( conf, - quantum_utils.CONFIG_FILES['neutron'][quantum_utils.NVP][conf] + neutron_utils.CONFIG_FILES['neutron'][neutron_utils.NVP][conf] ['hook_contexts'] ) def test_register_configs_nsx(self): self.config.return_value = 'nsx' - configs = quantum_utils.register_configs() - confs = [quantum_utils.NEUTRON_DHCP_AGENT_CONF, - quantum_utils.NEUTRON_METADATA_AGENT_CONF, - quantum_utils.NOVA_CONF, - quantum_utils.NEUTRON_CONF] + configs = neutron_utils.register_configs() + confs = [neutron_utils.NEUTRON_DHCP_AGENT_CONF, + neutron_utils.NEUTRON_METADATA_AGENT_CONF, + neutron_utils.NOVA_CONF, + neutron_utils.NEUTRON_CONF] for conf in confs: configs.register.assert_any_call( conf, - quantum_utils.CONFIG_FILES['neutron'][quantum_utils.NSX][conf] + neutron_utils.CONFIG_FILES['neutron'][neutron_utils.NSX][conf] ['hook_contexts'] ) def test_stop_services_nvp(self): self.config.return_value = 'nvp' - quantum_utils.stop_services() + neutron_utils.stop_services() calls = [ call('neutron-dhcp-agent'), call('nova-api-metadata'), @@ -364,7 +364,7 @@ class TestQuantumUtils(CharmTestCase): def test_stop_services_ovs(self): self.config.return_value = 'ovs' - quantum_utils.stop_services() + neutron_utils.stop_services() calls = [call('neutron-dhcp-agent'), call('neutron-plugin-openvswitch-agent'), call('nova-api-metadata'), @@ -378,75 +378,75 @@ class TestQuantumUtils(CharmTestCase): def test_restart_map_nvp(self): self.config.return_value = 'nvp' ex_map = { - quantum_utils.NEUTRON_DHCP_AGENT_CONF: ['neutron-dhcp-agent'], - quantum_utils.NEUTRON_DNSMASQ_CONF: ['neutron-dhcp-agent'], - quantum_utils.NOVA_CONF: ['nova-api-metadata'], - quantum_utils.NEUTRON_CONF: ['neutron-dhcp-agent', + neutron_utils.NEUTRON_DHCP_AGENT_CONF: ['neutron-dhcp-agent'], + neutron_utils.NEUTRON_DNSMASQ_CONF: ['neutron-dhcp-agent'], + neutron_utils.NOVA_CONF: ['nova-api-metadata'], + neutron_utils.NEUTRON_CONF: ['neutron-dhcp-agent', 'neutron-metadata-agent'], - quantum_utils.NEUTRON_METADATA_AGENT_CONF: + neutron_utils.NEUTRON_METADATA_AGENT_CONF: ['neutron-metadata-agent'], } - self.assertEquals(quantum_utils.restart_map(), ex_map) + self.assertEquals(neutron_utils.restart_map(), ex_map) def test_register_configs_pre_install(self): self.config.return_value = 'ovs' self.is_relation_made.return_value = False self.networking_name.return_value = 'quantum' - configs = quantum_utils.register_configs() - confs = [quantum_utils.QUANTUM_DHCP_AGENT_CONF, - quantum_utils.QUANTUM_METADATA_AGENT_CONF, - quantum_utils.NOVA_CONF, - quantum_utils.QUANTUM_CONF, - quantum_utils.QUANTUM_L3_AGENT_CONF, - quantum_utils.QUANTUM_OVS_PLUGIN_CONF, - quantum_utils.EXT_PORT_CONF] + configs = neutron_utils.register_configs() + confs = [neutron_utils.QUANTUM_DHCP_AGENT_CONF, + neutron_utils.QUANTUM_METADATA_AGENT_CONF, + neutron_utils.NOVA_CONF, + neutron_utils.QUANTUM_CONF, + neutron_utils.QUANTUM_L3_AGENT_CONF, + neutron_utils.QUANTUM_OVS_PLUGIN_CONF, + neutron_utils.EXT_PORT_CONF] print configs.register.mock_calls for conf in confs: configs.register.assert_any_call( conf, - quantum_utils.CONFIG_FILES['quantum'][quantum_utils.OVS][conf] + neutron_utils.CONFIG_FILES['quantum'][neutron_utils.OVS][conf] ['hook_contexts'] ) def test_get_common_package_quantum(self): self.get_os_codename_package.return_value = 'folsom' - self.assertEquals(quantum_utils.get_common_package(), 'quantum-common') + self.assertEquals(neutron_utils.get_common_package(), 'quantum-common') def test_get_common_package_neutron(self): self.get_os_codename_package.return_value = None - self.assertEquals(quantum_utils.get_common_package(), 'neutron-common') + self.assertEquals(neutron_utils.get_common_package(), 'neutron-common') def test_copy_file_without_update(self): src = 'dummy_source_dir/dummy_file' dst = 'dummy_des_dir' - quantum_utils.copy_file(src, dst) + neutron_utils.copy_file(src, dst) self.assertTrue(self.mkdir.called) self.assertTrue(self.copy2.called) - @patch('quantum_utils.os.path.isfile') + @patch('neutron_utils.os.path.isfile') def test_copy_file_with_update(self, _isfile): src = 'dummy_source_dir/dummy_file' dst = 'dummy_des_dir' _isfile.return_value = False - quantum_utils.copy_file(src, dst, force=True) + neutron_utils.copy_file(src, dst, force=True) self.assertTrue(self.mkdir.called) self.assertTrue(self.copy2.called) - @patch('quantum_utils.os.remove') - @patch('quantum_utils.os.path.isfile') + @patch('neutron_utils.os.remove') + @patch('neutron_utils.os.path.isfile') def test_remove_file_exists(self, _isfile, _remove): path = 'dummy_des_dir/dummy_file' _isfile.return_value = True - quantum_utils.remove_file(path) + neutron_utils.remove_file(path) self.assertTrue(_remove.called) self.assertFalse(self.log.called) - @patch('quantum_utils.os.remove') - @patch('quantum_utils.os.path.isfile') + @patch('neutron_utils.os.remove') + @patch('neutron_utils.os.path.isfile') def test_remove_file_non_exists(self, _isfile, _remove): path = 'dummy_des_dir/dummy_file' _isfile.return_value = False - quantum_utils.remove_file(path) + neutron_utils.remove_file(path) self.assertFalse(_remove.called) self.assertTrue(self.log.called) @@ -608,7 +608,7 @@ class TestQuantumAgentReallocation(CharmTestCase): def setUp(self): if not neutronclient: raise self.skipTest('Skipping, no neutronclient installed') - super(TestQuantumAgentReallocation, self).setUp(quantum_utils, + super(TestQuantumAgentReallocation, self).setUp(neutron_utils, TO_PATCH) def tearDown(self): @@ -618,7 +618,7 @@ class TestQuantumAgentReallocation(CharmTestCase): def test_no_network_context(self): self.NetworkServiceContext.return_value = \ DummyNetworkServiceContext(return_value=None) - quantum_utils.reassign_agent_resources() + neutron_utils.reassign_agent_resources() self.assertTrue(self.log.called) @patch('neutronclient.v2_0.client.Client') @@ -628,7 +628,7 @@ class TestQuantumAgentReallocation(CharmTestCase): dummy_client = MagicMock() dummy_client.list_agents.side_effect = agents_all_alive.itervalues() _client.return_value = dummy_client - quantum_utils.reassign_agent_resources() + neutron_utils.reassign_agent_resources() dummy_client.add_router_to_l3_agent.assert_not_called() dummy_client.remove_router_from_l3_agent.assert_not_called() dummy_client.add_network_to_dhcp_agent.assert_not_called() @@ -649,7 +649,7 @@ class TestQuantumAgentReallocation(CharmTestCase): self.unit_private_ip.return_value = 'cluster2-machine1.internal' self.relations_of_type.return_value = \ [{'private-address': 'cluster2-machine3.internal'}] - quantum_utils.reassign_agent_resources() + neutron_utils.reassign_agent_resources() # Ensure routers removed from dead l3 agent dummy_client.remove_router_from_l3_agent.assert_has_calls( @@ -690,33 +690,33 @@ class TestQuantumAgentReallocation(CharmTestCase): _client.return_value = dummy_client self.unit_private_ip.return_value = 'cluster1-machine1.internal' self.relations_of_type.return_value = [] - quantum_utils.reassign_agent_resources() + neutron_utils.reassign_agent_resources() self.assertTrue(self.log.called) assert not dummy_client.remove_router_from_l3_agent.called assert not dummy_client.remove_network_from_dhcp_agent.called - @patch.object(quantum_utils, 'git_install_requested') - @patch.object(quantum_utils, 'git_clone_and_install') - @patch.object(quantum_utils, 'git_post_install') - @patch.object(quantum_utils, 'git_pre_install') + @patch.object(neutron_utils, 'git_install_requested') + @patch.object(neutron_utils, 'git_clone_and_install') + @patch.object(neutron_utils, 'git_post_install') + @patch.object(neutron_utils, 'git_pre_install') def test_git_install(self, git_pre, git_post, git_clone_and_install, git_requested): projects_yaml = openstack_origin_git git_requested.return_value = True - quantum_utils.git_install(projects_yaml) + neutron_utils.git_install(projects_yaml) self.assertTrue(git_pre.called) git_clone_and_install.assert_called_with(openstack_origin_git, core_project='neutron') self.assertTrue(git_post.called) - @patch.object(quantum_utils, 'mkdir') - @patch.object(quantum_utils, 'write_file') - @patch.object(quantum_utils, 'add_user_to_group') - @patch.object(quantum_utils, 'add_group') - @patch.object(quantum_utils, 'adduser') + @patch.object(neutron_utils, 'mkdir') + @patch.object(neutron_utils, 'write_file') + @patch.object(neutron_utils, 'add_user_to_group') + @patch.object(neutron_utils, 'add_group') + @patch.object(neutron_utils, 'adduser') def test_git_pre_install(self, adduser, add_group, add_user_to_group, write_file, mkdir): - quantum_utils.git_pre_install() + neutron_utils.git_pre_install() adduser.assert_called_with('neutron', shell='/bin/bash', system_user=True) add_group.assert_called_with('neutron', system_group=True) @@ -779,8 +779,8 @@ class TestQuantumAgentReallocation(CharmTestCase): self.assertEquals(write_file.call_args_list, expected) @patch('os.remove') - @patch.object(quantum_utils, 'git_src_dir') - @patch.object(quantum_utils, 'render') + @patch.object(neutron_utils, 'git_src_dir') + @patch.object(neutron_utils, 'render') @patch('os.path.join') @patch('os.path.exists') @patch('os.symlink') @@ -791,7 +791,7 @@ class TestQuantumAgentReallocation(CharmTestCase): exists, join, render, git_src_dir, remove): projects_yaml = openstack_origin_git join.return_value = 'joined-string' - quantum_utils.git_post_install(projects_yaml) + neutron_utils.git_post_install(projects_yaml) expected = [ call('joined-string', '/etc/neutron'), call('joined-string', '/etc/neutron/plugins'),