]> git.entuzijast.net Git - imunes.git/commitdiff
source documentation for linkcfg.tcl file
authorzrinka <zrinka>
Fri, 2 Dec 2005 09:22:14 +0000 (09:22 +0000)
committerzrinka <zrinka>
Fri, 2 Dec 2005 09:22:14 +0000 (09:22 +0000)
Bug found by:
Submitted by:
Requested by:
Reviewed by:
Approved by:
Obtained from:

linkcfg.tcl

index 312c6c748af88e67306c9ef303f7439b286fdeb9..ce3618a1b592e74b726a4abf0ad6a5b288050e39 100755 (executable)
 # and Technology through the research contract #IP-2003-143.
 #
 
-
+#****h* imunes/linkcfg.tcl
+# NAME
+#  linkcfg.tcl -- file used for manipultaion with links in IMUNES
+# FUNCTION
+#  This module is used to define all the actions used for configuring 
+#  links in IMUNES. 
 #
+# NOTES
+# 
 # linkPeers { link_id }
 #      Returns node_ids of link endpoints
 #
 # they can be used for implementing tasks external to GUI, yet inside the
 # GUI any updating of related Tk objects (such as text labels etc.) will
 # have to be implemented by additional Tk code.
-#
-
+#****
+
+#****f* linkcfg.tcl/linkPeers
+# NAME
+#   linkPeers -- get link's peer nodes
+# SYNOPSIS
+#   set link_peers [linkPeers $link_id]
+# FUNCTION
+#   Returns node_ids of link endpoints.
+# INPUTS
+#   * link_id -- link id
+# RESULT
+#   * link_peers -- returns nodes_ids of a link endpoints 
+#     in a list {node1_id node2_id}
+#****
 
 proc linkPeers { link } {
     global $link
@@ -76,6 +96,21 @@ proc linkPeers { link } {
     return [lindex $entry 1]
 }
 
+#****f* linkcfg.tcl/linkByPeers
+# NAME
+#   linkByPeers -- get link id from peer nodes
+# SYNOPSIS
+#   set link_id [linkByPeers $node1_id $node2_id]
+# FUNCTION
+#   Returns link_id whose peers are node1 and node2. 
+#   The order of input nodes is irrelevant.
+# INPUTS
+#   * node1_id -- node id of the first node
+#   * node2_id -- node id of the second node
+# RESULT
+#   * link_id -- returns id of a link connecting endpoints 
+#     node1_id node2_id. 
+#****
 
 proc linkByPeers { node1 node2 } {
     global link_list
@@ -89,6 +124,17 @@ proc linkByPeers { node1 node2 } {
     return
 }
 
+#****f* linkcfg.tcl/removeLink
+# NAME
+#   removeLink -- removes a link.
+# SYNOPSIS
+#   removeLink $link_id
+# FUNCTION
+#   Removes the link and related entries in peering node's configs.
+#   Updates the default route for peer nodes. 
+# INPUTS
+#   * link_id -- link id
+#****
 
 proc removeLink { link } {
     global link_list $link
@@ -102,12 +148,30 @@ proc removeLink { link } {
         netconfClearSection $node "interface $ifc"
         set i [lsearch [set $node] "interface-peer {$ifc $peer}"]
         set $node [lreplace [set $node] $i $i]
+        if { [[typemodel $node].layer] == "NETWORK" } {
+            set ifcs [ifcList $node]
+            foreach ifc $ifcs {
+                autoIPv4defaultroute $node $ifc
+            }
+        }
     }
     set i [lsearch -exact $link_list $link]
     set link_list [lreplace $link_list $i $i]
     return
 }
 
+#****f* linkcfg.tcl/getLinkBandwidth
+# NAME
+#   getLinkBandwidth -- get link bandwidth
+# SYNOPSIS
+#   set bandwidth [getLinkBandwidth $link_id]
+# FUNCTION
+#   Returns the link bandwidth expressed in bits per second.
+# INPUTS
+#   * link_id -- link id
+# RESULT
+#   * bandwidth -- The value of link bandwidth in bits per second.
+#****
 
 proc getLinkBandwidth { link } {
     global $link
@@ -116,6 +180,20 @@ proc getLinkBandwidth { link } {
     return [lindex $entry 1]
 }
 
+#****f* linkcfg.tcl/getLinkBandwidthString
+# NAME
+#   getLinkBandwidthString -- get link bandwidth string
+# SYNOPSIS
+#   set bandwidth_str [getLinkBandwidthString $link_id]
+# FUNCTION
+#   Returns the link bandwidth in form of a number an a mesure unit.
+#   Measure unit is automaticaly asigned depending on the value of bandwidth.
+# INPUTS
+#   * link_id -- link id
+# RESULT
+#   * bandwidth_str -- The value of link bandwidth formated in a sting 
+#     containing a measure unit.
+#****
 
 proc getLinkBandwidthString { link } {
     global $link
@@ -139,6 +217,17 @@ proc getLinkBandwidthString { link } {
     return $bandstr
 }
 
+#****f* linkcfg.tcl/setLinkBandwidth
+# NAME
+#   setLinkBandwidth -- set link bandwidth
+# SYNOPSIS
+#   setLinkBandwidth $link_id $value
+# FUNCTION
+#   Sets the link bandwidth in a bits per second.
+# INPUTS
+#   * link_id -- link id
+#   * value -- link bandwidth in bits per second.
+#****
 
 proc setLinkBandwidth { link value } {
     global $link
@@ -151,6 +240,18 @@ proc setLinkBandwidth { link value } {
     }
 }
 
+#****f* linkcfg.tcl/getLinkDelay
+# NAME
+#   getLinkDelay -- get link delay
+# SYNOPSIS
+#   set delay [getLinkDelay $link_id]
+# FUNCTION
+#   Returns the link delay expressed in microseconds.
+# INPUTS
+#   * link_id -- link id
+# RESULT
+#   * delay -- The value of link delay in microseconds.
+#****
 
 proc getLinkDelay { link } {
     global $link
@@ -159,6 +260,20 @@ proc getLinkDelay { link } {
     return [lindex $entry 1]
 }
 
+#****f* linkcfg.tcl/getLinkDelayString
+# NAME
+#   getLinkDelayString -- get link delay string
+# SYNOPSIS
+#   set delay [getLinkDelayString $link_id]
+# FUNCTION
+#   Returns the link delay as a string with avalue and measure unit.
+#   Measure unit is automaticaly asigned depending on the value of delay.
+# INPUTS
+#   * link_id -- link id
+# RESULT
+#   * delay -- The value of link delay formated in a sting 
+#     containing a measure unit.
+#****
 
 proc getLinkDelayString { link } {
     global $link
@@ -178,6 +293,17 @@ proc getLinkDelayString { link } {
     return $delstr
 }
 
+#****f* linkcfg.tcl/setLinkDelay
+# NAME
+#   setLinkDelay -- set link delay
+# SYNOPSIS
+#   setLinkDelay $link_id $value
+# FUNCTION
+#   Sets the link delay in microseconds.
+# INPUTS
+#   * link_id -- link id
+#   * value -- link delay value in microseconds.
+#****
 
 proc setLinkDelay { link value } {
     global $link
@@ -191,6 +317,18 @@ proc setLinkDelay { link value } {
     return
 }
 
+#****f* linkcfg.tcl/getLinkBER
+# NAME
+#   getLinkBER -- get link BER
+# SYNOPSIS
+#   set BER [getLinkBER $link_id]
+# FUNCTION
+#   Returns 1/BER value of the link.
+# INPUTS
+#   * link_id -- link id
+# RESULT
+#   * BER -- The value of 1/BER of the link.
+#****
 
 proc getLinkBER { link } {
     global $link
@@ -199,6 +337,17 @@ proc getLinkBER { link } {
     return [lindex $entry 1]
 }
 
+#****f* linkcfg.tcl/setLinkBER
+# NAME
+#   setLinkBER -- set link BER
+# SYNOPSIS
+#   setLinkBER $link_id value
+# FUNCTION
+#   Sets the BER value of the link.
+# INPUTS
+#   * link_id -- link id
+#   * value -- The value of 1/BER of the link.
+#****
 
 proc setLinkBER { link value } {
     global $link
@@ -212,6 +361,18 @@ proc setLinkBER { link value } {
     return
 }
 
+#****f* linkcfg.tcl/getLinkDup
+# NAME
+#   getLinkDup -- get link packet duplicate value 
+# SYNOPSIS
+#   set duplicate [getLinkDup $link_id]
+# FUNCTION
+#   Returns the value of the link duplicate percentage.
+# INPUTS
+#   * link_id -- link id
+# RESULT
+#   * duplicate -- The percentage of the link packet duplicate value.
+#****
 
 proc getLinkDup { link } {
     global $link
@@ -220,6 +381,17 @@ proc getLinkDup { link } {
     return [lindex $entry 1]
 }
 
+#****f* linkcfg.tcl/setLinkDup
+# NAME
+#   setLinkDup -- set link packet duplicate value 
+# SYNOPSIS
+#   setLinkDup $link_id $value
+# FUNCTION
+#   Set link packet duplicate percentage.
+# INPUTS
+#   * link_id -- link id
+#   * value -- The percentage of the link packet duplicate value.
+#****
 
 proc setLinkDup { link value } {
     global $link
@@ -233,6 +405,20 @@ proc setLinkDup { link value } {
     return
 }
 
+#****f* linkcfg.tcl/getLinkMirror
+# NAME
+#   getLinkMirror -- get link's mirror link 
+# SYNOPSIS
+#   set mirror_link_id [getLinkMirror $link_id]
+# FUNCTION
+#   Returns the value of the link's mirror link. Mirror link is the other
+#   part of the link connecting node to a pseudo node. Two mirror links
+#   present only one physical link.
+# INPUTS
+#   * link_id -- link id
+# RESULT
+#   * mirror_link_id -- Mirror link id
+#****
 
 proc getLinkMirror { link } {
     global $link
@@ -241,6 +427,20 @@ proc getLinkMirror { link } {
     return [lindex $entry 1]
 }
 
+#****f* linkcfg.tcl/setLinkMirror
+# NAME
+#   setLinkMirror -- set link's mirror link 
+# SYNOPSIS
+#   setLinkMirror $link_id $mirror_link_id
+# FUNCTION
+#   Sets the value of the link's mirror link. Mirror link is the other
+#   part of the link connecting node to a pseudo node. Two mirror links
+#   present only one physical link.
+# INPUTS
+#   * link_id -- link id
+# RESULT
+#   * mirror_link_id -- Mirror link id
+#****
 
 proc setLinkMirror { link value } {
     global $link
@@ -254,6 +454,21 @@ proc setLinkMirror { link value } {
     return
 }
 
+#****f* linkcfg.tcl/splitLink
+# NAME
+#   splitLink -- slit the link
+# SYNOPSIS
+#   set nodes [splitLink  $link_id $nodetype]
+# FUNCTION
+#   Splits the link in two parts. Each part of the split link is one 
+#   pseudo link.
+# INPUTS
+#   * link_id -- link id
+#   * nodetype -- type of the new nodes connecting slit links.
+#     Usual value is pseudo.
+# RESULT
+#   * nodes -- list of node ids of new nodes.
+#****
 
 proc splitLink { link nodetype } {
     global link_list $link
@@ -262,7 +477,7 @@ proc splitLink { link nodetype } {
     set orig_node1 [lindex $orig_nodes 0]
     set orig_node2 [lindex $orig_nodes 1]
     set new_node1 [newNode $nodetype]
-    set new_node2 [newNode $nodetype]
+    set new_node2 [newNode $nodeSplits the link in two parts.type]
     set new_link1 [newObjectId link]
     lappend link_list $new_link1
     set new_link2 [newObjectId link]
@@ -314,6 +529,18 @@ proc splitLink { link nodetype } {
     return "$new_node1 $new_node2"
 }
 
+#****f* linkcfg.tcl/mergeLink
+# NAME
+#   mergeLink -- merge the link
+# SYNOPSIS
+#   set new_link_id [mergeLink  $link_id]
+# FUNCTION
+#   Rebuilts a link from two pseudo link. 
+# INPUTS
+#   * link_id -- pseudo link id
+# RESULT
+#   * new_link_id -- rebuilt link id.
+#****
 
 proc mergeLink { link } {
     global link_list node_list
@@ -364,6 +591,20 @@ proc mergeLink { link } {
     return $new_link
 }
 
+#****f* linkcfg.tcl/newLink
+# NAME
+#   newLink -- create new link
+# SYNOPSIS
+#   set new_link_id [newLink  $node1_id $node2_id]
+# FUNCTION
+#   Creates a new link between nodes node1_id and node2_id. The order of
+#   nodes is irrelevant.
+# INPUTS
+#   * node1_id -- node id of the peer node
+#   * node2_id -- node id of the second peer node
+# RESULT
+#   * new_link_id -- new link id.
+#****
 
 proc newLink { lnode1 lnode2 } {
     global link_list
@@ -447,6 +688,19 @@ proc newLink { lnode1 lnode2 } {
     return $link
 }
 
+#****f* linkcfg.tcl/linkByIfc
+# NAME
+#   linkByIfg -- get link by interface
+# SYNOPSIS
+#   set link_id [linkByIfc  $node_id $fc]
+# FUNCTION
+#   Returns the link id of the link connecting the node's interface
+# INPUTS
+#   * node_id -- node id 
+#   * ifc -- interface
+# RESULT
+#   * link_id -- link id.
+#****
 
 proc linkByIfc { node ifc } {
     global link_list