kytos-ng / pathfinder

Kytos main path finder Network Application (NApp)
https://kytos-ng.github.io/api/pathfinder.html
MIT License
0 stars 7 forks source link

[Fix] undesired_links (logical OR) and desired_links (logical AND) filters #30

Closed viniarck closed 1 year ago

viniarck commented 1 year ago

This PR supersedes PR #28 (it also fixes issue 29)

Fixes #20 #27 #29

I've explored it locally with the same topology that Italo has initially reported the issue and same request, here's a diff of the response:

❯ diff /tmp/resp_master.json /tmp/resp_fix.json
11,30d10
<         "00:00:00:00:00:00:00:02:3",
<         "00:00:00:00:00:00:00:03:2",
<         "00:00:00:00:00:00:00:03",
<         "00:00:00:00:00:00:00:03:4",
<         "00:00:00:00:00:00:00:06:5",
<         "00:00:00:00:00:00:00:06",
<         "00:00:00:00:00:00:00:06:2",
<         "00:00:00:00:00:00:00:05:3",
<         "00:00:00:00:00:00:00:05",
<         "00:00:00:00:00:00:00:05:1"
<       ]
<     },
<     {
<       "cost": 14,
<       "hops": [
<         "00:00:00:00:00:00:00:01:1",
<         "00:00:00:00:00:00:00:01",
<         "00:00:00:00:00:00:00:01:2",
<         "00:00:00:00:00:00:00:02:2",
<         "00:00:00:00:00:00:00:02",
❯ rg "00:00:00:00:00:00:00:01:3|00:00:00:00:00:00:00:06:3|00:00:00:00:00:00:00:05:3|00:00:00:00:00:00:00:06:2" /tmp/resp_master.json
17:        "00:00:00:00:00:00:00:06:2",
18:        "00:00:00:00:00:00:00:05:3",
❯ rg "00:00:00:00:00:00:00:01:3|00:00:00:00:00:00:00:06:3|00:00:00:00:00:00:00:05:3|00:00:00:00:00:00:00:06:2" /tmp/resp_fix.json

I've also re-run the same example of issue #27, no longer duplicated paths are being seeing in the response, and desired_links now can be used to narrow down a set of links in the path. In the future, we might also have the logical expression being parametrized.