service/ovsdb: Add properties to EventNewOVSDBConnection

Currently, EventNewOVSDBConnection only has system_id.
This patch let the class has RemoteOvsdb to get more
informations through it.

e.g.)
    @set_ev_cls(ovsdb_event.EventNewOVSDBConnection)
    def handle_new_ovsdb_connection(self, ev):
        system_id = ev.system_id
        remote_addr = ev.client.address

Signed-off-by: Satoshi Fujimoto <satoshi.fujimoto7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Satoshi Fujimoto 2017-06-16 11:45:43 +09:00 committed by FUJITA Tomonori
parent 2edfb20884
commit cf667e4097
2 changed files with 8 additions and 4 deletions

View File

@ -119,13 +119,17 @@ class EventModifyReply(ryu_event.EventReplyBase):
class EventNewOVSDBConnection(ryu_event.EventBase):
def __init__(self, system_id):
def __init__(self, client):
super(EventNewOVSDBConnection, self).__init__()
self.system_id = system_id
self.client = client
def __str__(self):
return '%s<system_id=%s>' % (self.__class__.__name__,
self.system_id)
self.client.system_id)
@property
def system_id(self):
return self.client.system_id
class EventReadRequest(ryu_event.EventRequestBase):

View File

@ -146,7 +146,7 @@ class OVSDB(app_manager.RyuApp):
if app:
self._clients[app.name] = app
app.start()
ev = event.EventNewOVSDBConnection(app.system_id)
ev = event.EventNewOVSDBConnection(app)
self.send_event_to_observers(ev)
else: