CiscoTestAutomation / genielibs

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

Learn fdp model parser exception on Cisco NXOS in genie.metaparser.util.schemaengine.Schema.validate: Missing keys #153

Closed Sulray closed 8 months ago

Sulray commented 8 months ago

When doing the CLI command genie learn fdb --testbed-file /folder/testbed.yaml --devices {my_device_hostname} -v, I have an exception traceback:

Issue while parsing: <class 'genie.libs.parser.nxos.show_fdb.ShowMacAddressTable'>

Traceback (most recent call last): File "src/genie/cli/commands/learn.py", line 365, in genie.cli.commands.learn.LearnCommand._retrieve_ops File "/folder/.venv/lib/python3.8/site-packages/genie/libs/ops/fdb/nxos/fdb.py", line 123, in learn self.make(final_call=True) File "/folder/.venv/lib/python3.8/site-packages/genie/ops/base/base.py", line 103, in make self.maker.make(*args, **kwargs) File "src/genie/ops/base/maker.py", line 315, in genie.ops.base.maker.Maker.make File "src/genie/ops/base/maker.py", line 427, in genie.ops.base.maker.Maker._call_parser File "src/genie/metaparser/_metaparser.py", line 342, in genie.metaparser._metaparser.MetaParser.parse File "src/genie/metaparser/_metaparser.py", line 322, in genie.metaparser._metaparser.MetaParser.parse File "src/genie/metaparser/util/schemaengine.py", line 419, in genie.metaparser.util.schemaengine.Schema.validate genie.metaparser.util.exceptions.SchemaMissingKeyError: Missing keys: [['mac_table', 'vlans', '-', 'mac_addresses', '0000.eeef.f118', 'drop', 'age'], ['mac_table', 'vlans', '-', 'mac_addresses', '0000.eeef.f118', 'drop', 'mac_type']]

Notice that the line associated with the mac address 0000.eeef.f118 in the output is the following:

  VLAN/BD   MAC Address      Type      age     Secure NTFY Ports/SWID.SSID.LID
---------+-----------------+--------+---------+------+----+------------------
*     -    0000.eeef.f118    static       -       F    F  Drop (Eth17/3.280)

The device is a Cisco NXOS:

It's probably an issue with the * not being recognised by the parser.

Harishv01 commented 8 months ago

Hello Sulray,

Currently, I am working on it, kindly give me some time to debug it.

Thank you.

Harishv01 commented 8 months ago

Hi,

Can you share the raw output?

Sulray commented 8 months ago

Hi Harishv,

Do you mean the raw output of the learn command directly or the output of the command which led to an error in the learn ?

Harishv01 commented 8 months ago

Hi Sulray, Please provide both the output of the command that resulted in an error and the command as well.

Sulray commented 8 months ago

The command was :

genie learn fdb --testbed-file ./testbed.yaml --devices a1aaabb1 -v

The output in the terminal at the end was :

+==============================================================================+
| Genie Learn Summary for device a1aaabb1                                      |
+==============================================================================+
|  Connected to a1aaabb1                                                       |
|  -   Log: ./connection_a1aaabb1.txt                                          |
|------------------------------------------------------------------------------|
|  Could not learn feature 'fdb'                                               |
|  -  Exception:      ./fdb_nxos_a1aaabb1_exception.txt                        |
|  -  Ops structure:  ./fdb_nxos_a1aaabb1_ops.txt                              |
|  -  Device Console: ./fdb_nxos_a1aaabb1_console.txt                          |
|==============================================================================|

In ./fdb_nxos_a1aaabb1_exception.txt:

Issue while parsing: <class 'genie.libs.parser.nxos.show_fdb.ShowMacAddressTable'>

Traceback (most recent call last):
  File "src/genie/cli/commands/learn.py", line 365, in genie.cli.commands.learn.LearnCommand._retrieve_ops
  File "/home/user/project/.venv/lib/python3.8/site-packages/genie/libs/ops/fdb/nxos/fdb.py", line 123, in learn
    self.make(final_call=True)
  File "/home/user/project/.venv/lib/python3.8/site-packages/genie/ops/base/base.py", line 103, in make
    self.maker.make(*args, **kwargs)
  File "src/genie/ops/base/maker.py", line 315, in genie.ops.base.maker.Maker.make
  File "src/genie/ops/base/maker.py", line 427, in genie.ops.base.maker.Maker._call_parser
  File "src/genie/metaparser/_metaparser.py", line 342, in genie.metaparser._metaparser.MetaParser.parse
  File "src/genie/metaparser/_metaparser.py", line 322, in genie.metaparser._metaparser.MetaParser.parse
  File "src/genie/metaparser/util/schemaengine.py", line 419, in genie.metaparser.util.schemaengine.Schema.validate
genie.metaparser.util.exceptions.SchemaMissingKeyError: Missing keys: [['mac_table', 'vlans', '-', 'mac_addresses', '0000.0c9f.f118', 'drop', 'mac_type'], ['mac_table', 'vlans', '-', 'mac_addresses', '0000.eeef.f118', 'drop', 'age']]

In ./fdb_nxos_a1aaabb1_ops.txt:

{
  "_exclude": [],
  "attributes": null,
  "commands": null,
  "connections": null,
  "context_manager": {},
  "raw_data": false
}

In ./fdb_nxos_a1aaabb1_console.txt (only the interesting part from command 'show mac address-table'):

a1aaabb1# 
+++ r1mlbga4 with via 'cli': executing command 'show mac address-table' +++
show mac address-table

 Note: MAC table entries displayed are getting read from software.
 Use the 'hardware-age' keyword to get information related to 'Age' 

 Legend: 
        * - primary entry, G - Gateway MAC, (R) - Routed MAC, O - Overlay MAC
        age - seconds since last seen,+ - primary entry using vPC Peer-Link, E - EVPN entry 
        (T) - True, (F) - False ,  ~~~ - use 'hardware-age' keyword to retrieve age info 
  VLAN/BD   MAC Address      Type      age     Secure NTFY Ports/SWID.SSID.LID
---------+-----------------+--------+---------+------+----+------------------
G     -    0000.eeef.f113    static       -       F    F  sup-eth1(R) (Po90.275)
*     -    0000.eeef.f118    static       -       F    F  Drop (Eth17/3.280)
G 301      0000.eeef.f12d    static       -       F    F  sup-eth1(R)
G 440      0000.eeef.f1b8    static       -       F    F  vPC Peer-Link(R)

Is it what you wanted ? It's just a little more detailed than the initial comment.

Harishv01 commented 8 months ago

Hi,

Thank you for sharing the details, kindly give us some time to debug the issue

Thank you!

Harishv01 commented 8 months ago

Hi Sulray,

I have raised a pull request for this. Once it is merged, I will let you know.

Thank you!!

Harishv01 commented 8 months ago

Hi,

I have merged the pull request, and you will see the fix in the next version, i.e., 24.3. Therefore, I am closing this ticket

Thank you!