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

Improve cisco_ios show_lldp_neighbors_detail #1086

Merged
merged 3 commits into from
Feb 26, 2022

Conversation

lamiskin
Copy link
Contributor

ISSUE TYPE
  • Additional Testing and improvements
COMPONENT

ntc_templates/templates/cisco_ios_show_lldp_neighbors_detail.textfsm
cisco_ios
show lldp neighbors details

SUMMARY
  • Capture new power fields where available.
  • Capture chassis id's that contain spaces, but don't match : in the case another field is added on the same line to the ouptut in the future.
  • Tests added for both of these scenarios.
  - local_interface: ""
    chassis_id: "0004.7a2a.bbbb"
    neighbor_port_id: "0004.7a2a.bbbb"
    neighbor_interface: "eth0"
    neighbor: "system2"
    system_description: "Dragonfly"
    capabilities: "S"
    management_ip: "10.132.14.52"
    vlan: ""
    serial: ""
    power_pair: "Spare"
    power_class: "4"
    power_device_type: "2"
    power_priority: "High"
    power_source: "PSE"
    power_requested: "25000"

@@ -1,5 +1,5 @@
Value LOCAL_INTERFACE (\S+)
Value CHASSIS_ID (\S+)
Value CHASSIS_ID ([^:]*)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since matching anything not colon(:) maybe also exclude blank space ?
Should the match be nothing (*) or at least something (+) ?
e.g. ([^:\s]+)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diepes Thanks for the feedback. I've pushed a commit now using + instead of *.

My example in the PR wasn't very clear for this case.
The output I get from a device is:
Chassis id: S7-1200 6DS7 212-1BH40-0XB0 S V-LCCC5820 10 V 4 3 1

Do you think its valid to capture the output chassis-id as the following (including spaces)?:
S7-1200 6DS7 212-1BH40-0XB0 S V-LCCC5820 10 V 4 3 1

@@ -63,6 +70,15 @@ IgnoreDescription
^\s*$$
^.* -> Error

PowerMDI
^\s+Power\s+Pair:\s+${POWER_PAIR}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the variable match is at the end of the line, probably better to follow them with
\s*$$ to ensure no capture of spaces

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @diepes I've pushed your suggested changes now.

@jvanderaa jvanderaa merged commit deddddc into networktocode:master Feb 26, 2022
@lamiskin lamiskin deleted the cisco_ios_lldp_neighbours branch July 20, 2022 05:01
guillaume-mbali pushed a commit to unyc-io/ntc-templates that referenced this pull request Apr 12, 2023
* Improve cisco_ios show_lldp_neighbours_detail

* Ensure yml file has new line at EOF

* Include @diepes suggestions.
cppmonkey pushed a commit to cppmonkey/ntc-templates that referenced this pull request Oct 25, 2023
* Improve cisco_ios show_lldp_neighbours_detail

* Ensure yml file has new line at EOF

* Include @diepes suggestions.
@mjbear
Copy link
Contributor

mjbear commented Jul 21, 2024

resolves #919

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.

4 participants