kytos-ng / sdntrace

Napp that traces OpenFlow paths in the dataplane
https://kytos-ng.github.io/api/sdntrace.html
GNU Lesser General Public License v3.0
0 stars 6 forks source link

Create UI components to run L2, L3 and full traces in a new `k-toolbar` #6

Closed viniarck closed 5 months ago

viniarck commented 2 years ago

This is for creating a k-toolbar component allowing operators to perform sdntrace (which are run in the data plane). This UI is somewhat similar to https://github.com/kytos-ng/sdntrace_cp/issues/66, except how the data is displayed is asynchronous.

The result is supposed to be shown on a new k-info-panel that will be implemented on https://github.com/amlight/sdntrace/issues/7

We need a new k-tool-bar with inputs to send a request to PUT /api/amlight/sdntrace/trace

The following components are recommended:

If you need a reference how to implement k-input with autocompletion and also displaying the specific metadata when applicable check out these components on pathfinder:

Scenarios

For local tests, you'll probably want to use a topology such as linear,3 and with mef_eline and create an EVC, just so you have at least one expected completing trace result (since sdntrace would be tracing the current path of this EVC).

mn --controller=remote,ip=127.0.0.1,port=6653 --switch=ovsk,protocols=OpenFlow13 --topo=linear,3
kytosd -f -E --database mongodb        
curl -H 'Content-type: application/json' -X POST http://127.0.0.1:8181/api/kytos/mef_eline/v2/evc/ -d '{"name": "inter_evpl", "dynamic_backup_path": true, "uni_a": {"interface_id": "00:00:00:00:00:00:00:01:1", "tag": {"tag_type": "vlan", "value": 2221}}, "uni_z": { "interface_id": "00:00:00:00:00:00:00:03:1", "tag": {"tag_type": "vlan", "value": 2221}}}'
❯ curl -X PUT http://127.0.0.1:8181/api/amlight/sdntrace/trace \      
     -H "Content-Type: application/json" \
     -d '{"trace": {"switch": {"dpid": "00:00:00:00:00:00:00:01", "in_port": 1}, "eth": {"dl_type": 2048, "dl_vlan": 2221}, "ip": {"nw_proto": 6}}}' | jq
{
  "result": {
    "trace_id": 30001
  }
}
❯ curl http://127.0.0.1:8181/api/amlight/sdntrace/trace/30001 | jq
{
  "request_id": 30001,
  "result": [
    {
      "type": "starting",
      "dpid": "00:00:00:00:00:00:00:01",
      "port": 1,
      "time": "2024-01-16 15:23:44.131888"
    },
    {
      "type": "trace",
      "dpid": "00:00:00:00:00:00:00:02",
      "port": 2,
      "time": "0:00:00.521440"
    },
    {
      "type": "trace",
      "dpid": "00:00:00:00:00:00:00:03",
      "port": 2,
      "time": "0:00:01.041600"
    },
    {
      "type": "last",
      "reason": "done",
      "msg": "none",
      "time": "0:00:02.560983"
    }
  ],
  "start_time": "2024-01-16 15:23:44.131888",
  "total_time": "0:00:02.561487",
  "request": {
    "trace": {
      "switch": {
        "dpid": "00:00:00:00:00:00:00:01",
        "in_port": 1
      },
      "eth": {
        "dl_type": 2048,
        "dl_vlan": 2221
      },
      "ip": {
        "nw_proto": 6
      }
    }
  }
}
viniarck commented 9 months ago

This UI should be similar to https://github.com/kytos-ng/sdntrace_cp/issues/66