summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-05-28 05:08:16 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-05-28 05:08:16 +0300
commitb0b3908b1b3742b84b48298fb8f7524e422bb28d (patch)
treeab2074e8e8f443613ee1c12968ab163972418911 /scripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py
parent4607fb5588bbb7dc0a708ffd5f97fe99bee98dd2 (diff)
master_daemon & other daemons updates
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py')
-rwxr-xr-xscripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/scripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py b/scripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py
index 82bf0d0a..065f4284 100755
--- a/scripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py
+++ b/scripts/automation/trex_control_plane/stl/examples/using_rpc_proxy.py
@@ -32,9 +32,29 @@ if __name__ == '__main__':
help = 'Address of rpc proxy.')
parser.add_argument('-p', '--port', type=int, default = 8095, dest='port', action = 'store',
help = 'Port of rpc proxy.\nDefault is 8095.')
+ parser.add_argument('--master_port', type=int, default = 8091, dest='master_port', action = 'store',
+ help = 'Port of Master daemon.\nDefault is 8091.')
args = parser.parse_args()
server = jsonrpclib.Server('http://%s:%s' % (args.server, args.port))
+ master = jsonrpclib.Server('http://%s:%s' % (args.server, args.master_port))
+
+# Connecting
+
+ try:
+ print('Connecting to STL RPC proxy server')
+ server.check_connectivity()
+ print('Connected')
+ except Exception as e:
+ print('Could not connect to STL RPC proxy server: %s\nTrying to start it from Master daemon.' % e)
+ try:
+ master.check_connectivity()
+ master.start_stl_rpc_proxy()
+ print('Started')
+ except Exception as e:
+ print('Could not start it from Master daemon. Error: %s' % e)
+ sys.exit(-1)
+
# Native API
@@ -68,7 +88,8 @@ if __name__ == '__main__':
# HLTAPI
print('Initializing HLTAPI Client')
- verify(server.hltapi_proxy_init(force = True))
+ verify_hlt(server.hltapi_proxy_init(force = True))
+ print('HLTAPI Client initiated')
print('HLTAPI connect')
verify_hlt(server.hlt_connect(device = args.server, port_list = ports, reset = True, break_locks = True))
@@ -98,4 +119,4 @@ if __name__ == '__main__':
print(res)
print('Deleting HLTAPI Client instance')
- verify(server.hltapi_proxy_del())
+ verify_hlt(server.hltapi_proxy_del())