tunnel ids were specific to the OVS plugin which was removed in Juno.
Change-Id: I369203a23ad4af1d307166aae84aee817572370b
if not self.enable_tunneling:
return
tunnel_ip = kwargs.get('tunnel_ip')
- tunnel_id = kwargs.get('tunnel_id', self.get_ip_in_hex(tunnel_ip))
- if not tunnel_id:
+ tunnel_ip_hex = self.get_ip_in_hex(tunnel_ip)
+ if not tunnel_ip_hex:
return
tunnel_type = kwargs.get('tunnel_type')
if not tunnel_type:
return
if tunnel_ip == self.local_ip:
return
- tun_name = '%s-%s' % (tunnel_type, tunnel_id)
+ tun_name = '%s-%s' % (tunnel_type, tunnel_ip_hex)
if not self.l2_pop:
self._setup_tunnel_port(self.tun_br, tun_name, tunnel_ip,
tunnel_type)
tunnels = details['tunnels']
for tunnel in tunnels:
if self.local_ip != tunnel['ip_address']:
- tunnel_id = tunnel.get('id')
- # Unlike the OVS plugin, ML2 doesn't return an id
- # key. So use ip_address to form port name instead.
- # Port name must be <=15 chars, so use shorter hex.
remote_ip = tunnel['ip_address']
remote_ip_hex = self.get_ip_in_hex(remote_ip)
- if not tunnel_id and not remote_ip_hex:
+ if not remote_ip_hex:
continue
- tun_name = '%s-%s' % (tunnel_type,
- tunnel_id or remote_ip_hex)
+ tun_name = '%s-%s' % (tunnel_type, remote_ip_hex)
self._setup_tunnel_port(self.tun_br,
tun_name,
tunnel['ip_address'],
{'type': p_const.TYPE_GRE, 'ip': 'remote_ip'})
self.assertEqual(ofport, 0)
- def test_tunnel_sync_with_ovs_plugin(self):
- fake_tunnel_details = {'tunnels': [{'id': '42',
- 'ip_address': '100.101.102.103'}]}
- with contextlib.nested(
- mock.patch.object(self.agent.plugin_rpc, 'tunnel_sync',
- return_value=fake_tunnel_details),
- mock.patch.object(self.agent, '_setup_tunnel_port')
- ) as (tunnel_sync_rpc_fn, _setup_tunnel_port_fn):
- self.agent.tunnel_types = ['gre']
- self.agent.tunnel_sync()
- expected_calls = [mock.call(self.agent.tun_br, 'gre-42',
- '100.101.102.103', 'gre')]
- _setup_tunnel_port_fn.assert_has_calls(expected_calls)
-
def test_tunnel_sync_with_ml2_plugin(self):
fake_tunnel_details = {'tunnels': [{'ip_address': '100.101.31.15'}]}
with contextlib.nested(
tunnel_port = '9999'
self.mock_tun_bridge.add_tunnel_port.return_value = tunnel_port
self.mock_tun_bridge_expected += [
- mock.call.add_tunnel_port('gre-1', '10.0.10.1', '10.0.0.1',
+ mock.call.add_tunnel_port('gre-0a000a01', '10.0.10.1', '10.0.0.1',
'gre', 4789, True),
mock.call.add_flow(priority=1, in_port=tunnel_port,
actions='resubmit(,3)')
a = self._build_agent()
a.tunnel_update(
- mock.sentinel.ctx, tunnel_id='1', tunnel_ip='10.0.10.1',
+ mock.sentinel.ctx, tunnel_ip='10.0.10.1',
tunnel_type=p_const.TYPE_GRE)
self._verify_mock_calls()
def test_tunnel_update_self(self):
a = self._build_agent()
a.tunnel_update(
- mock.sentinel.ctx, tunnel_id='1', tunnel_ip='10.0.0.1')
+ mock.sentinel.ctx, tunnel_ip='10.0.0.1')
self._verify_mock_calls()
def test_daemon_loop(self):