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

TXTFSM will not process template even though Regex checker says line is acceptable for ciena SAOS #779

Closed
sroodman opened this issue Jul 16, 2020 · 1 comment

Comments

@sroodman
Copy link

sroodman commented Jul 16, 2020

ISSUE TYPE
  • Bug Report
  • Template Creation Help
TEMPLATE USING
 port show status
Value NAME (([0-9A-Za-z\.]+)|\s*)
Value DESC ([0-9A-Za-z\.\_]+)
Value LINK ((Up|Down)|\s*)
Value DURATION ((\w+\s*\wh\s*\w+m\s*\w+)|\s*)
Value XCVR ((\s*)|(\w+))
Value STP ((\s*|(\w+))
VALUE SPEED  ((\w+\/\w+)|(\s*))
VALUE MTU (([0-9]+)|\s*)
VALUE FLOW (([0-9A-Za-z\.\-]+)|\s*)


Start
  ^\+-+\s*PORT\s*OPERATIONAL\s*STATE\s*-+\+ 
  ^\+-+
  ^\|\s*\|\s*\|\s*\|\w+\s*\w+\|\s*\|\s*\|\w+\/\s*\|\w+\s*\|\w+\s*\|
  ^\|\s*\#\#\s*\|\s*Description\s*\|\w+\|\w+\s*\|\w+\|\w+\|\w+\s*\|\w+\|\w+\s*\|
  ^\|-+
  ^\|\s*${NAME}\s*\|\s*${DESC}\s*\|\s*${LINK}\s*\|\s*${DURATION}\|\s*${XCVR}\s*\|${STP}\|\s*${SPEED}\s*\|$(MTU)\|\s*${FLOW}\s*\| -> Record
  ^\+-+
  ^\s*$$
  ^. -> Error
SAMPLE COMMAND OUTPUT
5142001> port show status
+---------------------------- PORT OPERATIONAL STATUS ---------------------------+
|    |                               |    |Link State|    |   |Speed/ |MTU |Flow |
| ## | Description                   |Link|Duration  |XCVR|STP|Duplex |Size|Ctrl |
+----+-------------------------------+----+----------+----+---+-------+----+-----+
|1   |Text-blah_blah_blah_b          | Up |302d 4h43m|Ena |FWD|1000/FD|9216|off  |
|2   |Text-blah_blah_blah_b          | Up |292d 6h23m|Ena |FWD|1000/FD|9216|a-tx |
|3   |Some_AUTOMOTIVE_SOMEWHERE_with_|Down|  0h 0m 0s|    |Dis|       |9216|     |
|    |903wraparound                  |    |          |    |   |       |    |     |
|4   |Text-blah_blah_blah_b          |Down|  0h 0m 0s|    |Dis|       |9216|     |
|5   |Text-blah_blah_blah_b          | Up |159d 4h16m|Ena |FWD|1000/FD|9216|off  |
|6   |Text-blah_blah_blah_b          | Up | 15d21h12m|Ena |FWD|1000/FD|9216|off  |
|7   |Text-blah_blah_blah_b          | Up | 20d23h40m|Ena |FWD|1000/FD|9216|off  |
|8   |Text-blah_blah_blah_b          | Up | 15d21h13m|Ena |FWD|1000/FD|9216|off  |
|9   |Text-blah_blah_blah_b          | Up |  7d 9h19m|Ena |FWD|1000/FD|9216|off  |
|10  |Text-blah_blah_blah_b          | Up |  6d 5h 5m|Ena |FWD|1000/FD|9216|off  |
|11  |                               |Down|  0h 0m 0s|    |Dis|       |9216|     |
|12  |                               |Down|  0h 0m 0s|    |Dis|       |9216|     |
|13  |                               |Down|  0h 0m 0s|    |Dis|       |9216|     |
|14  |                               |Down|  0h 0m 0s|    |Dis|       |9216|     |
|15  |                               |Down|  0h 0m 0s|    |Dis|       |9216|     |
|16  |                               |Down|  0h 0m 0s|    |Dis|       |9216|     |
|17  |                               |Down|  0h 0m 0s|    |Dis|       |9216|     |
|18  |                               |Down|  0h 0m 0s|    |Dis|       |9216|     |
|19  |                               |Down|  0h 0m 0s|    |Dis|       |9216|     |
|20  |                               |Down|  0h 0m 0s|    |Dis|       |9216|     |
|21  |INNI_10000_TO_DEVICEblah__72100| Up |322d13h18m|Ena |FWD| 10G/FD|9216|off  |
|    |more1wraparound                |    |          |    |   |       |    |     |
|22  |                               |Down|  0h 0m 0s|    |Dis|       |9216|     |
|23  |                               | Up |113d21h48m|Ena |FWD| 10G/FD|9216|off  |
|24  |                               | Up |322d13h18m|Ena |FWD| 10G/FD|9216|off  |
+----+-------------------------------+----+----------+----+---+-------+----+-----+


SUMMARY
This line:  ^\|\s*\|\s*\|\s*\|\w+\s*\w+\|\s*\|\s*\|\w+\/\s*\|\w+\s*\|\w+\s*\|  errors out when applying 
|    |                               |    |Link State|    |   |Speed/ |MTU |Flow |

Regex checkers on the web say it has no problem.

STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
textfsm.TextFSMError: State Error raised. Rule Line: 30. Input Line: |    |                               |    |Link State|    |   |Speed/ |MTU |Flow |

@itdependsnetworks
Copy link
Contributor

As the error indicates you are not accounting for the current line | | | |Link State| | |Speed/ |MTU |Flow |

If that is not clear, feel free to join the slack community and the slack channel #networktocode to get better interactive questions answered.

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

No branches or pull requests

2 participants