Thanks a lot Numan!   I did some research on ovsdbapp and found:  
www.flaviof.com www.flaviof.com  which allowed me to write fully working script.





        Dnia 16 stycznia 2020 17:00 Numan Siddique <num...@ovn.org> 
napisał(a):



         On Thu, Jan 16, 2020 at 6:26 PM mkobus <mko...@o2.pl> wrote:


 Hi MailingList!

 I'm trying to write Python script using OVS library to fetch DB content 
and print all current bridges, ports and interfaces. Following snippet shows 
what I deduced so far from examples found in  mail.openvswitch.org 
mail.openvswitch.org

 ```
 import ovs.db.idl
 import ovs.poller

 SCHEMA_PATH = "/usr/share/openvswitch/vswitc
 SOCKET_PATH = 'punix:/run/openvswitch/db.soc

 schema_helper = ovs.db.idl.SchemaHelper(SCHEMA

 schema_helper.register_columns
     "Bridge", ["name", "ports"]
 )
 schema_helper.register_columns
     "Port", ["name", "interfaces"]
 )
 schema_helper.register_columns
     "Interface", []
 )

 idl = ovs.db.idl.Idl(SOCKET_PATH, schema_helper)

 while not idl.run():
     poller = ovs.poller.Poller()
     print('Seqno value {}'.format(idl.change_seqno))
     idl.wait(poller)
     poller.block()
 ```

 As I understand idl.run() should return `True` after DB content was fetched. 
In my case this loop is infinite - seqno doesn't change. There is no error 
though.

 I checked listing OVS resources using cli for version:


 Seems to me you are doing something wrong.

 You can refer this file
 github.com github.com
 which tests the OVS python idl code.

 There is this ovsdbapp python library which internally uses the ovs
 python idl if you are interested to look into -
 github.com github.com

 Thanks
 Numan



 ovs-vsctl (Open vSwitch) 2.9.5
 DB Schema 7.15.1

 and those commands worked perfectly fine.

 Has anyone encountered similar issue?

 Regards,
 MK
 ______________________________
 discuss mailing list
  disc...@openvswitch.org
 mail.openvswitch.org mail.openvswitch.org
_______________________________________________
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

Reply via email to