날짜: 07-13-2021 08:30 AM
Hi All,
I am trying to reference an xpath of service A in service B. In service B will first lookup for devicename(key) and prefix id(key)
the third key is static [public='true']:
Service A:
/services/test:test[devicename='ww']/prefixes[prefix='6000'][public='true']/ipv4Address 200.1.1.1
/services/test:test[devicename='ww']/prefixes[prefix='6000'][public='false']/ipv4Address 172.1.1.1
Service B:
해결되었습니다! 솔루션으로 이동.
날짜: 07-13-2021 09:02 AM
날짜: 07-19-2021 01:39 AM
Hello,
Looks like you are trying to get the value of the leaf
root.services.devicename["ww"].prefixes[6000,"true"].ipv4Address
inside the variable for your templates.
Couple of points here:
* As @vleijon mentioned the correct way to reference the leaf should use the python syntax for multi key list (you can look it up there: https://developer.cisco.com/docs/nso/guides/#!python-api-overview/maagic-api - subsection List and List Elements - there is no anchor at this hierarchy level so cannot point you to it directly)
* You actually don't need the f string
From what I understand from your model, a possible resolution in service B would be:
vars.add('ipv4Address', root.services.devicename[service.Service_B_devicename].prefixes[service.prefix,"true"].ipv4Address)
which *SHOULD* put the value of the leaf ipv4Address for (6000, "true") inside the variable you are then using in your template.
날짜: 07-13-2021 09:02 AM
날짜: 07-13-2021 09:27 AM
prefixes Is a list with two keys: prefix and public.
prefix is will be selected in service B, while public is always true.
날짜: 07-19-2021 01:39 AM
Hello,
Looks like you are trying to get the value of the leaf
root.services.devicename["ww"].prefixes[6000,"true"].ipv4Address
inside the variable for your templates.
Couple of points here:
* As @vleijon mentioned the correct way to reference the leaf should use the python syntax for multi key list (you can look it up there: https://developer.cisco.com/docs/nso/guides/#!python-api-overview/maagic-api - subsection List and List Elements - there is no anchor at this hierarchy level so cannot point you to it directly)
* You actually don't need the f string
From what I understand from your model, a possible resolution in service B would be:
vars.add('ipv4Address', root.services.devicename[service.Service_B_devicename].prefixes[service.prefix,"true"].ipv4Address)
which *SHOULD* put the value of the leaf ipv4Address for (6000, "true") inside the variable you are then using in your template.
새로운 아이디어를 발견하고 저장하세요. 전문가 답변, 단계별 가이드, 최근 주제 등 다양한 내용을 확인해 보세요.
처음이신가요? 아래 팁들을 확인해 보세요. 시스코 커뮤니티 사용하기 새 멤버 가이드