From ffaa77461a890ba0ddc8ba84798da735cb90ba77 Mon Sep 17 00:00:00 2001 From: jeffry <36665036+wangxin688@users.noreply.github.com> Date: Tue, 8 Oct 2024 19:00:18 +0800 Subject: [PATCH 1/9] Create aruba_os.yaml --- assets/platforms/aruba_os.yaml | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 assets/platforms/aruba_os.yaml diff --git a/assets/platforms/aruba_os.yaml b/assets/platforms/aruba_os.yaml new file mode 100644 index 0000000..56ab8d2 --- /dev/null +++ b/assets/platforms/aruba_os.yaml @@ -0,0 +1,57 @@ +--- +platform-type: 'aruba_os' +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: 'aruba_os' # 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 width 512' + - operation: 'driver.send-command' + command: 'terminal length 0' + network-on-close: + - operation: 'acquire-priv' + - operation: 'channel.write' + input: 'exit' + - operation: 'channel.return' From 900918add0aed28faf60a5f0894d2289a2b39ff1 Mon Sep 17 00:00:00 2001 From: jeffry <36665036+wangxin688@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:45:02 +0800 Subject: [PATCH 2/9] Update aruba_os.yaml --- assets/platforms/aruba_os.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/platforms/aruba_os.yaml b/assets/platforms/aruba_os.yaml index 56ab8d2..05365f8 100644 --- a/assets/platforms/aruba_os.yaml +++ b/assets/platforms/aruba_os.yaml @@ -39,17 +39,17 @@ default: escalate-prompt: default-desired-privilege-level: 'privilege-exec' failed-when-contains: + - '% Unrecognized command' - '% Ambiguous command' - - '% Incomplete command' - - '% Invalid input detected' - - '% Unknown command' + - '% Wrong parameter' + - "% Incomplete command" + - "% Too many parameters" + - "% Invalid input" textfsm-platform: 'aruba_os' # 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 width 512' - - operation: 'driver.send-command' - command: 'terminal length 0' + command: 'no paging' network-on-close: - operation: 'acquire-priv' - operation: 'channel.write' From 93b0d183ff3d6337dbfb3dd142750a76dec51cfa Mon Sep 17 00:00:00 2001 From: jeffry <36665036+wangxin688@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:45:36 +0800 Subject: [PATCH 3/9] Update huawei_vrp.yaml --- assets/platforms/huawei_vrp.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/platforms/huawei_vrp.yaml b/assets/platforms/huawei_vrp.yaml index 49b320b..b73c023 100644 --- a/assets/platforms/huawei_vrp.yaml +++ b/assets/platforms/huawei_vrp.yaml @@ -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: From 9ed33f83b3301cb371293ff82591697da2789bb3 Mon Sep 17 00:00:00 2001 From: jeffry <36665036+wangxin688@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:46:05 +0800 Subject: [PATCH 4/9] Create h3c.yaml --- assets/platforms/h3c.yaml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 assets/platforms/h3c.yaml diff --git a/assets/platforms/h3c.yaml b/assets/platforms/h3c.yaml new file mode 100644 index 0000000..af32fd7 --- /dev/null +++ b/assets/platforms/h3c.yaml @@ -0,0 +1,38 @@ +--- +platform-type: 'h3c' +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: 'h3c' # 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' From c05a003cc6ed348a77cfbc85967d08f90ec3dfee Mon Sep 17 00:00:00 2001 From: jeffry <36665036+wangxin688@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:47:09 +0800 Subject: [PATCH 5/9] Create ruijie.yaml --- assets/platforms/ruijie.yaml | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 assets/platforms/ruijie.yaml diff --git a/assets/platforms/ruijie.yaml b/assets/platforms/ruijie.yaml new file mode 100644 index 0000000..a5436c3 --- /dev/null +++ b/assets/platforms/ruijie.yaml @@ -0,0 +1,55 @@ +--- +platform-type: 'ruijie' +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' From 22ec7c1643b6b03b709f595462372d7f539a53e5 Mon Sep 17 00:00:00 2001 From: jeffry <36665036+wangxin688@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:52:12 +0800 Subject: [PATCH 6/9] Create fortinet.yaml --- assets/platforms/fortinet.yaml | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 assets/platforms/fortinet.yaml diff --git a/assets/platforms/fortinet.yaml b/assets/platforms/fortinet.yaml new file mode 100644 index 0000000..111bf96 --- /dev/null +++ b/assets/platforms/fortinet.yaml @@ -0,0 +1,40 @@ +--- +platform-type: 'fortinet' +default: + driver-type: 'network' + privilege-levels: + exec: + name: 'exec' + pattern: '(?im)^[\w\._- ]+@[\w\.\(\)_-]+#\s?' + previous-priv: + deescalate: + escalate: + escalate-auth: false + escalate-prompt: + # configuration: + # name: 'configuration' + # pattern: '(?im)^[\w\._- ]+@[\w\.\(\)_-]+#\s?$' + # previous-priv: 'exec' + # deescalate: 'exit' + # escalate: 'config' + # escalate-auth: false + # escalate-prompt: + default-desired-privilege-level: 'exec' + failed-when-contains: + - "Command fail" + - "Unknown action" + - "Return code" + 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: 'config system console' + - operation: 'driver.send-command' + command: 'set output standard' + - operation: 'driver.send-command' + command: 'end' + network-on-close: + - operation: 'acquire-priv' + - operation: 'channel.write' + input: 'exit' + - operation: 'channel.return' From 45074501caeb89320e3825366235ef70435d5730 Mon Sep 17 00:00:00 2001 From: jeffry <36665036+wangxin688@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:53:38 +0800 Subject: [PATCH 7/9] Update definition.go --- platform/definition.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platform/definition.go b/platform/definition.go index 186c0a9..4d1fa9f 100644 --- a/platform/definition.go +++ b/platform/definition.go @@ -28,13 +28,23 @@ const ( JuniperJunos = "juniper_junos" // NokiaSrl is a constant representing the platform string/name for Nokia SRL/SRLinux devices. NokiaSrl = "nokia_srl" + // ArubaOs is a constant representing the platform string/name for Aruba OS devices. + ArubaOs = "aruba_os" + // H3C is a constant representing the platform string/name for H3Cdevices. + H3C = "h3c" + // HuaweiVrp is a constant representing the platform string/name for Huawei VRP devices. + HuaweiVrp = "huawei_vrp" + // Ruijie is a constant representing the platform string/name for Ruijie devices. + Ruijie = "ruijie" + // Fortinet is a constant representing the platform string/name for Fortinet devices. + Fortinet = "fortinet" ) // 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, CiscoIosxe, CiscoIosxr, CiscoNxos, JuniperJunos, NokiaSrl, ArubaOs, H3C, HuaweiVrp, Ruijie, Fortinet, } } From 2abec5729b4fbb9515c0cc38294fd86ddfcb7b44 Mon Sep 17 00:00:00 2001 From: jeffry <182467653@qq.com> Date: Sun, 13 Oct 2024 09:54:14 +0800 Subject: [PATCH 8/9] feat: update platform definition --- .../{aruba_os.yaml => aruba_wlc.yaml} | 4 ++-- .../{fortinet.yaml => fortinet_fortios.yaml} | 2 +- assets/platforms/{h3c.yaml => hp_comware.yaml} | 4 ++-- .../{ruijie.yaml => ruijie_rjos.yaml} | 2 +- platform/definition.go | 18 +++++++++--------- 5 files changed, 15 insertions(+), 15 deletions(-) rename assets/platforms/{aruba_os.yaml => aruba_wlc.yaml} (94%) rename assets/platforms/{fortinet.yaml => fortinet_fortios.yaml} (97%) rename assets/platforms/{h3c.yaml => hp_comware.yaml} (90%) rename assets/platforms/{ruijie.yaml => ruijie_rjos.yaml} (98%) diff --git a/assets/platforms/aruba_os.yaml b/assets/platforms/aruba_wlc.yaml similarity index 94% rename from assets/platforms/aruba_os.yaml rename to assets/platforms/aruba_wlc.yaml index 05365f8..bfdec7e 100644 --- a/assets/platforms/aruba_os.yaml +++ b/assets/platforms/aruba_wlc.yaml @@ -1,5 +1,5 @@ --- -platform-type: 'aruba_os' +platform-type: 'aruba_wlc' default: driver-type: 'network' privilege-levels: @@ -45,7 +45,7 @@ default: - "% Incomplete command" - "% Too many parameters" - "% Invalid input" - textfsm-platform: 'aruba_os' # ignored in go because no ntc-templates + 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' diff --git a/assets/platforms/fortinet.yaml b/assets/platforms/fortinet_fortios.yaml similarity index 97% rename from assets/platforms/fortinet.yaml rename to assets/platforms/fortinet_fortios.yaml index 111bf96..4d34e13 100644 --- a/assets/platforms/fortinet.yaml +++ b/assets/platforms/fortinet_fortios.yaml @@ -1,5 +1,5 @@ --- -platform-type: 'fortinet' +platform-type: 'fortinet_fortios' default: driver-type: 'network' privilege-levels: diff --git a/assets/platforms/h3c.yaml b/assets/platforms/hp_comware.yaml similarity index 90% rename from assets/platforms/h3c.yaml rename to assets/platforms/hp_comware.yaml index af32fd7..a7a50f3 100644 --- a/assets/platforms/h3c.yaml +++ b/assets/platforms/hp_comware.yaml @@ -1,5 +1,5 @@ --- -platform-type: 'h3c' +platform-type: 'hp_comware' default: driver-type: 'network' privilege-levels: @@ -26,7 +26,7 @@ default: - '% Wrong parameter' - "% Incomplete command" - "% Too many parameters" - textfsm-platform: 'h3c' # ignored in go because no ntc-templates + 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' diff --git a/assets/platforms/ruijie.yaml b/assets/platforms/ruijie_rjos.yaml similarity index 98% rename from assets/platforms/ruijie.yaml rename to assets/platforms/ruijie_rjos.yaml index a5436c3..9d15a14 100644 --- a/assets/platforms/ruijie.yaml +++ b/assets/platforms/ruijie_rjos.yaml @@ -1,5 +1,5 @@ --- -platform-type: 'ruijie' +platform-type: 'ruijie_rgos' default: driver-type: 'network' privilege-levels: diff --git a/platform/definition.go b/platform/definition.go index 4d1fa9f..a7cef84 100644 --- a/platform/definition.go +++ b/platform/definition.go @@ -28,23 +28,23 @@ const ( JuniperJunos = "juniper_junos" // NokiaSrl is a constant representing the platform string/name for Nokia SRL/SRLinux devices. NokiaSrl = "nokia_srl" - // ArubaOs is a constant representing the platform string/name for Aruba OS devices. - ArubaOs = "aruba_os" - // H3C is a constant representing the platform string/name for H3Cdevices. - H3C = "h3c" + // ArubaWlc is a constant representing the platform string/name for Aruba Wireless controller AOS devices. + ArubaWlc = "aruba_wlc" + // 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" - // Ruijie is a constant representing the platform string/name for Ruijie devices. - Ruijie = "ruijie" - // Fortinet is a constant representing the platform string/name for Fortinet devices. - Fortinet = "fortinet" + // Ruijie is a constant representing the platform string/name for Ruijie network devices. + RuijieOs = "ruijie_os" + // // FortinetFortiOs is a constant representing the platform string/name for Fortinet firewall devices. + // FortinetFortiOs = "fortinet_fortios" ) // 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, ArubaOs, H3C, HuaweiVrp, Ruijie, Fortinet, + AristaEos, CiscoIosxe, CiscoIosxr, CiscoNxos, JuniperJunos, NokiaSrl, ArubaWlc, HpComware, HuaweiVrp, RuijieOs, } } From 48226835c2c458ee2f43c0aa85d1d16f75df2cd7 Mon Sep 17 00:00:00 2001 From: Carl Montanari Date: Sun, 13 Oct 2024 12:46:30 -0700 Subject: [PATCH 9/9] chore: minor platform definition tune up --- assets/platforms/fortinet_fortios.yaml | 40 ------------------- platform/definition.go | 54 ++++++++++++++++++++------ 2 files changed, 43 insertions(+), 51 deletions(-) delete mode 100644 assets/platforms/fortinet_fortios.yaml diff --git a/assets/platforms/fortinet_fortios.yaml b/assets/platforms/fortinet_fortios.yaml deleted file mode 100644 index 4d34e13..0000000 --- a/assets/platforms/fortinet_fortios.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -platform-type: 'fortinet_fortios' -default: - driver-type: 'network' - privilege-levels: - exec: - name: 'exec' - pattern: '(?im)^[\w\._- ]+@[\w\.\(\)_-]+#\s?' - previous-priv: - deescalate: - escalate: - escalate-auth: false - escalate-prompt: - # configuration: - # name: 'configuration' - # pattern: '(?im)^[\w\._- ]+@[\w\.\(\)_-]+#\s?$' - # previous-priv: 'exec' - # deescalate: 'exit' - # escalate: 'config' - # escalate-auth: false - # escalate-prompt: - default-desired-privilege-level: 'exec' - failed-when-contains: - - "Command fail" - - "Unknown action" - - "Return code" - 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: 'config system console' - - operation: 'driver.send-command' - command: 'set output standard' - - operation: 'driver.send-command' - command: 'end' - network-on-close: - - operation: 'acquire-priv' - - operation: 'channel.write' - input: 'exit' - - operation: 'channel.return' diff --git a/platform/definition.go b/platform/definition.go index a7cef84..819d48d 100644 --- a/platform/definition.go +++ b/platform/definition.go @@ -18,33 +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" - // 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" - // ArubaWlc is a constant representing the platform string/name for Aruba Wireless controller AOS devices. - ArubaWlc = "aruba_wlc" + // 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" - // Ruijie is a constant representing the platform string/name for Ruijie network devices. - RuijieOs = "ruijie_os" - // // FortinetFortiOs is a constant representing the platform string/name for Fortinet firewall devices. - // FortinetFortiOs = "fortinet_fortios" + // 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, ArubaWlc, HpComware, HuaweiVrp, RuijieOs, + AristaEos, + ArubaWlc, + CiscoIosxe, + CiscoIosxr, + CiscoNxos, + CumulusLinux, + CumulusVtysh, + HpComware, + HuaweiVrp, + IpinfusionOcnos, + JuniperJunos, + NokiaSrl, + NokiaSros, + NokiaSrosClassic, + PaloAltoPanos, + RuijieRgos, + VyattaVyos, } }