Hi, I am trying out the python idl library to write scripts to talk to the ovsdb-server but I can figure out why the idl database is not being loaded. My setup consists fo the following.
Started the ovsdb-server and switch as $ sudo ovsdb-server /usr/local/etc/openvswitch/conf.db --remote=punix:/usr/local/var/run/openvswitch/db.sock --log-file=/tmp/vswitch.log --pidfile --detach $ sudo ovs-vswitchd --pidfile --detach This stated the ovsdb-server and listening on port 39779. Confirmed that they are both running using $ ps aux | grep ovs ali 9464 0.0 0.1 54772 6320 pts/13 S+ 11:48 0:01 vim test-ovsdb.py root 9817 0.0 0.0 12824 1396 ? Ss 12:12 0:00 ovsdb-server /usr/local/etc/openvswitch/conf.db -v --remote=punix:/usr/local/var/run/openvswitch/db.sock --pidfile --detach --log-file --remote=ptcp:0:127.0.0.1 root 9849 0.0 0.1 234908 4148 ? Ssl 12:14 0:04 ovs-vswitchd --pidfile --detach ali 11894 0.0 0.0 15940 920 pts/14 S+ 14:30 0:00 grep --color=auto ovs I was hoping idl to load the database on the first idl.run() call but it doesn't seem like it is. The tables are always empty although the current set up is as shown below (tornado)ali@ali-virtual-machine:ovstests$ sudo ovs-vsctl show [sudo] password for ali: e5fee773-c92d-44b9-92f3-98335d4fee6e Bridge "br3" Port "br3" Interface "br3" type: internal Bridge "br4" Port "br4" Interface "br4" type: internal Bridge "br2" Port "br2" Interface "br2" type: internal Bridge "br1" Port "br1" Interface "br1" type: internal My test script looks as shown below. Can someone tell me what is it that I am doing wrong? import ovs.db.idl import ovs.db.schema import ovs.poller import time # tried all the three options for 'remote' remote = 'punix:/usr/local/var/run/openvswitch/db.sock' #remote = 'ptcp:127.0.0.1:39779' #remote = 'ptcp:127.0.0.1' schema_file = '/home/ali/Documents/Projects/OVS/openvswitch-2.3.1/vswitchd/vswitch.ovsschema' schema_helper = ovs.db.idl.SchemaHelper(schema_file) schema_helper.register_columns("Bridge", ["name",]) idl = ovs.db.idl.Idl(remote, schema_helper) seqno = 0 print idl.run() print idl.tables['Bridge'].to_json() #for row in idl.tables["Bridge"].rows.itervalues(): # print type(row.to_json()) for key, value in idl.tables.items(): print (key, value) while True: state = idl.run() change_seqno = idl.change_seqno print "change_seqno: " + str(change_seqno) + "state: " + str(state) poller = ovs.poller.Poller() idl.wait(poller) poller.block() Thanks Mir
_______________________________________________ discuss mailing list discuss@openvswitch.org http://openvswitch.org/mailman/listinfo/discuss