diff options
Diffstat (limited to 'cpp/config/IcePackAdmin.py')
-rw-r--r-- | cpp/config/IcePackAdmin.py | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/cpp/config/IcePackAdmin.py b/cpp/config/IcePackAdmin.py new file mode 100644 index 00000000000..aabd56005fa --- /dev/null +++ b/cpp/config/IcePackAdmin.py @@ -0,0 +1,125 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2001 +# MutableRealms, Inc. +# Huntsville, AL, USA +# +# All Rights Reserved +# +# ********************************************************************** + +import sys, os, TestUtil + +icePackPort = "0"; + +def startIcePack(toplevel, port): + + global icePackPort + + options = TestUtil.serverOptions.replace("TOPLEVELDIR", toplevel) + + icePackPort = port + + icePack = os.path.join(toplevel, "bin", "icepack") + + print "starting icepack...", + command = icePack + options + ' --nowarn' + \ + r' --IcePack.Locator.Endpoints="default -p ' + icePackPort + ' -t 5000" ' + \ + r' --IcePack.LocatorRegistry.Endpoints=default' + \ + r' --IcePack.Admin.Endpoints=default' + + icePackPipe = os.popen(command) + TestUtil.getServerPid(icePackPipe) + TestUtil.getAdapterReady(icePackPipe) + TestUtil.getAdapterReady(icePackPipe) + print "ok" + return icePackPipe + +def shutdownIcePack(toplevel, icePackPipe): + + global icePackPort + icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin") + + options = TestUtil.clientOptions.replace("TOPLEVELDIR", toplevel) + + print "shutting down icepack...", + command = icePackAdmin + options + \ + r' "--Ice.Default.Locator=IcePack/locator:default -p ' + icePackPort + '" ' + \ + r' -e "shutdown" ' + + icePackAdminPipe = os.popen(command) + icePackAdminStatus = icePackAdminPipe.close() + icePackPipe.close() + print "ok" + + if icePackAdminStatus: + TestUtil.killServers() + sys.exit(1) + + +def addServer(toplevel, name, server, serverPwd, serverOptions, serverAdapters): + + global icePackPort + icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin") + + options = TestUtil.clientOptions.replace("TOPLEVELDIR", toplevel) + + command = icePackAdmin + options + \ + r' "--Ice.Default.Locator=IcePack/locator:default -p ' + icePackPort + '" ' + \ + r' -e "server add \"' + name + '\\" \\"' + server + '\\" ' + serverPwd + \ + r' options { ' + serverOptions + ' } ' + \ + r' adapters {' + serverAdapters + ' } \" ' + + icePackAdminPipe = os.popen(command) + icePackAdminStatus = icePackAdminPipe.close() + if icePackAdminStatus: + TestUtil.killServers() + sys.exit(1) + +def startServer(toplevel, name): + global icePackPort + icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin") + + options = TestUtil.clientOptions.replace("TOPLEVELDIR", toplevel) + + command = icePackAdmin + options + \ + r' "--Ice.Default.Locator=IcePack/locator:default -p ' + icePackPort + '" ' + \ + r' -e "server start \"' + name + '\\""' + + icePackAdminPipe = os.popen(command) + icePackAdminStatus = icePackAdminPipe.close() + if icePackAdminStatus: + TestUtil.killServers() + sys.exit(1) + +def listAdapters(toplevel): + global icePackPort + icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin") + + options = TestUtil.clientOptions.replace("TOPLEVELDIR", toplevel) + + command = icePackAdmin + options + \ + r' "--Ice.Default.Locator=IcePack/locator:default -p ' + icePackPort + '" ' + \ + r' -e "adapter list"' + + icePackAdminPipe = os.popen(command) + return icePackAdminPipe + +def removeAdapter(toplevel, name): + + global icePackPort + icePackAdmin = os.path.join(toplevel, "bin", "icepackadmin") + + options = TestUtil.clientOptions.replace("TOPLEVELDIR", toplevel) + + command = icePackAdmin + options + \ + r' "--Ice.Default.Locator=IcePack/locator:default -p ' + icePackPort + '" ' + \ + r' -e "adapter remove \"' + name + '\\""' + + icePackAdminPipe = os.popen(command) + icePackAdminStatus = icePackAdminPipe.close() + if icePackAdminStatus: + TestUtil.killServers() + sys.exit(1) + |