diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2016-09-26 09:28:38 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-10-01 21:13:27 +0900 |
commit | 8627c280707a3dfab5c79f5362ceacbb3cbca781 (patch) | |
tree | 7b033fa9466b8f404444b6da3470f1061fdb6548 | |
parent | 3d815d34553362466ac01d0bb791b5707396e449 (diff) |
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 <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/ovs/bridge.py | 13 |
1 files 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)) |