Comware Based
cancel
Showing results for 
Search instead for 
Did you mean: 

Indentation on a HP Comware 5 Config file.

sdide
Respected Contributor

Indentation on a HP Comware 5 Config file.

Hi.

 

We're working on a configuration audit tool, that parses various configuration files for various reason.

Its been parsing Cisco IOS for some time, and Cisco configuration files have blockwise indentation, e.g

 

!
interface TenGigabitEthernet1/19
 switchport
 switchport trunk allowed vlan 2-4,10-13,20-24,30,40
 switchport mode trunk
 switchport nonegotiate
 storm-control broadcast level 0.10
 storm-control multicast level 0.10
 channel-group 1 mode active
 no ethernet cfm ais link-status
!

 Så "!" can be ignored, and no indentation means either global config or a start of a block, and all lines in the block are indented by 1. Sub-blocks are further indented (usually - but at least always indented ).

 

HP Comware 5 uses "#" instead of "!",  and obvoius blocks (e.g interface,vlan-interface, etc . blocks) works the same way as Cisco. So far - so good.

But global commands seems to follow a pattern - maybe not quite so obvoius.  Some are intented, some are not e.g:

 

 undo copyright-info enable
#
 lldp enable
 lldp compliance cdp
#
 transceiver phony-alarm-disable
#
switch-mode standard
switch-mode normal slot 0
switch-mode normal slot 7
switch-mode normal slot 12
#
switch-mode  route-normal
#
 password-recovery enable
#
header login %

blablablablalblal
blakdfjaklsdj
kdjfkdfjk
%
#

 

Note the "header login %" is a block-start, but indented one space (why?)

Is there some kind of system in this, or is it more or less random indentation (for the global commands)?

(I expect Comware itself knows every command :), and therefore doesn't care about indentation. )

 

Regards

Søren Diderksen

 

Søren Dideriksen, Network Administrator
Region Midtjylland
1 REPLY
Apachez-
Trusted Contributor

Re: Indentation on a HP Comware 5 Config file.

I think you will have to ignore tab as row delimiter, look for # and then the tabs within each paragraph is the various levels of current command.