Skip to content

Commit

Permalink
Fix "cmds" command argument and update markdown (#27154) (#27166)
Browse files Browse the repository at this point in the history
* Fix "cmds" command argument
Update markdown

* Update release notes

* Update Packs/Netmiko/ReleaseNotes/1_0_3.md

---------

Co-authored-by: Josh Levine <76795471+TerminalFin@users.noreply.github.com>
Co-authored-by: Dan Tavori <38749041+dantavori@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 3, 2023
1 parent e820f4e commit bc828ec
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 34 deletions.
14 changes: 6 additions & 8 deletions Packs/Netmiko/Integrations/Netmiko/Netmiko.yml
Expand Up @@ -3,18 +3,18 @@ commonfields:
id: Netmiko
version: -1
configuration:
- name: port
display: Port
required: true
defaultvalue: null
type: 0
additionalinfo: ""
- name: hostname
display: Hostname
required: true
defaultvalue: null
type: 0
additionalinfo: null
- name: port
display: Port
required: true
defaultvalue: null
type: 0
additionalinfo: ""
- name: platform
display: Platform
required: true
Expand Down Expand Up @@ -203,8 +203,6 @@ script:
required: true
isArray: true
defaultValue: ""
predefined:
- ""
- auto: PREDEFINED
defaultValue: "false"
description: Whether requires "enable" to be run before commands are executed. Default
Expand Down
62 changes: 37 additions & 25 deletions Packs/Netmiko/Integrations/Netmiko/README.md
Expand Up @@ -18,7 +18,7 @@ This integration provides ssh-based access to network devices, servers, and othe
- *Credentials*: The username/password, or XSOAR credential object, to be used for the connection.
**NOTE**: Platform names are taken from the supported [SSH](https://github.com/ktbyers/netmiko/blob/develop/PLATFORMS.md#supported-ssh-device_type-values) or [Telnet](https://github.com/ktbyers/netmiko/blob/develop/PLATFORMS.md#supported-telnet-device_type-values) device type lists on GitHub.

4. Click **Test** to validate the new instance. This performs a simple connection to the system hosting the SSH server.
4. Click **Test** to validate the new instance. This performs a simple connection to the system hosting the SSH server.

## Commands

Expand All @@ -27,12 +27,15 @@ This integration provides ssh-based access to network devices, servers, and othe
1. [Executes a command, or series of commands, over an SSH connection: netmiko-cmds](#netmiko-cmds)

## netmiko-cmds

Executes a command, or series of commands, over an SSH connection. Outputs from the executed commands are returned to the incident/playground context.

#### Base Command

`netmiko-cmds`

#### Input

------------------
| **Argument Name** | **Description** | **Required** |
|--|--|--|
Expand All @@ -50,6 +53,7 @@ Executes a command, or series of commands, over an SSH connection. Outputs from
|require_exit|Specifies an optional command that must be executed upon completion of the cmds parameter being executed. Default: False.|Optional|

#### Context Output

|**Path**|**Type**|**Description**|
|--|--|--|
|Netmiko.Command|String|The executed command(s).|
Expand All @@ -58,51 +62,59 @@ Executes a command, or series of commands, over an SSH connection. Outputs from
|Netmiko.Output|String|The results of the command(s) that were executed.|

#### Command Example (Single command)

`!netmiko-cmds cmds="whoami"`

#### Context Example

>{<br>
>&emsp;"Command": "whoami",<br>
>&emsp;"DateTimeUTC": "2023-04-24T21:40:21.755985",<br>
>&emsp;"Hostname": "192.168.0.1",<br>
>&emsp;"Output": "[someuser@someserver ~]$ root"<br>
>}<br>
>{
>&emsp;"Command": "whoami",
>&emsp;"DateTimeUTC": "2023-04-24T21:40:21.755985",
>&emsp;"Hostname": "192.168.0.1",
>&emsp;"Output": "[someuser@someserver ~]$ root"
>}
#### Human Readable Output

#### Command(s) against 192.168.0.1 (linux)

|**Command**|**DateTimeUTC**|**Hostname**|**Output**|
|--|--|--|--|
|whoami|2023-04-24T21:40:21.755985|192.168.0.1|root|

### Command Example (Multiple commands)

#### As multiple commands via CLI or task

`!netmiko-cmds cmds="whoami`
`who"`
`!netmiko-cmds cmds="whoami`
`who"`

#### As multiple commands via CLI or task using an array
`array context key = ["whoami", "who"]`
`!netmiko-cmds cmds=${array}`

`array context key = ["whoami", "who"]`
`!netmiko-cmds cmds=${array}`

#### Context Example

>{<br>
>&emsp;"Netmiko": [{<br>
>&emsp;&emsp;"Command": "whoami",<br>
>&emsp;&emsp;"DateTimeUTC": "2023-04-24T21:59:02.177240",<br>
>&emsp;&emsp;"Hostname": "192.168.0.1",<br>
>&emsp;&emsp;"Output": "[someuser@somehost ~]$ root"<br>
>&emsp;},<br>
>&emsp;{<br>
>&emsp;&emsp;"Command": "who",<br>
>&emsp;&emsp;"DateTimeUTC": "2023-04-24T21:59:04.882842",<br>
>&emsp;&emsp;"Hostname": "192.168.0.1",<br>
>&emsp;&emsp;"Output": "[someuser@somehost ~]$ root pts/0 2023-04-24 17:58 (192.168.0.1)"<br>
>&emsp;}]<br>
>}<br>
>{
>&emsp;"Netmiko": [{
>&emsp;&emsp;"Command": "whoami",
>&emsp;&emsp;"DateTimeUTC": "2023-04-24T21:59:02.177240",
>&emsp;&emsp;"Hostname": "192.168.0.1",
>&emsp;&emsp;"Output": "[someuser@somehost ~]$ root"
>&emsp;},
>&emsp;{
>&emsp;&emsp;"Command": "who",
>&emsp;&emsp;"DateTimeUTC": "2023-04-24T21:59:04.882842",
>&emsp;&emsp;"Hostname": "192.168.0.1",
>&emsp;&emsp;"Output": "[someuser@somehost ~]$ root pts/0 2023-04-24 17:58 (192.168.0.1)"
>&emsp;}]
>}
#### Human Readable Output

#### Command(s) against 192.168.0.1 (linux)

|**Command**|**DateTimeUTC**|**Hostname**|**Output**|
|--|--|--|--|
|whoami|2023-04-24T21:59:02.177240|192.168.0.1|root|
Expand Down
7 changes: 7 additions & 0 deletions Packs/Netmiko/ReleaseNotes/1_0_3.md
@@ -0,0 +1,7 @@

#### Integrations

##### Netmiko

- Documentation and metadata improvements.
- Fixed an issue in the ***netmiko-cmds*** command where the *cmds* command argument could not accept free text values.
2 changes: 1 addition & 1 deletion Packs/Netmiko/pack_metadata.json
Expand Up @@ -2,7 +2,7 @@
"name": "Netmiko",
"description": "The Netmiko pack uses the Netmiko/Paramiko libraries to execute commands via SSH on platforms supported by these python modules.",
"support": "xsoar",
"currentVersion": "1.0.2",
"currentVersion": "1.0.3",
"author": "Josh Levine",
"url": "",
"email": "",
Expand Down

0 comments on commit bc828ec

Please sign in to comment.