upf icon indicating copy to clipboard operation
upf copied to clipboard

Replace deprecated and obsoleted `IPDB` with `NDB`

Open gab-arrobo opened this issue 1 year ago • 4 comments

IPDB is deprecated, and obsolete as stated in IPDB module — pyroute2 0.7.3.post2 documentation. This PR resolves #735 by replacing IPDB with NDB

  • [x] Run Python Lint and Test locally
  • [x] Address issue with Python Lint and Test when using GitHub runners
  • [x] Run an E2E test (UPF in stand-alone mode)
  • [ ] Run an E2E test (UPF as part of AiaB)

gab-arrobo avatar Feb 05 '24 23:02 gab-arrobo

I am wondering why the Python Lint and Test action fails... would it require sudo for the tests to pass, which is suspicious because in my local setup, the action successfully completes

[Python Lint and Test/route-control-tests] ⭐ Run Main Run tests
[Python Lint and Test/route-control-tests]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/4] user= workdir=
| 2024-02-05 23:16:15,586 INFO Neighbor entry does not exist, creating modules.
| 2024-02-05 23:16:15,588 INFO Neighbor already exists
| 2024-02-05 23:16:15,589 INFO Route count for 1.2.3.4 decremented to 1
| .2024-02-05 23:16:15,592 INFO Neighbor entry does not exist, creating modules.
| 2024-02-05 23:16:15,593 INFO Module deleted random_interfaceRoutesDstMAC001A2B3C4D5E
| 2024-02-05 23:16:15,593 INFO Deleted item from neighbor cache
| .2024-02-05 23:16:15,596 INFO Neighbor entry does not exist, creating modules.
| 2024-02-05 23:16:15,597 INFO Module deleted random_interfaceRoutesDstMAC001A2B3C4D5E
| 2024-02-05 23:16:15,597 INFO Deleted item from neighbor cache
| ..2024-02-05 23:16:15,599 INFO RTM_DELROUTE netlink event received.
| .2024-02-05 23:16:15,600 INFO RTM_NEWNEIGH netlink event received.
| 2024-02-05 23:16:15,600 ERROR Error parsing route entry message
| Traceback (most recent call last):
|   File "/home/ubuntu/upf-ga/conf/route_control.py", line 659, in _parse_route_entry_msg
|     attr_dict = dict(route_entry["attrs"])
|                      ~~~~~~~~~~~^^^^^^^^^
| TypeError: string indices must be integers, not 'str'
| .2024-02-05 23:16:15,602 INFO RTM_NEWROUTE netlink event received.
| .2024-02-05 23:16:15,604 INFO Mac address not found for 1.2.3.4
| 2024-02-05 23:16:15,604 INFO mac address of the next hop 1.2.3.4 is not stored in ARP table. Probing...
| 2024-02-05 23:16:15,604 INFO Adding entry RouteEntry(next_hop_ip='1.2.3.4', interface='random_interface', dest_prefix='1.1.1.1', prefix_len=24) in arp table by pinging
| 2024-02-05 23:16:15,605 INFO Neighbor entry does not exist, creating modules.
| ..2024-02-05 23:16:15,608 INFO Mac address not found for 1.2.3.4
| 2024-02-05 23:16:15,608 INFO mac address of the next hop 1.2.3.4 is not stored in ARP table. Probing...
| 2024-02-05 23:16:15,608 INFO Adding entry RouteEntry(next_hop_ip='1.2.3.4', interface='random_interface', dest_prefix='1.1.1.1', prefix_len=24) in arp table by pinging
| ...2024-02-05 23:16:15,614 INFO Mac address not found for 1.2.3.4
| 2024-02-05 23:16:15,614 INFO mac address of the next hop 1.2.3.4 is not stored in ARP table. Probing...
| 2024-02-05 23:16:15,614 INFO Adding entry RouteEntry(next_hop_ip='1.2.3.4', interface='random_interface', dest_prefix='1.1.1.1', prefix_len=24) in arp table by pinging
| 2024-02-05 23:16:15,614 INFO Sending ping to 1.2.3.4
| .
| Sent 1 packets.
| .2024-02-05 23:16:15,722 INFO Mac address not found for 1.2.3.4
| 2024-02-05 23:16:15,722 INFO mac address of the next hop 1.2.3.4 is not stored in ARP table. Probing...
| 2024-02-05 23:16:15,722 INFO Adding entry RouteEntry(next_hop_ip='1.2.3.4', interface='random_interface', dest_prefix='1.1.1.1', prefix_len=24) in arp table by pinging
| 2024-02-05 23:16:15,722 INFO Sending ping to 1.2.3.4
| .
| Sent 1 packets.
| ...2024-02-05 23:16:15,797 ERROR The IP address 192.168.300.1 is invalid
| .2024-02-05 23:16:15,797 ERROR The IP address  is invalid
| ..2024-02-05 23:16:15,800 INFO Mac address found for 192.168.1.1, Mac: 00:1a:2b:3c:4d:5e
| .2024-02-05 23:16:15,802 INFO Mac address found for 192.168.1.1, Mac: None
| ....
| ----------------------------------------------------------------------
| Ran 24 tests in 0.220s
|
| OK
[Python Lint and Test/route-control-tests]   ✅  Success - Main Run tests

gab-arrobo avatar Feb 06 '24 00:02 gab-arrobo

I am wondering why the Python Lint and Test action fails... would it require sudo for the tests to pass, which is suspicious because in my local setup, the action successfully completes

[Python Lint and Test/route-control-tests] ⭐ Run Main Run tests
[Python Lint and Test/route-control-tests]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/4] user= workdir=
| 2024-02-05 23:16:15,586 INFO Neighbor entry does not exist, creating modules.
| 2024-02-05 23:16:15,588 INFO Neighbor already exists
| 2024-02-05 23:16:15,589 INFO Route count for 1.2.3.4 decremented to 1
| .2024-02-05 23:16:15,592 INFO Neighbor entry does not exist, creating modules.
| 2024-02-05 23:16:15,593 INFO Module deleted random_interfaceRoutesDstMAC001A2B3C4D5E
| 2024-02-05 23:16:15,593 INFO Deleted item from neighbor cache
| .2024-02-05 23:16:15,596 INFO Neighbor entry does not exist, creating modules.
| 2024-02-05 23:16:15,597 INFO Module deleted random_interfaceRoutesDstMAC001A2B3C4D5E
| 2024-02-05 23:16:15,597 INFO Deleted item from neighbor cache
| ..2024-02-05 23:16:15,599 INFO RTM_DELROUTE netlink event received.
| .2024-02-05 23:16:15,600 INFO RTM_NEWNEIGH netlink event received.
| 2024-02-05 23:16:15,600 ERROR Error parsing route entry message
| Traceback (most recent call last):
|   File "/home/ubuntu/upf-ga/conf/route_control.py", line 659, in _parse_route_entry_msg
|     attr_dict = dict(route_entry["attrs"])
|                      ~~~~~~~~~~~^^^^^^^^^
| TypeError: string indices must be integers, not 'str'
| .2024-02-05 23:16:15,602 INFO RTM_NEWROUTE netlink event received.
| .2024-02-05 23:16:15,604 INFO Mac address not found for 1.2.3.4
| 2024-02-05 23:16:15,604 INFO mac address of the next hop 1.2.3.4 is not stored in ARP table. Probing...
| 2024-02-05 23:16:15,604 INFO Adding entry RouteEntry(next_hop_ip='1.2.3.4', interface='random_interface', dest_prefix='1.1.1.1', prefix_len=24) in arp table by pinging
| 2024-02-05 23:16:15,605 INFO Neighbor entry does not exist, creating modules.
| ..2024-02-05 23:16:15,608 INFO Mac address not found for 1.2.3.4
| 2024-02-05 23:16:15,608 INFO mac address of the next hop 1.2.3.4 is not stored in ARP table. Probing...
| 2024-02-05 23:16:15,608 INFO Adding entry RouteEntry(next_hop_ip='1.2.3.4', interface='random_interface', dest_prefix='1.1.1.1', prefix_len=24) in arp table by pinging
| ...2024-02-05 23:16:15,614 INFO Mac address not found for 1.2.3.4
| 2024-02-05 23:16:15,614 INFO mac address of the next hop 1.2.3.4 is not stored in ARP table. Probing...
| 2024-02-05 23:16:15,614 INFO Adding entry RouteEntry(next_hop_ip='1.2.3.4', interface='random_interface', dest_prefix='1.1.1.1', prefix_len=24) in arp table by pinging
| 2024-02-05 23:16:15,614 INFO Sending ping to 1.2.3.4
| .
| Sent 1 packets.
| .2024-02-05 23:16:15,722 INFO Mac address not found for 1.2.3.4
| 2024-02-05 23:16:15,722 INFO mac address of the next hop 1.2.3.4 is not stored in ARP table. Probing...
| 2024-02-05 23:16:15,722 INFO Adding entry RouteEntry(next_hop_ip='1.2.3.4', interface='random_interface', dest_prefix='1.1.1.1', prefix_len=24) in arp table by pinging
| 2024-02-05 23:16:15,722 INFO Sending ping to 1.2.3.4
| .
| Sent 1 packets.
| ...2024-02-05 23:16:15,797 ERROR The IP address 192.168.300.1 is invalid
| .2024-02-05 23:16:15,797 ERROR The IP address  is invalid
| ..2024-02-05 23:16:15,800 INFO Mac address found for 192.168.1.1, Mac: 00:1a:2b:3c:4d:5e
| .2024-02-05 23:16:15,802 INFO Mac address found for 192.168.1.1, Mac: None
| ....
| ----------------------------------------------------------------------
| Ran 24 tests in 0.220s
|
| OK
[Python Lint and Test/route-control-tests]   ✅  Success - Main Run tests

Are you running the test in a docker container? In that case, you are probably root inside the container, letting you open a socket. Mocking the send_ping function will let you bypass the actual sending of a ping. You can find an example on line 217 in the test file.

ghislainbourgeois avatar Feb 07 '24 00:02 ghislainbourgeois

Overall it looks good, I provided some comments on the tests.

Thanks for your feedback!

gab-arrobo avatar Feb 07 '24 02:02 gab-arrobo

Looks good (assuming the lint check gets figured out)

Investigating the lint issue. However, I am not quite sure why there is an issue with (GO) lint because we are not touching anything related to it.

gab-arrobo avatar Feb 07 '24 19:02 gab-arrobo