scrapli / scrapligo

scrapli, but in go!
MIT License
244 stars 35 forks source link

Add support for Huawei VRP CLI #170

Closed wwijkander closed 5 months ago

wwijkander commented 5 months ago

Add support for Huawei VRP CLI. A CLI session looks like this:

[wilwij@mira ~]$ ssh huawei-development-sw1.example.net

User Authentication
(wiwi@huawei-development-sw1.example.net) Password: 

Info: The max number of VTY users is 10, and the number
      of current VTY users on line is 1.
      The current login time is 2024-01-10 08:41:02+01:00.
<huawei-development-sw1>
<huawei-development-sw1>
<huawei-development-sw1>
<huawei-development-sw1>disp port vlan gig
<huawei-development-sw1>disp port vlan gi0/0/20
Port                        Link Type    PVID  Trunk VLAN List
-------------------------------------------------------------------------------
GigabitEthernet0/0/20       desirable    1     1-4094
<huawei-development-sw1>system-vi
Enter system view, return user view with Ctrl+Z.
[huawei-development-sw1]interface gi0/0/20
[huawei-development-sw1-GigabitEthernet0/0/20]?
gigabitethernet-l2 interface view commands:
  als                        Set automatic laser shutdown 
  am                         Unidirectional isolation
  arp                        Address Resolution Protocol
  arp-fake                   ARP fake entry
  arp-limit                  Limit the number of learnt ARP
  arp-miss                   ARP Miss
  authentication             Authentication
  auto                       Auto negotiates port mode 
  bandwidth                  Specify mib-referenced bandwidth of the interface
  broadcast-suppression      Set broadcast flow suppression
  carrier                    Set carrier function
  cfm                        Connectivity fault management
  clear                      Clear
  collect                    Collect TOPN information
  combo-port                 Set combo type 
  configuration              Configuration interlock
  dei                        Specify dei as drop precedence 
  description                Specify interface description
  dhcp                       Dynamic host configure protocol
  dhcpv6                     Dynamic host configure protocol for IPv6
  display                    Display current system information
  dldp                       Device link detection protocol
  dot1x                      802.1x and mac-authen configuration information
  duplex                     Configure duplex operation mode 

[huawei-development-sw1-GigabitEthernet0/0/20]quit
[huawei-development-sw1]quit
<huawei-development-sw1>disp port gi0/0/40
                                  ^
Error: Unrecognized command found at '^' position.
<huawei-development-sw1>quit
Info: The max number of VTY users is 10, and the number
      of current VTY users on line is 0.Connection to huawei-development-sw1.example.net closed.
carlmontanari commented 5 months ago

👋 hey @wwijkander thanks for the work here! looks good to me - just left a few little comments to discuss then we can get it all merged! thanks a bunch!

carlmontanari commented 5 months ago

ah seems I can't push to your pr for whatever reason -- so if you wanna get those comments cleared out and revert that base pattern stuff like discussed whenever ya have a sec ill get this merged. have a nice weekend!

wwijkander commented 5 months ago

ah seems I can't push to your pr for whatever reason -- so if you wanna get those comments cleared out and revert that base pattern stuff like discussed whenever ya have a sec ill get this merged. have a nice weekend!

Hope you had a good weekend! I kind of lost this in other stuff but I pushed a new commit now. Left the comments about the error message as it might look like a typo otherwise.

Cheers!