napalm-automation / napalm

Network Automation and Programmability Abstraction Layer with Multivendor support
Apache License 2.0
2.26k stars 554 forks source link

Error to use get_facts in XRV - 6.1.2 #788

Open rarodrigo opened 6 years ago

rarodrigo commented 6 years ago

I am having some problem using napalm_get_facts with filter facts under specific plataform related Cisco.

The issue was found under Cisco XRV IOS version 6.1.2.

Cannot see information in some variable. Follow the logs:

TASK [GET FACTS NAPALM DEVICE MODEL] *********************************************************************************************************
task path: /home/rodrigo/Documents/ansible/Project_Ansible_On-Going/napalm_test/xrv.yaml:8
<10.0.0.2> attempting to start connection
<10.0.0.2> using connection plugin network_cli
<10.0.0.2> local domain socket does not exist, starting it
<10.0.0.2> control socket path is /root/.ansible/pc/b56b2d7f20
<10.0.0.2> <10.0.0.2> ESTABLISH CONNECTION FOR USER: rodrigo on PORT 22 TO 10.0.0.2
<10.0.0.2> <10.0.0.2> ssh connection done, setting terminal
<10.0.0.2> <10.0.0.2> loaded terminal plugin for network_os iosxr
<10.0.0.2> <10.0.0.2> loaded cliconf plugin for network_os iosxr
<10.0.0.2> <10.0.0.2> firing event: on_open_shell()
<10.0.0.2> <10.0.0.2> ssh connection has completed successfully
<10.0.0.2> connection to remote device started successfully
<10.0.0.2> local domain socket listeners started successfully
<10.0.0.2> 
<10.0.0.2> local domain socket path is /root/.ansible/pc/b56b2d7f20
<10.0.0.2> ESTABLISH LOCAL CONNECTION FOR USER: root
<10.0.0.2> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-6978wb8XVp/ansible-tmp-1534004622.74-198820508317370 `" && echo ansible-tmp-1534004622.74-198820508317370="` echo /root/.ansible/tmp/ansible-local-6978wb8XVp/ansible-tmp-1534004622.74-198820508317370 `" ) && sleep 0'
Using module file /usr/local/lib/python2.7/dist-packages/napalm_ansible/modules/napalm_get_facts.py
<10.0.0.2> PUT /root/.ansible/tmp/ansible-local-6978wb8XVp/tmpuvMEbJ TO /root/.ansible/tmp/ansible-local-6978wb8XVp/ansible-tmp-1534004622.74-198820508317370/napalm_get_facts.py
<10.0.0.2> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-6978wb8XVp/ansible-tmp-1534004622.74-198820508317370/ /root/.ansible/tmp/ansible-local-6978wb8XVp/ansible-tmp-1534004622.74-198820508317370/napalm_get_facts.py && sleep 0'
<10.0.0.2> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-local-6978wb8XVp/ansible-tmp-1534004622.74-198820508317370/napalm_get_facts.py && sleep 0'
<10.0.0.2> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-6978wb8XVp/ansible-tmp-1534004622.74-198820508317370/ > /dev/null 2>&1 && sleep 0'
ok: [XRV] => {
    "ansible_facts": {
        "napalm_facts": {
            "fqdn": "XRV", 
            "hostname": "XRV", 
            "interface_list": [
                "GigabitEthernet0/0/0/0", 
                "GigabitEthernet0/0/0/1", 
                "GigabitEthernet0/0/0/2", 
                "MgmtEth0/0/CPU0/0", 
                "Null0"
            ], 
            "model": "", 
            "os_version": "", 
            "serial_number": "", 
            "uptime": 12870, 
            "vendor": "Cisco"
        }, 
        "napalm_fqdn": "XRV", 
        "napalm_hostname": "XRV", 
        "napalm_interface_list": [
            "GigabitEthernet0/0/0/0", 
            "GigabitEthernet0/0/0/1", 
            "GigabitEthernet0/0/0/2", 
            "MgmtEth0/0/CPU0/0", 
            "Null0"
        ], 
        "napalm_model": "", 
        "napalm_os_version": "", 
        "napalm_serial_number": "", 
        "napalm_uptime": 12870, 
        "napalm_vendor": "Cisco"
    }, 
    "changed": false, 
    "invocation": {
        "module_args": {
            "args": null, 
            "dev_os": "iosxr", 
            "filter": [
                "facts"
            ], 
            "hostname": "XRV", 
            "ignore_notimplemented": false, 
            "optional_args": null, 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "provider": {
                "hostname": "10.0.0.2", 
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
                "timeout": 60, 
                "username": null
            }, 
            "timeout": 60, 
            "username": "rodrigo"
        }
    }
}

Like cannot see napalm_os_version, napalm_version.

ktbyers commented 6 years ago

The next step is to figure out what the corresponding XML returned on your device is. Here is what it looks like we are doing:

https://github.com/napalm-automation/napalm/tree/develop/test/iosxr/mocked_data/test_get_facts/normal

But that would need translated into how to retrieve the corresponding XML on your device.

ktbyers commented 6 years ago

@rarodrigo Any chance to get the needed XML information from the device?

rarodrigo commented 6 years ago

@ktbyers I am trying to figure out how to execute command on device and export all directly as xml.

DiogoAndre commented 6 years ago

Below is what I get when I run the XML directly on an XRV running Cisco IOS XR Software, Version 6.1.3[Default].

Looks like <PlatformInventory/> is not supported?

Request

<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
    <Get>
        <Operational>
            <SystemTime/>
            <PlatformInventory/>
        </Operational>
    </Get>
</Request>

Response

<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
    <Get ItemNotFoundBelow="true">
        <Operational>
            <SystemTime MajorVersion="2" MinorVersion="0">
                <Clock>
                    <Year>
                        2018
                    </Year>
                    <Month>
                        10
                    </Month>
                    <Day>
                        26
                    </Day>
                    <Hour>
                        3
                    </Hour>
                    <Minute>
                        57
                    </Minute>
                    <Second>
                        21
                    </Second>
                    <Millisecond>
                        790
                    </Millisecond>
                    <Wday>
                        5
                    </Wday>
                    <TimeZone>
                        UTC
                    </TimeZone>
                    <TimeSource>
                        Calendar
                    </TimeSource>
                </Clock>
                <Uptime>
                    <Hostname>
                        iosxrv-1
                    </Hostname>
                    <Uptime>
                        2927
                    </Uptime>
                </Uptime>
            </SystemTime>
            <PlatformInventory MajorVersion="0" MinorVersion="8" NotFound="true"/>
        </Operational>
    </Get>
    <ResultSummary ErrorCount="0" ItemNotFoundBelow="true"/>
</Response>