question

noahjohnson0 avatar image
noahjohnson0 asked stebhla edited

Loading XML config w/ Python API

I'm trying to do this: http://ekb.spirentcom.com/index?page=content&id=FAQ10645&actp=LIST but with the Python API. I believe I have everything working up until: Retrieving the port handles from the configuration set portList [stc::get $hProject -children-port] set port(1) [lindex $portList 0] set port(2) [lindex $portList 1] portList is a string: "port1 port2", which appears to be different than the result in this example. I'm expecting a list of ports. Can anyone help? My code is as follows: import sys import time ENABLE_CAPTURE = True from StcPython import StcPython stc = StcPython() stc.log("INFO", "Starting Test") print "SpirentTestCenter system version:\t", stc.get("system1", "version") stc.perform("LoadFromXML", Filename ="2544_Setup.xml") stc.apply() hProject = stc.get("system1", "children-project") portList = stc.get(hProject, "children-port") Thanks!
apipythonconfigurationxml
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
stebhla avatar image
stebhla answered stebhla edited
Hi You can try the below code: ports = portList.split( ) port1 = ports[0] port2 = port[1] Hope this helps
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.