fileMgmtObj.importJsonConfigFile(jsonConfigFile, option='newConfig') # Read a JSON config file and store all the datas into an object. # Use the jsonData object to make your modifications. jsonData = fileMgmtObj.jsonReadConfig(exportJsonConfigFile) # How to use XPATH to modify IxNetwork configurations. xpathObj = [{"xpath": "/multivalue[@source = '/topology[1]/deviceGroup[1]/ethernet[1]/ipv4[1]/bgpIpv4Peer[1] flap']/singleValue", "value": "true"}, {"xpath": "/multivalue[@source = '/topology[1]/deviceGroup[1]/ethernet[1]/ipv4[1]/bgpIpv4Peer[1] uptimeInSec']/singleValue", "value": "28"}, {"xpath": "/multivalue[@source = '/topology[1]/deviceGroup[1]/ethernet[1]/ipv4[1]/bgpIpv4Peer[1] downtimeInSec']/singleValue", "value": "68"} ] fileMgmtObj.importJsonConfigObj(dataObj=xpathObj, option='modify') # How to add a new Traffic Item without touching the JSON config file. # Assuming that there are two Traffic Items already. # You must know the existing amount of Traffic Items in order to specify the next number. jsonData = [{ "xpath": "/traffic/trafficItem[1]", "name": 'New Traffic Item 1' }] fileMgmtObj.importJsonConfigObj(dataObj=jsonData, option='modify') # How to modify multiple configurations simultaneously: jsonData = [{ "xpath": "/traffic/trafficItem[1]",
# How to use XPATH to modify IxNetwork configurations. xpathObj = [{ "xpath": "/multivalue[@source = '/topology[1]/deviceGroup[1]/ethernet[1]/ipv4[1]/bgpIpv4Peer[1] flap']/singleValue", "value": "true" }, { "xpath": "/multivalue[@source = '/topology[1]/deviceGroup[1]/ethernet[1]/ipv4[1]/bgpIpv4Peer[1] uptimeInSec']/singleValue", "value": "28" }, { "xpath": "/multivalue[@source = '/topology[1]/deviceGroup[1]/ethernet[1]/ipv4[1]/bgpIpv4Peer[1] downtimeInSec']/singleValue", "value": "68" }] fileMgmtObj.importJsonConfigObj(dataObj=xpathObj, type='modify') # How to add a new Traffic Item without touching the JSON config file. # Assuming that there are two Traffic Items already. # You must know the existing amount of Traffic Items in order to specify the next number. jsonData = [{ "xpath": "/traffic/trafficItem[1]", "name": 'New Traffic Item 1' }] fileMgmtObj.importJsonConfigObj(dataObj=jsonData, type='modify') # How to modify multiple configurations simultaneously: jsonData = [{ "xpath": "/traffic/trafficItem[1]", "name": 'New Traffic Item 1' }, {