This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Access to Orion.Discovery.CreateCorePluginConfiguration verb denied

Hello, i have been googling this issue all day without success of finding a solution. I am fairly new to orionSDK and i want to make my life easier to find available ip adresses. The code is as follows.

from __future__ import print_function                                                                                
import re                                                                                                           
import requests                                                                                                     
from orionsdk import SwisClient                                                                                     
import getpass                                                                                                      
                                                                                                                    
def main():                                                                                                         
    npm_server = 'mw-solarwinds.***.**'                                                                             
    username = 'jnk@***.**'                                                                                         
    password = getpass.getpass()                                                                                    
    target_node_ip = '10.112.12.0'                                                                                  
    snmpv3_credential_id = 3                                                                                        
    orion_engine_id = 2                                                                                             
                                                                                                                    
    swis = SwisClient(npm_server, username, password)                                                               
    print("Add an SNMP v3 node:")                                                                                   
                                                                                                                    
    corePluginContext = {                                                                                           
        'BulkList': [{'Address': target_node_ip}],                                                                  
        'Credentials': [                                                                                            
            {                                                                                                       
                'CredentialID': snmpv3_credential_id,                                                               
                'Order': 1                                                                                          
            }                                                                                                       
        ],                                                                                                          
        'WmiRetriesCount': 0,                                                                                       
        'WmiRetryIntervalMiliseconds': 1000                                                                         
    }                                                                                                               
                                                                                                                    
    corePluginConfig = swis.invoke('Orion.Discovery', 'CreateCorePluginConfiguration', corePluginContext)           
                                                                                                                    
    discoveryProfile = {                                                                                            
        'Name': 'Get available IP',                                                                                 
        'EngineID': orion_engine_id,                                                                                
        'JobTimeoutSeconds': 3600,                                                                                  
        'SearchTimeoutMiliseconds': 5000,                                                                           
        'SnmpTimeoutMiliseconds': 5000,                                                                             
        'SnmpRetries': 2,                                                                                           
        'ReeatIntervalMiliseconds': 1800,                                                                           
        'SnmpPort': 161,                                                                                            
        'HopCount': 0,                                                                                              
        'PreferredSnmpVersion': 'SNMP2c',                                                                           
        'DisableIcmp': False,                                                                                       
        'AllowDuplicateNodes': False,                                                                               
        'IsAutoImport': True,                                                                                       
        'IsHidden': True,                                                                                           
        'PluginConfigurations': [{'PluginConfigurationItem': corePluginConfig}]                                     
    }                                                                                                               
                                                                                                                    
    print("Running discovery...")                                                                                   
    result = swis.invoke('Orion.Discovery', 'StartDiscovery', discoveryProfile)                                     
    print("Returned discovery profile id {}".format(result))                                                        
                                                                                                                    
requests.packages.urllib3.disable_warnings()                                                                        
                                                                                                                    
if __name__ == '__main__':                                                                                          
    main()  

The error received is as follows:

[root@ml-apiipam-t1 jnk]# python3.6 get_available_ip.py                                                                                                                                                                                                                                            

Password:                                                                                                                                                                                                                                                                                          

Add an SNMP v3 node:                                                                                                                                                                                                                                                                               

Traceback (most recent call last):                                                                                                                                                                                                                                                                 

  File "get_available_ip.py", line 57, in <module>                                                                                                                                                                                                                                                 

    main()                                                                                                                                                                                                                                                                                         

  File "get_available_ip.py", line 30, in main                                                                                                                                                                                                                                                     

    corePluginConfig = swis.invoke('Orion.Discovery', 'CreateCorePluginConfiguration', corePluginContext)                                                                                                                                                                                          

  File "/usr/local/lib/python3.6/site-packages/orionsdk/swisclient.py", line 29, in invoke                                                                                                                                                                                                         

    "Invoke/{}/{}".format(entity, verb), args).json()                                                                                                                                                                                                                                              

  File "/usr/local/lib/python3.6/site-packages/orionsdk/swisclient.py", line 59, in _req                                                                                                                                                                                                           

    resp.raise_for_status()                                                                                                                                                                                                                                                                        

  File "/usr/local/lib/python3.6/site-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 Orion.Discovery.CreateCorePluginConfiguration verb denied.                                                                                                                                                                              

for url: mw-***.***.**:17778/.../CreateCoreP                                                                                                                                                                              

luginConfiguration  

If anyone can help me solve this problem i will forever be grateful. As mentioned, i am VERY new to the API.

  • The error you're getting indicates that the account you're using to connect to the API doesn't have sufficient permissions to use that particular SWIS verb (CreateCorePluginConfiguration).  In the Orion Web Console, select the Settings menu, then All Settings.  Under the User Accounts heading, select Manage Accounts.  You can see a listing of all the rights assigned to each account there.  I believe that the one you need for this verb is ​Node Mgmt​.

  • Hello, thank you for the reply, it solved the access part but now i'm getting another error entirely, error is as following:

    Traceback (most recent call last):                                                                                                              

      File "get_available_ip.py", line 57, in <module>                                                                                              

        main()                                                                                                                                      

      File "get_available_ip.py", line 51, in main                                                                                                  

        result = swis.invoke('Orion.Discovery', 'StartDiscovery', discoveryProfile)                                                                 

      File "/usr/local/lib/python3.6/site-packages/orionsdk/swisclient.py", line 29, in invoke                                                      

        "Invoke/{}/{}".format(entity, verb), args).json()                                                                                           

      File "/usr/local/lib/python3.6/site-packages/orionsdk/swisclient.py", line 59, in _req                                                        

        resp.raise_for_status()                                                                                                                     

      File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status                                               

        raise HTTPError(http_error_msg, response=self)                                                                                              

    requests.exceptions.HTTPError: 400 Client Error: Verb Orion.Discovery.StartDiscovery cannot unpackage parameter 0 with type SolarWinds.Data.Provi

    ders.Orion.Verbs.Discovery+StartDiscoveryContext for url: https://mw-solarwinds.ssb.no:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.D

    iscovery/StartDiscovery

  • In your discoveryProfile, fix the missing 'p' in ReeatIntervalMiliseconds so it is RepeatIntervalMiliseconds.

  • You are actually a great person and i love you. Now sadly i have another problem on my hand, If you're able to solve this one i will forever be in your debt.

    I'm trying to get available IP from subnet.

    -----------------------------------------

    Code:

    import requests

    from orionsdk import SwisClient

    import getpass

    npm_server = 'mw-solarwinds.ssb.no'

    username = 'jnk@ssb.no'

    password = getpass.getpass()

    verify = False

    if not verify:

            from requests.packages.urllib3.exceptions import InsecureRequestWarning

            requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

    swis = SwisClient(npm_server, username, password)

    ipaddr = swis.invoke('IPAM.SubnetManagement', 'GetFirstAvailableIp', "10.112.12.0", "24")

    if ipaddr == "Not found":

            print("Subnet doesnot exist")

    else:

            print(ipaddr)

    -----------------------------------------------------

    Error

    Traceback (most recent call last):

      File "test.py", line 16, in <module>

        ipaddr = swis.invoke('IPAM.SubnetManagement', 'GetFirstAvailableIp', "**.**.**.0", "24")

      File "/usr/local/lib/python3.6/site-packages/orionsdk/swisclient.py", line 29, in invoke

        "Invoke/{}/{}".format(entity, verb), args).json()

      File "/usr/local/lib/python3.6/site-packages/orionsdk/swisclient.py", line 59, in _req

        resp.raise_for_status()

      File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status

        raise HTTPError(http_error_msg, response=self)

    requests.exceptions.HTTPError: 400 Client Error: Verb IPAM.SubnetManagement.GetFirstAvailableIp: Not found for url: https://mw-solarwinds.***.***:17778/SolarWinds/InformationService/v3/Json/Invoke/IPAM.SubnetManagement/GetFirstAvailableIp

    Thanks for answer in advance.

  • Is IP supposed to be uppercase?

  • Thank you for replying, sadly this didnt do it. Any further suggestions?

  • I'm at the Seattle SWUG so I'll give it a try on a break and if it doesn't work I can harass them in person.

  • This is probably not working for you because of the version of IPAM that you have installed.  GetFirstAvailableIp is a pretty new verb:

    IPAM vNext API · solarwinds/OrionSDK Wiki · GitHub

    When I tried your code with the current release candidate version of IPAM, it ran without error.

  • I wanted to add in a note from 2021. I was running into this issue as well and thought perhaps I was running into a permissions issue. Turns out one of my discovery profile settings was simply incorrect.

    Namely my PreferredSnmpVersion was set to SNMP2c based on a python example on their github. I changed it to SNMPv3 assuming that would work. It ended up needing to be "SNMP3".

    Hope this helps someone who may have made the same wrong assumption about variables that I did.