CiscoTestAutomation / genielibs

genie.libs contains libraries for configuring, retrieving and testing topologies
Apache License 2.0
109 stars 55 forks source link

IOSXE genie learn vrf - missing data #61

Open dpecak opened 3 years ago

dpecak commented 3 years ago

I am trying to use VRF model in my testcases, but I cannot learn data properly on some devices.

Tested on

No exceptions during genie learn process

(venv) [root@dpecak-centos-docker pyATS]# genie learn vrf --testbed-file sda.yaml

Learning '['vrf']' on devices '['Fab1-BC', 'Fab1-E', 'Fab1-WLC']'
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:01<00:00,  1.27s/it]
+==============================================================================+
| Genie Learn Summary for device Fab1-BC                                       |
+==============================================================================+
|  Connected to Fab1-BC                                                        |
|  -   Log: ./connection_Fab1-BC.txt                                           |
|------------------------------------------------------------------------------|
|  Learnt feature 'vrf'                                                        |
|  -  Ops structure:  ./vrf_iosxe_Fab1-BC_ops.txt                              |
|  -  Device Console: ./vrf_iosxe_Fab1-BC_console.txt                          |
|==============================================================================|

+==============================================================================+
| Genie Learn Summary for device Fab1-E                                        |
+==============================================================================+
|  Connected to Fab1-E                                                         |
|  -   Log: ./connection_Fab1-E.txt                                            |
|------------------------------------------------------------------------------|
|  Learnt feature 'vrf'                                                        |
|  -  Ops structure:  ./vrf_iosxe_Fab1-E_ops.txt                               |
|  -  Device Console: ./vrf_iosxe_Fab1-E_console.txt                           |
|==============================================================================|

+==============================================================================+
| Genie Learn Summary for device Fab1-WLC                                      |
+==============================================================================+
|  Connected to Fab1-WLC                                                       |
|  -   Log: ./connection_Fab1-WLC.txt                                          |
|------------------------------------------------------------------------------|
|  Learnt feature 'vrf'                                                        |
|  -  Ops structure:  ./vrf_iosxe_Fab1-WLC_ops.txt                             |
|  -  Device Console: ./vrf_iosxe_Fab1-WLC_console.txt                         |
|==============================================================================|

Cannot get output for Fab1-E and Fab1-WLC. Console and ops outputs are attached: vrf_iosxe_Fab1-BC_console.txt vrf_iosxe_Fab1-BC_ops.txt vrf_iosxe_Fab1-E_console.txt vrf_iosxe_Fab1-E_ops.txt vrf_iosxe_Fab1-WLC_console.txt vrf_iosxe_Fab1-WLC_ops.txt

Running pyats parse of show vrf detail returns correct output Fab1-WLC

(venv) [root@dpecak-centos-docker pyATS]# pyats parse "show vrf detail" --testbed-file sda.yaml --devices Fab1-WLC
{
  "Mgmt-vrf": {
    "address_family": {
      "ipv4 unicast": {
        "flags": "0x0",
        "table_id": "0x1",
        "vrf_label": {
          "allocation_mode": "per-prefix"
        }
      }
    },
    "cli_format": "Old",
    "description": "OOB Mgmt",
    "flags": "0x8",
    "interface": {
      "GigabitEthernet1": {
        "vrf": "Mgmt-vrf"
      }
    },
    "interfaces": [
      "GigabitEthernet1"
    ],
    "support_af": "IPv4 only",
    "vrf_id": 1
  }
}

Fab1-BC

(venv) [root@dpecak-centos-docker pyATS]# pyats parse "show vrf detail" --testbed-file sda.yaml --devices Fab1-BC
{
  "Mgmt-vrf": {
    "address_family": {
      "ipv4 unicast": {
        "flags": "0x0",
        "table_id": "0x1"
      },
      "ipv6 unicast": {
        "flags": "0x0",
        "table_id": "0x1E000001"
      }
    },
    "cli_format": "New",
    "flags": "0x1808",
    "interface": {
      "GigabitEthernet0/0": {
        "vrf": "Mgmt-vrf"
      }
    },
    "interfaces": [
      "GigabitEthernet0/0"
    ],
    "support_af": "multiple address-families",
    "vrf_id": 1
  },
  "SDA_Lab_Employee": {
    "address_family": {
      "ipv4 unicast": {
        "flags": "0x0",
        "route_targets": {
          "1:4099": {
            "route_target": "1:4099",
            "rt_type": "both"
          }
        },
        "table_id": "0x2"
      }
    },
    "cli_format": "New",
    "flags": "0x180C",
    "interface": {
      "LI0.4099": {
        "vrf": "SDA_Lab_Employee"
      },
      "Loopback1021": {
        "vrf": "SDA_Lab_Employee"
      },
      "Loopback1023": {
        "vrf": "SDA_Lab_Employee"
      },
      "Loopback1027": {
        "vrf": "SDA_Lab_Employee"
      },
      "Vlan3002": {
        "vrf": "SDA_Lab_Employee"
      },
      "Vlan920": {
        "vrf": "SDA_Lab_Employee"
      }
    },
    "interfaces": [
      "Loopback1021",
      "Loopback1023",
      "Vlan920",
      "Vlan3002",
      "LI0.4099",
      "Loopback1027"
    ],
    "route_distinguisher": "1:4099",
    "support_af": "multiple address-families",
    "vrf_id": 2
  },
  "SDA_Lab_Guest": {
    "address_family": {
      "ipv4 unicast": {
        "flags": "0x0",
        "route_targets": {
          "1:4100": {
            "route_target": "1:4100",
            "rt_type": "both"
          }
        },
        "table_id": "0x3"
      }
    },
    "cli_format": "New",
    "flags": "0x180C",
    "interface": {
      "LI0.4100": {
        "vrf": "SDA_Lab_Guest"
      },
      "Loopback1025": {
        "vrf": "SDA_Lab_Guest"
      },
      "Vlan3003": {
        "vrf": "SDA_Lab_Guest"
      }
    },
    "interfaces": [
      "Loopback1025",
      "Vlan3003",
      "LI0.4100"
    ],
    "route_distinguisher": "1:4100",
    "support_af": "multiple address-families",
    "vrf_id": 3
  }
}

Library versions

(venv) # pyats version check
You are currently running pyATS version: 21.5.1
Python: 3.6.8 [64bit]

  Package                      Version
  ---------------------------- -------
  genie                        21.5.1
  genie.libs.clean             21.5
  genie.libs.conf              21.5
  genie.libs.filetransferutils 21.5
  genie.libs.health            21.5
  genie.libs.ops               21.5
  genie.libs.parser            21.5
  genie.libs.robot             21.5
  genie.libs.sdk               21.5
  genie.telemetry              21.5
  genie.trafficgen             21.5
  pyats                        21.5.1
  pyats.aereport               21.5.1
  pyats.aetest                 21.5.1
  pyats.async                  21.5.1
  pyats.connections            21.5.1
  pyats.contrib                21.5
  pyats.datastructures         21.5.1
  pyats.easypy                 21.5.1
  pyats.kleenex                21.5.1
  pyats.log                    21.5.1
  pyats.reporter               21.5.1
  pyats.results                21.5.1
  pyats.robot                  21.5.1
  pyats.tcl                    21.5.1
  pyats.topology               21.5.1
  pyats.utils                  21.5.2
  unicon                       21.5.1
  unicon.plugins               21.5
lsheikal commented 3 years ago

Hi @dpecak,

Fab1-BC: Here the parsed output have "route_targets" and "route_distinguisher" in each vrf. This is the reason you were only getting output for this device.

Fab1-E, Fab1-WLC: These two devices does'nt have the above data that's why you were not able to learn the data properly. In this case, we have added support for two new data "description" and "table_id". Now you should be able to learn it from parsed output. The fix will be available in next release.