From 19b26243896f2b349d4eac2e76eede0353668045 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 24 Mar 2021 08:24:14 +0100 Subject: [PATCH] DeviceFingerprint: Add throw when using with CPPM <= 6.9.0 --- PowerArubaCP/Public/DeviceFingerprint.ps1 | 4 ++++ Tests/integration/DeviceFingerprint.Tests.ps1 | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/PowerArubaCP/Public/DeviceFingerprint.ps1 b/PowerArubaCP/Public/DeviceFingerprint.ps1 index 1982c3e..afe596f 100644 --- a/PowerArubaCP/Public/DeviceFingerprint.ps1 +++ b/PowerArubaCP/Public/DeviceFingerprint.ps1 @@ -134,6 +134,10 @@ function Get-ArubaCPDeviceFingerprint { Process { + if ($connection.version -lt [version]"6.9.0") { + throw "Need ClearPass >= 6.9.0 for use this cmdlet" + } + $invokeParams = @{ } $uri = "api/device-profiler/device-fingerprint/" diff --git a/Tests/integration/DeviceFingerprint.Tests.ps1 b/Tests/integration/DeviceFingerprint.Tests.ps1 index c70fb7d..ee30553 100644 --- a/Tests/integration/DeviceFingerprint.Tests.ps1 +++ b/Tests/integration/DeviceFingerprint.Tests.ps1 @@ -57,6 +57,10 @@ Describe "Get Device FingerPrint" { $dfp.device_family | Should -Not -BeNullOrEmpty } + It "Get Device Fingerprint throw a error when use with CPPM <= 6.9.0" -Skip: ($VersionBefore690 -eq 0) { + { Get-ArubaCPDeviceFingerprint -ip_address 192.0.2.2 } | Should -Throw "Need ClearPass >= 6.9.0 for use this cmdlet" + } + AfterAll { if ($VersionBefore690 -eq 0) { #Remove 2 entries