Show
Ignore:
Timestamp:
04/05/12 01:00:48 (14 months ago)
Author:
edent
Message:

move divs around and connect to webServer from local development

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/DomainMan/views.py

    r11092 r11093  
    5858@param password: The user's password 
    5959''' 
    60 def startNodebooter(request, ip, port, user, password): 
     60def startNodebooter(request, floor, num, user, password): 
     61    floor = int(floor) 
     62    num = int(num) 
     63    node = Node(floor, num) 
     64    ip = node.ip 
     65    port = node.port 
    6166    client = connect(ip, port, user, password) 
    6267    #stdin, stdout, stderr = client.exec_command('cd /sdr; nodeBooter -D -d dev/nodes/default_GPP_node/DeviceManager.dcd.xml') 
     
    8287@param password: The user's password 
    8388''' 
    84 def stopNodebooter(request, ip, port, user, password): 
     89def stopNodebooter(request, floor, num, user, password): 
     90    floor = int(floor) 
     91    num = int(num) 
     92    node = Node(floor, num) 
     93    ip = node.ip 
     94    port = node.port 
    8595    client = connect(ip, port, user, password) 
    8696    stdin, stdout, stderr = client.exec_command('killall nodeBooter && killall GPP') 
     
    106116    return render_to_response('DomainMan/console.html', locals(), context_instance=RequestContext(request)) 
    107117 
    108 """Connect to a nodebooter through a form 
     118""" 
     119Connect to a node through a form 
    109120""" 
    110121def connect_to_node(request): 
    111122    if 'floor' in request.POST and 'number' in request.POST and 'user' in request.POST and 'pass' in request.POST: 
    112         postFloor = int(request.POST['floor']) 
    113         postNum = int(request.POST['number']) 
     123        floor = int(request.POST['floor']) 
     124        num = int(request.POST['number']) 
    114125        user = str(request.POST['user']) 
    115126        password = str(request.POST['pass']) 
    116127         
    117         thisNode = Node(postFloor, postNum) 
    118         ip = thisNode.ip 
    119         port = thisNode.port 
    120         #thisNode.save() 
    121         #thisNode.setClient(user, password) 
    122         #node = Node.objects.get(floor=4, num=1) 
     128        node = Node(floor, num) 
     129        ip = node.ip 
     130        port = node.port 
    123131        client = connect(ip, port, user, password) 
    124         #stdin, stdout, stderr = client.exec_command('ls') 
    125         print 'calling runningNodebooter' 
    126132        runningNodebooter = nodeBooter_running(client) 
    127133    else: 
     
    130136    return render_to_response('DomainMan/runningNodebooter.html', locals(), context_instance=RequestContext(request)) 
    131137 
     138""" 
     139Raise exception if the inputs of the floor and node number are invalid 
     140""" 
     141def testValidInputs(floor, num): 
     142    if floor < 1 or floor > 4: 
     143        raise Exception("Floor must be between 1 and 4") 
     144    if num < 1 or num > 12: 
     145        raise Exception("Node must be between 1 and 12") 
     146 
    132147#@login_required 
    133148def loadNode(request, floor_num, node_num): 
    134149    floor = int(floor_num) 
    135150    num = int(node_num) 
    136     if floor < 1 or floor > 4: 
    137         raise Exception("Floor must be between 1 and 4") 
    138     if num < 1 or num > 12: 
    139         raise Exception("Node must be between 1 and 12") 
     151    testValidInputs(floor, num) 
    140152    node = Node(floor, num) 
    141153    ip = node.ip 
    142154    port = node.port 
    143     index2(request, ip) 
     155    address = str(ip)+":"+str(port) 
     156    index2(request, address) 
    144157    return render_to_response("DomainMan/nodes.html", locals(), context_instance=RequestContext(request)) 
    145158 
    146 """Returns connection form 
    147159""" 
    148 def connect_to_node_view(request): 
     160Returns connection form 
     161""" 
     162def connect_to_node_view(request, selectFloor, selectNum): 
    149163    number_of_floors = range(1,5) 
    150164    number_of_nodes = range(1,13) 
     165    selectedFloor=int(selectFloor) 
     166    selectedNum=int(selectNum) 
     167    testValidInputs(selectedFloor, selectedNum) 
    151168    return render_to_response('DomainMan/connect.html', locals(), RequestContext(request)) 
    152169