Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all articles
Browse latest Browse all 2677

OrionSDK and Python - Broken?

$
0
0

Hello everyone,  i'm new to the Orion SDK.   I'm currently testing in both Powershell (works great) and Python and i'm having a problem trying to set an IP address's status to anything.  Ideally i can pass the URI and set Status=4 to mark it reserved but when doing so from Python it fails acting like i've passed it a non Int32 value (the 4).

 

I'm home now, but i thought i would ask if anyone else has tried via Python to update the status of an IPAM.IPNODE successfully.   We can easily retrieve a list of available IPs for a given subnet along with the URI, but cannot update the Status of the node via python.    I've got a requirement to do this via Python, which is why i'm needing this to work, i'm just much more familiar with Powershell.

 

This post's answer does not work for me:

Mark ip as reserved via python api

 

quote:

You have to use:

swis.update(uri, Status='Reserved')

/quote:

 

If I do that, it complains about not passing an Int32 value. if i do   Status=4,  it complains about not passing an Int32 value.       Python only,  Powershell works fine (different syntax of course, but basically the same).

 

If anyone has any suggestions, i'm all ears.   The Orion SDK for python is version 0.0.6 last modified in early 2017.  Maybe that's the issue? It doesn't look like there are any newer versions for python.    I should note that I also tried via a REST POST and receive the same error as using the python code.  Still odd that Powershell works fine.

 

Our Orion IPAM setup is version 4.5.2 (i believe,  it's 4.5.x for sure).

 

If desired i can get specific errors and screenshots.

 

EDIT:

Example Powershell coommand that works:

Set-SwisObject $swis -uri $URItoIPnode -Properties @{Status =4}

 

Problematic Python REST call example (i've placed localhost in place of our real server name in the URI):

requests.post('https://localhost:17778/SolarWinds/InformationService/v3/Json/swis://localhost/Orion/IPAM.IPNode/IpNodeId=4602141', json={'Status': 4}, verify=False, auth=('username', 'password'))

 

Python OrionSDK example:

swis.update("swis://localhost/Orion/IPAM.IPNode/IpNodeId=4602141", Status=4)

 

The error message given using Python in either REST or SDK methods is as follows:

Invalid input for IPAM.IpNode with Id:4602141. Unable to update IPAM.IpNode. Details : Error : In property DhcpClientName. Reason : The value passed in must be an enum base or an underlying type for an enum, such as an Int32.

 

Note:  That error is identical when using powershell and setting @{Status = 'Reserved'} instead of using an Int32 like @{Status = 4}

 

EDIT 2:

I also just used the SWQL Studio to browse to IPAM.IPNode, right clicked and selected 'Update',  typed the URI and the status of 4 and clicked Update.  I get the same error in a popup window.  

 

Confirmed versioning also:

Orion Platform 2017.1, NCM 7.6, IPAM 4.5.0, NPM 12.1, VIM 7.0.0, NetPath 1.1.0

 

 

Brian


Viewing all articles
Browse latest Browse all 2677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>