[ovs-discuss] OVSDB - match empty set?

Hans Ole Rafaelsen hrafaelsen at gmail.com
Thu Sep 6 07:49:14 UTC 2018


Hi,

How do I match an empty set (null reference) in a select?

I have a weak reference from one table to another as defined with:
"network_status": {
          "type": {
            "key": {
              "refTable": "NetworkStatus",
              "refType": "weak",
              "type": "uuid"},
            "min": 0}},

When a row is deleted in NetworkStatus, ovsdb sets the reference value:
"network_status": [
          "set",
          []]
I would like to be able to find all rows which as no valid references. I
have tried this:
ovsdb-client transact tcp:127.0.0.1:6640 '
["Open_vSwitch",
 {"op":"select",
  "table": "Xinterface",
  "columns" : ["name", "network_status"],
  "where": [[ "network_status" , "==", ["set",[]] ]]
 }]
' --prety
which gives no match.
The reverse gives all rows, also the one with the empty set.
ovsdb-client transact tcp:127.0.0.1:6640 '
["Open_vSwitch",
 {"op":"select",
  "table": "Xinterface",
  "columns" : ["name", "network_status"],
  "where": [[ "network_status" , "!=", ["set",[]] ]]
 }]
' --pretty
[
  {
    "rows": [
      {
        "name": "WAN-2",
        "network_status": [
          "set",
          []]},
      {
        "name": "WAN-1",
        "network_status": [
          "uuid",
          "6aeebd8c-811e-4a0d-937d-4512a2dbc4c7"]},
      {
        "name": "WIFI",
        "network_status": [
          "uuid",
          "05f1223d-fb9f-4bce-b860-9e0fa3c7e603"]}]}]
I have also tried with "includes", but with same result.

Matching on specific uuid works, and only returns that row.

Is there a way to match against empty sets, or do I need to do something
else to find broken references?

Regards,

Hans Ole
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-discuss/attachments/20180906/8e6f06e8/attachment.html>


More information about the discuss mailing list