From 8627c280707a3dfab5c79f5362ceacbb3cbca781 Mon Sep 17 00:00:00 2001 From: IWASE Yusuke Date: Mon, 26 Sep 2016 09:28:38 +0900 Subject: ovs/bridge: Make local_ip to optional field for tunnel To create GRE tunnel, the local_ip field is not mandatory field. This patch makes the local_ip field to optional for the convenience. Signed-off-by: IWASE Yusuke Signed-off-by: FUJITA Tomonori --- ryu/lib/ovs/bridge.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ryu/lib/ovs/bridge.py b/ryu/lib/ovs/bridge.py index 02b9acb3..05535ef2 100644 --- a/ryu/lib/ovs/bridge.py +++ b/ryu/lib/ovs/bridge.py @@ -173,11 +173,13 @@ class OVSBridge(object): self.run_command([command]) return command.result - def add_tunnel_port(self, name, tunnel_type, local_ip, remote_ip, - key=None): - options = 'local_ip=%(local_ip)s,remote_ip=%(remote_ip)s' % locals() + def add_tunnel_port(self, name, tunnel_type, remote_ip, + local_ip=None, key=None): + options = 'remote_ip=%(remote_ip)s' % locals() if key: options += ',key=%(key)s' % locals() + if local_ip: + options += ',local_ip=%(local_ip)s' % locals() command_add = ovs_vsctl.VSCtlCommand('add-port', (self.br_name, name)) command_set = ovs_vsctl.VSCtlCommand( @@ -185,8 +187,9 @@ class OVSBridge(object): 'type=%s' % tunnel_type, 'options=%s' % options)) self.run_command([command_add, command_set]) - def add_gre_port(self, name, local_ip, remote_ip, key=None): - self.add_tunnel_port(name, 'gre', local_ip, remote_ip, key=key) + def add_gre_port(self, name, remote_ip, local_ip=None, key=None): + self.add_tunnel_port(name, 'gre', remote_ip, + local_ip=local_ip, key=key) def del_port(self, port_name): command = ovs_vsctl.VSCtlCommand('del-port', (self.br_name, port_name)) -- cgit v1.2.3