kytos-ng / telemetry_int

Kytos Telemetry Napp
MIT License
0 stars 2 forks source link

UI: implement a k-info-panel to list EVCs displaying INT metadata #93

Closed viniarck closed 2 months ago

viniarck commented 5 months ago

This is the k-info-panel mentioned on https://github.com/kytos-ng/telemetry_int/issues/92.

❯ http http://127.0.0.1:8181/api/kytos/mef_eline/v2/evc/db43d585b64242 | jq '.id, .name, .active, .metadata'  
"db43d585b64242"
"inter_evpl_2222"
true
{
  "telemetry": {
    "enabled": true,
    "status": "UP",
    "status_reason": [],
    "status_updated_at": "2024-04-26T13:20:35"
  }
}

Once the EVCs are listed, the following actions enable/disable/redeploy should be supported in bulk (meaning that you can select one or more EVCs for a given action to be performed, telemetry_int API support passing a list of EVC ids for these actions):

Notice that both enable and disable also accept a force: bool flag which should also be set or not. The API explains what it's useful for, but essentially it's to force certain validation criteria to be bypassed when it can be safe and intentional to do so.

viniarck commented 5 months ago

How to run it locally?

"""Custom topology example

Two directly connected switches plus a host for each switch:

   host --- switch --- switch --- host

Adding the 'topos' dict with a key/value pair to generate our newly defined
topology enables one to pass in '--topo=mytopo' from the command line.
"""

from mininet.topo import Topo

class MyTopo(Topo):
    "Simple topology example."

    def build(self):
        "Create custom topo."

        # Add hosts and switches
        h11 = self.addHost("h11")
        h12 = self.addHost("h12")
        h2 = self.addHost("h2")
        h3 = self.addHost("h3")

        s1 = self.addSwitch("s1")
        s2 = self.addSwitch("s2")
        s3 = self.addSwitch("s3")

        self.addLink(s1, h11)
        self.addLink(s1, h12)
        self.addLink(s2, h2)
        self.addLink(s3, h3)

        self.addLink(s1, s2)
        self.addLink(s2, s3)
        self.addLink(s1, s3)

        self.addLink(s1, s1, port1=5, port2=6)
        self.addLink(s1, s1, port1=7, port2=8)
        self.addLink(s3, s3, port1=5, port2=6)

topos = {"mytopo": (lambda: MyTopo())}

local_ring_topo

diff --git a/managers/int.py b/managers/int.py
index 4b5eec1..b0f1c48 100644
--- a/managers/int.py
+++ b/managers/int.py
@@ -634,6 +634,7 @@ class INTManager:
         The flows will be batched per dpid based on settings.BATCH_SIZE and will wait
         for settings.BATCH_INTERVAL per batch iteration.
         """
+        return

         switch_flows = defaultdict(list)
         for flows in stored_flows.values():

echo  '{"proxy_port": 5}' | http http://127.0.0.1:8181/api/kytos/topology/v3/interfaces/00:00:00:00:00:00:00:01:01/metadata
echo  '{"proxy_port": 7}' | http http://127.0.0.1:8181/api/kytos/topology/v3/interfaces/00:00:00:00:00:00:00:01:02/metadata
echo  '{"proxy_port": 5}' | http http://127.0.0.1:8181/api/kytos/topology/v3/interfaces/00:00:00:00:00:00:00:03:01/metadata
curl -H 'Content-type: application/json' -X POST http://127.0.0.1:8181/api/kytos/mef_eline/v2/evc/ -d '{"name": "inter_evpl_2222", "dynamic_backup_path": true, "uni_a": {"interface_id": "00:00:00:00:00:00:00:01:1", "tag": {"tag_type": "vlan", "value": 2222}}, "uni_z": { "interface_id": "00:00:00:00:00:00:00:03:1", "tag": {"tag_type": "vlan", "value": 2222}}}'
❯ curl -H 'Content-type: application/json' -X POST http://127.0.0.1:8181/api/kytos/telemetry_int/v1/evc/enable -d '{"evc_ids": []}'
["db43d585b64242"]
viniarck commented 5 months ago

@HeriLFIU will work on this one