1. Using fabric-cli JSON output difficult (bug and/or feature request)

Using fabric-cli JSON output difficult (bug and/or feature request)

Home Forums FABRIC General Questions and Discussion Using fabric-cli JSON output difficult (bug and/or feature request)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2099
    Timothy Middelkoop
    Participant

      Output from the fabric-cli escapes embedded resources making it more difficult to access output as it needs to be parsed multiple times.

      fabric-cli slices query –state=StableOK

      [{

      “graph_node_id”: “4fa367b1-99d0-42b2-bb7a-fc93811d6dc9”,

      “join_state”: “NoJoin”,

      “lease_end”: “2022-06-11 18:20:09 +0000”,

      “lease_start”: “2022-06-10 18:20:10 +0000”,

      “notices”: “Reservation 0e1dd71e-5dc9-4710-8b0f-67d267deeb61 (Slice MySlice(bf3fbf1a-84d7-4629-8b8c-3661972fbb2e) Graph Id:39f2325f-f8fc-463a-93aa-8de6e2076597 Owner:tmiddelkoop@internet2.edu) is in state (Active,None_) “,

      “pending_state”: “None_”,

      “reservation_id”: “0e1dd71e-5dc9-4710-8b0f-67d267deeb61”,

      “reservation_state”: “Active”,

      “slice_id”: “bf3fbf1a-84d7-4629-8b8c-3661972fbb2e”,

      “sliver”: “{\”Name\”: \”Node1\”, \”Type\”: \”VM\”, \”Capacities\”: \”{\\\”core\\\”: 2, \\\”disk\\\”: 10, \\\”ram\\\”: 8}\”, \”CapacityHints\”: \”{\\\”instance_type\\\”: \\\”fabric.c2.m8.d10\\\”}\”, \”CapacityAllocations\”: \”{\\\”core\\\”: 2, \\\”disk\\\”: 10, \\\”ram\\\”: 8}\”, \”LabelAllocations\”: \”{\\\”instance\\\”: \\\”instance-00001414\\\”, \\\”instance_parent\\\”: \\\”max-w5.fabric-testbed.net\\\”}\”, \”ReservationInfo\”: \”{\\\”error_message\\\”: \\\”\\\”, \\\”reservation_id\\\”: \\\”0e1dd71e-5dc9-4710-8b0f-67d267deeb61\\\”, \\\”reservation_state\\\”: \\\”Active\\\”}\”, \”NodeMap\”: \”[\\\”508c3fa3-df17-41ab-bb95-fdf71c105a61\\\”, \\\”HW2DZB3\\\”]\”, \”StitchNode\”: \”false\”, \”ImageRef\”: \”default_rocky_8,qcow2\”, \”MgmtIp\”: \”63.239.135.72\”, \”Site\”: \”MAX\”}”,

      “sliver_type”: “NodeSliver”

      }]

      Note the multiple (some times 3 levels deep) escaping.

      This makes parsing multiple steps and restricts richer queries (note the double use of jq)

      IP=$(fabric-cli slivers query –sliceid=$SLICEID | jq -r ‘.[0].sliver’ | jq -r ‘.MgmtIp’)

      echo $IP

      #2101
      Komal Thareja
      Participant

        fabric-cli currently does a json dump of the Slice object thus resulting in the escaping of the inner json objects. We would work on making this output more parseable in the next releases until then using the FABlib interface which returns the Python objects is recommended.

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.