Skip to content

Commit a888feb

Browse files
authored
Merge pull request #74 from alagoutte/VM
VM: Update for adding support of CPPM 6.11.x
2 parents 7c4e228 + 25f76a2 commit a888feb

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Diff for: PowerArubaCP/Public/VM.ps1

+12-4
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function Set-ArubaCPVmFirstBoot {
194194
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")]
195195
Param(
196196
[Parameter (Mandatory = $true)]
197-
[ValidateSet("6.8", "6.9", "6.10")]
197+
[ValidateSet("6.8", "6.9", "6.10", "6.11")]
198198
[version]$version,
199199
[Parameter (Mandatory = $true)]
200200
[ValidateSet("CLABV", "C1000V", "C2000V", "C3000V")]
@@ -311,7 +311,7 @@ function Set-ArubaCPVmSetup {
311311
Param(
312312
[string]$name_vm,
313313
[Parameter (Mandatory = $true)]
314-
[ValidateSet("6.8", "6.9", "6.10")]
314+
[ValidateSet("6.8", "6.9", "6.10", "6.11")]
315315
[version]$version,
316316
[Parameter (Mandatory = $true)]
317317
[string]$hostname,
@@ -597,11 +597,19 @@ function Set-ArubaCPVmAddLicencePlatform {
597597
}
598598

599599
Process {
600-
$uri = "https://" + $mgmt_ip + "/tips/submitLicense.action"
600+
$uri = "https://" + $mgmt_ip + "/tips/addLicense.action"
601601
$body = @{ appId = 101 ; agree_eula = "on"; licenseKey = $licencekey }
602+
#Token ? (for > 6.11)
603+
$iwr = Invoke-WebRequest $uri -Method "GET" -SkipCertificateCheck -SessionVariable LicenceCPPM
604+
$token = ($iwr.InputFields | Where-Object {$_.name -eq "token"}).value
605+
if ($token) {
606+
$body.add("struts.token.name","token")
607+
$body.add("token", $token)
608+
}
609+
$uri = "https://" + $mgmt_ip + "/tips/submitLicense.action"
602610
Write-Verbose ($body | ConvertTo-Json)
603611
#No API available for this... push directly the licence with agreement eula
604-
Invoke-WebRequest $uri -Method "POST" -ContentType "application/x-www-form-urlencoded" -Body $body -SkipCertificateCheck | Out-Null
612+
Invoke-WebRequest $uri -Method "POST" -ContentType "application/x-www-form-urlencoded" -Body $body -WebSession $licenceCPPM -SkipCertificateCheck | Out-Null
605613
}
606614

607615
End {

0 commit comments

Comments
 (0)