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 > https://mail.openvswitch.org/pipermail/ovs-dev/2018-July/349200.html: > > ``` > import ovs.db.idl > import ovs.poller > > SCHEMA_PATH = "/usr/share/openvswitch/vswitch.ovsschema" > SOCKET_PATH = 'punix:/run/openvswitch/db.sock' > > schema_helper = ovs.db.idl.SchemaHelper(SCHEMA_PATH) > > 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 https://github.com/openvswitch/ovs/blob/master/tests/test-ovsdb.py#L648 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 - https://github.com/openstack/ovsdbapp 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 > https://mail.openvswitch.org/mailman/listinfo/ovs-discuss _______________________________________________ discuss mailing list disc...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-discuss