Closed xcluysen closed 5 years ago
Are you getting an ansible error? What is the output from the efp
variable? Is it failing to parse a particular portion of that CLI output?
BTW, this is just the ansible filter plugin that calls Cisco's Genie library. If there is an issue with parsing the data successfully, you will need to file an issue on the GenieParser GitHub page.
The router output never get parsed. I get an Ansible/Python error about that variable being referenced before being assigned at execution of genie_parse : genie_parse: local variable ''micro_block_dict'' referenced before assignment So the program aborts before the efp variable gets assigned.
Can you include the full ansible output so I can see the actual error?
Here it is.
I am not an ansible expert yet, if there is more debug available by turning a flag, tell me and I'll do it.
[root@ULYSSE-ANSIBLE Genie Tests Scripts]# ansible-playbook evc.yml
PLAY [pyATS testing] ****
TASK [Read in parse_genie role] *****
TASK [Run the show EFP command] ***** ok: [Eos]
TASK [Set EFP fact with Genie filter plugin] **** fatal: [Eos]: FAILED! => msg: 'genie_parse: local variable ''micro_block_dict'' referenced before assignment - Failed to parse command output.'
PLAY RECAP ** Eos : ok=1 changed=0 unreachable=0 failed=1
Hi, genie developer here - it seems an issue with one of our parser. Can you send us your full device output; and we will look into it early next week!
If you prefer for privacy reason, you can send your output at pyats-support-ext@cisco.com
Hi,
Please see attached sanitized version of the switch output (only Description field is changed). Acheloos-EFP.txt
Switch is a ME-3600X running IOS 15.4(3)S10.
Same problem/issue with command run on an ASR920-4SZ-A running IOS XE 3.18.4SP4 I also attach the sanitized version, as the output is a little bit different, being IOS XE. Ajax-EFP.txt
Great, thanks. We will look into it and let you know.
Hi JB,
Thanks for the update, however I get an error when trying to upgrade :
[root@ANSIBLE Genie Tests Scripts]# pip install genie.lis.parser --upgrade --pre Collecting genie.lis.parser ERROR: Could not find a version that satisfies the requirement genie.lis.parser (from versions: none) ERROR: No matching distribution found for genie.lis.parser
Am I missing something ?
Best Regards, Xavier.
@xcluysen - I sent it too quickly, This enhancement will be done today/tomorrow.
And ; pip install genie.libs.parser --upgrade --pre
Thanks,
Hi JB,
I have installed the latest parser (19.6.1b1), but the playbook gives exactly the same error as before :
TASK [Set EFP fact with Genie filter plugin] *** fatal: [Eos]: FAILED! => msg: 'genie_parse: local variable ''micro_block_dict'' referenced before assignment - Failed to parse command output.'
Hi @xcluysen - It has now been released, the fix should work.
pip install genie.libs.parser --upgrade --pre
Let me know if all is good now
Thanks,
@xcluysen Is this working now? Can I close this issue?
@clay584 Yes it works, I sent email but apparently it failed to show here. You can close the issue.
Simple Playbook used : `# Test of PyATS / Genie
name: pyATS testing hosts: Eos gather_facts: no connection: network_cli
tasks:
name: Read in parse_genie role include_role: name: clay584.parse_genie
name: Run the show EFP command ios_command: commands:
name: Set EFP fact with Genie filter plugin set_fact: efp: "{{ showefp['stdout'][0] | parse_genie(command='show ethernet service instance detail', os='iosxe') }}"
name: Debug pyATS facts - EFPs to check data structure received debug: var: efp `
Result from router command that can't be parsed (extract) :