|
|
|
@ -2442,29 +2442,33 @@ class TestOvsDvrNeutronAgent(object):
|
|
|
|
|
return resp
|
|
|
|
|
|
|
|
|
|
def _expected_install_dvr_process(self, lvid, port, ip_version,
|
|
|
|
|
gateway_ip, gateway_mac):
|
|
|
|
|
if ip_version == 4:
|
|
|
|
|
ipvx_calls = [
|
|
|
|
|
mock.call.install_dvr_process_ipv4(
|
|
|
|
|
gateway_ip, gateway_mac, shared=False):
|
|
|
|
|
if not shared:
|
|
|
|
|
if ip_version == 4:
|
|
|
|
|
ipvx_calls = [
|
|
|
|
|
mock.call.install_dvr_process_ipv4(
|
|
|
|
|
vlan_tag=lvid,
|
|
|
|
|
gateway_ip=gateway_ip),
|
|
|
|
|
]
|
|
|
|
|
else:
|
|
|
|
|
ipvx_calls = [
|
|
|
|
|
mock.call.install_dvr_process_ipv6(
|
|
|
|
|
vlan_tag=lvid,
|
|
|
|
|
gateway_mac=gateway_mac),
|
|
|
|
|
]
|
|
|
|
|
return ipvx_calls + [
|
|
|
|
|
mock.call.install_dvr_process(
|
|
|
|
|
vlan_tag=lvid,
|
|
|
|
|
gateway_ip=gateway_ip),
|
|
|
|
|
dvr_mac_address=self.agent.dvr_agent.dvr_mac_address,
|
|
|
|
|
vif_mac=port.vif_mac,
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
else:
|
|
|
|
|
ipvx_calls = [
|
|
|
|
|
mock.call.install_dvr_process_ipv6(
|
|
|
|
|
vlan_tag=lvid,
|
|
|
|
|
gateway_mac=gateway_mac),
|
|
|
|
|
]
|
|
|
|
|
return ipvx_calls + [
|
|
|
|
|
mock.call.install_dvr_process(
|
|
|
|
|
vlan_tag=lvid,
|
|
|
|
|
dvr_mac_address=self.agent.dvr_agent.dvr_mac_address,
|
|
|
|
|
vif_mac=port.vif_mac,
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
return []
|
|
|
|
|
|
|
|
|
|
def _test_port_bound_for_dvr_on_vlan_network(self, device_owner,
|
|
|
|
|
ip_version=4):
|
|
|
|
|
ip_version=4,
|
|
|
|
|
shared=False):
|
|
|
|
|
self._setup_for_dvr_test()
|
|
|
|
|
if ip_version == 4:
|
|
|
|
|
gateway_ip = '1.1.1.1'
|
|
|
|
@ -2487,7 +2491,12 @@ class TestOvsDvrNeutronAgent(object):
|
|
|
|
|
return_value={'gateway_ip': gateway_ip,
|
|
|
|
|
'cidr': cidr,
|
|
|
|
|
'ip_version': ip_version,
|
|
|
|
|
'gateway_mac': gateway_mac}),\
|
|
|
|
|
'gateway_mac': gateway_mac,
|
|
|
|
|
'network_id': 'fake-id'}),\
|
|
|
|
|
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
|
|
|
|
'get_network_info_for_id',
|
|
|
|
|
return_value=[{'shared': shared,
|
|
|
|
|
'router:external': False}]),\
|
|
|
|
|
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
|
|
|
|
'get_ports_on_host_by_subnet',
|
|
|
|
|
return_value=[]),\
|
|
|
|
@ -2521,7 +2530,8 @@ class TestOvsDvrNeutronAgent(object):
|
|
|
|
|
lvid=lvid,
|
|
|
|
|
ip_version=ip_version,
|
|
|
|
|
gateway_ip=gateway_ip,
|
|
|
|
|
gateway_mac=gateway_mac)
|
|
|
|
|
gateway_mac=gateway_mac,
|
|
|
|
|
shared=shared)
|
|
|
|
|
expected_on_int_br = [
|
|
|
|
|
mock.call.provision_local_vlan(
|
|
|
|
|
port=int_ofp,
|
|
|
|
@ -2554,7 +2564,8 @@ class TestOvsDvrNeutronAgent(object):
|
|
|
|
|
self.assertFalse([], phys_br.mock_calls)
|
|
|
|
|
|
|
|
|
|
def _test_port_bound_for_dvr_on_vxlan_network(self, device_owner,
|
|
|
|
|
ip_version=4):
|
|
|
|
|
ip_version=4,
|
|
|
|
|
shared=False):
|
|
|
|
|
self._setup_for_dvr_test()
|
|
|
|
|
if ip_version == 4:
|
|
|
|
|
gateway_ip = '1.1.1.1'
|
|
|
|
@ -2577,7 +2588,12 @@ class TestOvsDvrNeutronAgent(object):
|
|
|
|
|
return_value={'gateway_ip': gateway_ip,
|
|
|
|
|
'cidr': cidr,
|
|
|
|
|
'ip_version': ip_version,
|
|
|
|
|
'gateway_mac': gateway_mac}),\
|
|
|
|
|
'gateway_mac': gateway_mac,
|
|
|
|
|
'network_id': 'fake-id'}),\
|
|
|
|
|
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
|
|
|
|
'get_network_info_for_id',
|
|
|
|
|
return_value=[{'shared': shared,
|
|
|
|
|
'router:external': False}]),\
|
|
|
|
|
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
|
|
|
|
'get_ports_on_host_by_subnet',
|
|
|
|
|
return_value=[]),\
|
|
|
|
@ -2610,7 +2626,8 @@ class TestOvsDvrNeutronAgent(object):
|
|
|
|
|
lvid=lvid,
|
|
|
|
|
ip_version=ip_version,
|
|
|
|
|
gateway_ip=gateway_ip,
|
|
|
|
|
gateway_mac=gateway_mac)
|
|
|
|
|
gateway_mac=gateway_mac,
|
|
|
|
|
shared=shared)
|
|
|
|
|
self.assertEqual(expected_on_int_br, int_br.mock_calls)
|
|
|
|
|
self.assertEqual(expected_on_tun_br, tun_br.mock_calls)
|
|
|
|
|
self.assertEqual([], phys_br.mock_calls)
|
|
|
|
@ -2645,6 +2662,16 @@ class TestOvsDvrNeutronAgent(object):
|
|
|
|
|
self._test_port_bound_for_dvr_on_vxlan_network(
|
|
|
|
|
device_owner=DEVICE_OWNER_COMPUTE, ip_version=6)
|
|
|
|
|
|
|
|
|
|
def test_port_bound_for_dvr_with_compute_ports_on_shared_network(self):
|
|
|
|
|
self._test_port_bound_for_dvr_on_vlan_network(
|
|
|
|
|
device_owner=DEVICE_OWNER_COMPUTE, shared=True)
|
|
|
|
|
self._test_port_bound_for_dvr_on_vlan_network(
|
|
|
|
|
device_owner=DEVICE_OWNER_COMPUTE, ip_version=6, shared=True)
|
|
|
|
|
self._test_port_bound_for_dvr_on_vxlan_network(
|
|
|
|
|
device_owner=DEVICE_OWNER_COMPUTE, shared=True)
|
|
|
|
|
self._test_port_bound_for_dvr_on_vxlan_network(
|
|
|
|
|
device_owner=DEVICE_OWNER_COMPUTE, ip_version=6, shared=True)
|
|
|
|
|
|
|
|
|
|
def test_port_bound_for_dvr_with_lbaas_vip_ports(self):
|
|
|
|
|
self._test_port_bound_for_dvr_on_vlan_network(
|
|
|
|
|
device_owner=n_const.DEVICE_OWNER_LOADBALANCER)
|
|
|
|
@ -2738,7 +2765,8 @@ class TestOvsDvrNeutronAgent(object):
|
|
|
|
|
return_value={'gateway_ip': '1.1.1.1',
|
|
|
|
|
'cidr': '1.1.1.0/24',
|
|
|
|
|
'ip_version': 4,
|
|
|
|
|
'gateway_mac': 'aa:bb:cc:11:22:33'}),\
|
|
|
|
|
'gateway_mac': 'aa:bb:cc:11:22:33',
|
|
|
|
|
'network_id': 'faked-id'}),\
|
|
|
|
|
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
|
|
|
|
'get_ports_on_host_by_subnet',
|
|
|
|
|
return_value=[]),\
|
|
|
|
@ -2802,7 +2830,12 @@ class TestOvsDvrNeutronAgent(object):
|
|
|
|
|
return_value={'gateway_ip': gateway_ip,
|
|
|
|
|
'cidr': cidr,
|
|
|
|
|
'ip_version': ip_version,
|
|
|
|
|
'gateway_mac': gateway_mac}),\
|
|
|
|
|
'gateway_mac': gateway_mac,
|
|
|
|
|
'network_id': 'fake-id'}),\
|
|
|
|
|
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
|
|
|
|
'get_network_info_for_id',
|
|
|
|
|
return_value=[{'shared': False,
|
|
|
|
|
'router:external': False}]),\
|
|
|
|
|
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
|
|
|
|
'get_ports_on_host_by_subnet',
|
|
|
|
|
return_value=[]),\
|
|
|
|
@ -2907,7 +2940,12 @@ class TestOvsDvrNeutronAgent(object):
|
|
|
|
|
return_value={'gateway_ip': gateway_ip,
|
|
|
|
|
'cidr': cidr,
|
|
|
|
|
'ip_version': ip_version,
|
|
|
|
|
'gateway_mac': gateway_mac}),\
|
|
|
|
|
'gateway_mac': gateway_mac,
|
|
|
|
|
'network_id': 'faked-id'}),\
|
|
|
|
|
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
|
|
|
|
'get_network_info_for_id',
|
|
|
|
|
return_value=[{'shared': False,
|
|
|
|
|
'router:external': False}]),\
|
|
|
|
|
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
|
|
|
|
'get_ports_on_host_by_subnet',
|
|
|
|
|
return_value=[]),\
|
|
|
|
@ -3022,7 +3060,12 @@ class TestOvsDvrNeutronAgent(object):
|
|
|
|
|
return_value={'gateway_ip': '1.1.1.1',
|
|
|
|
|
'cidr': '1.1.1.0/24',
|
|
|
|
|
'ip_version': 4,
|
|
|
|
|
'gateway_mac': gateway_mac}),\
|
|
|
|
|
'gateway_mac': gateway_mac,
|
|
|
|
|
'network_id': 'fake-id'}),\
|
|
|
|
|
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
|
|
|
|
'get_network_info_for_id',
|
|
|
|
|
return_value=[{'shared': False,
|
|
|
|
|
'router:external': False}]),\
|
|
|
|
|
mock.patch.object(self.agent.dvr_agent.plugin_rpc,
|
|
|
|
|
'get_ports_on_host_by_subnet',
|
|
|
|
|
return_value=[]),\
|
|
|
|
|