Allow virtual tunnel ports to also have virtual sources
In some cases, tunneling applications will also want to specify the source IP of the tunnel. This is in case the tunneling network is different than the main network, as specified by local_ip. Change-Id: I39b0cc0bdfee7a1a13f8e0e9625e210ff83f6d9a
This commit is contained in:
parent
1b5efe44f4
commit
cae4efc1d9
|
@ -56,11 +56,14 @@ class GetBridgePorts(commands.BaseCommand):
|
|||
|
||||
|
||||
class AddVirtualTunnelPort(commands.BaseCommand):
|
||||
def __init__(self, api, tunnel_type):
|
||||
def __init__(self, api, tunnel_type, local_ip=None):
|
||||
super(AddVirtualTunnelPort, self).__init__(api)
|
||||
self.tunnel_type = tunnel_type
|
||||
self.integration_bridge = cfg.CONF.df.integration_bridge
|
||||
self.port = tunnel_type + "-vtp"
|
||||
self.local_ip = local_ip
|
||||
if local_ip is None:
|
||||
self.local_ip = cfg.CONF.df.local_ip
|
||||
|
||||
def run_idl(self, txn):
|
||||
port = idlutils.row_by_value(self.api.idl, 'Port', 'name',
|
||||
|
@ -85,7 +88,7 @@ class AddVirtualTunnelPort(commands.BaseCommand):
|
|||
options_dict = getattr(iface, 'options', {})
|
||||
options_dict['remote_ip'] = 'flow'
|
||||
options_dict['key'] = 'flow'
|
||||
options_dict['local_ip'] = cfg.CONF.df.local_ip
|
||||
options_dict['local_ip'] = self.local_ip
|
||||
iface.options = options_dict
|
||||
port.verify('interfaces')
|
||||
ifaces = getattr(port, 'interfaces', [])
|
||||
|
|
|
@ -203,8 +203,8 @@ class DFOvsdbApi(impl_idl.OvsdbIdl):
|
|||
def add_patch_port(self, bridge, port, peer_port):
|
||||
return commands.AddPatchPort(self, bridge, port, peer_port)
|
||||
|
||||
def add_virtual_tunnel_port(self, tunnel_type):
|
||||
return commands.AddVirtualTunnelPort(self, tunnel_type)
|
||||
def add_virtual_tunnel_port(self, tunnel_type, local_ip=None):
|
||||
return commands.AddVirtualTunnelPort(self, tunnel_type, local_ip)
|
||||
|
||||
def create_qos(self, port_id, qos):
|
||||
return commands.CreateQos(self, port_id, qos)
|
||||
|
|
|
@ -111,8 +111,8 @@ class OvsApi(object):
|
|||
|
||||
return tunnel_ports
|
||||
|
||||
def add_virtual_tunnel_port(self, tunnel_type):
|
||||
self.ovsdb.add_virtual_tunnel_port(tunnel_type).execute()
|
||||
def add_virtual_tunnel_port(self, tunnel_type, local_ip=None):
|
||||
self.ovsdb.add_virtual_tunnel_port(tunnel_type, local_ip).execute()
|
||||
|
||||
def delete_port(self, switch_port):
|
||||
self.ovsdb.del_port(switch_port.name,
|
||||
|
|
Loading…
Reference in New Issue