forked from PowerAruba/PowerArubaSW
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for Add|Get|Set|Remove-ArubaSWVlansPorts (via id or pipeline) Part of issue PowerAruba#36
- Loading branch information
Showing
1 changed file
with
157 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,157 @@ | ||
# | ||
# Copyright 2018, Alexis La Goutte <alexis.lagoutte at gmail dot com> | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
. ../common.ps1 | ||
|
||
Describe "Get Vlans Ports" { | ||
BeforeAll { | ||
Add-ArubaSWVlans -id 85 | ||
} | ||
It "Get VLAN Ports Does not throw an error" { | ||
{ | ||
Get-ArubaSWVlansPorts | ||
} | Should Not Throw | ||
} | ||
|
||
It "Get ALL vlans Ports" { | ||
$VLANS_PORTS = Get-ArubaSWVlansPorts | ||
$VLANS_PORTS.count | Should not be $NULL | ||
} | ||
|
||
It "Get the Vlan Port by port_id (8)" { | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 | ||
$VLANP.vlan_id | Should Be 1 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_UNTAGGED" | ||
} | ||
|
||
It "Get the Vlan Port by vlan_id (85)" { | ||
Add-ArubaSWVlansPorts -vlan_id 85 -port_id 8 -port_mode Untagged | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 | ||
$VLANP.vlan_id | Should Be 85 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_UNTAGGED" | ||
} | ||
|
||
AfterAll { | ||
Remove-ArubaSWVlans -id 85 -noconfirm | ||
} | ||
} | ||
|
||
Describe "Configure (Add/Set/Remove) Vlans Ports" { | ||
BeforeAll { | ||
Add-ArubaSWVlans -id 85 | ||
} | ||
|
||
Context "Configure Vlan via port_id" { | ||
It "Add vlan_id 85 on port_id 8 (untagged)" { | ||
Add-ArubaSWVlansPorts -vlan_id 85 -port_id 8 -port_mode Untagged | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 | ||
$VLANP.vlan_id | Should Be 85 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_UNTAGGED" | ||
} | ||
|
||
It "Set vlan_id 85 on port_id 8 (tagged)" { | ||
Set-ArubaSWVlansPorts -vlan_id 85 -port_id 8 -port_mode tagged | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 | ||
$VLANP.vlan_id | Should Be 85 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_TAGGED_STATIC" | ||
} | ||
|
||
It "Remove vlan_id 85 on port_id 8" { | ||
Remove-ArubaSWVlansPorts -vlan_id 85 -port_id 8 -noconfirm | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 | ||
$VLANP.vlan_id | Should Be 1 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_UNTAGGED" | ||
} | ||
|
||
It "Add vlan_id 85 on port_id 8 (tagged)" { | ||
Add-ArubaSWVlansPorts -vlan_id 85 -port_id 8 -port_mode tagged | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 -vlan_id 85 | ||
$VLANP.vlan_id | Should Be 85 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_TAGGED_STATIC" | ||
} | ||
|
||
It "Set vlan_id 85 on port_id 8 (untagged)" { | ||
Set-ArubaSWVlansPorts -vlan_id 85 -port_id 8 -port_mode untagged | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 | ||
$VLANP.vlan_id | Should Be 85 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_UNTAGGED" | ||
} | ||
|
||
It "Remove vlan_id 85 on port_id 8" { | ||
Remove-ArubaSWVlansPorts -vlan_id 85 -port_id 8 -noconfirm | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 | ||
$VLANP.vlan_id | Should Be 1 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_UNTAGGED" | ||
} | ||
} | ||
|
||
Context "Configure Vlan via pipeline (or position arg)" { | ||
It "Add vlan_id 85 on port_id 8 (untagged)" { | ||
Add-ArubaSWVlansPorts 85 8 Untagged | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 | ||
$VLANP.vlan_id | Should Be 85 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_UNTAGGED" | ||
} | ||
|
||
It "Set vlan_id 85 on port_id 8 (tagged)" { | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 -vlan_id 85 | ||
$VLANP | Set-ArubaSWVlansPorts -port_mode tagged | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 | ||
$VLANP.vlan_id | Should Be 85 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_TAGGED_STATIC" | ||
} | ||
|
||
It "Remove vlan_id 85 on port_id 8" { | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 -vlan_id 85 | ||
$VLANP | Remove-ArubaSWVlansPorts -noconfirm | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 | ||
$VLANP.vlan_id | Should Be 1 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_UNTAGGED" | ||
} | ||
|
||
It "Add vlan_id 85 on port_id 8 (tagged)" { | ||
Add-ArubaSWVlansPorts 85 8 tagged | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 -vlan_id 85 | ||
$VLANP.vlan_id | Should Be 85 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_TAGGED_STATIC" | ||
} | ||
|
||
It "Set vlan_id 85 on port_id 8 (untagged)" { | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 -vlan_id 85 | ||
$VLANP | Set-ArubaSWVlansPorts -port_mode untagged | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 | ||
$VLANP.vlan_id | Should Be 85 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_UNTAGGED" | ||
} | ||
|
||
It "Remove vlan_id 85 on port_id 8" { | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 -vlan_id 85 | ||
$VLANP | Remove-ArubaSWVlansPorts -noconfirm | ||
$VLANP = Get-ArubaSWVlansPorts -port_id 8 | ||
$VLANP.vlan_id | Should Be 1 | ||
$VLANP.port_id | Should be 8 | ||
$VLANP.port_mode | should be "POM_UNTAGGED" | ||
} | ||
} | ||
|
||
AfterAll { | ||
Remove-ArubaSWVlans -id 85 -noconfirm | ||
} | ||
} | ||
|
||
Disconnect-ArubaSW -noconfirm |