-
Notifications
You must be signed in to change notification settings - Fork 742
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
Adding new template for Alcatel aos: show system
Co-authored-by: Michael Bear <38406045+mjbear@users.noreply.github.com>
#1900
Adding new template for Alcatel aos: show system
Co-authored-by: Michael Bear <38406045+mjbear@users.noreply.github.com>
#1900
Conversation
@evilmonkey19 |
Fixed ✅ It was not intended but rather that i'm doing local development. |
ntc_templates/templates/index
Outdated
@@ -11,6 +11,7 @@ | |||
# | |||
Template, Hostname, Platform, Command | |||
|
|||
alcatel_aos_show_system.textfsm, .*, alcatel_aos, show system |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the AOS command line support any shorthand for show system
?
Value CONTACT (.+,(?: https://\S+)?) | ||
Value NAME ([^,]+) | ||
Value LOCATION ([^,]+) | ||
Value Service (\d+) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Value Service (\d+) | |
Value SERVICES (\d+) |
Make plural to match raw output label.
Capitalize capture group name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this suggestion (and others) help, click the button here to accept them. Thank you!
Value DESCRIPTION (.+,.+,[^,]+) | ||
Value OBJECT_ID ([^,]+) | ||
Value UP_TIME (\d+ days \d+ hours \d+ minutes and \d+ seconds) | ||
Value CONTACT (.+,(?: https://\S+)?) | ||
Value NAME ([^,]+) | ||
Value LOCATION ([^,]+) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Value DESCRIPTION (.+,.+,[^,]+) | |
Value OBJECT_ID ([^,]+) | |
Value UP_TIME (\d+ days \d+ hours \d+ minutes and \d+ seconds) | |
Value CONTACT (.+,(?: https://\S+)?) | |
Value NAME ([^,]+) | |
Value LOCATION ([^,]+) | |
Value DESCRIPTION (.+) | |
Value OBJECT_ID (\S+) | |
Value UP_TIME (.+) | |
Value CONTACT (.+) | |
Value NAME (\S+) | |
Value LOCATION (.+) |
Simplify regexes.
Some capture groups do not need to accept spaces (thus \S+
), but others do (hence .+
).
Simpler and flexible should mean less breakage over time.
Value Service (\d+) | ||
Value DATE_TIME (\S+\s*\S+\s*\d+\s*\d+\s*\d+:\d+:\d+\s*(\(\w+\))) | ||
Value AVAILABLE (\d+) | ||
Value COMMENTS ([^,]+) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Value COMMENTS ([^,]+) | |
Value COMMENTS (.+) |
Simplify regex.
Value NAME ([^,]+) | ||
Value LOCATION ([^,]+) | ||
Value Service (\d+) | ||
Value DATE_TIME (\S+\s*\S+\s*\d+\s*\d+\s*\d+:\d+:\d+\s*(\(\w+\))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Value DATE_TIME (\S+\s*\S+\s*\d+\s*\d+\s*\d+:\d+:\d+\s*(\(\w+\))) | |
Value DATE_TIME ((\S+\s*)+) |
Simplify regex.
Fortunately you can (and are) anchoring the match line with that trailing comma within the rule line for this one. 😀
@@ -0,0 +1,27 @@ | |||
Value DESCRIPTION (.+,.+,[^,]+) | |||
Value OBJECT_ID ([^,]+) | |||
Value UP_TIME (\d+ days \d+ hours \d+ minutes and \d+ seconds) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Value UP_TIME (\d+ days \d+ hours \d+ minutes and \d+ seconds) | |
Value UPTIME (.+) |
Move UP_TIME
to UPTIME
as that is a common capture group name. (We're hoping to standardize/normalize where we can.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/networktocode/ntc-templates/blob/master/docs/dev/data_model.md
I haven't added UPTIME in here, but I should. 😉
^\s*System:$$ | ||
^\s*Description:\s*${DESCRIPTION},$$ | ||
^\s*Object\s*ID:\s*${OBJECT_ID},$$ | ||
^\s*Up\s*Time:\s*${UP_TIME},$$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^\s*Up\s*Time:\s*${UP_TIME},$$ | |
^\s*Up\s*Time:\s*${UPTIME},$$ |
Match capture group change (as noted above in the file) to the common occurrence.
^\s*Contact:\s*${CONTACT},$$ | ||
^\s*Name:\s*${NAME},$$ | ||
^\s*Location:\s*${LOCATION},$$ | ||
^\s*Services:\s*${Service},$$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^\s*Services:\s*${Service},$$ | |
^\s*Services:\s*${SERVICES},$$ |
Change capture group name and make all uppercase.
I added all your suggestions 😀 Thanks again! I added also the short-handed version |
@evilmonkey19 Was the Commit suggestion button available? |
Yees it was available hehe. Simply just that sometimes i like to do things manually as everthing is automated :P |
Darn. |
Is there anything i could do to add you? |
I've seen that for making the tests better we can rename the _1 to _R6 and the _2 to _R8 ;) |
I'll see if there's anything else, but for now things appear to be fairly complete on this PR. If you were to add co-author text to the PR description (it might get picked up).
|
show system
show system
Co-authored-by: Michael Bear <38406045+mjbear@users.noreply.github.com>
No description provided.