Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_get_iface_addr_info KeyError: 'ip' in tgen_utils.py #195

Open
vikumarks opened this issue Mar 15, 2023 · 0 comments
Open

_get_iface_addr_info KeyError: 'ip' in tgen_utils.py #195

vikumarks opened this issue Mar 15, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@vikumarks
Copy link
Collaborator

All cases listed below failing with error mentioned above:

  • alpha/bgp_routing/test_as_path_filtering.py::test_alpha_lab_bgp_routing_as_path_filtering
  • alpha/bgp_routing/test_communities.py::test_alpha_lab_bgp_routing_communities
  • alpha/bgp_routing/test_local_pref.py::test_alpha_lab_bgp_routing_local_pref
  • alpha/bgp_routing/test_med_metric.py::test_alpha_lab_bgp_routing_med_metric
  • alpha/bgp_routing/test_route_allow_as_in.py::test_alpha_lab_bgp_routing_allow_as_in
  • alpha/bgp_routing/test_route_filtering.py::test_alpha_lab_bgp_routing_route_filtering
  • alpha/bgp_routing/test_route_loop_detection.py::test_alpha_lab_bgp_routing_loop_detection
  • alpha/bgp_routing/test_route_map.py::test_alpha_lab_bgp_routing_route_map
  • alpha/bgp_routing/test_route_selection.py::test_alpha_lab_bgp_routing_route_selection
  • alpha/bgp_routing/test_timers.py::test_alpha_lab_bgp_routing_timers
  • bgp/test_bgp_route_flap.py::test_bgp_route_and_interface_flap
  • tgen/test_traffic_all_ports.py::test_all_ports_tgen_w_traffic

if swp doesn't have any ip assigned, _get_iface_addr_info will return swp_info which will have only mac like {"mac": "xx:xx.."} and we'll see the key error.

`else:
check if the aaddress is on the device else add one
swp_info = {}
await _get_iface_addr_info(dd, swp, swp_info)

if dev_gw != ".".join(swp_info["ip"]):
E KeyError: "ip"
/usr/local/lib/python3.10/dist-packages/dent_os_testbed/utils/test_utils/tgen_utils.py:296: KeyError`

i think by adding below code we can fix the issue.
if 'ip' not in swp_info: out = await IpAddress.add(input_data=[{dd.host_name: [{"dev": swp, "prefix": dev_gw + "/24"}]}] ) elif dev_gw != ".".join(swp_info["ip"]): out = await IpAddress.add(input_data=[{dd.host_name: [{"dev": swp, "prefix": dev_gw + "/24"}]}],)

@mgheorghe mgheorghe added the enhancement New feature or request label Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants