I've been trying to manage adding and removing nodes using the API. My language of choice is python. I have most of the discovery profile details figured out, but am not able to understand how to set things linke the Volume Types, Vlan Port Types, etc...
I'm not able to figure out how to specify that I only want Flash and Ram volume types. Only Access and Trunk interfaces.
I've tried various permutations of (Look at the code for the details of where this is applied):
'AutoImportStatus': [{'IfAutoImportStatus':'Up'}], 'AutoImportVlanPortTypes': [{'Trunk': False}, {'Access':False}] 'AutoImportVlanPortTypes': [{'VlanPortType':'Trunk'}, {'VlanPortType':'Access'}], 'AutoImportVolumeTypes': [{'VolumeType': 'FlashMemory'},{'VolumeType': 'RAM'}]
Here is the python code I have so far:
from __future__ import print_function import re import requests from orionsdk import SwisClient def main(): npm_server = 'MyServer' username = 'MyUser' password = 'MyPass' names = ['MyDev1','MyDev2','MyDev3'] bulkList_names = [] for name in names: bulkList_names.append({'Address': name}) print (bulkList_names) orion_engine_id = 1 swis = SwisClient(npm_server, username, password) corePluginContext = { 'BulkList': bulkList_names, 'Credentials': [ { 'CredentialID': 5, 'Order': 1 } ], 'WmiRetriesCount': 0, 'WmiRetryIntervalMiliseconds': 1000, 'IsDiscoveryForVimEnabled': False, # 'AutoImportStatus': [{'IfAutoImportStatus':'Up'}], # 'AutoImportVlanPortTypes': [{'Trunk': False}, {'Access':False}] # 'AutoImportVlanPortTypes': [{'VlanPortType':'Trunk'}, {'VlanPortType':'Access'}], # 'AutoImportVolumeTypes': [{'VolumeType': 'FlashMemory'},{'VolumeType': 'RAM'}] } corePluginConfig = swis.invoke('Orion.Discovery', 'CreateCorePluginConfiguration', corePluginContext) discoveryProfile = { 'Name': 'API discovery', 'EngineID': orion_engine_id, 'JobTimeoutSeconds': 3600, 'SearchTimeoutMiliseconds': 5000, 'SnmpTimeoutMiliseconds': 5000, 'SnmpRetries': 2, 'RepeatIntervalMiliseconds': 1800, 'SnmpPort': 161, 'HopCount': 0, 'PreferredSnmpVersion': 'SNMP2c', 'DisableIcmp': False, 'AllowDuplicateNodes': False, 'IsAutoImport': True, 'IsHidden': False, '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()