from huawei command line – output modifiers

Download as PDF

As you know, looking through output information by CLI, can take a long time, especially when this output contains configuration, routing tables or logbuffer. Nobody wants to waste time, knowing, that there are many tasks and little time. You can simplify your work using output modifiers. You do not have to read all information step by step to find the interesting one. Probably most of you know what I am talking about.

You have 3 options:

  1. begin     begins with the line that matches
  2. exclude matches the character strings excluding the regular expression
  3. include  matches the character strings including the regular expression

“include”

<labnario> display current-configuration | include ip route-static
 ip route-static 10.20.11.8 255.255.255.252 192.168.13.1 preference 30 description VPN VRR TEST
 ip route-static 10.20.11.11 255.255.255.255 192.168.13.1 preference 30 description VPN VRR TEST
 ip route-static 10.20.11.11 255.255.255.255 192.168.13.5 preference 50 description VPN VRR TEST
 ip route-static 20.0.0.0 255.255.255.0 172.29.20.1
 ip route-static 20.0.0.0 255.255.255.0 1.10.20.2
 ip route-static vpn-instance vpnLTE 30.30.30.1 255.255.255.255 60.60.60.1

<labnario> display ip routing-table | include 172.29.12.0
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
        Destinations : 11       Routes : 11

Destination/Mask    Proto  Pre  Cost       Flags NextHop         Interface

    172.29.12.0/24  Static 60   0           RD   172.29.20.1     GigabitEthernet0/0/0

“begin”

<labnario> display current-configuration | begin ip vpn-instance
ip vpn-instance vpn2G
description 2G services
route-distinguisher 10.10.1.45:250
vpn-target 65200:33207 export-extcommunity
vpn-target 65200:150 import-extcommunity
ip vpn-instance vpn3G
route-distinguisher 10.10.1.45:220
vpn-target 65200:33208 export-extcommunity
vpn-target 65200:151 import-extcommunity
#
vlan 98
description voice Nb
#
bfd
mpls-passive
#
mpls lsr-id 10.10.1.45
mpls
mpls te
lsp-trigger all
mpls te bfd enable
mpls te bfd min-tx-interval 50 min-rx-interval 50
mpls rsvp-te
mpls rsvp-te hello
mpls rsvp-te hello full-gr
mpls te cspf

The exclude option you can use in the same way. It is omitted here as it is not often used.

You can use equivalents of include, exclude and begin modifiers. Only remember that:

  • include = “+”
  • exclude = “-“
  • begin = “/”.

“+”

<labnario> display current-configuration
#
 sysname labnario
#
 super password level 3 simple labnario
#
 FTP server enable
 FTP acl 2000
#
 info-center source BFD channel 1 log level informational
 info-center loghost source GigabitEthernet0/0/0
 info-center loghost 172.29.20.100 facility local4
#
 vlan batch 31 to 32 98 100
#
 hotkey CTRL_U "display ip interface brief"
#
 undo cluster enable
#
snmp-agent trap type base-trap
#
 load-balance ip-enhance all
+ip route-static

Filtering...
 ip route-static 10.20.11.8 255.255.255.252 192.168.13.1 preference 30 description VPN VRR TEST
 ip route-static 10.20.11.11 255.255.255.255 192.168.13.1 preference 30 description VPN VRR TEST
 ip route-static 10.20.11.11 255.255.255.255 192.168.13.5 preference 50 description VPN VRR TEST
 ip route-static 20.0.0.0 255.255.255.0 172.29.20.1
 ip route-static 20.0.0.0 255.255.255.0 1.10.20.2
 ip route-static 172.29.12.0 255.255.255.0 172.29.20.1
 ip route-static 192.168.1.100 255.255.255.255 192.168.1.1
 ip route-static vpn-instance vpnLTE 30.30.30.1 255.255.255.255 60.60.60.1

“/”

<labnario> display current-configuration
#
 sysname labnario
#
 super password level 3 simple labnario
#
 FTP server enable
 FTP acl 2000
#
 info-center source BFD channel 1 log level informational
 info-center loghost source GigabitEthernet0/0/0
 info-center loghost 172.29.20.100 facility local4
#
 vlan batch 31 to 32 98 100
#
 hotkey CTRL_U "display ip interface brief"
#
 undo cluster enable
#
snmp-agent trap type base-trap
#
 load-balance ip-enhance all
/ip route-static

Filtering...
 ip route-static 10.20.11.8 255.255.255.252 192.168.13.1 preference 30 description VPN VRR TEST
 ip route-static 10.20.11.11 255.255.255.255 192.168.13.1 preference 30 description VPN VRR TEST
 ip route-static 10.20.11.11 255.255.255.255 192.168.13.5 preference 50 description VPN VRR TEST
 ip route-static 20.0.0.0 255.255.255.0 172.29.20.1
 ip route-static 20.0.0.0 255.255.255.0 1.10.20.2
 ip route-static vpn-instance vpnLTE 30.30.30.1 255.255.255.255 60.60.60.1
#
 snmp-agent
 snmp-agent local-engineid 000007DB7FFFFFFF000010CA
 snmp-agent community read  public
 snmp-agent community write  private

Of course you can use more advanced combinations. For example, if you have many MPLS TE tunnels configured and you only want to check what a status of these tunnels is, you can use:

<labnario> display mpls te tunnel-interface | include Tunnel Name | Desc
    Tunnel Name       :  Tunnel0/0/101
    Tunnel State Desc :  Primary CR-LSP Up and HotBackup CR-LSP Up
    Tunnel Name       :  Tunnel0/0/102
    Tunnel State Desc :  Primary CR-LSP Up and HotBackup CR-LSP Up
    Tunnel Name       :  Tunnel0/0/103
    Tunnel State Desc :  Primary CR-LSP Up and HotBackup CR-LSP Up
    Tunnel Name       :  Tunnel0/0/104
    Tunnel State Desc :  Primary CR-LSP Up and HotBackup CR-LSP Up
Advertisements

2 thoughts on “from huawei command line – output modifiers

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s