l2pop UT: Simplify migration tests

"port2" is created but not used in the tests.

Change-Id: Ib27d32063a2b5cecc707a6aece4e604cbfecefa7
This commit is contained in:
YAMAMOTO Takashi 2015-02-23 13:23:53 +09:00
parent a6af531339
commit 4791746f41
1 changed files with 66 additions and 88 deletions

View File

@ -800,27 +800,16 @@ class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase):
self._register_ml2_agents() self._register_ml2_agents()
with self.subnet(network=self._network) as subnet: with self.subnet(network=self._network) as subnet:
host_arg = {portbindings.HOST_ID: L2_AGENT['host']} host_arg = {portbindings.HOST_ID: L2_AGENT['host']}
host2_arg = {portbindings.HOST_ID: L2_AGENT_2['host']}
with self.port(subnet=subnet, cidr='10.0.0.0/24', with self.port(subnet=subnet, cidr='10.0.0.0/24',
device_owner=DEVICE_OWNER_COMPUTE, device_owner=DEVICE_OWNER_COMPUTE,
arg_list=(portbindings.HOST_ID,), arg_list=(portbindings.HOST_ID,),
**host_arg) as port1: **host_arg) as port1:
with self.port(subnet=subnet, cidr='10.0.0.0/24',
device_owner=DEVICE_OWNER_COMPUTE,
arg_list=(portbindings.HOST_ID,),
**host2_arg) as port2:
p1 = port1['port'] p1 = port1['port']
device1 = 'tap' + p1['id'] device1 = 'tap' + p1['id']
self.callbacks.update_device_up( self.callbacks.update_device_up(
self.adminContext, self.adminContext,
agent_id=L2_AGENT['host'], agent_id=L2_AGENT['host'],
device=device1) device=device1)
p2 = port2['port']
device2 = 'tap' + p2['id']
self.callbacks.update_device_up(
self.adminContext,
agent_id=L2_AGENT_2['host'],
device=device2)
data2 = {'port': {'binding:host_id': L2_AGENT_2['host']}} data2 = {'port': {'binding:host_id': L2_AGENT_2['host']}}
req = self.new_update_request('ports', data2, p1['id']) req = self.new_update_request('ports', data2, p1['id'])
res = self.deserialize(self.fmt, res = self.deserialize(self.fmt,
@ -851,27 +840,16 @@ class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase):
self._register_ml2_agents() self._register_ml2_agents()
with self.subnet(network=self._network) as subnet: with self.subnet(network=self._network) as subnet:
host_arg = {portbindings.HOST_ID: L2_AGENT['host']} host_arg = {portbindings.HOST_ID: L2_AGENT['host']}
host2_arg = {portbindings.HOST_ID: L2_AGENT_2['host']}
with self.port(subnet=subnet, cidr='10.0.0.0/24', with self.port(subnet=subnet, cidr='10.0.0.0/24',
device_owner=DEVICE_OWNER_COMPUTE, device_owner=DEVICE_OWNER_COMPUTE,
arg_list=(portbindings.HOST_ID,), arg_list=(portbindings.HOST_ID,),
**host_arg) as port1: **host_arg) as port1:
with self.port(subnet=subnet, cidr='10.0.0.0/24',
device_owner=DEVICE_OWNER_COMPUTE,
arg_list=(portbindings.HOST_ID,),
**host2_arg) as port2:
p1 = port1['port'] p1 = port1['port']
device1 = 'tap' + p1['id'] device1 = 'tap' + p1['id']
self.callbacks.update_device_up( self.callbacks.update_device_up(
self.adminContext, self.adminContext,
agent_id=L2_AGENT['host'], agent_id=L2_AGENT['host'],
device=device1) device=device1)
p2 = port2['port']
device2 = 'tap' + p2['id']
self.callbacks.update_device_up(
self.adminContext,
agent_id=L2_AGENT_2['host'],
device=device2)
data2 = {'port': {'binding:host_id': L2_AGENT_2['host']}} data2 = {'port': {'binding:host_id': L2_AGENT_2['host']}}
req = self.new_update_request('ports', data2, p1['id']) req = self.new_update_request('ports', data2, p1['id'])
res = self.deserialize(self.fmt, res = self.deserialize(self.fmt,