I’m reporting a bug in gnpy related to the YANG conversion functions.
I’m using yang_to_legacy to develop the gnpy APIs.
I’m doing:
legacy_data = yang_to_legacy(json.loads(request.json))
and then I expect to be able to read:
service = legacy_data['gnpy-path-computation:services']
topology = legacy_data['gnpy-network-topology:topology']
equipment = legacy_data['gnpy-eqpt-config:equipment']
but I get this error:
cr = raman_coefficient.pop('cr')
TypeError: 'str' object cannot be interpreted as an integer
The issue seems to come from a conversion problem, because it works if I convert only the equipment part of the API payload:
equipment = yang_to_legacy(json.loads(request.json)["gnpy-api:api"]['gnpy-eqpt-config:equipment'])
So the result of yang_to_legacy seems to be different depending on whether I pass the full payload or only the gnpy-eqpt-config:equipment section.
I added some debug prints for dict/list conversion here:
https://pastebin.com/GxRzQht5
I’m reporting a bug in gnpy related to the YANG conversion functions.
I’m using
yang_to_legacyto develop the gnpy APIs.I’m doing:
legacy_data = yang_to_legacy(json.loads(request.json))
and then I expect to be able to read:
service = legacy_data['gnpy-path-computation:services']
topology = legacy_data['gnpy-network-topology:topology']
equipment = legacy_data['gnpy-eqpt-config:equipment']
but I get this error:
cr = raman_coefficient.pop('cr')
TypeError: 'str' object cannot be interpreted as an integer
The issue seems to come from a conversion problem, because it works if I convert only the equipment part of the API payload:
equipment = yang_to_legacy(json.loads(request.json)["gnpy-api:api"]['gnpy-eqpt-config:equipment'])
So the result of
yang_to_legacyseems to be different depending on whether I pass the full payload or only thegnpy-eqpt-config:equipmentsection.I added some debug prints for dict/list conversion here:
https://pastebin.com/GxRzQht5