[ovs-discuss] how to use ovsdb-tool transact?

ychen ychen103103 at 163.com
Fri Sep 5 05:55:08 UTC 2014


hi, Ben:
Thanks for your reply,  it really works with the following command:
ovsdb-client transact "[\"Open_vSwitch\",{\"mutations\":[[\"ports\",\"delete\",[\"uuid\",\"508cd3d7-a29c-47c3-80df-cdff04228cf9\"]]], \"table\":\"Bridge\", \"where\":[[\"_uuid\",\"==\",[\"uuid\",\"a24d9a54-c30c-4224-906d-d0af73c53094\"]]], \"op\":\"mutate\"}]"


Then there is another question, how can I delete a port with its name? As you see, in the above command, I must use the "uuid" to delete port from bridge table. Is there a simple way to use "select" and "mutate" to delete port with name? like this:
ovsdb-client transact  "["Open_vSwitch",{"mutations":[["ports","delete",["uuid","{"columns":["_uuid"],"table":"Port","where":[["name","==","p0"]],"op":"select"}"]]], "table":"Bridge", "where":[["_uuid","==",["uuid","a24d9a54-c30c-4224-906d-d0af73c53094"]]],
"op":"mutate"}]"







At 2014-09-03 11:23:40, "Ben Pfaff" <blp at nicira.com> wrote:
>Please don't drop the mailing list.
>
>On Wed, Sep 03, 2014 at 03:53:13PM +0800, ychen wrote:
>> hi, Ben:
>> I am still have serval problems about transact.
>> when I use the following format to add port p100,type=internal, system returns error
>>  "ovsdb-client: invalid syntax for 'transact' (use --help for help)"
>> ovsdb-client transact {"method":"transact", "params":["Open_vSwitch",{"row":{"type":"internal"},"table":"Interface","uuid-name":"rowp100intf","op":"insert"},{"row":{"ports":["set",[["uuid","275537c3-b469-47d1-b3c0-10efd08cb193"],["named-uuid","rowp100port"]]]},"table":"Bridge","where":[["_uuid","==",["uuid","8f725ab8-c5f4-4077-a251-d866e7a448d9"]]],"op":"update"},{"row":{"name":"p100","interfaces":["named-uuid","rowp100intf"],"tag":100},"table":"Port","uuid-name":"rowp100port","op":"insert"}], "id":1}
>
>It looks like you forgot to quote to protect the JSON content from the
>shell.
>
>> Also, I have tried to substitute the outer {} to [], and "method:transact" to "method=transact", but system still reports error.
>> so what's the correct transact format?
>
>As specified in RFC 7047.
>
>> Another question:
>> I noticed that when add or delete one port, we should always update table Bridge. But the update operation needs the old value(exp: add port p100, there will be an operation update in bridge table, column ports). That's really complicated when I want to debug with tool ovsdb-tool or ovsdb-client.
>> I am considering why we can't just use operation like "add" or "remove" to add/delete one element of the ports column?(or other column which type is map or set)
>
>Use "mutate"?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20140905/700cc062/attachment-0002.html>


More information about the discuss mailing list