Skip to content

Commit

Permalink
Merge pull request #196 from wangxin688/main
Browse files Browse the repository at this point in the history
add more vendors support.
  • Loading branch information
carlmontanari authored Oct 15, 2024
2 parents 9baa9c5 + 4822683 commit c98e523
Show file tree
Hide file tree
Showing 5 changed files with 194 additions and 1 deletion.
57 changes: 57 additions & 0 deletions assets/platforms/aruba_wlc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
platform-type: 'aruba_wlc'
default:
driver-type: 'network'
privilege-levels:
exec:
name: 'exec'
pattern: '(?im)^[\w.\-@/: ()*]{1,63}>$'
previous-priv:
deescalate:
escalate:
escalate-auth: false
escalate-prompt:
privilege-exec:
name: 'privilege-exec'
pattern: '(?im)^[\w.\-@/: ()*]{1,63}#$'
previous-priv: 'exec'
deescalate: 'disable'
escalate: 'enable'
escalate-auth: true
escalate-prompt: '(?im)^(?:enable\s){0,1}password:\s?$'
configuration:
name: 'configuration'
pattern: '(?im)^[\w.\-@/: ()*]{1,63}\([\+\w.\-@/:+]{0,32}\)#$'
not-contains:
- 'tcl)'
previous-priv: 'privilege-exec'
deescalate: 'end'
escalate: 'configure terminal'
escalate-auth: false
escalate-prompt:
tclsh:
name: 'tclsh'
pattern: '(?im)^([\w.\-@/+>:]+\(tcl\)[>#]|\+>)$'
previous-priv: 'privilege-exec'
deescalate: 'tclquit'
escalate: 'tclsh'
escalate-auth: false
escalate-prompt:
default-desired-privilege-level: 'privilege-exec'
failed-when-contains:
- '% Unrecognized command'
- '% Ambiguous command'
- '% Wrong parameter'
- "% Incomplete command"
- "% Too many parameters"
- "% Invalid input"
textfsm-platform: 'aruba_wlc' # ignored in go because no ntc-templates
network-on-open:
- operation: 'acquire-priv' # targets default desired priv by default
- operation: 'driver.send-command'
command: 'no paging'
network-on-close:
- operation: 'acquire-priv'
- operation: 'channel.write'
input: 'exit'
- operation: 'channel.return'
38 changes: 38 additions & 0 deletions assets/platforms/hp_comware.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
platform-type: 'hp_comware'
default:
driver-type: 'network'
privilege-levels:
user-view:
name: 'user-view'
pattern: '(?im)^<[\w.\-@/:]{1,63}>$'
previous-priv:
deescalate:
escalate:
escalate-auth: false
escalate-prompt:
system-view:
name: 'system-view'
pattern: '(?im)^[[\w.\-@/:]{1,63}]$'
previous-priv: 'user-view'
deescalate: 'quit'
escalate: 'system-view'
escalate-auth: false
escalate-prompt:
default-desired-privilege-level: 'user-view'
failed-when-contains:
- '% Unrecognized command'
- '% Ambiguous command'
- '% Wrong parameter'
- "% Incomplete command"
- "% Too many parameters"
textfsm-platform: 'hp_comware' # ignored in go because no ntc-templates
network-on-open:
- operation: 'acquire-priv' # targets default desired priv by default
- operation: 'driver.send-command'
command: 'screen-length disable'
network-on-close:
- operation: 'acquire-priv'
- operation: 'channel.write'
input: 'quit'
- operation: 'channel.return'
1 change: 1 addition & 0 deletions assets/platforms/huawei_vrp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ default:
- 'Error: Wrong parameter'
# missing whitespace is intentional below
- 'Error:Ambiguous command'
- 'Error:Too many parameters'
- 'Error:Incomplete command'
textfsm-platform: 'huawei_vrp' # ignored in go because no ntc-templates
network-on-open:
Expand Down
55 changes: 55 additions & 0 deletions assets/platforms/ruijie_rjos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
platform-type: 'ruijie_rgos'
default:
driver-type: 'network'
privilege-levels:
exec:
name: 'exec'
pattern: '(?im)^[\w.\-@/:]{1,63}>$'
previous-priv:
deescalate:
escalate:
escalate-auth: false
escalate-prompt:
privilege-exec:
name: 'privilege-exec'
pattern: '(?im)^[\w.\-@/:]{1,63}#$'
previous-priv: 'exec'
deescalate: 'disable'
escalate: 'enable'
escalate-auth: true
escalate-prompt: '(?im)^(?:enable\s){0,1}password:\s?$'
configuration:
name: 'configuration'
pattern: '(?im)^[\w.\-@/:]{1,63}\([\+\w.\-@/:+]{0,32}\)#$'
not-contains:
- 'tcl)'
previous-priv: 'privilege-exec'
deescalate: 'end'
escalate: 'configure terminal'
escalate-auth: false
escalate-prompt:
tclsh:
name: 'tclsh'
pattern: '(?im)^([\w.\-@/+>:]+\(tcl\)[>#]|\+>)$'
previous-priv: 'privilege-exec'
deescalate: 'tclquit'
escalate: 'tclsh'
escalate-auth: false
escalate-prompt:
default-desired-privilege-level: 'privilege-exec'
failed-when-contains:
- '% Ambiguous command'
- '% Incomplete command'
- '% Invalid input detected'
- '% Unknown command'
textfsm-platform: '' # ignored in go because no ntc-templates
network-on-open:
- operation: 'acquire-priv' # targets default desired priv by default
- operation: 'driver.send-command'
command: 'terminal length 0'
network-on-close:
- operation: 'acquire-priv'
- operation: 'channel.write'
input: 'exit'
- operation: 'channel.return'
44 changes: 43 additions & 1 deletion platform/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,65 @@ import (
const (
// AristaEos is a constant representing the platform string/name for Arista EOS devices.
AristaEos = "arista_eos"
// ArubaWlc is a constant representing the platform string/name for Aruba Wireless controller
// AOS devices.
ArubaWlc = "aruba_wlc"
// CiscoIosxe is a constant representing the platform string/name for Cisco IOSXE devices.
CiscoIosxe = "cisco_iosxe"
// CiscoIosxr is a constant representing the platform string/name for Cisco IOSXR devices.
CiscoIosxr = "cisco_iosxr"
// CiscoNxos is a constant representing the platform string/name for Cisco NXOS devices.
CiscoNxos = "cisco_nxos"
// CumulusLinux is a constant representing the platform string/name for Cumulus devices.
CumulusLinux = "cumulus_linux"
// CumulusVtysh is a constant representing the platform string/name for Cumulus vtysh devices.
CumulusVtysh = "cumulus_vtysh"
// HpComware is a constant representing the platform string/name for H3C devices.
HpComware = "hp_comware"
// HuaweiVrp is a constant representing the platform string/name for Huawei VRP devices.
HuaweiVrp = "huawei_vrp"
// IpinfusionOcnos is a constant representing the platform string/name for Ipinfusion OCNos
// devices.
IpinfusionOcnos = "ipinfusion_ocnos"
// JuniperJunos is a constant representing the platform string/name for Juniper JunOS devices.
JuniperJunos = "juniper_junos"
// NokiaSrl is a constant representing the platform string/name for Nokia SRL/SRLinux devices.
NokiaSrl = "nokia_srl"
// NokiaSros is a constant representing the platform string/name for Nokia SROS devices.
NokiaSros = "nokia_sros"
// NokiaSrosClassic is a constant representing the platform string/name for Nokia SROS devices
// in classic mode.
NokiaSrosClassic = "nokia_sros_classic"
// PaloAltoPanos is a constant representing the platform string/name for Palo Alto PanOS
// devices.
PaloAltoPanos = "paloalto_panos"
// RuijieRgos is a constant representing the platform string/name for Ruijie network devices.
RuijieRgos = "ruijie_rgos"
// VyattaVyos is a constant representing the platform string/name for Vyos devices.
VyattaVyos = "vyatta_vyos"
)

// GetPlatformNames is used to get the "core" (as in embedded in assets and used in testing)
// platform names.
func GetPlatformNames() []string {
return []string{
AristaEos, CiscoIosxe, CiscoIosxr, CiscoNxos, JuniperJunos, NokiaSrl,
AristaEos,
ArubaWlc,
CiscoIosxe,
CiscoIosxr,
CiscoNxos,
CumulusLinux,
CumulusVtysh,
HpComware,
HuaweiVrp,
IpinfusionOcnos,
JuniperJunos,
NokiaSrl,
NokiaSros,
NokiaSrosClassic,
PaloAltoPanos,
RuijieRgos,
VyattaVyos,
}
}

Expand Down

0 comments on commit c98e523

Please sign in to comment.