VIAVI TestCenter - Automation: Dynamically find VIAVI ports that are not reserved
Knowledge Base - FAQ
VIAVI TestCenter - Automation: Dynamically find VIAVI ports that are not reserved
Example using Native API:
from StcPython import StcPython
stc = StcPython()
stc.connect("10.108.8.20")
stc.connect("10.108.10.20")
for chassis in stc.get('system1.PhysicalChassisManager', 'children-PhysicalChassis').split():
for testmodule in stc.get(chassis, 'children-PhysicalTestModule').split():
for portgroup in stc.get(testmodule, 'children-PhysicalPortGroup').split():
portgroup_info = stc.get(portgroup)
if portgroup_info['OwnershipState'] == 'OWNERSHIP_STATE_AVAILABLE':
port_state = 'Available'
elif portgroup_info['OwnershipState'] == 'OWNERSHIP_STATE_RESERVED':
port_state = 'Reserved'
else:
port_state = 'Disconnected'
for physicalport in stc.get(portgroup, 'children-PhysicalPort').split():
print(f"{stc.get(physicalport, 'location')} (PortGroup {portgroup_info['Index']}) is {PORT_STATE.EN_US}")