CiscoTestAutomation / genieparser

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

[IOS-XE] show lisp instance-id {instance_id} {address_family} server registration-history #875

Open dmychepk opened 1 month ago

dmychepk commented 1 month ago

2024-07-31 00:12:19,420: %UNICON-INFO: +++ [edited] with via 'ssh': executing command 'show lisp instance-id 1 ipv4 server registration-history' +++ show lisp instance-id 1 ipv4 server registration-history Map-Server registration history Roam = Did host move to a new location? WLC = Did registration come from a Wireless Controller? Prefix qualifier: + = Register Event, - = Deregister Event, * = AR register event

Timestamp (EDT) Instance Proto Roam WLC Source EID prefix / Locator Jul 30 20:11:05.927 1 TCP No No 7.255.0.1

SchemaEmptyParserError: Parser Output is empty

Harishv01 commented 1 month ago

Can you please share the output in the correct format? Thank you.

Harishv01 commented 1 month ago

Hi, I am able to reproduce the issue. Kindly give me some time to fix it.

ThomasJRyan commented 1 month ago

Unfortunately, we have two parsers that fit this command

genie.libs.parser.iosxe.show_lisp_ipv4.ShowLispIpv4ServerDetail and genie.libs.parser.iosxe.show_lisp.ShowLispRegistrationHistory

Due to the nature of our parser searching, it's incredibly difficult to determine which parser should be used given the context.

I cannot guarantee that we will ever provided an adequate fix to this. However, for the time being, you can pass fuzzy=True to device.parse() to have it find and retrieve both parsers

IE

device.parse("show lisp instance-id 1 ipv4 server registration-history", fuzzy=True)
ThomasJRyan commented 1 month ago

A bit of a band-aid fix that you could apply (and hopefully raise a PR to help others in the same situation) would be to modify this line

https://github.com/CiscoTestAutomation/genieparser/blob/cece987eea903856b03026b3952279662a2868b7/src/genie/libs/parser/iosxe/show_lisp.py#L3924

to be

'show lisp instance-id {instance_id} ipv4 server registration-history',
'show lisp instance-id {instance_id} ipv6 server registration-history',

Which would make it a more exact match and fix up the fuzzy search problems

Harishv01 commented 1 month ago

Hi @dmychepk, I tried Thomas's suggestion and it is working. If you'd like, you can raise a PR and contribute.

Thank you

Output:

{'lisp_id': {0: {'eid_address': {'25.0.29.26/32': [{'time': 'Jul 30 20:11:05.927', 'instance_id': 1, 'protocol': 'TCP', 'roam': 'No', 'wlc': 'No', 'source': '7.255.0.1', 'reg_type': '+', 'eid': '25.0.29.26', 'mask': 32}], '25.0.29.23/32': [{'time': 'Jul 30 20:11:05.927', 'instance_id': 1, 'protocol': 'TCP', 'roam': 'No', 'wlc': 'No', 'source': '7.255.0.1', 'reg_type': '+', 'eid': '25.0.29.23', 'mask': 32}], '25.0.29.22/32': [{'time': 'Jul 30 20:11:05.927', 'instance_id': 1, 'protocol': 'TCP', 'roam': 'No', 'wlc': 'No', 'source': '7.255.0.1', 'reg_type': '+', 'eid': '25.0.29.22', 'mask': 32}], '25.0.29.21/32': [{'time': 'Jul 30 20:11:05.927', 'instance_id': 1, 'protocol': 'TCP', 'roam': 'No', 'wlc': 'No', 'source': '7.255.0.1', 'reg_type': '+', 'eid': '25.0.29.21', 'mask': 32}]}}}}

Harishv01 commented 3 weeks ago

Hi, I have raised a PR for this and merged it. This fix will be available in version 24.8. Hence, I am closing the issue. Thank you.