From 9df448d7f52d56ff070b7b0f9178c9af75f01fb2 Mon Sep 17 00:00:00 2001
From: "Leigh B. Stoller" <stoller@flux.utah.edu>
Date: Wed, 6 Apr 2005 12:23:06 +0000
Subject: [PATCH] Add tb-set-node-id for Rob ...

---
 tbsetup/ns2ir/node.tcl         | 18 ++++++++++++++++++
 tbsetup/ns2ir/tb_compat.tcl.in | 12 ++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/tbsetup/ns2ir/node.tcl b/tbsetup/ns2ir/node.tcl
index e7d9cd6646..8de1e5d046 100644
--- a/tbsetup/ns2ir/node.tcl
+++ b/tbsetup/ns2ir/node.tcl
@@ -97,6 +97,9 @@ Node instproc init {s} {
 	$self set simulated 0
     }
     $self set nsenode_vportlist {}
+
+    # This is a mote thing.
+    $self set numeric_id {}
 }
 
 # The following procs support renaming (see README)
@@ -155,6 +158,7 @@ Node instproc updatedb {DB} {
     $self instvar X_
     $self instvar Y_
     $self instvar orientation_
+    $self instvar numeric_id
     var_import ::TBCOMPAT::default_osids
     var_import ::GLOBALS::use_physnaming
     var_import ::TBCOMPAT::physnodes
@@ -254,6 +258,11 @@ Node instproc updatedb {DB} {
 	lappend values $inner_elab_role
     }
 
+    if { $numeric_id != {} } {
+	lappend fields "numeric_id"
+	lappend values $numeric_id
+    }
+
     $sim spitxml_data "virt_nodes" $fields $values
 
     if {$topo != ""} {
@@ -559,3 +568,12 @@ Node instproc console {} {
     
     return $console_
 }
+
+#
+# Set numeric ID (a mote thing)
+#
+Node instproc set_numeric_id {myid} {
+    $self instvar numeric_id
+
+    set numeric_id $myid
+}
diff --git a/tbsetup/ns2ir/tb_compat.tcl.in b/tbsetup/ns2ir/tb_compat.tcl.in
index a8ea1cb2f4..ade8a5c39b 100644
--- a/tbsetup/ns2ir/tb_compat.tcl.in
+++ b/tbsetup/ns2ir/tb_compat.tcl.in
@@ -1489,3 +1489,15 @@ proc tb-set-security-level {level} {
     }
     set security_level $level
 }
+
+#
+# Set numeric ID (this is a mote thing)
+#
+proc tb-set-node-id {vnode myid} {
+    if {[$vnode info class] != "Node"} {
+	perror "\[tb-set-node-id] $vnode is not a node."
+	return
+    }
+    $vnode set_numeric_id $myid
+}
+
-- 
GitLab