Hi, Hu

Then, you need to know the ip address of the interface which connects to ovs?
If so, how about to let RemoteOvsdb have the socket object?

--- a/ryu/services/protocols/ovsdb/client.py
+++ b/ryu/services/protocols/ovsdb/client.py
@@ -332,6 +332,7 @@ class RemoteOvsdb(app_manager.RyuApp):
         fsm.set_name(name)

         kwargs = kwargs.copy()
+        kwargs['socket'] = sock
         kwargs['address'] = address
         kwargs['idl'] = idl
         kwargs['name'] = name
@@ -358,6 +359,7 @@ class RemoteOvsdb(app_manager.RyuApp):

     def __init__(self, *args, **kwargs):
         super(RemoteOvsdb, self).__init__(*args, **kwargs)
+        self.socket = kwargs['socket']
         self.address = kwargs['address']
         self._idl = kwargs['idl']
         self.system_id = kwargs['system_id']

Then you can get the socket's ip address like this:

    @set_ev_cls(ovsdb_event.EventNewOVSDBConnection)
    def handle_new_ovsdb_connection(self, ev):
print(ev.client.socket.getsockname()[0]) # print socket's ip address


Thanks,
Fujimoto

On 2017年06月23日 11:26, Hu Dingyuan wrote:

Hi Fujimoto,

It’s impossible to config ovsdb to listen on several ip addresses.

If controller has multiple interfaces, self.CONF.ovsdb.addressshould be 0.0.0.0 .

In my case, self.CONF.ovsdb.addressshould be :: . (After apply patch `IPv6 support for ovsdb`)

And listen on :: can make ovsdb handle both IPv4and IPv6 connections. (through IPv4-mapped address, https://tools.ietf.org/html/rfc3493#section-3.6 )

Fortunately , I just need to need the IP version of local ip address instead of local ip itself.

*From: *Fujimoto Satoshi <satoshi.fujimo...@gmail.com>
*Reply-To: *"ryu-devel@lists.sourceforge.net" <ryu-devel@lists.sourceforge.net>
*Date: *Friday, 23 June 2017 at 09:59
*To: *Dingyuan <h...@outlook.com>, "ryu-devel@lists.sourceforge.net" <ryu-devel@lists.sourceforge.net> *Subject: *Re: [Ryu-devel] [feature request] get ovs information from ovsdb protocol

Hi, Hu

Umm, I think ryu cannot get the local ip address.
Instead of it, how about configuring the ovsdb manager ip address?

You can configure the ovsdb manager ip address through the config file:
https://github.com/osrg/ryu/blob/master/ryu/services/protocols/ovsdb/manager.py#L27

And you can get the address like this:
@set_ev_cls(ovsdb_event.EventNewOVSDBConnection)
            def handle_new_ovsdb_connection(self, ev):
                print(self.CONF.ovsdb.address)
So you can configure your bridges with this address.


Thanks,
Fujimoto

On 2017年06月22日 18:32, Hu Dingyuan wrote:

    Thanks Fujimoto.

    Now I can get ovs ip address!

    It is possible to get the local ip address?

    In some case, controller ( ryu ) has multiple ips. (e.g. each
    interface can have multiple IPv6 addresses.)

    If someone need to set controller (same ip as manager) for
    bridges, it’s necessary to know the ovsdb manager ip address.

    *From: *Fujimoto Satoshi <satoshi.fujimo...@gmail.com>
    <mailto:satoshi.fujimo...@gmail.com>
    *Reply-To: *"ryu-devel@lists.sourceforge.net"
    <mailto:ryu-devel@lists.sourceforge.net>
    <ryu-devel@lists.sourceforge.net>
    <mailto:ryu-devel@lists.sourceforge.net>
    *Date: *Friday, 16 June 2017 at 12:00
    *To: *Dingyuan <h...@outlook.com> <mailto:h...@outlook.com>,
    "ryu-devel@lists.sourceforge.net"
    <mailto:ryu-devel@lists.sourceforge.net>
    <ryu-devel@lists.sourceforge.net>
    <mailto:ryu-devel@lists.sourceforge.net>
    *Subject: *Re: [Ryu-devel] [feature request] get ovs information
    from ovsdb protocol

    Hi, Hu

    I've just submitted the patch which enables to get more
    informations from EventNewOVSDBConnection.
    (Subject:  [PATCH 1/5] service/ovsdb: Add properties to
    EventNewOVSDBConnection)
    Could you review my patch?

    ---
     ryu/services/protocols/ovsdb/event.py | 10 +++++++---
     ryu/services/protocols/ovsdb/manager.py |  2 +-
     2 files changed, 8 insertions(+), 4 deletions(-)

    diff --git a/ryu/services/protocols/ovsdb/event.py
    b/ryu/services/protocols/ovsdb/event.py
    index 486e5c7..f162b52 100644
    --- a/ryu/services/protocols/ovsdb/event.py
    +++ b/ryu/services/protocols/ovsdb/event.py
    @@ -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):
    diff --git a/ryu/services/protocols/ovsdb/manager.py
    b/ryu/services/protocols/ovsdb/manager.py
    index 86a2d1f..9822503 100644
    --- a/ryu/services/protocols/ovsdb/manager.py
    +++ b/ryu/services/protocols/ovsdb/manager.py
    @@ -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:
--
    Thanks,
    Fujimoto

    On 2017年06月14日 16:30, Hu Dingyuan wrote:

        Hi Fujimoto,

        I just want to get the ip address of ovsdb.

        I think RemoteOvsdb has enough information and these
        information should be available for app developer though
        EventNewOVSDBConnection and other events.

        *From: *Fujimoto Satoshi <satoshi.fujimo...@gmail.com>
        <mailto:satoshi.fujimo...@gmail.com>
        *Reply-To: *"ryu-devel@lists.sourceforge.net"
        <mailto:ryu-devel@lists.sourceforge.net>
        <ryu-devel@lists.sourceforge.net>
        <mailto:ryu-devel@lists.sourceforge.net>
        *Date: *Wednesday, 14 June 2017 at 15:16
        *To: *Dingyuan <h...@outlook.com> <mailto:h...@outlook.com>,
        "ryu-devel@lists.sourceforge.net"
        <mailto:ryu-devel@lists.sourceforge.net>
        <ryu-devel@lists.sourceforge.net>
        <mailto:ryu-devel@lists.sourceforge.net>
        *Subject: *Re: [Ryu-devel] [feature request] get ovs
        information from ovsdb protocol

        Hello, Hu

        Could you tell me what informations you want to get?
        For example, informations which RemoteOvsdb has are enough for
        you?
        
https://github.com/osrg/ryu/blob/master/ryu/services/protocols/ovsdb/manager.py#L139-L144

        Thanks,
        Fujimoto

        On 2017年06月14日 13:03, Hu Dingyuan wrote:

            Hi,

            When I use OpenFlow protocol, I can get bridge ip address
            though `ev.msg.datapath.address[0]`.

            But when I try to use OVSDB protocol, I can only get
            `system_id` from `ev`.

            Can someone help me to get more information from
            `ovsdb_event.EventNewOVSDBConnection`?






            
------------------------------------------------------------------------------

            Check out the vibrant tech community on one of the world's most

            engaging tech sites, Slashdot.org!http://sdm.link/slashdot






            _______________________________________________

            Ryu-devel mailing list

            Ryu-devel@lists.sourceforge.net
            <mailto:Ryu-devel@lists.sourceforge.net>

            https://lists.sourceforge.net/lists/listinfo/ryu-devel









        
------------------------------------------------------------------------------

        Check out the vibrant tech community on one of the world's most

        engaging tech sites, Slashdot.org!http://sdm.link/slashdot





        _______________________________________________

        Ryu-devel mailing list

        Ryu-devel@lists.sourceforge.net
        <mailto:Ryu-devel@lists.sourceforge.net>

        https://lists.sourceforge.net/lists/listinfo/ryu-devel







------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to