Skip to content

Commit

Permalink
Fix HP Procurve show_vlans template (failing py.test)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcgill298 committed May 11, 2018
1 parent f5fb01e commit a014197
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions templates/hp_procurve_show_vlans.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Value VLAN_ID (\d+)
Value NAME ([\S+\s+].*(?=\|))
Value NAME (.*?)
Value STATUS (\S+)
Value VOICE (Yes|No)
Value JUMBO (Yes|No)
Expand All @@ -8,4 +8,6 @@ Start
^.*VLAN ID -> VLAN

VLAN
^\s+${VLAN_ID}\s+${NAME}\s+\|?\s?${STATUS}\s+${VOICE}\s+${JUMBO}? -> Record
^\s+${VLAN_ID}\s+${NAME}\s+(\|\s+|)${STATUS}\s+${VOICE}(\s+${JUMBO}|)\s*$$ -> Record
^\s+-+\s+-+\s+(\+\s+|)-+\s+-+(\s+-+|)\s*$$
^.*$$ -> Error

2 comments on commit a014197

@sliddjur
Copy link
Contributor

Choose a reason for hiding this comment

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

why is the ^.*$$ -> Error there?
it seems like it fails this output from show vlan on a hp procurve 2520. It has a trailing \s\n as last line which seem to trigger the error.

('\n'
 ' Status and Counters - VLAN Information\n'
 '\n'
 '  Maximum VLANs to support : 256                  \n'
 '  Primary VLAN : DEFAULT_VLAN\n'
 '  Management VLAN :             \n'
 '\n'
 '  VLAN ID Name                             Status       Voice\n'
 '  ------- -------------------------------- ------------ -----\n'
 '  1       DEFAULT_VLAN                     Port-based   No   \n'
 '  29      T7D-KONTOR                       Port-based   No   \n'
 '  43      TG-VOIP                          Port-based   No   \n'
 '  1806    80003-LINK                       Port-based   No   \n'
 '  1808    80003-LAN                        Port-based   No   \n'
 ' \n')

[{'jumbo': '',
  'name': 'DEFAULT_VLAN',
  'status': 'Port-based',
  'vlan_id': '1',
  'voice': 'No'},
 {'jumbo': '',
  'name': 'T7D-KONTOR',
  'status': 'Port-based',
  'vlan_id': '29',
  'voice': 'No'},
 {'jumbo': '',
  'name': 'TG-VOIP',
  'status': 'Port-based',
  'vlan_id': '43',
  'voice': 'No'},
 {'jumbo': '',
  'name': '80003-LINK',
  'status': 'Port-based',
  'vlan_id': '1806',
  'voice': 'No'},
 {'jumbo': '',
  'name': '80003-LAN',
  'status': 'Port-based',
  'vlan_id': '1808',
  'voice': 'No'}]```

@jmcgill298
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error like is to ensure that all data is accounted for. We should include a line for capturing only space characters in the template

Please sign in to comment.