summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDingyuan Hu <hdyvip@gmail.com>2017-08-29 22:48:25 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-08-29 22:49:12 +0900
commitbc7451dc7c932ce314abf635b017ed11d041c9e1 (patch)
treec1febb5cb7fe1904546e229e7bc2a289f6ac5a5e
parent7f537c4185dd0ab5da58d00299aa61a6ccf63df3 (diff)
services/ovsdb: Listen on IPv6 Address
This patch enables Ryu to listen ovsdb connections on IPv6 Address. Note that you need to make a config file like belows: [ovsdb] address=:: Signed-off-by: Dingyuan Hu <hdyvip@gmail.com> Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/services/protocols/ovsdb/client.py6
-rw-r--r--ryu/services/protocols/ovsdb/manager.py22
2 files changed, 21 insertions, 7 deletions
diff --git a/ryu/services/protocols/ovsdb/client.py b/ryu/services/protocols/ovsdb/client.py
index 7c939f09..6ea36842 100644
--- a/ryu/services/protocols/ovsdb/client.py
+++ b/ryu/services/protocols/ovsdb/client.py
@@ -300,7 +300,7 @@ class RemoteOvsdb(app_manager.RyuApp):
schema_exclude_columns)
fsm = reconnect.Reconnect(now())
- fsm.set_name('%s:%s' % address)
+ fsm.set_name('%s:%s' % address[:2])
fsm.enable(now())
fsm.set_passive(True, now())
fsm.set_max_tries(-1)
@@ -390,8 +390,8 @@ class RemoteOvsdb(app_manager.RyuApp):
if proxy_ev_cls:
self.send_event_to_observers(proxy_ev_cls(ev))
except Exception:
- self.logger.exception('Error submitting specific event for OVSDB',
- self.system_id)
+ self.logger.exception(
+ 'Error submitting specific event for OVSDB %s', self.system_id)
def _idl_loop(self):
while self.is_active:
diff --git a/ryu/services/protocols/ovsdb/manager.py b/ryu/services/protocols/ovsdb/manager.py
index 98225034..eea9c835 100644
--- a/ryu/services/protocols/ovsdb/manager.py
+++ b/ryu/services/protocols/ovsdb/manager.py
@@ -15,6 +15,7 @@
import ssl
import socket
+import netaddr
from ryu import cfg
from ryu.base import app_manager
@@ -91,7 +92,12 @@ class OVSDB(app_manager.RyuApp):
sock.close()
continue
- self.logger.debug('New connection from %s:%s' % client_address)
+ if netaddr.valid_ipv6(client_address[0]):
+ self.logger.debug(
+ 'New connection from [%s]:%s' % client_address[:2])
+ else:
+ self.logger.debug(
+ 'New connection from %s:%s' % client_address[:2])
t = hub.spawn(self._start_remote, sock, client_address)
self.threads.append(t)
@@ -158,7 +164,11 @@ class OVSDB(app_manager.RyuApp):
sock.close()
def start(self):
- server = hub.listen((self._address, self._port))
+ if netaddr.valid_ipv6(self._address):
+ server = hub.listen(
+ (self._address, self._port), family=socket.AF_INET6)
+ else:
+ server = hub.listen((self._address, self._port))
key = self.CONF.ovsdb.mngr_privkey or self.CONF.ctl_privkey
cert = self.CONF.ovsdb.mngr_cert or self.CONF.ctl_cert
@@ -173,8 +183,12 @@ class OVSDB(app_manager.RyuApp):
self._server = server
- self.logger.info('Listening on %s:%s for clients' % (self._address,
- self._port))
+ if netaddr.valid_ipv6(self._address):
+ self.logger.info(
+ 'Listening on [%s]:%s for clients', self._address, self._port)
+ else:
+ self.logger.info(
+ 'Listening on %s:%s for clients', self._address, self._port)
t = hub.spawn(self._accept, self._server)
super(OVSDB, self).start()
return t