networktocode/ntc-templates

Issue:hp_comware, display device manuinfo

Closed this issue · 7 comments

ISSUE TYPE
  • Template Issue with error and raw data
TEMPLATE USING
Value Filldown CHASSIS_ID (\d+)
Value Required SLOT_TYPE (Slot|Subslot|Fan|Power|Chassis)
Value SLOT_ID (\d+|self)
Value DEVICE_NAME (.+)
Value DEVICE_SERIAL_NUMBER (\S+)
Value MANUFACTURING_DATE (\S+)
Value VENDOR_NAME (\S+)
Value MAC_ADDRESS (\S+)
Value PRODUCT_ID (\S+)


Start
  ^\s*Chassis\s+${CHASSIS_ID}
  ^\s*${SLOT_TYPE}\s+${SLOT_ID}
  ^\s*DEVICE_ID
  ^\s*The\s+operation\s+is\s+not\s+supported\s+ -> Record Start
  ^\s*Failed\s+to\s+display\s+the\s+manufacture\s+ -> Record Start
  ^\s*DEVICE_NAME\s*:\s*${DEVICE_NAME}
  ^\s*DEVICE_SERIAL_NUMBER\s*:\s*${DEVICE_SERIAL_NUMBER}
  ^\s*MAC_ADDRESS\s*:\s*${MAC_ADDRESS}
  ^\s*MANUFACTURING_DATE\s*:\s*${MANUFACTURING_DATE}
  ^\s*VENDOR_NAME\s*:\s*${VENDOR_NAME}
  ^\s*PRODUCT_ID\s*:\s*${PRODUCT_ID} -> Record Start
  ^\s*$$
  ^. -> Error
SAMPLE COMMAND OUTPUT
<AC01-250.5>dis device manuinfo 
DEVICE_NAME:WX2560X-LI
DEVICE_SERIAL_NUMBER:219801A2X08218E8888M
MAC_ADDRESS:9C54-C2FF-5A80
MANUFACTURING_DATE:2021-08-09
VENDOR_NAME:H3C
SUMMARY
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
![image](https://user-images.githubusercontent.com/3947704/236122098-669431bf-19c8-4069-979f-987c73e7f5f2.png)
Device info has been saved to output1.8.csv for device 10.209.250.5.
device connect successful 10.209.250.6.
Empty DataFrame
Columns: []
Index: []

Is there an error with this?

mjbear commented

@xiarunjie
This template requires SLOT_TYPE which the example output above does not contain.

Value Required SLOT_TYPE (Slot|Subslot|Fan|Power|Chassis)

If I add fictitious information Fan 123 to your example output then I can get it to parse.

Is the example output all of the output from that command?

DEVICE_NAME:WX2560X-LI
DEVICE_SERIAL_NUMBER:219801A2X08218E8888M
MAC_ADDRESS:9C54-C2FF-5A80
MANUFACTURING_DATE:2021-08-09
VENDOR_NAME:H3C
Fan 123

@xiarunjie
Are you able to provide feedback on whether your above output included all of the lines?

I don't have access to hp_comware equipment to pull output so your input it needed. Thank you!

@xiarunjie
Would you please respond back?

@xiarunjie
❓ Could you please confirm whether the sub-slot type is sometimes or always missing?

Page 152 of this HP Comware command reference (PDF) shows the sub-slot can be in the output.

<Sysname> display device manuinfo
Slot 1:
DEVICE_NAME : HP 5500-24G SI Switch with 2 Interface Slots JD369A
DEVICE_SERIAL_NUMBER : 210235A252H09A000878
MAC_ADDRESS : 0023-8980-549A
MANUFACTURING_DATE : 2011-10-21
VENDOR_NAME : HP
Subslot 1:

Though on page 25 in this other command comparison/reference (PDF) the slot is before the Device Name, but no sub-slot type and ID are shown.

<Comware>display device manuinfo
Slot 1:
DEVICE_NAME : S5500-28C-PWR-EI
DEVICE_SERIAL_NUMBER : xxxxxxxxxxxx
MAC_ADDRESS : 0023-89D5-A059
MANUFACTURING_DATE : 2010-02-16
VENDOR_NAME : H3C

🔍 I suspect there is no data for Subslot 1 in the first code block in this post/message. Put another way, the data there may actually (does) "belong" to Slot 1. This ⬆️ appears to be correct.

💡 (❌ Wrong) This could explain why the second example doesn't have a Subslot section.

WX2560X-LI appears to be a branch router which probably won't have a SLOT_TYPE.

From what I discovered the SLOT_TYPE was made Required to filter out a few different items, including an extra mostly empty match (except for what was Filldown. I was able to fix this by overriding the default EOF State behavior.

Example data for the: 5200 router and 5930 switch required a few template tweaks

I submitted PR #1805