CiscoTestAutomation / genieparser

sub-component of Genie that parse the device output into structured datastructure
Apache License 2.0
252 stars 388 forks source link

iosxr - Cannot parse "show route ipv6" #75

Closed gdluca closed 4 years ago

gdluca commented 4 years ago

Environment: Platform: IOS-XR 6.5.3 and 6.6.3

> ansible 2.9.4
>   config file = None
>   configured module search path = ['/home/ubuntu/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
>   ansible python module location = /home/ubuntu/venv/issue/lib/python3.7/site-packages/ansible
>   executable location = /home/ubuntu/venv/issue/bin/ansible
>   python version = 3.7.6 (default, Jan 24 2020, 07:14:12) [GCC 7.4.0]

pip packages version:

---------------------------- -----------
aiohttp                      3.6.2      
ansible                      2.9.4      
async-timeout                3.0.1      
attrs                        19.3.0     
backports.ssl                0.0.9      
bcrypt                       3.1.7      
certifi                      2019.11.28 
cffi                         1.13.2     
chardet                      3.0.4      
cryptography                 2.8        
dill                         0.3.1.1    
distro                       1.4.0      
genie                        19.12      
genie.abstract               19.12      
genie.conf                   19.12      
genie.harness                19.12      
genie.libs.conf              19.12      
genie.libs.filetransferutils 19.12      
genie.libs.ops               19.12      
genie.libs.parser            19.12      
genie.libs.sdk               19.12      
genie.libs.telemetry         19.12      
genie.metaparser             19.12      
genie.ops                    19.12      
genie.parsergen              19.12      
genie.predcore               19.12      
genie.telemetry              19.12      
genie.trafficgen             19.12      
genie.utils                  19.12      
idna                         2.8        
IxNetwork                    9.0.1915.16
Jinja2                       2.10.3     
jsonpickle                   1.2        
junit-xml                    1.8        
MarkupSafe                   1.1.1      
multidict                    4.7.4      
netaddr                      0.7.19     
paramiko                     2.7.1      
pathspec                     0.7.0      
pip                          20.0.1     
prettytable                  0.7.2      
psutil                       5.6.7      
pyats                        19.12      
pyats.aereport               19.12      
pyats.aetest                 19.12      
pyats.async                  19.12      
pyats.connections            19.12      
pyats.datastructures         19.12      
pyats.easypy                 19.12      
pyats.kleenex                19.12      
pyats.log                    19.12      
pyats.reporter               19.12      
pyats.results                19.12      
pyats.tcl                    19.12      
pyats.topology               19.12      
pyats.utils                  19.12      
pycparser                    2.19       
PyNaCl                       1.3.0      
pyOpenSSL                    19.1.0     
PyYAML                       5.3        
requests                     2.22.0     
setuptools                   41.2.0     
six                          1.14.0     
tqdm                         4.41.1     
unicon                       19.12.1    
unicon.plugins               19.12.1    
urllib3                      1.25.8     
websocket-client             0.57.0     
wheel                        0.33.6     
xlrd                         1.2.0      
XlsxWriter                   1.2.7      
xlwt                         1.3.0      
xmltodict                    0.12.0     
yamllint                     1.20.0     
yarl                         1.4.2 

Task example:

    - name: run "show route ipv6" on remote devices 
      iosxr_command:
        commands: show route ipv6
      register: result_show_route_ipv6
    - debug:
        msg: "{{ result_show_route_ipv6 }}"
    - name: get parsed data using pyats_parser for "show route ipv6"
      set_fact:
        check_sh_route_ipv6: "{{ result_show_route_ipv6.stdout[0] | pyats_parser('show route ipv6', 'iosxr') }}"
    - debug:    
        msg: "{{ check_sh_route_ipv6 }}"

Error: FAILED! => {"msg": "Unable to parse output for command 'show route ipv6' (local variable 'source_protocol' referenced before assignment)"}

What could be the problem? Two months ago, more or less, I was able to parse "show route ipv6" using the clay584.parse_genie like this:

 tasks:
     - name: run "show route ipv6" on remote devices 
       iosxr_command:
         commands: 
            - show route ipv6
       register: result_show_route_ipv6

     - name: get parsed data using pyats_parser for "show route ipv6"
       set_fact:
         check_sh_route_ipv6: "{{ result_show_route_ipv6.stdout[0] | parse_genie(command='show route ipv6', os='iosxr') }}"

     - debug:
             msg: "{{ check_sh_route_ipv6 }}"

but now I have a similar error:

FAILED! => {"msg": "parse_genie: local variable 'source_protocol' referenced before assignment - Failed to parse command output."}

thaixuann commented 4 years ago

Hello @gdluca , Thanks for reporting the issue. If you can send the device output for this failures to pyats-support-ext@cisco.com so we can verify our fix.

Thanks, --Thai.

gdluca commented 4 years ago

Device output sent. Thanks for the support.

gdluca commented 4 years ago

"show route ipv4" is working fine, sorry.

thaixuann commented 4 years ago

@gdluca thanks for the update.

--Thai.

thaixuann commented 4 years ago

Hello @gdluca ,

We fixed the issue and genie package v20.1 has been released with the fix. Could you please run the following command and try again to see if it works?

pip install genie.libs.parser --upgrade --pre

Thanks, --Thai.

gdluca commented 4 years ago

Yes, it works now!

Thanks!