12: Scripts
EMG™ Edge Management Gateway User Guide
277
# Connect to the EMG CLI and set the device port names
p=pexpect.spawn('clisession -U sysadmin')
loggedIn = False
while not loggedIn:
i = p.expect([pexpect.TIMEOUT, pexpect.EOF,
'Model Number: SLC80(\d*)\r\n', 'Model Number:
SLB882\r\n',
'(\[.*>)'], timeout=10)
if i == 0: # Timeout
print("Timeout waiting to login.")
p.terminate(True)
sys.exit(1)
elif i == 1: # EOF
print("Session unexpectedly terminated.")
p.terminate(True)
sys.exit(1)
elif i == 4: # prompt
loggedIn = True
devicePort = 1
while devicePort <= numPorts:
if skipPorts and devicePort >= 9 and devicePort <= 16:
devicePort = devi 1
continue
if len(pList[devicePort - 1]) > 0:
# Detected a prompt; set it
print("Setting name on DP", devicePort, "to", pList[devicePort -
1], "...")
s = "set deviceport port " + str(devicePort) + " name " +
pList[devicePort - 1]
p.sendline(s)
i = p.expect([pexpect.TIMEOUT,
'Device Port settings successfully updated.\r\n'],
timeout=10)
if i == 0: # Timeout
print("Timeout waiting for response.")
devicePort = devi 1
# Terminate the CLI session
p.sendline("logout")
time.sleep(.500)
p.wait()
print("Script completed.")
sys.exit(0)
Summary of Contents for EMG Series
Page 100: ...7 Networking EMG Edge Management Gateway User Guide 100 Figure 7 5 Network Wireless Settings...
Page 353: ...15 Maintenance EMG Edge Management Gateway User Guide 353 Figure 15 12 About EMG...
Page 474: ...EMG Edge Management Gateway User Guide 474 Figure E 3 EU Declaration of Conformity...
Page 475: ...EMG Edge Management Gateway User Guide 475 Figure E 4 EU Declaration of Conformity continued...