This repository has been archived by the owner on Sep 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 2.0 - Core functions complete (#2)
- Loading branch information
1 parent
1c203c9
commit 370707f
Showing
32 changed files
with
1,315 additions
and
1,850 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
_Credentials.xml | ||
Documentation/Function/Images/Thumbs.db |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Get-ICXSession | ||
|
||
Get a Brocade ICX session. | ||
|
||
* [view function](https://github.com/BornToBeRoot/PowerShell_BrocadeICX/blob/master/Module/BrocadeICX/Core/Get-ICXSession.ps1) | ||
|
||
## Description | ||
|
||
Get one or multiple Brocade ICX sessions based on SessionID or ComputerName. | ||
|
||
![Screenshot](Images/Get-ICXSession.png?raw=true) | ||
|
||
## Syntax | ||
|
||
```powershell | ||
Get-ICXSession [<CommonParameters>] | ||
Get-ICXSession [-SessionID] <Int32[]> [<CommonParameters>] | ||
Get-ICXSession [-ComputerName] <String[]> [[-CaseSensitive]] [<CommonParameters>] | ||
``` | ||
|
||
## Example 1 | ||
|
||
```powershell | ||
PS> Get-ICXSession -SessionID 1,2 | ||
SessionID ComputerName Session Stream | ||
--------- ------------ ------- ------ | ||
1 megatron SSH.SshSession Renci.SshNet.ShellStream | ||
2 megatron SSH.SshSession Renci.SshNet.ShellStream | ||
``` | ||
|
||
## Example 2 | ||
|
||
```powershell | ||
PS> Get-ICXSession -ComputerName megatron | ||
SessionID ComputerName Session Stream | ||
--------- ------------ ------- ------ | ||
0 megatron SSH.SshSession Renci.SshNet.ShellStream | ||
1 megatron SSH.SshSession Renci.SshNet.ShellStream | ||
2 megatron SSH.SshSession Renci.SshNet.ShellStream | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Get-ICXVLAN | ||
|
||
Get VLANs from a Brocade ICX Switch. | ||
|
||
* [view function](https://github.com/BornToBeRoot/PowerShell_BrocadeICX/blob/master/Module/BrocadeICX/Functions/VLAN/Get-ICXVLAN.ps1) | ||
|
||
## Description | ||
|
||
Get VLANs from a Brocade ICX Switch as PSCustomObject, which can be further processed. | ||
|
||
![Screenshot](Images/Get-ICXVLAN.png?raw=true) | ||
|
||
## Syntax | ||
|
||
```powershell | ||
Get-ICXVLAN [-ComputerName] <String[]> [[-AcceptKey]] [[-Credential] <PSCredential>] [<CommonParameters>] | ||
Get-ICXVLAN [-Session] <PSObject[]> [<CommonParameters>] | ||
``` | ||
|
||
## Example 1 | ||
|
||
```powershell | ||
PS> Get-ICXVLAN -ComputerName megatron | ||
SessionID ComputerName ID Name By TaggedPort UntaggedPort | ||
--------- ------------ -- ---- -- ---------- ------------ | ||
2 megatron 1001 Test1 port {0/1/1} {0/1/5, 0/1/6, 0/1/7, 0/1/8, ...} | ||
2 megatron 1002 Test2 port {0/1/1, 0/1/2, 0/1/3, 0/1/4} {0/1/11, 0/1/12, 0/1/13, 0/1/14, ...} | ||
``` | ||
|
||
## Example 2 | ||
|
||
```powershell | ||
PS> $Session = Get-ICXSession -SessionID 0,2 | ||
PS> Get-ICXVLAN -Session $Session | Where-Object {$_.Name -eq "Test1"} | ||
SessionID ComputerName ID Name By TaggedPort UntaggedPort | ||
--------- ------------ -- ---- -- ---------- ------------ | ||
0 megatron 1001 Test1 port {0/1/1} {0/1/5, 0/1/6, 0/1/7, 0/1/8, ...} | ||
2 megatron 1001 Test1 port {0/1/1} {0/1/5, 0/1/6, 0/1/7, 0/1/8, ...} | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Invoke-ICXCommand | ||
|
||
Invoke an SSH command in a Brocade ICX session. | ||
|
||
* [view function](https://github.com/BornToBeRoot/PowerShell_BrocadeICX/blob/master/Module/BrocadeICX/Core/Invoke-ICXCommand.ps1) | ||
|
||
## Description | ||
|
||
Invoke an SSH command into one or multiple Brocade ICX session(s). By default, the function will try to detect the SSH output automatically based on the first and last string. Normally the output starts with the SSH command (which was passed) and ends with SSH@HOSTNAME#. If the automatic detection fails and the timeout is reached, the output which is currently in the SSH stream will be returned. | ||
|
||
If you have trouble with some commands (such as `copy running-config tftp ...`), you should try the compatibility mode (`-CompatibilityMode`) and define your own timout values (`-Seconds` or `-Milliseconds`). With the compatibility mode, the SSH command ist executed and the output of the SSH stream is returned after a specific time. | ||
|
||
![Screenshot](Images/Invoke-ICXCommand.png?raw=true) | ||
|
||
## Syntax | ||
|
||
```powershell | ||
Invoke-ICXCommand [-Command] <String> [-Session] <PSObject[]> [[-Timeout] <Int32>] [[-EndString] | ||
<String[]>] [<CommonParameters>] | ||
Invoke-ICXCommand [-Command] <String> [-Session] <PSObject[]> [[-CompatibilityMode]] [[-Seconds] | ||
<Int32>] [<CommonParameters>] | ||
Invoke-ICXCommand [-Command] <String> [-Session] <PSObject[]> [[-CompatibilityMode]] [[-Milliseconds] | ||
<Int32>] [<CommonParameters>] | ||
``` | ||
|
||
## Example 1 | ||
|
||
```powershell | ||
PS> Get-ICXSession | Invoke-ICXCommand -Command "sh clock" | ||
SessionID ComputerName Output | ||
--------- ------------ ------ | ||
0 megatron {14:53:53 GMT+01 Thu Aug 25 2016... | ||
1 megaTRON {14:53:53 GMT+01 Thu Aug 25 2016... | ||
2 megatron {14:53:53 GMT+01 Thu Aug 25 2016... | ||
``` | ||
|
||
## Example 2 | ||
|
||
```powershell | ||
PS> $Session = Get-ICXSession -SessionID 0 | ||
PS> (Invoke-ICXCommand -Command "sh clock" -Session $Session).Output | ||
14:54:13 GMT+01 Thu Aug 25 2016 | ||
``` | ||
|
||
## Example 3 | ||
```powershell | ||
PS> (Get-ICXSession -SessionID 2 | Invoke-ICXCommand -Command "copy running-config tftp 192.168.XXX.XXX" -CompatibilityMode -Seconds 5).Output | ||
Upload running-config to TFTP server done. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# New-ICXSession | ||
|
||
Create a new Brocade ICX sessions over SSH. | ||
|
||
* [view function](https://github.com/BornToBeRoot/PowerShell_BrocadeICX/blob/master/Module/BrocadeICX/Core/New-ICXSession.ps1) | ||
|
||
## Description | ||
|
||
Create one or multiple Brocade ICX session over SSH. If no credentials are submitted, a credential popup will appear. | ||
|
||
![Screenshot](Images/New-ICXSession.png?raw=true) | ||
|
||
## Syntax | ||
|
||
```powershell | ||
New-ICXSession [-ComputerName] <String[]> [[-AcceptKey]] [[-Credential] <PSCredential>] [<CommonParameters>] | ||
``` | ||
|
||
## Example | ||
|
||
```powershell | ||
PS> New-ICXSession -ComputerName megatron | ||
SessionID ComputerName Session Stream | ||
--------- ------------ ------- ------ | ||
0 megatron SSH.SshSession Renci.SshNet.ShellStream | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Remove-ICXSession | ||
|
||
Remove a Brocade ICX session. | ||
|
||
* [view function](https://github.com/BornToBeRoot/PowerShell_BrocadeICX/blob/master/Module/BrocadeICX/Core/Remove-ICXSession.ps1) | ||
|
||
## Description | ||
|
||
Remove one or multiple Brocade ICX sessions. | ||
|
||
![Screenshot](Images/Remove-ICXSession.png?raw=true) | ||
|
||
## Syntax | ||
|
||
```powershell | ||
Remove-ICXSession [-SessionID] <Int32[]> [<CommonParameters>] | ||
Remove-ICXSession [-ComputerName] <String[]> [[-CaseSensitive]] [<CommonParameters>] | ||
Remove-ICXSession [-Session] <PSObject[]> [<CommonParameters>] | ||
``` | ||
|
||
## Example 1 | ||
|
||
```powershell | ||
PS> Remove-ICXSession -SessionID 1 | ||
``` | ||
|
||
## Example 2 | ||
|
||
```powershell | ||
PS> Get-ICXSession | Remove-ICXSession | ||
``` | ||
|
||
## Example 3 | ||
```powershell | ||
PS> Remove-ICXSession -ComputerName megatron | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Test-ICXSession | ||
|
||
Test if a session is a valid Brocade ICX session. | ||
|
||
* [view function](https://github.com/BornToBeRoot/PowerShell_BrocadeICX/blob/master/Module/BrocadeICX/Core/Test-ICXSession.ps1) | ||
|
||
## Description | ||
|
||
Test if a session is a valid Brocade ICX session and managed by the BrocadeICX module. | ||
|
||
![Screenshot](Images/Test-ICXSession.png?raw=true) | ||
|
||
## Syntax | ||
|
||
```powershell | ||
Test-ICXSession [-Session] <PSObject> [<CommonParameters>] | ||
``` | ||
|
||
## Example 1 | ||
|
||
```powershell | ||
PS> $Session = Get-ICXSession -SessionID 0 | ||
PS> Test-ICXSession -Session $Session | ||
true | ||
``` | ||
|
||
## Example 2 | ||
|
||
```powershell | ||
PS> "Test" | Test-ICXSessions | ||
false | ||
``` |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
############################################################################################################### | ||
# Language : PowerShell 4.0 | ||
# Filename : BrocadeICX.psm1 | ||
# Autor : BornToBeRoot (https://github.com/BornToBeRoot) | ||
# Description : Module to administrate Brocade ICX Switches over SSH | ||
# Repository : https://github.com/BornToBeRoot/PowerShell_BrocadeICX | ||
############################################################################################################### | ||
|
||
# Global array to store Brocade ICX sessions | ||
if(-not(Test-Path Variable:BrocadeICXSessions)) | ||
{ | ||
[System.Collections.ArrayList]$Global:BrocadeICXSessions = @() | ||
} | ||
|
||
# Import core functions | ||
Get-ChildItem -Path "$PSScriptRoot\Core" -Recurse | Where-Object {$_.Name.EndsWith(".ps1")} | ForEach-Object {. $_.FullName} | ||
|
||
# Import additional functions | ||
Get-ChildItem -Path "$PSScriptRoot\Functions" -Recurse | Where-Object {$_.Name.EndsWith(".ps1")} | ForEach-Object {. $_.FullName} |
Oops, something went wrong.