Merge "add router_id to response for CRU on fw/vip objs"

This commit is contained in:
Jenkins 2014-02-23 17:13:21 +00:00 committed by Gerrit Code Review
commit a872951552
4 changed files with 224 additions and 68 deletions

View File

@ -26,6 +26,7 @@ from neutron.db.loadbalancer import loadbalancer_db
from neutron.db import routedserviceinsertion_db as rsi_db
from neutron.extensions import firewall as fw_ext
from neutron.extensions import l3
from neutron.extensions import routedserviceinsertion as rsi
from neutron.openstack.common import excutils
from neutron.openstack.common import log as logging
from neutron.plugins.common import constants as service_constants
@ -801,7 +802,7 @@ class NvpAdvancedPlugin(sr_db.ServiceRouter_mixin,
def _make_firewall_rule_list_by_policy_id(self, context, fw_policy_id):
if not fw_policy_id:
return None
return []
firewall_policy_db = self._get_firewall_policy(context, fw_policy_id)
return [
self._make_firewall_rule_dict(fw_rule_db)
@ -897,17 +898,21 @@ class NvpAdvancedPlugin(sr_db.ServiceRouter_mixin,
self._vcns_update_firewall(context, fw, router_id)
self._firewall_set_status(
context, fw['id'], service_constants.ACTIVE, fw)
fw[rsi.ROUTER_ID] = router_id
return fw
def update_firewall(self, context, id, firewall):
LOG.debug(_("update_firewall() called"))
self._ensure_firewall_update_allowed(context, id)
service_router_binding = self._get_resource_router_id_binding(
context, firewall_db.Firewall, resource_id=id)
rule_list_pre = self._make_firewall_rule_list_by_policy_id(
context,
self.get_firewall(context, id)['firewall_policy_id'])
firewall['firewall']['status'] = service_constants.PENDING_UPDATE
fw = super(NvpAdvancedPlugin, self).update_firewall(
context, id, firewall)
fw[rsi.ROUTER_ID] = service_router_binding['router_id']
rule_list_new = self._make_firewall_rule_list_by_policy_id(
context, fw['firewall_policy_id'])
if rule_list_pre == rule_list_new:
@ -915,10 +920,9 @@ class NvpAdvancedPlugin(sr_db.ServiceRouter_mixin,
context, fw['id'], service_constants.ACTIVE, fw)
return fw
else:
service_router_binding = self._get_resource_router_id_binding(
context, firewall_db.Firewall, resource_id=id)
self._vcns_update_firewall(
context, fw, service_router_binding.router_id)
context, fw, service_router_binding.router_id,
firewall_rule_list=rule_list_new)
self._firewall_set_status(
context, fw['id'], service_constants.ACTIVE, fw)
return fw
@ -934,6 +938,31 @@ class NvpAdvancedPlugin(sr_db.ServiceRouter_mixin,
self._delete_resource_router_id_binding(
context, id, firewall_db.Firewall)
def get_firewall(self, context, id, fields=None):
fw = super(NvpAdvancedPlugin, self).get_firewall(
context, id, fields)
if fields and rsi.ROUTER_ID not in fields:
return fw
service_router_binding = self._get_resource_router_id_binding(
context, firewall_db.Firewall, resource_id=fw['id'])
fw[rsi.ROUTER_ID] = service_router_binding['router_id']
return fw
def get_firewalls(self, context, filters=None, fields=None):
fws = super(NvpAdvancedPlugin, self).get_firewalls(
context, filters, fields)
if fields and rsi.ROUTER_ID not in fields:
return fws
service_router_bindings = self._get_resource_router_id_bindings(
context, firewall_db.Firewall,
resource_ids=[fw['id'] for fw in fws])
mapping = dict([(binding['resource_id'], binding['router_id'])
for binding in service_router_bindings])
for fw in fws:
fw[rsi.ROUTER_ID] = mapping[fw['id']]
return fws
def update_firewall_rule(self, context, id, firewall_rule):
LOG.debug(_("update_firewall_rule() called"))
self._ensure_update_or_delete_firewall_rule(context, id)
@ -983,7 +1012,8 @@ class NvpAdvancedPlugin(sr_db.ServiceRouter_mixin,
service_router_binding = self._get_resource_router_id_binding(
context, firewall_db.Firewall, resource_id=fw['id'])
self._vcns_update_firewall(
context, fw, service_router_binding.router_id)
context, fw, service_router_binding.router_id,
firewall_rule_list=firewall_rules)
return fwp
def insert_rule(self, context, id, rule_info):
@ -1043,15 +1073,14 @@ class NvpAdvancedPlugin(sr_db.ServiceRouter_mixin,
#
def _get_edge_id_by_vip_id(self, context, vip_id):
try:
router_binding = self._get_resource_router_id_bindings(
context, loadbalancer_db.Vip, resource_ids=[vip_id])[0]
service_router_binding = self._get_resource_router_id_binding(
context, loadbalancer_db.Vip, resource_id=vip_id)
except Exception:
with excutils.save_and_reraise_exception():
LOG.exception(_("Failed to find the edge with "
"vip_id: %s"), vip_id)
service_binding = vcns_db.get_vcns_router_binding(
context.session, router_binding.router_id)
return service_binding.edge_id
return self._get_edge_id_by_vcns_edge_binding(
context, service_router_binding.router_id)
def _get_all_vip_addrs_by_router_id(
self, context, router_id):
@ -1202,6 +1231,7 @@ class NvpAdvancedPlugin(sr_db.ServiceRouter_mixin,
super(NvpAdvancedPlugin, self).delete_vip(context, v['id'])
self._resource_set_status(context, loadbalancer_db.Vip,
v['id'], service_constants.ACTIVE, v)
v[rsi.ROUTER_ID] = router_id
return v
@ -1210,6 +1240,8 @@ class NvpAdvancedPlugin(sr_db.ServiceRouter_mixin,
old_vip = self.get_vip(context, id)
vip['vip']['status'] = service_constants.PENDING_UPDATE
v = super(NvpAdvancedPlugin, self).update_vip(context, id, vip)
v[rsi.ROUTER_ID] = self._get_resource_router_id_binding(
context, loadbalancer_db.Vip, resource_id=id)['router_id']
if old_vip['pool_id'] != v['pool_id']:
self.vcns_driver.delete_vip(context, id)
#Delete old pool/monitor on the edge
@ -1268,6 +1300,30 @@ class NvpAdvancedPlugin(sr_db.ServiceRouter_mixin,
super(NvpAdvancedPlugin, self).delete_vip(context, id)
self._update_interface(context, router, sync=True)
def get_vip(self, context, id, fields=None):
vip = super(NvpAdvancedPlugin, self).get_vip(context, id, fields)
if fields and rsi.ROUTER_ID not in fields:
return vip
service_router_binding = self._get_resource_router_id_binding(
context, loadbalancer_db.Vip, resource_id=vip['id'])
vip[rsi.ROUTER_ID] = service_router_binding['router_id']
return vip
def get_vips(self, context, filters=None, fields=None):
vips = super(NvpAdvancedPlugin, self).get_vips(
context, filters, fields)
if fields and rsi.ROUTER_ID not in fields:
return vips
service_router_bindings = self._get_resource_router_id_bindings(
context, loadbalancer_db.Vip,
resource_ids=[vip['id'] for vip in vips])
mapping = dict([(binding['resource_id'], binding['router_id'])
for binding in service_router_bindings])
for vip in vips:
vip[rsi.ROUTER_ID] = mapping[vip['id']]
return vips
def update_pool(self, context, id, pool):
pool['pool']['status'] = service_constants.PENDING_UPDATE
p = super(NvpAdvancedPlugin, self).update_pool(context, id, pool)

View File

@ -593,7 +593,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
keys.append(('subnet_id', vip['vip']['subnet_id']))
req = self.new_list_request('vips')
res = self.deserialize(self.fmt, req.get_response(self.ext_api))
self.assertEqual(len(res), 1)
self.assertEqual(len(res['vips']), 1)
for k, v in keys:
self.assertEqual(res['vips'][0][k], v)

View File

@ -96,7 +96,6 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
fw_plugin=FW_PLUGIN_CLASS)
self.vcns_firewall_patch()
self.plugin = manager.NeutronManager.get_plugin()
self.router_id = None
def tearDown(self):
super(FirewallPluginTestCase, self).tearDown()
@ -105,10 +104,10 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
self.ext_api = None
self.plugin = None
def _fake_router_edge_mapping(self):
def _create_and_get_router(self):
req = self._create_router(self.fmt, self._tenant_id)
res = self.deserialize(self.fmt, req)
self.router_id = res['router']['id']
return res['router']['id']
def _create_firewall(self, fmt, name, description, firewall_policy_id,
admin_state_up=True, expected_res_status=None,
@ -116,7 +115,7 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
data = {'firewall': {'name': name,
'description': description,
'firewall_policy_id': firewall_policy_id,
'router_id': self.router_id,
'router_id': kwargs.get('router_id'),
'admin_state_up': admin_state_up,
'tenant_id': self._tenant_id}}
@ -128,17 +127,16 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
return firewall_res
def test_create_firewall(self):
self._fake_router_edge_mapping()
name = "new_fw"
attrs = self._get_test_firewall_attrs(name)
with self.firewall_policy() as fwp:
fwp_id = fwp['firewall_policy']['id']
attrs['firewall_policy_id'] = fwp_id
attrs['router_id'] = self._create_and_get_router()
with self.firewall(name=name,
firewall_policy_id=fwp_id,
router_id=self.router_id,
router_id=attrs['router_id'],
admin_state_up=
test_db_firewall.ADMIN_STATE_UP,
expected_res_status=201) as fw:
@ -148,16 +146,15 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
self.assertEqual(fw['firewall'][k], v)
def test_update_firewall(self):
self._fake_router_edge_mapping()
name = "new_fw"
attrs = self._get_test_firewall_attrs(name)
attrs['router_id'] = self._create_and_get_router()
with self.firewall_policy() as fwp:
fwp_id = fwp['firewall_policy']['id']
attrs['firewall_policy_id'] = fwp_id
with self.firewall(
firewall_policy_id=fwp_id, router_id=self.router_id,
firewall_policy_id=fwp_id, router_id=attrs['router_id'],
admin_state_up=test_db_firewall.ADMIN_STATE_UP) as fw:
fw_id = fw['firewall']['id']
new_data = {'firewall': {'name': name}}
@ -173,13 +170,11 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
def test_delete_firewall(self):
ctx = context.get_admin_context()
self._fake_router_edge_mapping()
with self.firewall_policy() as fwp:
fwp_id = fwp['firewall_policy']['id']
with self.firewall(
firewall_policy_id=fwp_id,
router_id=self.router_id,
router_id=self._create_and_get_router(),
admin_state_up=test_db_firewall.ADMIN_STATE_UP,
no_delete=True) as fw:
fw_id = fw['firewall']['id']
@ -191,10 +186,62 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
firewall.FirewallNotFound,
self.plugin.get_firewall, ctx, fw_id)
def test_show_firewall(self):
name = "firewall1"
attrs = self._get_test_firewall_attrs(name)
attrs['router_id'] = self._create_and_get_router()
with self.firewall_policy() as fwp:
fwp_id = fwp['firewall_policy']['id']
attrs['firewall_policy_id'] = fwp_id
with self.firewall(
name=name,
firewall_policy_id=fwp_id, router_id=attrs['router_id'],
admin_state_up=test_db_firewall.ADMIN_STATE_UP) as firewall:
req = self.new_show_request('firewalls',
firewall['firewall']['id'],
fmt=self.fmt)
res = self.deserialize(self.fmt,
req.get_response(self.ext_api))
attrs = self._replace_firewall_status(
attrs, const.PENDING_CREATE, const.ACTIVE)
for k, v in attrs.iteritems():
self.assertEqual(res['firewall'][k], v)
def test_list_firewalls(self):
keys_list = []
for i in range(3):
keys_list.append({'name': "fw" + str(i),
'router_id': self._create_and_get_router(),
'admin_state_up': True,
'status': "ACTIVE"})
with contextlib.nested(
self.firewall(
name='fw0', router_id=keys_list[0]['router_id'],
admin_state_up=True, description='fw'),
self.firewall(
name='fw1', router_id=keys_list[1]['router_id'],
admin_state_up=True, description='fw'),
self.firewall(
name='fw2', router_id=keys_list[2]['router_id'],
admin_state_up=True, description='fw'),
) as (fw1, fw2, fw3):
self._test_list_resources(
'firewall', (fw1, fw2, fw3),
query_params='description=fw')
req = self.new_list_request('firewalls')
res = self.deserialize(
self.fmt, req.get_response(self.ext_api))
self.assertEqual(len(res['firewalls']), 3)
for index in range(len(res['firewalls'])):
for k, v in keys_list[index].items():
self.assertEqual(res['firewalls'][index][k], v)
def test_create_firewall_with_rules(self):
ctx = context.get_admin_context()
self._fake_router_edge_mapping()
with contextlib.nested(self.firewall_rule(name='fwr1'),
self.firewall_rule(name='fwr2'),
self.firewall_rule(name='fwr3')) as fr:
@ -209,7 +256,8 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
attrs = self._get_test_firewall_attrs()
attrs['firewall_policy_id'] = fwp_id
with self.firewall(
firewall_policy_id=fwp_id, router_id=self.router_id,
firewall_policy_id=fwp_id,
router_id=self._create_and_get_router(),
admin_state_up=test_db_firewall.ADMIN_STATE_UP) as fw:
rule_list = (
self.plugin._make_firewall_rule_list_by_policy_id(
@ -232,8 +280,6 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
self.assertEqual(res['firewall_policy'][k], v)
def test_update_firewall_policy_with_firewall(self):
self._fake_router_edge_mapping()
name = "new_firewall_policy1"
attrs = self._get_test_firewall_policy_attrs(name)
@ -242,7 +288,7 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
audited=test_db_firewall.AUDITED) as fwp:
fwp_id = fwp['firewall_policy']['id']
with self.firewall(firewall_policy_id=fwp_id,
router_id=self.router_id,
router_id=self._create_and_get_router(),
admin_state_up=
test_db_firewall.ADMIN_STATE_UP):
data = {'firewall_policy': {'name': name}}
@ -296,8 +342,6 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
self.assertEqual(res['firewall_rule'][k], v)
def test_update_firewall_rule_with_firewall(self):
self._fake_router_edge_mapping()
name = "new_firewall_rule1"
attrs = self._get_test_firewall_rule_attrs(name)
with self.firewall_rule() as fwr:
@ -305,7 +349,7 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
fwp_id = fwp['firewall_policy']['id']
attrs['firewall_policy_id'] = fwp_id
with self.firewall(firewall_policy_id=fwp_id,
router_id=self.router_id,
router_id=self._create_and_get_router(),
admin_state_up=
test_db_firewall.ADMIN_STATE_UP):
fwr_id = fwr['firewall_rule']['id']
@ -399,8 +443,6 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
expected_body=attrs)
def test_insert_rule_with_firewall(self):
self._fake_router_edge_mapping()
attrs = self._get_test_firewall_policy_attrs()
attrs['audited'] = False
attrs['firewall_list'] = []
@ -414,7 +456,7 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
with self.firewall_policy() as fwp:
fwp_id = fwp['firewall_policy']['id']
attrs['id'] = fwp_id
with self.firewall(router_id=self.router_id,
with self.firewall(router_id=self._create_and_get_router(),
firewall_policy_id=fwp_id) as fw:
# test insert when rule list is empty
fwr0_id = fwr[0]['firewall_rule']['id']
@ -517,15 +559,13 @@ class FirewallPluginTestCase(test_db_firewall.FirewallPluginDbTestCase,
expected_body=None)
def test_remove_rule_with_firewall(self):
self._fake_router_edge_mapping()
attrs = self._get_test_firewall_policy_attrs()
attrs['audited'] = False
attrs['firewall_list'] = []
with self.firewall_policy() as fwp:
fwp_id = fwp['firewall_policy']['id']
attrs['id'] = fwp_id
with self.firewall(router_id=self.router_id,
with self.firewall(router_id=self._create_and_get_router(),
firewall_policy_id=fwp_id) as fw:
attrs['firewall_list'].insert(0, fw['firewall']['id'])
with contextlib.nested(self.firewall_rule(name='fwr1'),

View File

@ -103,7 +103,6 @@ class TestLoadbalancerPlugin(
lb_plugin=LBAAS_PLUGIN_CLASS)
self.vcns_loadbalancer_patch()
self.plugin = manager.NeutronManager.get_plugin()
self.router_id = None
def tearDown(self):
super(TestLoadbalancerPlugin, self).tearDown()
@ -112,18 +111,16 @@ class TestLoadbalancerPlugin(
self.ext_api = None
self.plugin = None
def _fake_router_edge_mapping(self):
def _create_and_get_router(self):
req = self._create_router(self.fmt, self._tenant_id)
res = self.deserialize(self.fmt, req)
self.router_id = res['router']['id']
return res['router']['id']
def _get_vip_optional_args(self):
args = super(TestLoadbalancerPlugin, self)._get_vip_optional_args()
return args + ('router_id',)
def test_update_healthmonitor(self):
self._fake_router_edge_mapping()
keys = [('type', "TCP"),
('tenant_id', self._tenant_id),
('delay', 20),
@ -139,8 +136,8 @@ class TestLoadbalancerPlugin(
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)
with self.vip(
router_id=self.router_id, pool=pool,
subnet=subnet):
router_id=self._create_and_get_router(),
pool=pool, subnet=subnet):
self.plugin.create_pool_health_monitor(
context.get_admin_context(),
health_mon, pool['pool']['id']
@ -160,7 +157,6 @@ class TestLoadbalancerPlugin(
def test_delete_healthmonitor(self):
ctx = context.get_admin_context()
self._fake_router_edge_mapping()
with contextlib.nested(
self.subnet(),
self.pool(),
@ -169,8 +165,8 @@ class TestLoadbalancerPlugin(
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)
with self.vip(
router_id=self.router_id, pool=pool,
subnet=subnet):
router_id=self._create_and_get_router(),
pool=pool, subnet=subnet):
self.plugin.create_pool_health_monitor(
context.get_admin_context(),
health_mon, pool['pool']['id']
@ -185,7 +181,6 @@ class TestLoadbalancerPlugin(
self.assertIsNone(qry.first())
def test_create_vip(self, **extras):
self._fake_router_edge_mapping()
expected = {
'name': 'vip1',
'description': '',
@ -193,7 +188,8 @@ class TestLoadbalancerPlugin(
'protocol': 'HTTP',
'connection_limit': -1,
'admin_state_up': True,
'status': 'PENDING_CREATE',
'status': 'ACTIVE',
'router_id': self._create_and_get_router(),
'tenant_id': self._tenant_id,
}
@ -214,11 +210,10 @@ class TestLoadbalancerPlugin(
monitor, pool['pool']['id']
)
with self.vip(
router_id=self.router_id, name=name,
router_id=expected['router_id'], name=name,
pool=pool, subnet=subnet, **extras) as vip:
for k in ('id', 'address', 'port_id', 'pool_id'):
self.assertTrue(vip['vip'].get(k, None))
expected['status'] = 'ACTIVE'
self.assertEqual(
dict((k, v)
for k, v in vip['vip'].items() if k in expected),
@ -226,9 +221,10 @@ class TestLoadbalancerPlugin(
)
def test_update_vip(self):
self._fake_router_edge_mapping()
name = 'new_vip'
keys = [('name', name),
router_id = self._create_and_get_router()
keys = [('router_id', router_id),
('name', name),
('address', "10.0.0.2"),
('protocol_port', 80),
('connection_limit', 100),
@ -247,7 +243,7 @@ class TestLoadbalancerPlugin(
monitor, pool['pool']['id']
)
with self.vip(
router_id=self.router_id, name=name,
router_id=router_id, name=name,
pool=pool, subnet=subnet) as vip:
keys.append(('subnet_id', vip['vip']['subnet_id']))
data = {'vip': {'name': name,
@ -264,7 +260,6 @@ class TestLoadbalancerPlugin(
self.assertEqual(res['vip'][k], v)
def test_delete_vip(self):
self._fake_router_edge_mapping()
with contextlib.nested(
self.subnet(),
self.pool(),
@ -277,15 +272,83 @@ class TestLoadbalancerPlugin(
monitor, pool['pool']['id']
)
with self.vip(
router_id=self.router_id,
router_id=self._create_and_get_router(),
pool=pool, subnet=subnet, no_delete=True) as vip:
req = self.new_delete_request('vips',
vip['vip']['id'])
res = req.get_response(self.ext_api)
self.assertEqual(res.status_int, 204)
def test_show_vip(self):
router_id = self._create_and_get_router()
name = "vip_show"
keys = [('name', name),
('protocol_port', 80),
('protocol', 'HTTP'),
('connection_limit', -1),
('admin_state_up', True),
('status', 'ACTIVE'),
('router_id', router_id)]
with contextlib.nested(
self.subnet(),
self.pool(),
self.health_monitor()
) as (subnet, pool, monitor):
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)
self.plugin.create_pool_health_monitor(
context.get_admin_context(),
monitor, pool['pool']['id']
)
with self.vip(
router_id=router_id, name=name,
pool=pool, subnet=subnet) as vip:
req = self.new_show_request('vips',
vip['vip']['id'])
res = self.deserialize(
self.fmt, req.get_response(self.ext_api))
for k, v in keys:
self.assertEqual(res['vip'][k], v)
def test_list_vips(self):
keys_list = []
for i in range(3):
keys_list.append({'name': "vip" + str(i),
'router_id': self._create_and_get_router(),
'protocol_port': 80 + i,
'protocol': "HTTP",
'status': "ACTIVE",
'admin_state_up': True})
with self.subnet() as subnet:
net_id = subnet['subnet']['network_id']
self._set_net_external(net_id)
with contextlib.nested(
self.vip(
router_id=keys_list[0]['router_id'], name='vip0',
subnet=subnet, protocol_port=80),
self.vip(
router_id=keys_list[1]['router_id'], name='vip1',
subnet=subnet, protocol_port=81),
self.vip(
router_id=keys_list[2]['router_id'], name='vip2',
subnet=subnet, protocol_port=82),
) as (vip1, vip2, vip3):
self._test_list_with_sort(
'vip',
(vip1, vip3, vip2),
[('protocol_port', 'asc'), ('name', 'desc')]
)
req = self.new_list_request('vips')
res = self.deserialize(
self.fmt, req.get_response(self.ext_api))
self.assertEqual(len(res['vips']), 3)
for index in range(len(res['vips'])):
for k, v in keys_list[index].items():
self.assertEqual(res['vips'][index][k], v)
def test_update_pool(self):
self._fake_router_edge_mapping()
data = {'pool': {'name': "new_pool",
'admin_state_up': False}}
with contextlib.nested(
@ -300,7 +363,7 @@ class TestLoadbalancerPlugin(
monitor, pool['pool']['id']
)
with self.vip(
router_id=self.router_id,
router_id=self._create_and_get_router(),
pool=pool, subnet=subnet):
req = self.new_update_request(
'pools', data, pool['pool']['id'])
@ -310,8 +373,7 @@ class TestLoadbalancerPlugin(
self.assertEqual(res['pool'][k], v)
def test_create_member(self):
self._fake_router_edge_mapping()
router_id = self._create_and_get_router()
with contextlib.nested(
self.subnet(),
self.pool(),
@ -325,13 +387,13 @@ class TestLoadbalancerPlugin(
monitor, pool['pool']['id']
)
with self.vip(
router_id=self.router_id,
router_id=router_id,
pool=pool, subnet=subnet):
with contextlib.nested(
self.member(address='192.168.1.100',
protocol_port=80,
pool_id=pool_id),
self.member(router_id=self.router_id,
self.member(router_id=router_id,
address='192.168.1.101',
protocol_port=80,
pool_id=pool_id)) as (member1, member2):
@ -354,7 +416,6 @@ class TestLoadbalancerPlugin(
return self.deserialize(self.fmt, res)
def test_update_member(self):
self._fake_router_edge_mapping()
with contextlib.nested(
self.subnet(),
self.pool(name="pool1"),
@ -372,7 +433,7 @@ class TestLoadbalancerPlugin(
monitor, pool2['pool']['id']
)
with self.vip(
router_id=self.router_id,
router_id=self._create_and_get_router(),
pool=pool1, subnet=subnet):
keys = [('address', "192.168.1.100"),
('tenant_id', self._tenant_id),
@ -407,7 +468,6 @@ class TestLoadbalancerPlugin(
self.assertFalse(pool1_update['pool']['members'])
def test_delete_member(self):
self._fake_router_edge_mapping()
with contextlib.nested(
self.subnet(),
self.pool(),
@ -421,7 +481,7 @@ class TestLoadbalancerPlugin(
monitor, pool['pool']['id']
)
with self.vip(
router_id=self.router_id,
router_id=self._create_and_get_router(),
pool=pool, subnet=subnet):
with self.member(pool_id=pool_id,
no_delete=True) as member: