| 1 | = DETER ns2 Extensions For Topdl = |
| 2 | |
| 3 | The 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 | |
| 5 | With these commands, the ns2/tcl interface can create expressive topdl descriptions. |
| 6 | |
| 7 | == The commands == |
| 8 | |
| 9 | The 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 | |
| 13 | Takes a node object, an attribute name, and an attribute value: |
| 14 | |
| 15 | {{{ |
| 16 | set node [$ns node] |
| 17 | tb-add-node-attribute $node attribute_name attribute_value |
| 18 | }}} |
| 19 | |
| 20 | This 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 | |
| 24 | Takes 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 | {{{ |
| 27 | set a [$ns node] |
| 28 | set b [$ns node] |
| 29 | set lan [$ns make-lan "$a $b" 100Mb 0ms] |
| 30 | tb-add-network-attribute $lan attribute_name attribute_value |
| 31 | }}} |
| 32 | |
| 33 | This 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 | |
| 37 | Takes 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 | {{{ |
| 40 | set node1 [$ns node] |
| 41 | set node2 [$ns node] |
| 42 | set lan [$ns make-lan "$node1 $node2" 100Mb 0ms] |
| 43 | tb-add-interface-attribute $node1 $lan attribute_name attribute_value |
| 44 | }}} |
| 45 | |
| 46 | This 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 | |
| 48 | Note 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 | |
| 52 | Takes 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 | {{{ |
| 55 | set node [$ns node] |
| 56 | tb-add-node-topdl-os $node "Linux" "3.0.0" "Ubuntu" "12.04" "attribute1" "one" "attribute2" 2 |
| 57 | }}} |
| 58 | |
| 59 | Subsequent calls to {{{tb-add-node-topdl-os}}} on the same node add additional !OperatingSystem objects to the node. |
| 60 | |
| 61 | Note 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 | |
| 65 | Takes 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 | {{{ |
| 68 | set node [$ns node] |
| 69 | tb-add-node-topdl-cpu $node "Intel x86_64" "attribute1" "one" "attribute2" 2 |
| 70 | }}} |
| 71 | |
| 72 | Subsequent 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 | |
| 76 | Takes 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 | {{{ |
| 79 | set node [$ns node] |
| 80 | tb-add-node-topdl-storage $node 1000.0 "true" "attribute1" "one" "attribute2" 2 |
| 81 | }}} |
| 82 | |
| 83 | Subsequent 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 | |
| 87 | Takes 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 | {{{ |
| 90 | set node [$ns node] |
| 91 | tb-add-node-topdl-localname $node "Bob" |
| 92 | }}} |
| 93 | |
| 94 | Subsequent calls add additional names. |
| 95 | |
| 96 | === tb-set-node-topdl-status === |
| 97 | |
| 98 | Takes 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 | {{{ |
| 101 | set node [$ns node] |
| 102 | tb-set-node-topdl-status $node "active" |
| 103 | }}} |
| 104 | |
| 105 | Subsequent calls overwrite teh status. |