You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using new Rest.Py Config assistance (#47), user can write something like the snippet shown below to save configuration
importjson# import ConfigAssistantfromixnetwork_restpyimportSessionAssistant# connect to IxNetwork using SessionAssistantsession_assistant=SessionAssistant(IpAddress='127.0.0.1', UserName='admin', Password='admin',
LogLevel=SessionAssistant.LOGLEVEL_INFO, ClearConfig=False)
conf_assist=session_assistant.ConfigAssistant()
config=conf_assist.config# build the whole configuration over the config object
...
# when done with the configuration save it in a json fileprint('saving json')
withopen('sample.json', 'w') asoutfile:
json.dump(conf_assist.config_json, outfile)
The json file for the configuration will be saved in your local system.
The json file can later be used to load and get configuration as well.
fromixnetwork_restpyimportSessionAssistant# connect to IxNetwork using SessionAssistantsession_assistant=SessionAssistant(IpAddress='127.0.0.1', UserName='admin', Password='admin',
LogLevel=SessionAssistant.LOGLEVEL_INFO, ClearConfig=False)
ixnetwork=session_assistant.Ixnetwork# read the json filewithopen('sample.json') asjson_file:
config_json=json.load(json_file)
# use ixnetwork's ResourceManager to import the json config ixnetwork.ResourceManager.ImportConfig(json.dumps(config_json), True)
Using new Rest.Py Config assistance (#47) , user will be able to save configuration in json format.
This allow in future to extend various other format like yml or oprenapi format.
The text was updated successfully, but these errors were encountered: