wobcom / fernglas

BMP based looking glass
European Union Public License 1.2
24 stars 3 forks source link

Selecting specific router only shows routes from a single BMP session #18

Open v0tti opened 6 months ago

v0tti commented 6 months ago

In our setup, we utilize Nokia routers within an MPLS network configuration. This necessitates configuring BMP sessions from our Internet VRF for EBGP routes and on our Base router for IBGP (VPN) routes. Our routers establish two separate BMP sessions originating from the same IP address but using different source ports. This setup leads to a problem with fernglas, specifically when selecting a single router in the frontend. In this scenario, only the routes from one of the two BMP sessions are displayed. However, when selecting "on all", all routes are shown correctly.

Excepted behavior

When selecting a single router in the frontend, I expect to see all routes known by this particular router, irrespective of the BMP session source port.

Observed behavior

When selecting a single router in the frontend, only the routes from one of the BMP sessions are displayed, leading to incomplete data.

Examples with truncated output:

GET /api/query?MostSpecific=8.8.8.8:

...
{"Route":{"state":"Seen","net":"8.8.8.0/24","table":"PrePolicyAdjIn","from_client":"192.168.128.39:61415","peer_distinguisher":"Global","peer_address":"192.168.128.25","client_name":"swbb01-ams","router_id":"192.168.128.39","origin":"Igp","as_path":[15169],"communities":[[34953,10003],[65101,1082],[65102,1000],[65103,276],[65104,150]],"large_communities":[[6695,1000,1]],"med":0,"local_pref":110,"nexthop":"192.168.128.25"}}
{"Route":{"state":"Seen","net":"8.8.8.0/24","table":"PrePolicyAdjIn","from_client":"192.168.128.39:61445","peer_distinguisher":{"RD":[34953,10000]},"peer_address":"213.198.92.112","client_name":"swbb01-ams","router_id":"93.159.250.3","origin":"Igp","as_path":[2914,6453,15169],"communities":[[2914,420],[2914,1206],[2914,2203],[2914,3200]],"large_communities":null,"med":2001,"local_pref":null,"nexthop":"213.198.92.112"}}
{"Route":{"state":"Seen","net":"8.0.0.0/12","table":"PrePolicyAdjIn","from_client":"192.168.128.39:61415","peer_distinguisher":"Global","peer_address":"192.168.128.37","client_name":"swbb01-ams","router_id":"192.168.128.39","origin":"Igp","as_path":[1299,3356],"communities":[[1299,20000],[34953,10004]],"large_communities":null,"med":null,"local_pref":100,"nexthop":"192.168.128.37"}}
{"Route":{"state":"Accepted","net":"8.8.8.0/24","table":"PostPolicyAdjIn","from_client":"192.168.128.39:61415","peer_distinguisher":"Global","peer_address":"192.168.128.25","client_name":"swbb01-ams","router_id":"192.168.128.39","origin":"Igp","as_path":[15169],"communities":[[34953,10003],[65101,1082],[65102,1000],[65103,276],[65104,150]],"large_communities":[[6695,1000,1]],"med":0,"local_pref":110,"nexthop":"192.168.128.25"}}
{"Route":{"state":"Accepted","net":"8.8.8.0/24","table":"PostPolicyAdjIn","from_client":"192.168.128.39:61445","peer_distinguisher":{"RD":[34953,10000]},"peer_address":"213.198.92.112","client_name":"swbb01-ams","router_id":"93.159.250.3","origin":"Igp","as_path":[2914,6453,15169],"communities":[[2914,420],[2914,1206],[2914,2203],[2914,3200],[34953,10004]],"large_communities":null,"med":2001,"local_pref":null,"nexthop":"213.198.92.112"}}
{"Route":{"state":"Accepted","net":"8.0.0.0/12","table":"PostPolicyAdjIn","from_client":"192.168.128.39:61415","peer_distinguisher":"Global","peer_address":"192.168.128.37","client_name":"swbb01-ams","router_id":"192.168.128.39","origin":"Igp","as_path":[1299,3356],"communities":[[1299,20000],[34953,10004]],"large_communities":null,"med":null,"local_pref":100,"nexthop":"192.168.128.37"}}
...

GET /api/query?Router=192.168.128.39&MostSpecific=8.8.8.8:

...
{"Route":{"state":"Accepted","net":"8.8.8.0/24","table":"PostPolicyAdjIn","from_client":"192.168.128.39:61415","peer_distinguisher":"Global","peer_address":"192.168.128.25","client_name":"swbb01-ams","router_id":"192.168.128.39","origin":"Igp","as_path":[15169],"communities":[[34953,10003],[65101,1082],[65102,1000],[65103,276],[65104,150]],"large_communities":[[6695,1000,1]],"med":0,"local_pref":110,"nexthop":"192.168.128.25"}}
{"Route":{"state":"Seen","net":"8.8.8.0/24","table":"PrePolicyAdjIn","from_client":"192.168.128.39:61415","peer_distinguisher":"Global","peer_address":"192.168.128.25","client_name":"swbb01-ams","router_id":"192.168.128.39","origin":"Igp","as_path":[15169],"communities":[[34953,10003],[65101,1082],[65102,1000],[65103,276],[65104,150]],"large_communities":[[6695,1000,1]],"med":0,"local_pref":110,"nexthop":"192.168.128.25"}}
{"Route":{"state":"Accepted","net":"8.0.0.0/12","table":"PostPolicyAdjIn","from_client":"192.168.128.39:61415","peer_distinguisher":"Global","peer_address":"192.168.128.37","client_name":"swbb01-ams","router_id":"192.168.128.39","origin":"Igp","as_path":[1299,3356],"communities":[[1299,20000],[34953,10004]],"large_communities":null,"med":null,"local_pref":100,"nexthop":"192.168.128.37"}}
{"Route":{"state":"Seen","net":"8.0.0.0/12","table":"PrePolicyAdjIn","from_client":"192.168.128.39:61415","peer_distinguisher":"Global","peer_address":"192.168.128.37","client_name":"swbb01-ams","router_id":"192.168.128.39","origin":"Igp","as_path":[1299,3356],"communities":[[1299,20000],[34953,10004]],"large_communities":null,"med":null,"local_pref":100,"nexthop":"192.168.128.37"}}
...

Upon querying for a specific router, it becomes apparent that only the routes from client 192.168.128.39:61415 are returned, whereas those from client 192.168.128.39:61445 are omitted.

yu-re-ka commented 6 months ago

The "Router=192.168.128.39" parameter has nothing to do with the source of the BMP stream. Instead, it attempts to catch the BGP router id from one of the BGP handshakes encapsulated within the stream. We can of course add a field to hard-code this mapping, which would work around your issue.

v0tti commented 6 months ago

Thanks for the input.

We have added an option in our fork to override the router-id, would this patch be appreciated upstream?

ChrisDeh commented 2 weeks ago

Absolutely! Feel free to submit a PR!