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

Fix RuntimeError('dictionary keys changed during iteration') #59

Merged

Conversation

samuelbarata
Copy link
Contributor

In the get_mac_address_table function, when processing the gNMI output of an interface with tagged sub-interfaces the function _dictToList will crash as dictionary keys are deleted during iteration.

gNMI example request:

gnmic -a 172.80.80.11:57400 -u admin -p password --skip-verify --path '/interface[name=lag2]/subinterface[index=1]/vlan/encap/single-tagged/vlan-id' -e 'JSON_IETF' get

Response that makes function crash:

[
  {
    "source": "172.80.80.11:57400",
    "timestamp": 1739035251823391605,
    "time": "2025-02-08T17:20:51.823391605Z",
    "updates": [
      {
        "Path": "srl_nokia-interfaces:interface[name=lag2]/subinterface[index=1]/srl_nokia-interfaces-vlans:vlan/encap/single-tagged/vlan-id",
        "values": {
          "srl_nokia-interfaces:interface/subinterface/srl_nokia-interfaces-vlans:vlan/encap/single-tagged/vlan-id": 1
        }
      }
    ]
  }
]

@hellt
Copy link
Collaborator

hellt commented Feb 8, 2025

Thanks @samuelbarata
would you be willing to have a look at the failing clab startup in the test? I presume some config got outdated

@samuelbarata
Copy link
Contributor Author

@hellt can you rerun the CI?

@samuelbarata
Copy link
Contributor Author

@hellt Again please

@samuelbarata
Copy link
Contributor Author

@hellt One last time (I hope)

@hellt hellt merged commit c1fbdb3 into napalm-automation-community:main Feb 9, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants