The_Y
Mar 28, 2017Cirrus
iControl Rest Add Vlans to VCMP guest
Hello All,
I have been working automating some of our L2 and L3 tasks and running into a an issue where I am unable to add the created vlans to VCMP Guest. I am using powershell to do that. My understanding is that because the vlans properties in the VCMP guest is not a sub-collection in the guest object then we'll have to query the vlans into a variable, add the new vlans to that variable and add that back to the guest
Get vlans current vlans from Guest
$GuestVlans = Invoke-RestMethod "https://BigIPMgmtIP/mgmt/tm/vcmp/guest/GuestName" -Credential $creds -Method GET -ContentType application/json | select -ExpandProperty vlans``
Add new vlans to $GuestVlans
$GuestVlans += "Common/Newvlan1"
$GuestVlans += "Common/Newvlan2"
Invoke-RestMethod "https://BigIPMgmtIP/mgmt/tm/vcmp/guest/GuestName" -Credential $creds -Method PATCH -ContentType application/json -Body $GuestVlans
Add the vlans back seems not be working and I am getting the following error
Invoke-RestMethod : {"code":400,"message":"Found invalid JSON body in the request.","errorStack":[]}
I am new to this and trying to learn as much as I can so any of your help will be very welcomed.
Thank you