Skip to content

Commit

Permalink
DeviceFingerprint(Tests): Add Skip before 6.9.0
Browse files Browse the repository at this point in the history
(it is not supported before CPPM 6.9.0)
  • Loading branch information
alagoutte committed Mar 24, 2021
1 parent f10088e commit fd50fb6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
1 change: 1 addition & 0 deletions Tests/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ if ($null -eq $port) {
Connect-ArubaCP @invokeParams -SkipCertificateCheck

$script:VersionBefore680 = $DefaultArubaCPConnection.Version -lt [version]"6.8.0"
$script:VersionBefore690 = $DefaultArubaCPConnection.Version -lt [version]"6.9.0"

Disconnect-ArubaCP -confirm:$false
42 changes: 24 additions & 18 deletions Tests/integration/DeviceFingerprint.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@ BeforeAll {
Describe "Get Device FingerPrint" {

BeforeAll {
#Add 2 entries
Add-ArubaCPDeviceFingerPrint -mac_address 00-01-02-03-04-05 -ip_address 192.0.2.1
Add-ArubaCPDeviceFingerPrint -mac_address 00-01-02-03-04-06 -ip_address 192.0.2.2
#Need to wait the time of profiling... (2 seconds...)
Start-Sleep 2
if ($VersionBefore690 -eq 0) {
#Add 2 entries
Add-ArubaCPDeviceFingerPrint -mac_address 00-01-02-03-04-05 -ip_address 192.0.2.1
Add-ArubaCPDeviceFingerPrint -mac_address 00-01-02-03-04-06 -ip_address 192.0.2.2
#Need to wait the time of profiling... (2 seconds...)
Start-Sleep 2
}
}

It "Get Endpoint (with mac filter) Does not throw an error" {
It "Get Endpoint (with mac filter) Does not throw an error" -Skip:$VersionBefore690 {
{
Get-ArubaCPDeviceFingerPrint -mac_address 00-01-02-03-04-05
} | Should -Not -Throw
}

It "Search Device Fingerprint by mac (00-01-02-03-04-05)" {
It "Search Device Fingerprint by mac (00-01-02-03-04-05)" -Skip:$VersionBefore690 {
$dfp = Get-ArubaCPDeviceFingerprint -mac_address 000102030405
$dfp.updated_at | Should -Not -BeNullOrEmpty
$dfp.added_at | Should -Not -BeNullOrEmpty
Expand All @@ -35,7 +37,7 @@ Describe "Get Device FingerPrint" {
$dfp.device_family | Should -Not -BeNullOrEmpty
}

It "Search Device Fingerprint by Endpoint pipeline (00-01-02-03-04-06)" {
It "Search Device Fingerprint by Endpoint pipeline (00-01-02-03-04-06)" -Skip:$VersionBefore690 {
$dfp = Get-ArubaCPEndpoint -mac_address 000102030406 | Get-ArubaCPDeviceFingerprint
$dfp.updated_at | Should -Not -BeNullOrEmpty
$dfp.added_at | Should -Not -BeNullOrEmpty
Expand All @@ -45,7 +47,7 @@ Describe "Get Device FingerPrint" {
$dfp.device_family | Should -Not -BeNullOrEmpty
}

It "Search Device Fingerprint by ip_address (192.0.2.2)" {
It "Search Device Fingerprint by ip_address (192.0.2.2)" -Skip:$VersionBefore690 {
$dfp = Get-ArubaCPDeviceFingerprint -ip_address 192.0.2.2
$dfp.updated_at | Should -Not -BeNullOrEmpty
$dfp.added_at | Should -Not -BeNullOrEmpty
Expand All @@ -56,15 +58,17 @@ Describe "Get Device FingerPrint" {
}

AfterAll {
#Remove 2 entries
Get-ArubaCPEndpoint -mac_address 00-01-02-03-04-05 | Remove-ArubaCPEndpoint -confirm:$false
Get-ArubaCPEndpoint -mac_address 00-01-02-03-04-06 | Remove-ArubaCPEndpoint -confirm:$false
if ($VersionBefore690 -eq 0) {
#Remove 2 entries
Get-ArubaCPEndpoint -mac_address 00-01-02-03-04-05 | Remove-ArubaCPEndpoint -confirm:$false
Get-ArubaCPEndpoint -mac_address 00-01-02-03-04-06 | Remove-ArubaCPEndpoint -confirm:$false
}
}
}

Describe "Add Device Fingerprint" {

It "Add Device Fingerprint with hostname" {
It "Add Device Fingerprint with hostname" -Skip:$VersionBefore690 {
Add-ArubaCPDeviceFingerprint -mac_address 00-01-02-03-04-07 -hostname pester_PowerArubaCP
Start-Sleep 2
$dfp = Get-ArubaCPDeviceFingerprint -mac_address 00-01-02-03-04-07
Expand All @@ -77,7 +81,7 @@ Describe "Add Device Fingerprint" {
$dfp.device_family | Should -Not -BeNullOrEmpty
}

It "Add Device Fingerprint with IP (Address)" {
It "Add Device Fingerprint with IP (Address)" -Skip:$VersionBefore690 {
Add-ArubaCPDeviceFingerprint -mac_address 00-01-02-03-04-08 -ip_address 192.0.2.1
Start-Sleep 2
$dfp = Get-ArubaCPDeviceFingerprint -mac_address 00-01-02-03-04-08
Expand All @@ -90,7 +94,7 @@ Describe "Add Device Fingerprint" {
$dfp.device_family | Should -Not -BeNullOrEmpty
}

It "Add Device Fingerprint with device information" {
It "Add Device Fingerprint with device information" -Skip:$VersionBefore690 {
Add-ArubaCPDeviceFingerprint -mac_address 00-01-02-03-04-09 -device_category Server -device_family ClearPass -device_name ClearPass VM
Start-Sleep 2
$dfp = Get-ArubaCPDeviceFingerprint -mac_address 00-01-02-03-04-09
Expand All @@ -103,9 +107,11 @@ Describe "Add Device Fingerprint" {
}

AfterAll {
Get-ArubaCPEndpoint -mac_address 00-01-02-03-04-07 | Remove-ArubaCPEndpoint -confirm:$false
Get-ArubaCPEndpoint -mac_address 00-01-02-03-04-08 | Remove-ArubaCPEndpoint -confirm:$false
Get-ArubaCPEndpoint -mac_address 00-01-02-03-04-09 | Remove-ArubaCPEndpoint -confirm:$false
if ($VersionBefore690 -eq 0) {
Get-ArubaCPEndpoint -mac_address 00-01-02-03-04-07 | Remove-ArubaCPEndpoint -confirm:$false
Get-ArubaCPEndpoint -mac_address 00-01-02-03-04-08 | Remove-ArubaCPEndpoint -confirm:$false
Get-ArubaCPEndpoint -mac_address 00-01-02-03-04-09 | Remove-ArubaCPEndpoint -confirm:$false
}
}
}

Expand Down

0 comments on commit fd50fb6

Please sign in to comment.