aci_epg. output file is not in proper format when using loop (DCNE-323)
I used the below to create multiple epg's and it works fine but the output file being generated not in a proper format. Because of this i cant run NDI Pre-change analysis feature and i had to manually edit the file to make it in a proper format.
-
name: Create EPG aci_epg: host: "{{ host }}" username: username
password: "{{ password }}" tenant: "{{ item.Tenant }}" ap: "{{ item.AP }}" epg: "{{ item.EPG }}" bd: "{{ item.Bridge_domain }}" description: "{{ item.Description }}" state: "{{ item.State }}" validate_certs: no output_level: debug output_path: ./output/output.json loop: "{{ input.list }}"
I have attached the output i am getting and the expected output. Can you please have a look ?
Hi @prasanthvelunny78,
This format is expected since per task execution the output is appended to the file. When looping a task, multiple task executions are done which are unaware of each others output and thus also full config as you expect it. This accepted by NDI in the past , which version of NDI are you using for PCV?
@akinross
I tried it manually uploading the file but it gives me error.
NDI Version 6.5.1.32
ND. 3.2.1i
I opened a case with Cisco and they suggested to manually edit the file. But it wont work for us as we are using Gitlab pipeline.
Pipeline structure
- Ansible Dry run
- Run NDI PCV using the output created by Ansible Dry run
- Push the config if all ok
- NDI Post check
Please let me know if the format is working in this version.
Could you provide the error/traceback details of NDI?
Error is Couldnt parse change file. As I mentioned if put all epg's under fvAp manually then it works.
I also noticed, If run the same script again then it creates duplicate objects
I have added it to the backlog, we will update it here accordingly.
Thank you very much!
Hi @prasanthvelunny78, thank you for raising this issue.
As @akinross mentioned each looping task has no context of each other and will simply append the configuration to the specified output file. This is also why you see duplicate entries written into the file when running the playbook multiple times. You would need to either delete the file if it already exists or write to a different file for each playbook execution.
Would you be able to share how you are running NDI PCV in the GitLab pipeline? Does it use the cisco.nd.nd_pcv module?
@prasanthvelunny78 Any update on @samiib request?
Hi There,
Apologies for the delay. Yes I am using cisco.nd.nd_pcv. Cisco provided a simple script to make it in a proper format so NDI can read it. I havent tested it but will test it soon and give you an update.
Many Thanks
Hi @prasanthvelunny78,
I am following up to see if you have any further updates.
I revisited this issue to test out the outputs you provided. In our NDI environment I am able to successfully start a PCV job using the aci-epg.output_not_proper_format.json file with the cisco.nd.nd_pcv module. This module is designed to parse the looping Ansible output format and converts it into a proper ACI config dictionary before sending it to NDI.
Are you able to share the error output from cisco.nd.nd_pcv?
Hi @prasanthvelunny78,
Any update? Did you see the comment from @samiib above?
Closing as we are not getting updates. Re-open an issue if this is still an issue.