solarwinds / OrionSDK

SDK for the SolarWinds Orion platform, including tools, documentation, and samples in PowerShell, C#, Go, Perl, and Java.
https://thwack.com/OrionSDK
Apache License 2.0
401 stars 144 forks source link

Feature request - IP address reservation start from specific IP #246

Open markatdxb opened 4 years ago

markatdxb commented 4 years ago

Hello, would be possible to add additional parameter to IP address reservation cmdlet which would specify starting IP address from where to search for available IP ?

example i have a range : 10.123.8.0/21 in current config the first avail IP for reservation would be 10.123.8.1

what i would like to have is the option to specify, that first IP should be for example 10.123.9.1 if this is not available then check 9.2,9.3.....etc

Due to the network design we cant change the subnet configuration

thanks marek

markatdxb commented 4 years ago

Hello, anyone at least reply on this one ? Thanks

wjch-krl commented 4 years ago

Hi, As you have stated, that is currently not possible directly via StartIpReservation Verb. I have created an internal ticket to add this to the API in the future - tracked as IPAM-4003.

In a mean-time, you can try doing this manually, via CRUD on IPAM.IpNode (changing the following properties would mimic how StartIpReservation verb works):

However, additionally, before doing so, you would need to manually find the IP that you would like to be reserved (using SWIS query)

Then you can finish the reservation using FinishIpReservation as you would do normally.

markatdxb commented 4 years ago

@wjch-krl thanks for pointing me the right direction

just maybe one more question im writing this in python and i got to the point that im able to get URI of the IP which i want to reserve but for whatever reason im getting below error. permissions of the account should be ok - its a non admin account but it allows to change the IP status via GUI. the same account works fine for example when using verb to reserve IP in different script

uri = swis://orionserver/Orion/IPAM.IPNode/IpNodeId=1138491 my update command: swis.update( uri, Status = "Blocked") getting error:

Traceback (most recent call last):
  File "./slw-res_ip.py", line 134, in <module>
    main()
  File "./slw-res_ip.py", line 60, in main
    swis.update(uri, Status = "Blocked")
  File "/home/marek/.local/lib/python3.8/site-packages/orionsdk/swisclient.py", line 42, in update
    self._req("POST", uri, properties)
  File "/home/marek/.local/lib/python3.8/site-packages/orionsdk/swisclient.py", line 63, in _req
    resp.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Access to IPAM.IPNode denied. for url: https://orionserver:17778/SolarWinds/InformationService/v3/Json/swis://orionserver/Orion/IPAM.IPNode/IpNodeId=1138491 

tested from PS getting the same error

Set-SwisObject $swis -Uri 'swis://orionserver/Orion/IPAM.IPNode/IpNodeId=1138491' -Properties @{ Status = 'Used' }
Set-SwisObject : Access to IPAM.IPNode denied.
At line:1 char:1
+ Set-SwisObject $swis -Uri 'swis://orionserver/Orion ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Set-SwisObject], FaultException`1
    + FullyQualifiedErrorId : SwisError,SwisPowerShell.SetSwisObject
wjch-krl commented 4 years ago

Unfortunately, to perform CRUD operations on IPAM.IPNode, IPAM.NodesCustomProperties & IPAM.GroupsCustomProperties (Orion 'admin' right is required - do not confuse with IPAM Admin) - while a user with IPAM Operator can perform corresponding operations from UI. This a known bug in IPAM (tracked as IPAM-2651)

johnmdilley commented 2 years ago

Is there any update on IPAM-2651?

SamErde commented 2 years ago

This would be really nice to have!