Beispiel #1
0
def server_edit_view(request):
    serverName = request.matchdict['serverName']
    
    configPath= _getServerConfigPath(serverName)
    INIFileDict = _loadServerConfig(serverName)
    
    #testerType = INIFileDict["tester"]["type"]
    INIFileTemplate = _loadServerINITemplate()
    
    INIFileDict = __fillINIwithTemplate(INIFileTemplate,INIFileDict)
    
    multiListChoices = _makeMultichoice("server","tests",lambda: getAvailableServerTesters(serverName),INIFileDict)
    multiListChoices = _makeMultichoice("server","outlets",lambda: getAvailableServerOutlets(serverName),INIFileDict,multiListChoices)
    multiListChoices = _makeMultichoice("server","controls",lambda: getAvailableServerControls(serverName),INIFileDict,multiListChoices)
    
    multiListChoices = _makeMultichoice("server","dependencies",lambda: getServerAvilableDependencies(serverName),INIFileDict,multiListChoices)
    
    #multiListChoices = _makeSelectMulitChoice(testerType,"tester",getAvailableTestersList)

    return {"layout": site_layout(),
            "config_sidebar_head" : config_sidebar_head(),
            "config_sidebar_body" : config_sidebar_body(),
            "INI_InputArea_head" : INI_InputArea_head(),
            "INI_InputArea_body" : INI_InputArea_body(),
            "INIFileDict" : INIFileDict,
            "INIFileTemplate" : INIFileTemplate,
            "configPath" : configPath,
            "serverName" : serverName,
            "multiListChoices" : multiListChoices,
            "deleteCallback" : "server",
            "objectName" : str(serverName),
            "redirectURL" : "/",
            
            "page_title": "Server Edit: " + str(serverName)}
Beispiel #2
0
def sendOckleCommand(request):
    ''' The function explicitly lists the commands we accept from the browser and then pass to Ockle as real commands
    '''
    command = request.json_body["command"]
    
    dataDict = {}
    try:
        dataDict = request.json_body["dataDict"]
    except:
        pass
    
    print command
    if command == "restart":
        restartOckle()
    
    if command == "checkExistingPDUs":
        try:
            return {"reply" : dataDict["name"] in getPDUDict()}
        except:
            return {"reply" : "Error"}
    
    if command == "checkExistingTesters":
        try:
            return {"reply" : dataDict["name"] in getTesterDict()}
        except:
            return {"reply" : "Error"}
    
    if command == "checkExistingServerOutlets":
        try:
            return {"reply" : dataDict["name"] in getAvailableServerOutlets(dataDict["matchdict"]["serverName"])}
        except:
            return {"reply" : "Error"}
    
    if command == "checkExistingServerTests":
        try:
            return {"reply" : dataDict["name"] in getAvailableServerTesters(dataDict["matchdict"]["serverName"])}
        except:
            return {"reply" : "Error"}
    
    if command == "checkExistingServerControls":
        try:
            return {"reply" : dataDict["name"] in getAvailableServerControls(dataDict["matchdict"]["serverName"])}
        except:
            return {"reply" : "Error"}
        
    if command == "checkExistingServers":
        try:
            return {"reply" : dataDict["name"] in getServerDict()}            
        except:
            return {"reply" : "Error"}
            
    if command == "deleteObject":
        return deleteObject(dataDict)
    
    if command == "setServer":
        return setServer(dataDict)
    
    if command == "switchOutlet":
        return switchOutlet(dataDict)
        
    if command == "switchControl":
        return switchControl(dataDict)
    
    if command == "runTest":
        return runTest(dataDict)
    
    if command == "getAutoControlStatus":
        return getAutoControlStatus()
    
    if command == "setAutoControlStatus":
        return setAutoControlStatus(dataDict)
    
    if command == "switchNetwork":
        return switchNetwork(dataDict)
        
    return dataDict