telekom / das-schiff-network-operator

Configure netlink interfaces, simple eBPF filters and FRR using Kubernetes resources.
Apache License 2.0
28 stars 2 forks source link

Extended Visibility for Host Routing #96

Closed chdxD1 closed 1 week ago

chdxD1 commented 7 months ago

As of today we have to connect to all nodes one-by-one, open vtysh and run debug commands. This is a rather tedious process.

I'd like to propose an API endpoint on each of the monitoring containers (where it is probably best suited because we already have a vtysh connection and methods around querying it) that gathers this information on each node.

In addition to that there should be another endpoint that allows retrieving information from all nodes in a cluster by querying just one network-operator pod, this could be achieved by using Kubernetes service or pod discovery.

List of commands that should be implemented (all output can be returned as is, without any sanitization):

p-strusiewiczsurmacki-mobica commented 7 months ago

I was finally able to start working on this. Just created WIP PR.

For now there are 3 GET endpoints.

Endpoint /show/route:

Can you tell me what <input> is and how to switch between with/without longer-prefixes. Or point me to the docs, as I can't find this.

Endpoint: /show/bgp

Example: /show/bgp?vrf=\<vrf>&protocol=\<ipv4/ipv6>

Same question about <input> and prefixes applies here. Also, will

show bgp vrf all ipv4/ipv6 unicast \<input> json

be a valid command?

|> Example: /show/bgp?vrf=\<vrf>&type=summary

Endpoint /show/evpn:

Example: /show/evpn

Example: /show/evpn?type=rmac&vrf=\<vrf>

Example: Example: /show/evpn?type=mac&vrf=\<vrf>

Example: Example: /show/evpn?type=next-hops&vrf=\<vrf>

chdxD1 commented 7 months ago

@p-strusiewiczsurmacki-mobica <input> will be a CIDR in the form of <IP>/<length> e.g. 192.168.0.0/16, 0.0.0.0/0, 2a01::/64 (for IPv6). To switch between longer-prefixes mode prepend json with longer-prefixes --> show ip route vrf Vrf_test 192.168.0.0/16 longer-prefixes json

It would be good to sanitise the values, input should be parsed through net.ParseCIDR.

Example: /show/route?protocol=<ip/ipv6>&vrf=&cidr/input=&longer_prefixes=true/false

p-strusiewiczsurmacki-mobica commented 6 months ago

@chdxD1 OK, I've made changes you've requested (I hope it'll be OK now). I've also added global endpoints:

If any pod will be queried with those it will pass those requests to all the network operator pods and will return response in form of:

"hostname1": {json response}

"hostname2": {json response}

I don't really have setup to fully test this using frr, but I'll try to check if this works when queried using a service, and I'll also try to add some unit tests.

chdxD1 commented 6 months ago

@p-strusiewiczsurmacki-mobica I've commented on the MR 1) Probably it is better to use services for discovery 2) It would be nice to get JSON for the global endpoints as well (see my idea in MR)

I'll try it out soon

p-strusiewiczsurmacki-mobica commented 6 months ago

@chdxD1 - services are now used for discovery. See my comment in the PR for more details. JSON output should be handled as well.

Cellebyte commented 2 weeks ago

@chdxD1 @p-strusiewiczsurmacki-mobica maybe we should close this as #100 is merged.