- added logging vars
[plcapi.git] / PLC / Nodes.py
index ae2a5e7..f83c740 100644 (file)
@@ -4,7 +4,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: Nodes.py,v 1.19 2006/11/09 03:07:42 mlhuang Exp $
+# $Id: Nodes.py,v 1.25 2006/11/28 10:25:03 thierry Exp $
 #
 
 from types import StringTypes
@@ -59,8 +59,17 @@ class Node(Row):
         'slice_ids': Parameter([int], "List of slices on this node"),
         'pcu_ids': Parameter([int], "List of PCUs that control this node"),
         'ports': Parameter([int], "List of PCU ports that this node is connected to"),
+        'peer_id': Parameter(int, "Peer at which this node is managed", nullok = True),
         }
 
+    # for Cache
+    class_key = 'hostname'
+    foreign_fields = ['boot_state','model','version','date_created','last_updated']
+    foreign_xrefs = [
+       # in this case, we dont need the 'table' but Cache will look it up, so...
+        {'field' : 'site_id' , 'class' : 'Site' , 'table' : 'unused-on-direct-refs' } ,
+       ]
+
     def validate_hostname(self, hostname):
         if not valid_hostname(hostname):
             raise PLCInvalidArgument, "Invalid hostname"
@@ -95,6 +104,7 @@ class Node(Row):
         self['deleted'] = True
         self.sync(commit)
 
+
 class Nodes(Table):
     """
     Representation of row(s) from the nodes table in the
@@ -119,3 +129,4 @@ class Nodes(Table):
                 sql += " AND (%s)" % node_filter.sql(api, "AND")
 
         self.selectall(sql)
+