This commit is contained in:
James Page
2015-04-01 15:20:32 +01:00
2 changed files with 78 additions and 0 deletions

View File

@@ -54,6 +54,7 @@ TO_PATCH = [
'get_address_in_network',
'update_nrpe_config',
'service_reload',
'IdentityServiceContext',
]
NEUTRON_CONF_DIR = "/etc/neutron"
@@ -62,6 +63,15 @@ NEUTRON_CONF = '%s/neutron.conf' % NEUTRON_CONF_DIR
from random import randrange
class DummyContext():
def __init__(self, return_value):
self.return_value = return_value
def __call__(self):
return self.return_value
class NeutronAPIHooksTests(CharmTestCase):
def setUp(self):
@@ -282,12 +292,24 @@ class NeutronAPIHooksTests(CharmTestCase):
self.assertTrue(self.CONFIGS.write.called_with(NEUTRON_CONF))
def test_neutron_plugin_api_relation_joined_nol2(self):
self.IdentityServiceContext.return_value = \
DummyContext(return_value={})
_relation_data = {
'neutron-security-groups': False,
'enable-dvr': False,
'enable-l3ha': False,
'l2-population': False,
'overlay-network-type': 'vxlan',
'service_protocol': None,
'auth_protocol': None,
'service_tenant': None,
'service_port': None,
'region': 'RegionOne',
'service_password': None,
'auth_port': None,
'auth_host': None,
'service_username': None,
'service_host': None
}
self.get_dvr.return_value = False
self.get_l3ha.return_value = False
@@ -300,12 +322,24 @@ class NeutronAPIHooksTests(CharmTestCase):
)
def test_neutron_plugin_api_relation_joined_dvr(self):
self.IdentityServiceContext.return_value = \
DummyContext(return_value={})
_relation_data = {
'neutron-security-groups': False,
'enable-dvr': True,
'enable-l3ha': False,
'l2-population': True,
'overlay-network-type': 'vxlan',
'service_protocol': None,
'auth_protocol': None,
'service_tenant': None,
'service_port': None,
'region': 'RegionOne',
'service_password': None,
'auth_port': None,
'auth_host': None,
'service_username': None,
'service_host': None
}
self.get_dvr.return_value = True
self.get_l3ha.return_value = False
@@ -318,12 +352,24 @@ class NeutronAPIHooksTests(CharmTestCase):
)
def test_neutron_plugin_api_relation_joined_l3ha(self):
self.IdentityServiceContext.return_value = \
DummyContext(return_value={})
_relation_data = {
'neutron-security-groups': False,
'enable-dvr': False,
'enable-l3ha': True,
'l2-population': False,
'overlay-network-type': 'vxlan',
'service_protocol': None,
'auth_protocol': None,
'service_tenant': None,
'service_port': None,
'region': 'RegionOne',
'service_password': None,
'auth_port': None,
'auth_host': None,
'service_username': None,
'service_host': None
}
self.get_dvr.return_value = False
self.get_l3ha.return_value = True
@@ -336,6 +382,8 @@ class NeutronAPIHooksTests(CharmTestCase):
)
def test_neutron_plugin_api_relation_joined_w_mtu(self):
self.IdentityServiceContext.return_value = \
DummyContext(return_value={})
self.test_config.set('network-device-mtu', 1500)
_relation_data = {
'neutron-security-groups': False,
@@ -344,6 +392,16 @@ class NeutronAPIHooksTests(CharmTestCase):
'network-device-mtu': 1500,
'enable-l3ha': True,
'enable-dvr': True,
'service_protocol': None,
'auth_protocol': None,
'service_tenant': None,
'service_port': None,
'region': 'RegionOne',
'service_password': None,
'auth_port': None,
'auth_host': None,
'service_username': None,
'service_host': None
}
self.get_dvr.return_value = True
self.get_l3ha.return_value = True