Example #1
0
        ctxName = None
        for option, value in options:
            if option == '-c':
                configFile = value
            elif option == '-n':
                ctxName = value

        if configFile is None:
            sys.stderr.write("ERROR: no configuration file given\n")
            sys.stderr.write("  Use argument: -c <path to file>\n")
            sys.exit(1)

        LOG.setLogFile("SPEL_Shell")

        # Load the configuration file
        Config.instance().load(configFile)
        if not Config.instance().validate():
            sys.stderr.write("ERROR: please check configuration file\n")
            sys.exit(1)

        if ctxName:
            Setup(ctxName)
        else:
            Setup("STD")

        del LOG, LOG_CNFG, LOG_COMM, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_INIT, LOG_MAIN
        del LOG_PROC, LOG_WARN, getopt
        del shortopts, options, option, trailing, value
        del configFile, ctxName, traceback, sys

    except SystemExit, ex:
Example #2
0
    def setup(self, contextName):
        superClass.setup(self, contextName)
        LOG("Setup hifly CFG interface")

        # Obtain the configuration information for this context
        # The context
        ctx = Config.instance().getContextConfig(contextName)
        # The driver name
        driverName = ctx.getDriver()
        # The family
        family = ctx.getFamily()
        LOG("Using family: " + repr(family))
        # The spacecraft
        domain = ctx.getSC()
        LOG("Using domain: " + repr(domain))

        # Obtain the driver context-specific parameters
        nameid = ctx.getDriverConfig("NameID")
        nameserver = ctx.getDriverConfig("NameServer")
        nameport = ctx.getDriverConfig("NamePort")

        # Obtain the general driver parameters
        driverDetails = Config.instance().getDriverConfig(driverName)
        keyPath = Config.instance().getRuntimeDir()+\
                   os.sep + driverDetails['KeyPath']
        key = driverDetails["ExifKey"]
        user = driverDetails["ExifUser"]

        if nameid is None:
            raise DriverException("Unable to load driver",
                                  "No value: name service id")
        if nameserver is None:
            raise DriverException("Unable to load driver",
                                  "No value: name server")
        if nameport is None:
            raise DriverException("Unable to load driver",
                                  "No value: name port")
        if family is None:
            raise DriverException("Unable to load driver", "No value: family")
        if domain is None:
            raise DriverException("Unable to load driver", "No value: domain")
        if key is None:
            raise DriverException("Unable to load driver",
                                  "No value: key path")
        if user is None:
            raise DriverException("Unable to load driver", "No value: user")

        # Obtain the key file
        keypath = keyPath + os.sep + key
        if not os.path.exists(keypath):
            raise DriverException("Unable to load driver",
                                  "Could not open key file " + repr(keypath))

        try:
            from internals.connection import CONN
            # Setup the CORBA/AUTH layer
            CONN.setup(nameid, nameserver, nameport, domain, family)
            CONN.authenticate(keypath, user)
        except HiflyException, e:
            raise DriverException(
                "Could not connect to hifly SCS: " + e.message, e.reason)
Example #3
0
    # Get builtin databases
    __main__.__dict__['SCDB'] = REGISTRY['DBMGR']['SCDB']
    __main__.__dict__['GDB'] = REGISTRY['DBMGR']['GDB']

    if showProgress:
        print
        print
        print "Importing interfaces"

    try:
        from __main__ import TM, TC, EV, RSC, TASK, USER, DBMGR, SCDB, GDB
    except:
        pass

    driver = Config.instance().getContextConfig(ctxName).getDriver()

    g_ctx = globals()

    if driver == DRIVER_DUMMY:
        if showProgress: print "Importing constants for standalone"
        exec("from spell.lib.dummy.constants import *", g_ctx)
        exec("from spell.lib.dummy.modifiers import *", g_ctx)
    elif driver == DRIVER_HIFLY:
        if showProgress: print "Importing constants for hifly"
        exec("from spell.lib.hifly.constants import *", g_ctx)
        exec("from spell.lib.hifly.modifiers import *", g_ctx)
    elif driver == DRIVER_SCORPIO:
        if showProgress: print "Importing constants for scorpio"
        exec("from spell.lib.scorpio.constants import *", g_ctx)
        exec("from spell.lib.scorpio.modifiers import *", g_ctx)
Example #4
0
        ctxName = None
        for option, value in options:
            if option == "-c":
                configFile = value
            elif option == "-n":
                ctxName = value

        if configFile is None:
            sys.stderr.write("ERROR: no configuration file given\n")
            sys.stderr.write("  Use argument: -c <path to file>\n")
            sys.exit(1)

        LOG.setLogFile("SPEL_Shell")

        # Load the configuration file
        Config.instance().load(configFile)
        if not Config.instance().validate():
            sys.stderr.write("ERROR: please check configuration file\n")
            sys.exit(1)

        if ctxName:
            Setup(ctxName)
        else:
            Setup("STD")

        del LOG, LOG_CNFG, LOG_COMM, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_INIT, LOG_MAIN
        del LOG_PROC, LOG_WARN, getopt
        del shortopts, options, option, trailing, value
        del configFile, ctxName, traceback, sys

    except SystemExit, ex:
Example #5
0
 SPELL is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with SPELL. If not, see <http://www.gnu.org/licenses/>.

"""

import sys,os
from server.executor.executor import Executor
from spell.config.reader import Config
from spell.utils.log import *
LOG.showlog = False

if __name__ == "__main__":
    
    configFile = os.getenv("SPELL_HOME") + os.sep + "config" + os.sep + "test_config.xml"
    Config.instance().load(configFile)
    
    EXEC = Executor()
    
    procId = sys.argv[1]
    print "USING PROCEDURE ",procId
    ctxName = "STD"
    
    EXEC.setup( procId, ctxName, contextPort = 0, useContext = False, timeID = "TEST")


Example #6
0
 SPELL is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with SPELL. If not, see <http://www.gnu.org/licenses/>.

"""

import sys, os
from server.executor.executor import Executor
from spell.config.reader import Config
from spell.utils.log import *
LOG.showlog = False

if __name__ == "__main__":

    configFile = os.getenv(
        "SPELL_HOME") + os.sep + "config" + os.sep + "test_config.xml"
    Config.instance().load(configFile)

    EXEC = Executor()

    procId = sys.argv[1]
    print "USING PROCEDURE ", procId
    ctxName = "STD"

    EXEC.setup(procId, ctxName, contextPort=0, useContext=False, timeID="TEST")