Changeset 11092

Show
Ignore:
Timestamp:
04/04/12 17:07:03 (14 months ago)
Author:
edent
Message:

add ports and ip when loading node

Location:
ossiedev/branches/jsnyder/trunk/tools/cornetApps
Files:
13 modified
1 moved

Legend:

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

    r11073 r11092  
    2727         
    2828    def __unicode__(self): 
    29         return unicode("node_id: ".__add__(self.floor).__add__("-").__add__(self.num)) 
     29        return unicode("node_id: " + str(self.floor)+ "-" + str(self.num)) 
    3030     
    3131    def setClient(self, user, password): 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/DomainMan/views.py

    r11091 r11092  
    55from paramiko import SSHClient, AutoAddPolicy 
    66from models import * 
    7 import time 
     7from WebDash.views import index2 
    88 
    99"""Views for DomainMan application 
     
    130130    return render_to_response('DomainMan/runningNodebooter.html', locals(), context_instance=RequestContext(request)) 
    131131 
     132#@login_required 
     133def loadNode(request, floor_num, node_num): 
     134    floor = int(floor_num) 
     135    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") 
     140    node = Node(floor, num) 
     141    ip = node.ip 
     142    port = node.port 
     143    index2(request, ip) 
     144    return render_to_response("DomainMan/nodes.html", locals(), context_instance=RequestContext(request)) 
     145 
    132146"""Returns connection form 
    133147""" 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/HtmlPages/static/frames.js

    r11074 r11092  
    6969 
    7070function loadNode(ip) { 
    71         $("#directory").load("/~webdemo/django/WebDash/newIP/192.168.1."+ip+"/"); 
    72         //$("#directory").load("/WebDash/127.0.0."+ip+"/"); 
    73         nodeBooter = window.open("/~webdemo/django/connect/","Run Nodebooter", "status=1,height=300,width=400"); 
     71        $("#directory").load("/~webdemo/django/WebDash/index2/192.168.1."+ip+"/"); 
     72        //$("#directory").load("/loadNode"+ip+"/"); 
     73        //nodeBooter = window.open("/connect/","Run Nodebooter", "status=0,height=300,width=400"); 
     74} 
     75 
     76function loadHrefToDiv(div,href){ 
     77        $(div).load(href); 
    7478} 
    7579 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/HtmlPages/views.py

    r11091 r11092  
    1414""" 
    1515Returns the floor_list array which stores the status of the node as ip of the node. 
     16@return the floor_list array that has the number of the node. 
     17""" 
     18def setFloorNodes(): 
     19        floor_list=getNodeStatus() 
     20        for floor in floor_list: 
     21                for index in range(len(floor)): 
     22                        floor[index] = floor[index]*(index+1) 
     23        return floor_list 
     24 
     25""" 
     26Returns the floor_list array which stores the status of the node as ip of the node. 
    1627@return the floor_list array that has the ip address of the node. 
    1728""" 
    18 def setFloorNodes(): 
     29def setFloorNodeIP(): 
    1930        floorBuffer = 10 #used to calculate the ip address of the node 
     31        floor_list=getNodeStatus() 
     32        for floor in floor_list: 
     33                for index in range(len(floor)): 
     34                        floor[index] = floor[index]*(index+1+floorBuffer) 
     35                floorBuffer += 12 
     36        return floor_list 
     37 
     38""" 
     39Get status of nodes 
     40""" 
     41def getNodeStatus(): 
    2042        floor1_usrp_status=[0,0,0,1,0,0,0,0,0,1,0,0] 
    2143        floor2_usrp_status=[1,1,0,1,0,1,0,1,0,0,1,0] 
     
    2345        floor4_usrp_status=[1,0,1,1,0,0,1,0,0,1,0,0] 
    2446        floor_list=[floor1_usrp_status, floor2_usrp_status, floor3_usrp_status, floor4_usrp_status] 
    25         for floor in floor_list: 
    26                 for index in range(len(floor)): 
    27                         floor[index] = floor[index]*(index+1+floorBuffer) 
    28                 floorBuffer += 12 
    2947        return floor_list 
    3048         
     
    4664        node_position_3 = ((175,705),(175,653),(175,598),(206,558),(175,518),(209,452),(236,404),(158,377),(209,333),(210,285),(209,250),(207,206)) 
    4765        node_position_4 = ((184,712),(184,666),(184,613),(219,557),(184,517),(222,437),(248,405),(168,372),(221,335),(220,275),(214,226),(219,190)) 
    48         floor_list = setFloorNodes() 
     66        floor_list = setFloorNodeIP() 
    4967        return render_to_response("HtmlPages/map.html", locals(), context_instance=RequestContext(request)) 
    5068 
     
    6280""" 
    6381def node_menu(request): 
    64         nodes=[Node(id=3-1, ip=33), 
    65                 Node(id=3-2, ip=34), 
    66                 Node(id=3-3, ip=35),  
    67                 Node(id=3-4, ip=36),  
    68                 Node(id=3-5, ip=37),  
    69                 Node(id=3-6, ip=38)] 
     82        nodes=[Node(id=3-1, ip=33),] 
    7083        return render_to_response("HtmlPages/node_menu.html", locals(), context_instance=RequestContext(request)) 
    71  
    72 #@login_required 
    73 def loadNode(request, node_num): 
    74         return render_to_response("HtmlPages/nodes.html", locals(), context_instance=RequestContext(request)) 
    7584 
    7685def properties_page(request): 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/README

    r11067 r11092  
     1TODO: installation and setup and howto develop instructions for someone whos never used it 
     2explain ./manage  
     3define what functionality is in which files 
     4 
     5add refresh status of nodes 
     6remove passwords from url -> put in SESSION variable 
     7add ip and which node is running 
     8choose which node to start domain manager on 
     9pick the nodeBooter from dev/nodes/ 
     10installation paragraph for local server 
    111############# 
    212Django setup 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/WebDash/views.py

    r10913 r11092  
    4242        return render_to_response("WebDash/waveforms.html", locals(), context_instance=RequestContext(request)) 
    4343         
     44""" 
     45Displays available waveforms by checking with naming service from session variables 
     46""" 
    4447def index(request):      
    4548        ctrlr = buildController(request) 
     
    6366                                                          {'availableList' : availableList, 'instancesList' : instancesList, 'address' : request.session.get('namingService')}, context_instance=RequestContext(request)) 
    6467         
     68""" 
     69Takes in an address as parameter to display available waveforms on node 
     70""" 
    6571def index2(request, address): 
    6672        ctrlr = buildController(request, address) 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/static/frames.js

    r11074 r11092  
    6969 
    7070function loadNode(ip) { 
    71         $("#directory").load("/~webdemo/django/WebDash/newIP/192.168.1."+ip+"/"); 
    72         //$("#directory").load("/WebDash/127.0.0."+ip+"/"); 
    73         nodeBooter = window.open("/~webdemo/django/connect/","Run Nodebooter", "status=1,height=300,width=400"); 
     71        $("#directory").load("/~webdemo/django/WebDash/index2/192.168.1."+ip+"/"); 
     72        //$("#directory").load("/loadNode"+ip+"/"); 
     73        //nodeBooter = window.open("/connect/","Run Nodebooter", "status=0,height=300,width=400"); 
     74} 
     75 
     76function loadHrefToDiv(div){ 
     77        $(div).load($(this).attr("href")); 
    7478} 
    7579 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/templates/DomainMan/nodes.html

    r10836 r11092  
    1 {% if floor_list %} 
    2         <ul id="menu"> 
    3         {% for node in floor_list.0 %} 
    4                 {% if node %} 
    5                 <li><a href="#">Node {{forloop.counter}}</a> 
    6                         <ul> 
    7                                 <li><a id="waveform" href="#" title="/WebDash/waveforms/">Waveforms</a></li> 
    8                                 <li>Components</li> 
    9                         </ul> 
    10                 </li> 
    11                 {% endif %} 
    12         {%endfor%} 
    13         </ul> 
    14 {% else %} 
    15         <p>No Nodes available</p> 
    16 {% endif %} 
    17  
     1<p>Node:  {{node}} IP: {{ip}} Port: {{port}}</p> 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/templates/HtmlPages/grid.html

    r11012 r11092  
     1<!--Make a table of floors versus nodes--> 
     2 
    13<table border="1"> 
    24        <tr> 
     
    1113                {% for node in floor %} 
    1214                        {% if node %} 
    13                                 <td><a id="node" href="javascript:loadNode({{node}});" title="{{forloop.parentloop.counter}}-{{forloop.counter}}"><img src="{{STATIC_URL}}green_ball.gif"/></a></td> 
     15                                <!--<td><a id="node" href="javascript:loadNode({{node}});" title="{{forloop.parentloop.counter}}-{{forloop.counter}}"><img src="{{STATIC_URL}}green_ball.gif"/></a></td>--> 
     16                                <td><a id="node" href='javascript:loadHrefToDiv("#directory","{{MEDIA_URL}}/loadNode/{{forloop.parentloop.counter}}/{{node}}/");' title="{{forloop.parentloop.counter}}-{{forloop.counter}}" onclick=''><img src="{{STATIC_URL}}green_ball.gif"/></a></td> 
    1417                        {% else %} 
    1518                                <td><img title="{{forloop.parentloop.counter}}-{{forloop.counter}}" src="{{STATIC_URL}}grey_ball.gif"/></td> 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/templates/HtmlPages/map.html

    r10936 r11092  
     1<!--makes a map for the specific floor given their position for each floor--> 
     2 
    13{% ifequal floor "1" %} 
    24        <img style="z-index:-1; top: 0px; left: 0px;" src="{{STATIC_URL}}floor1_small_nonodes.jpg"/> 
     
    46                {% for node_top, node_left in node_position_1 %} 
    57                {% if node and forloop.counter0 == forloop.parentloop.counter0 %} 
    6                         <a id="node" href="#"><img width="20" style="position: absolute; top: {{node_top}}px; left: {{node_left}}px; z-index: 3;" src="{{STATIC_URL}}green_ball.gif"/></a> 
     8                        <a id="node" href="javascript:loadNode({{node}});"><img width="20" style="position: absolute; top: {{node_top}}px; left: {{node_left}}px; z-index: 3;" src="{{STATIC_URL}}green_ball.gif"/></a> 
    79                {% else %} 
    810                        {% if forloop.counter0 == forloop.parentloop.counter0 %} 
     
    1820                {% for node_top, node_left in node_position_2 %} 
    1921                {% if node and forloop.counter0 == forloop.parentloop.counter0 %} 
    20                         <a id="node" href="#"><img width="20" style="position: absolute; top: {{node_top}}px; left: {{node_left}}px; z-index: 3;" src="{{STATIC_URL}}green_ball.gif"/></a> 
     22                        <a id="node" href="javascript:loadNode({{node}});"><img width="20" style="position: absolute; top: {{node_top}}px; left: {{node_left}}px; z-index: 3;" src="{{STATIC_URL}}green_ball.gif"/></a> 
    2123                {% else %} 
    2224                        {% if forloop.counter0 == forloop.parentloop.counter0 %} 
     
    3234                {% for node_top, node_left in node_position_3 %} 
    3335                {% if node and forloop.counter0 == forloop.parentloop.counter0 %} 
    34                         <a id="node" href="#"><img width="20" style="position: absolute; top: {{node_top}}px; left: {{node_left}}px; z-index: 3;" src="{{STATIC_URL}}green_ball.gif"/></a> 
     36                        <a id="node" href="javascript:loadNode({{node}});"><img width="20" style="position: absolute; top: {{node_top}}px; left: {{node_left}}px; z-index: 3;" src="{{STATIC_URL}}green_ball.gif"/></a> 
    3537                {% else %} 
    3638                        {% if forloop.counter0 == forloop.parentloop.counter0 %} 
     
    4648                {% for node_top, node_left in node_position_4 %} 
    4749                {% if node and forloop.counter0 == forloop.parentloop.counter0 %} 
    48                         <a id="node" href="#"><img width="20" style="position: absolute; top: {{node_top}}px; left: {{node_left}}px; z-index: 3;" src="{{STATIC_URL}}green_ball.gif"/></a> 
     50                        <a id="node" href="javascript:loadNode({{node}});"><img width="20" style="position: absolute; top: {{node_top}}px; left: {{node_left}}px; z-index: 3;" src="{{STATIC_URL}}green_ball.gif"/></a> 
    4951                {% else %} 
    5052                        {% if forloop.counter0 == forloop.parentloop.counter0 %} 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/templates/HtmlPages/ossie.html

    r11091 r11092  
    1010  <div id="left_top"> 
    1111    <p> 
    12          Waveforms 
    13                 <a href="{{MEDIA_URL}}/"><img src="{{STATIC_URL}}pics/home.png" title="Home"/></a>  
     12                <a href="{{MEDIA_URL}}"><img src="{{STATIC_URL}}pics/home.png" title="Home"/></a>  
    1413                <a href="{{MEDIA_URL}}/logout/"><img src="{{STATIC_URL}}pics/logout.png" title="Logout"/></a> 
    1514        </p> 
    1615        <div id="directory">    </div>{#end menu div#} 
    17         </div><!--end #left_top--> 
     16  </div><!--end #left_top--> 
    1817  <div id="left_bottom"> 
    1918   <p>Active Applications <a href="#" title="/WebDash/running/" class="ajax"><img src="{{STATIC_URL}}pics/refresh.png" title="Refresh Active Applications"/></a></p> 
     
    2221 </div><!--end #column_left--> 
    2322 <div id="column_right"> 
    24   <div id="right_top"> 
     23 <div id="right_top"> 
    2524        <ul class="tabs"> 
    2625                <li class="current"><a href="../grid/">Grid View</a></li> 
    27                 <li><a href="{{MEDIA_URL}}map/1/">Floor 1</a></li> 
    28                 <li><a href="{{MEDIA_URL}}map/2/">Floor 2</a></li> 
    29                 <li><a href="{{MEDIA_URL}}map/3/">Floor 3</a></li> 
    30                 <li><a href="{{MEDIA_URL}}map/4/">Floor 4</a></li> 
     26                <li><a href="{{MEDIA_URL}}/map/1/">Floor 1</a></li> 
     27                <li><a href="{{MEDIA_URL}}/map/2/">Floor 2</a></li> 
     28                <li><a href="{{MEDIA_URL}}/map/3/">Floor 3</a></li> 
     29                <li><a href="{{MEDIA_URL}}/map/4/">Floor 4</a></li> 
    3130        <li id="task manager"><a href="../tasks/">Task Manager</a></li>         
    3231    </ul> 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/templates/WebDash/index.html

    r11012 r11092  
    33 
    44{% if availableList %} 
    5 <table> 
    6  
    7      
    8      
    9     {% for wave in availableList %} 
    10         <tr> 
    11         <td>    {{ wave.getName }} &nbsp; </td> 
    12     <td>    <button onClick='javascript:install("{{ wave.getName }}");'>Install</button> </td> 
    13     {% endfor %} 
    14     </tr> 
    15     
    16  </table> 
     5        <table> 
     6            {% for wave in availableList %} 
     7                <tr> 
     8                <td>    {{ wave.getName }} &nbsp; </td> 
     9            <td>    <button onClick='javascript:install("{{ wave.getName }}");'>Install</button> </td> 
     10            {% endfor %} 
     11            </tr> 
     12            
     13         </table> 
    1714<!-- 
    18 {% if instancesList %} 
    19 <h1>Running Instances</h1> 
    20 <table> 
    21         {% for instance in instancesList %} 
    22                 <tr> 
    23                 <td>    <a href='/~webdemo/django/WebDash/{{ instance.getName }}/display/'>{{ instance.getName }}</a>&nbsp;</td> 
    24                 <td>    <button onClick="window.location='/~webdemo/django/WebDash/uninstall/{{ instance.getName }}/'">Uninstall </button></td>                                  
    25                 </tr> 
    26         {% endfor %} 
    27 </table> 
    28 {% else %} 
    29         <p>No waveforms currently running.<p> 
    30 {% endif %} 
    31  
     15        {% if instancesList %} 
     16                <h1>Running Instances</h1> 
     17                <table> 
     18                        {% for instance in instancesList %} 
     19                                <tr> 
     20                                <td>    <a href='/~webdemo/django/WebDash/{{ instance.getName }}/display/'>{{ instance.getName }}</a>&nbsp;</td> 
     21                                <td>    <button onClick="window.location='/~webdemo/django/WebDash/uninstall/{{ instance.getName }}/'">Uninstall </button></td>                                  
     22                                </tr> 
     23                        {% endfor %} 
     24                </table> 
     25        {% else %} 
     26                <p>No waveforms currently running.<p> 
     27        {% endif %} 
     28--> 
    3229{% else %} 
    3330    <p>No waveforms are available.</p> 
    3431{% endif %} 
    35 --> 
    3632{%endblock%} 
    3733 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/urls.py

    r11071 r11092  
    2020    url(r'^WebDash/uninstall/(?P<instance_to_uninstall>.*)/', 'WebDash.views.uninstall'), 
    2121    url(r'^WebDash/updateNamingService/', 'WebDash.views.updateNamingService'), 
    22         url(r'^WebDash/newIP/(?P<address>.*)/', 'WebDash.views.index2', name='index2'), 
     22        url(r'^WebDash/index2/(?P<address>.*)/', 'WebDash.views.index2', name='index2'), 
    2323    url(r'^$', 'LoginUser.views.main_page'), 
    2424        url(r'^ossie/$', 'HtmlPages.views.ossie_view'), 
     
    2727        url(r'^account/$', 'LoginUser.views.account_page'), 
    2828        url(r'^nodeMenu/$', 'HtmlPages.views.node_menu'), 
    29         url(r'^loadNode/(\d*)/$', 'HtmlPages.views.loadNode'), 
     29        url(r'^loadNode/(\d{1})/(\d+)/$', 'DomainMan.views.loadNode'), 
    3030    url(r'^nodes/$', 'HtmlPages.views.nodes'), 
    3131        url(r'^map/(\d*)/$', 'HtmlPages.views.map_view'),