Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port-channel Fixes for iosxe ShowCtsInterface parser (iosxe/show_cts) #815

Merged

Conversation

aj-cruz
Copy link

@aj-cruz aj-cruz commented Jan 26, 2024

Description

Fixes/Updates to show_cts iosxe parser and associated tests to support port-channel interfaces.

  • IOSXE
    • Modified ShowCtsInterfaceSchema:
      • Changed global_dot1x_feature from schema to Optional (not present on port-channel interfaces)
      • Changed cts mode value from schema to Optional to (not present when cts status is disabled)
    • Modified ShowCtsInterface:
      • Updated regex pattern p2 to also match Port-channel interfaces
      • Updated regex pattern p3 to also match CTS disabled status
      • Added conditional to cts_dict so mode key is not generated if cts is disabled
    • Modified golden_output2_expected test data
      • Added expected output for Port-channel interfaces
    • Added golden_output4 test data & expected results

Motivation and Context

Resolves #812

Impact (If any)

Screenshots:

Code for using the fixed parser:
gh_screenshot1
Code for displaying the results:
gh_screenshot2
The results from running the code with the proposed fixes:
gh_screenshot3

Checklist:

  • I have updated the changelog.
  • I have updated the documentation (If applicable).
  • I have added tests to cover my changes (If applicable).
  • All new and existing tests passed.
  • All new code passed compilation.

@aj-cruz aj-cruz requested a review from a team as a code owner January 26, 2024 15:01
@aj-cruz aj-cruz requested review from Taarini and lsheikal January 26, 2024 15:01
@aj-cruz
Copy link
Author

aj-cruz commented Jan 30, 2024

I've added new golden_output files

@SohanTirpude
Copy link
Contributor

I've added new golden_output files

Hello @aj-cruz, I have just checked your PR and it seems you removed the output from golden_output2_output.txt file. Please revert it back.

@aj-cruz
Copy link
Author

aj-cruz commented Jan 30, 2024

Hello @SohanTirpude

I reverted golden_output2, but it is now failing Action tests.
This is what I was trying to explain, before I introduced my changes golden_output2_output.txt already had output for port-channels, but golden_output2_expected.json did not account for them and because the parser ignored the port-channel interfaces (due to the regex pattern) the testing was successful.

However, now that I added code to address that, the golden_output2_expected will no longer match.
I believe golden_output 2 must be modified to either remove port-channel interfaces from the output or add port-channel interfaces to the expected.
If the latter then I think there's really no need for the new golden_output4.

Let me know how you would like me to proceed. Thanks.

@SohanTirpude
Copy link
Contributor

SohanTirpude commented Jan 30, 2024

Hello @aj-cruz,

Yes, as you mentioned we will need to update the golden_output2_expected.py file with the newer output.

As per the guidelines, we should not remove anything from "*_output.txt" files and as per our changes, we can update the "*_expected.py" files. But along with these changes, we must add the newer output files. Because with the new output, we are seeing this above-mentioned error. So, to reproduce that error, we need original new output.

I hope it is clear now. Kindly let me know if it is not.

@aj-cruz
Copy link
Author

aj-cruz commented Jan 30, 2024

@SohanTirpude Understood, thanks. I've added port-channel interfces to golden_output2_expected and it is passing Actions tests. I believe it is ready for review.

@Taarini
Copy link
Contributor

Taarini commented Feb 1, 2024

Please pull the latest dev code and then merge this PR

@aj-cruz
Copy link
Author

aj-cruz commented Feb 1, 2024

Hello @Taarini

I'm not sure I did this correct, I'm kinda new to all this, but I did a git merge from upstream/master to my branch and my Actions test are failing with this error:

2024-02-01T16:53:19.0342828Z 2024-02-01T16:53:19: %SCRIPT-ERROR: �[31mTraceback (most recent call last):�[0m�[39m
2024-02-01T16:53:19.0344081Z 2024-02-01T16:53:19: %SCRIPT-ERROR: �[31m  File "/home/runner/work/genieparser/genieparser/src/genie/libs/parser/utils/unittests.py", line 575, in test_golden�[0m�[39m
2024-02-01T16:53:19.0344552Z 2024-02-01T16:53:19: %SCRIPT-ERROR: �[31m    parsed_output = obj.parse(**arguments)�[0m�[39m
2024-02-01T16:53:19.0345397Z 2024-02-01T16:53:19: %SCRIPT-ERROR: �[31m  File "src/genie/metaparser/_metaparser.py", line 308, in genie.metaparser._metaparser.MetaParser.parse�[0m�[39m
2024-02-01T16:53:19.0346400Z 2024-02-01T16:53:19: %SCRIPT-ERROR: �[31m  File "/home/runner/work/genieparser/genieparser/src/genie/libs/parser/iosxe/show_platform.py", line 35373, in cli�[0m�[39m
2024-02-01T16:53:19.0346887Z 2024-02-01T16:53:19: %SCRIPT-ERROR: �[31m    m = p3.match(line)�[0m�[39m
2024-02-01T16:53:19.0347304Z 2024-02-01T16:53:19: %SCRIPT-ERROR: �[31mNameError: name 'p3' is not defined�[0m�[39m

Looks like the show_platform iosxe parser from the master branch has a problem?

@SohanTirpude
Copy link
Contributor

Hello @aj-cruz,

Thank you very much for letting us know about this. Yes, it looks like regex p3 is missing from the master branch.

Can you please do us a favour and add the below lines of code after regex p2, especially after this line#35346?

#|       INTERFACE |      IF_ID | SADB_ID | SW_NUM | ASIC |
#|       Tunnel201 | 0x00000216 |       1 |      1 |    0 |
p3 = re.compile(r'^\s+\|\s+(?P<tunnel_int>Tunnel\d+)\s+\|\s+(?P<if_id>\w+)\s+\|\s+(?P<sbad_info>\d+)\s+\|\s+(?P<switch_number>\d+)\s+\|\s+(?P<asic_id>\d+)\s+\|')

Kindly let me know if you have any confusion.

Thank you.

@aj-cruz
Copy link
Author

aj-cruz commented Feb 2, 2024

Hello @SohanTirpude ,

You want me to add that to show_platform.py in my aj_fix_show_cts_iosxe branch?

@aj-cruz
Copy link
Author

aj-cruz commented Feb 2, 2024

Looks like now the Actions test are failing with this:

2024-02-02T17:02:04.4755592Z 2024-02-02T17:02:04: %AETEST-INFO: +..............................................................................+
2024-02-02T17:02:04.4756093Z 2024-02-02T17:02:04: %AETEST-INFO: :    Starting STEP 1.1.1: Gold -> iosxe -> ShowPlatformSoftwareDistributedI    :
2024-02-02T17:02:04.4756510Z 2024-02-02T17:02:04: %AETEST-INFO: :                       psecTunnelInfo -> golden_output2                       :
2024-02-02T17:02:04.4756879Z 2024-02-02T17:02:04: %AETEST-INFO: +..............................................................................+
2024-02-02T17:02:04.4780385Z 2024-02-02T17:02:04: %SCRIPT-ERROR: �[31mTraceback (most recent call last):�[0m�[39m
2024-02-02T17:02:04.4781801Z 2024-02-02T17:02:04: %SCRIPT-ERROR: �[31m  File "/home/runner/work/genieparser/genieparser/src/genie/libs/parser/utils/unittests.py", line 575, in test_golden�[0m�[39m
2024-02-02T17:02:04.4782741Z 2024-02-02T17:02:04: %SCRIPT-ERROR: �[31m    parsed_output = obj.parse(**arguments)�[0m�[39m
2024-02-02T17:02:04.4783672Z 2024-02-02T17:02:04: %SCRIPT-ERROR: �[31m  File "src/genie/metaparser/_metaparser.py", line 329, in genie.metaparser._metaparser.MetaParser.parse�[0m�[39m
2024-02-02T17:02:04.4784537Z 2024-02-02T17:02:04: %SCRIPT-ERROR: �[31m  File "src/genie/metaparser/_metaparser.py", line 322, in genie.metaparser._metaparser.MetaParser.parse�[0m�[39m
2024-02-02T17:02:04.4785510Z 2024-02-02T17:02:04: %SCRIPT-ERROR: �[31m  File "src/genie/metaparser/util/schemaengine.py", line 430, in genie.metaparser.util.schemaengine.Schema.validate�[0m�[39m
2024-02-02T17:02:04.4786523Z 2024-02-02T17:02:04: %SCRIPT-ERROR: �[31mgenie.metaparser.util.exceptions.SchemaUnsupportedKeyError: Unsupported keys: ['svti_tunnel']�[0m�[39m

@SohanTirpude SohanTirpude merged commit 266aeee into CiscoTestAutomation:master Feb 5, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iosxe show cts interface parser doesn't work with port channel interface on Cat 9300
4 participants