How do you retrieve running config on a vSwitch?

  • 0
  • 2
  • Question
  • Updated 3 years ago
  • Answered
Photo of Khargharia, Bithika

Khargharia, Bithika, Alum

  • 90 Points 75 badge 2x thumb

Posted 3 years ago

  • 0
  • 2
Photo of Khargharia, Bithika

Khargharia, Bithika, Alum

  • 90 Points 75 badge 2x thumb

vSwitch (OVS) is configured via OVSDB.  The following command dumps the OVSDB database: "ovs-vsctl show".

You can also get the config via OVSDB queries.  Here is the schema used by OVS vswitchd:

http://openvswitch.org/ovs-vswitchd.conf.db.5.pdf
Hello,

https://github.com/homework/openvswitch/blob/master/ovsdb/ovsdb-server.c

Can you please guide me what all API Calls does ovsdb-server.c uses?
Photo of Magreth Mushi

Magreth Mushi

  • 140 Points 100 badge 2x thumb
Thanks Bithika,

Now I know I don't need netconf if I will keep working with OVS. I have been using the OVSDB to manually configure the switches, but I would like to know what configurations to do in order to enable this command (ovs-vsctl show) to be sent by the MD-SAL plugin when the session is initialized with MD-SAL. 

Thanks,
Magreth
Photo of Masadi, Ravi

Masadi, Ravi, Employee

  • 100 Points 100 badge 2x thumb
OVSDB works with AD-SAL only. Follow below steps to connect to OVSDB manager and to read/write data to it. 

1. Configure OVS manager to listen in passive mode using below cli
sudo ovs-vsctl set-manager ptcp:6640

2. using RESTCLIENT, Connect to the OVSDB Manager by issuing below REST API.
http://10.127.13.240:8080/controller/nb/v2/connectionmanager/node/MINI1/address/10.127.13.234/port/6...

10.127.13.240 is my Controller IP and 10.127.13.234 server where OVSDB manager is running.
MINI1 is the name that I assigned to OVSDB manager to reference it in later REST API.

3. after connecting to OVSDB manager, you can use below REST API to read data from OVSDB
http://10.127.13.240:8080/controller/nb/v2/connectionmanager/nodes
http://10.127.13.240:8080/ovsdb/nb/v2/node/OVS/MINI1/tables/open_vswitch/rows/
http://10.127.13.240:8080/ovsdb/nb/v2/node/OVS/MINI1/tables/port/rows
http://10.127.13.240:8080/ovsdb/nb/v2/node/OVS/MINI1/tables/bridge/rows
http://10.127.13.240:8080/ovsdb/nb/v2/node/OVS/MINI1/tables/interface/rows/

4. Use below POST API to create a bridge
http://10.127.13.240:8080/controller/nb/v2/networkconfig/bridgedomain/bridge/OVS/MINI1/br1
with below data in the body part of request.
{}
5. to delete the bridge, use the above API with DELETE method.
Photo of Karthik D

Karthik D

  • 60 Points
Hi , Thanks for your help..At 2nd point , you mentioned "10.127.13.234" is server where OVSDB manager is running.For my case how to find that??where i can check my OVSDB manager ip..
Thanks in Advance..

sdkarthikk@gmail.com
Photo of Magreth Mushi

Magreth Mushi

  • 60 Points
Hi,

I will suggest that you use postman API and add the postman collections from here, the "GET all node" collection will give you the node. Note that you will need to supply the URL with controller IP and port, and have done the number 1 item as described by Ravi above.

Also note that OVSDB works with MD-SAL as well and the correct command to retrieve the database is "printcache <node>" node in the form of "OVS|192.168.1.1:4432"

Hope this help.
Magreth
Hello,

I am having a study project of OVSDB Server.c file in Github.

Can you please guide me how to look at the API Calls used in the OVSDB Server?
Photo of Magreth Mushi

Magreth Mushi

  • 140 Points 100 badge 2x thumb
Hi Sudarshan,

Can you please be a little clear with what kind of help you need? Personally, I haven't looked in the OVSDB server/manager itself, but I used it along the way when retrieving devices configuration from OVSDB. 

Magreth 
Hello Magreth,

I need to know what all API calls does https://github.com/homework/openvswitch/blob/master/ovsdb/ovsdb-server.c

ovsdb-server.c uses for various open vswitch operations?

Actually,I was going through the code,but i found in internet that it uses post man API Calls for network service and few other API calls for CRUD Operations....but the search leads to header files only....can you guide me what all API calls does it uses?