Changes between Initial Version and Version 1 of NsTopdlExtensions


Ignore:
Timestamp:
Oct 22, 2012 3:21:41 PM (12 years ago)
Author:
faber
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NsTopdlExtensions

    v1 v1  
     1= DETER ns2 Extensions For Topdl =
     2
     3The DETER ns2 libraries include some additional commands to produce [TopDl topdl] constructs.  These extensions do not directly affect experiments created and manipulated by the legacy web interface and command line programs, but are used by the [WikiStart federation] and [http://containers.deterlab.net containers] systems.  Specifically, [FeddCommands#fedd_ns2topdl.py fedd_ns2topdl.py] respects all of them.
     4
     5With these commands, the ns2/tcl interface can create expressive topdl descriptions.
     6
     7== The commands ==
     8
     9The vast majority of these commands are for completeness in dealing with later applications.  When working with [WikiStart federation] or [http://containers.deterlab.net containers], {{{tb-add-node-attribute}}} is the most commonly used command, and in most cases the only one needed.  Several other DETER ns2 commands also reflect their operation into the generated topdl and they will be noted below.
     10
     11=== tb-add-node-attribute ===
     12
     13Takes a node object, an attribute name, and an attribute value:
     14
     15{{{
     16set node [$ns node]
     17tb-add-node-attribute $node attribute_name attribute_value
     18}}}
     19
     20This attaches an attribute to the [TopDl#Elements Computer object] representing the node.  Attribute name and value are both strings.  The attribute is added to the element. Existing attribute/value pairs with the same name are not replaced or removed. Duplicate attribute names will result in application-demepndent behavior and should be avoided.
     21
     22=== tb-add-network-attribute ===
     23
     24Takes a link or a LAN object, an attribute name, and an attribute value.  This is the network analog of [NsTopdlExtensions#tb-add-node-attribute tb-add-node-attribute].
     25
     26{{{
     27set a [$ns node]
     28set b [$ns node]
     29set lan [$ns make-lan "$a $b" 100Mb 0ms]
     30tb-add-network-attribute $lan attribute_name attribute_value
     31}}}
     32
     33This attaches an attribute to the [TopDl#Substrates Substrate object] representing the lan or link.  Attribute name and value are both strings.  The attribute is added to the substrate. Existing attribute/value pairs with the same name are not replaced or removed. Duplicate attribute names will result in application-demepndent behavior and should be avoided.
     34
     35===  tb-add-interface-attribute ===
     36
     37Takes a node object, a lan or link object, an attribute, and a value. This is the interface analog of [NsTopdlExtensions#tb-add-node-attribute tb-add-node-attribute].
     38
     39{{{
     40set node1 [$ns node]
     41set node2 [$ns node]
     42set lan [$ns make-lan "$node1 $node2" 100Mb 0ms]
     43tb-add-interface-attribute $node1 $lan attribute_name attribute_value
     44}}}
     45
     46This attaches an attribute to the [TopDl#Interfacess Interface object] connecting the node to the lan or link.  If the node is attached multiple times to the network, the operation is undefined.  Attribute name and value are both strings.  The attribute is added to the substrate. Existing attribute/value pairs with the same name are not replaced or removed. Duplicate attribute names will result in application-demepndent behavior and should be avoided.
     47
     48Note that when [https://trac.deterlab.net/wiki/nscommands#tb-set-ip-link tb-set-ip-link] or [https://trac.deterlab.net/wiki/nscommands#tb-set-ip-link tb-set-ip-lan] are used on DETER, they automatically set the '''ip4_address''' and '''ip4_netmask''' attributes on the corresponding interface, so there is no need to attach the attributes using this command.
     49
     50=== tb-add-node-topdl-os ===
     51
     52Takes a node object, and a variable number of string arguments.  The first four arguments after the node are the {{{name}}}, {{{version}}}, {{{distribution}}}, and {{{distributionversion}}} members of the [TopdlLibrary#OperatingSystemClass OperatingSystem object].  They can be empty strings.  The remaining arguments are attribute name/value pairs, that are attached to the !OperatingSystem object.
     53
     54{{{
     55set node [$ns node]
     56tb-add-node-topdl-os $node "Linux" "3.0.0" "Ubuntu" "12.04" "attribute1" "one" "attribute2" 2
     57}}}
     58
     59Subsequent calls to {{{tb-add-node-topdl-os}}} on the same node add additional !OperatingSystem objects to the node.
     60
     61Note that the [https://trac.deterlab.net/wiki/nscommands#tb-set-node-os tb-set-node-os] command on DETER already attaches an appropriate !OperatingSystem object to the node.  Adding additional OperatingSystems is probably unnecessary.
     62
     63=== tb-add-node-topdl-cpu ===
     64
     65Takes a node object, a CPU name, and a variable number of attribute/value pairs as strings.   The first parameter is the [TopdlLibrary#CPUClass CPU object] {{{type}}} member and the rest are attributes.  These are pairs as in [NsTopdlExtensions#tb-add-node-topdl-os tb-add-node-topdl-os].
     66
     67{{{
     68set node [$ns node]
     69tb-add-node-topdl-cpu $node "Intel x86_64" "attribute1" "one" "attribute2" 2
     70}}}
     71
     72Subsequent calls to {{{tb-add-node-topdl-cpu}}} on the same node add additional CPU objects to the node.
     73
     74=== tb-add-node-topdl-storage ===
     75
     76Takes a node object, two strings and a variable number of attribute value pairs (strings).  The first string is the value of the {{{amount}}} member of the [Topdl#LibraryStorageClass Storage object] and must convert to a float.  The second is the {{{persistence}}} value for that class and must be "true" or "false".  The rest  are  attribute/value pairs as in [NsTopdlExtensions#tb-add-node-topdl-os tb-add-node-topdl-os].
     77
     78{{{
     79set node [$ns node]
     80tb-add-node-topdl-storage $node 1000.0 "true" "attribute1" "one" "attribute2" 2
     81}}}
     82
     83Subsequent calls to {{{tb-add-node-topdl-storage}}} on the same node add additional Storage objects to the node.
     84
     85=== tb-add-node-topdl-localname ===
     86
     87Takes a node object and a string.  The string is added to the list of local names of the [TopdlLibrary#ComputerClass Computer] object that represents the node.
     88
     89{{{
     90set node [$ns node]
     91tb-add-node-topdl-localname $node "Bob"
     92}}}
     93
     94Subsequent calls add additional names.
     95
     96=== tb-set-node-topdl-status ===
     97
     98Takes a node object and a string.  The string is used to set the {{{status}}} member of the [TopdlLibrary#ComputerClass Computer] object that represents the node.  Only the values valid for [TopdlLibrary#ComputerClass status] are valid as arguments.
     99
     100{{{
     101set node [$ns node]
     102tb-set-node-topdl-status $node "active"
     103}}}
     104
     105Subsequent calls overwrite teh status.