Skip to content

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

Merged
hellt merged 4 commits intonapalm-automation-community:mainfrom
samuelbarata:samuelbarata-patch-1
Feb 9, 2025
Merged

Fix RuntimeError('dictionary keys changed during iteration')#59
hellt merged 4 commits intonapalm-automation-community:mainfrom
samuelbarata:samuelbarata-patch-1

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