Changes between Initial Version and Version 1 of UsingShopdl


Ignore:
Timestamp:
Mar 20, 2012 2:56:14 PM (12 years ago)
Author:
mikeryan
Comment:

heyoo

Legend:

Unmodified
Added
Removed
Modified
  • UsingShopdl

    v1 v1  
     1= ShopDL =
     2
     3[[[TOC]]]
     4
     5ShopDL is a command-line tool for manipulating TopDL files.
     6
     7It can be invoked by running the following command on users:
     8{{{
     9$ /share/benito/util/shopdl.py <topo.xml>
     10}}}
     11
     12Once it begins you will be in an interactive shell. At any time you may run the {{{help}}} command to see the online documentation. You can also ask for help for specific commands.
     13{{{
     14shopdl> help
     15Commands: annotate attributes list save strip
     16
     17shopdl> help annotate
     18Annotates topdl.Computer elements
     19Usage: annotate <name=value> <regex-for-node-name>
     20}}}
     21
     22Throughout this documentation I'll be running through some examples with a sample TopDL file. Download the attached {{{two_nodes.xml}}} in order to follow along.
     23
     24== Regular Expressions ==
     25
     26Commands which take an argument for a node name always accept regular expressions. This is important to remember when nodes have similar names. For instance the following regular expression will match both {{{bot-10}}} '''and''' {{{bot-100}}}:
     27
     28{{{
     29bot-10
     30}}}
     31
     32If you wish to limit your results to only matching bot-10, you should use a regular expression such as the following:
     33
     34{{{
     35bot-10$
     36}}}
     37
     38== Commands ==
     39
     40=== Listing Information ===
     41
     42The two commands used to list information are {{{list}}} and {{{attributes}}}, which list nodes and their attributes respectively.
     43
     44{{{
     45shopdl> list
     46node-1
     47node-2
     48
     49shopdl> attributes .*
     50node-1:
     51    type: pc2133
     52    failureaction: fatal
     53node-2:
     54    type: pc2133
     55    failureaction: fatal
     56}}}
     57
     58The attributes listed above are not meaningful to Benito. They are present because this TopDL file was automatically converted from NS.
     59
     60=== Adding, Modifying, and Deleting ===
     61
     62The modification commands are {{{annotate}}} and {{{strip}}}, which add/modify attributes and remove them respectively. {{{strip}}} will also remove attributes from substrates, heyoo.
     63
     64Note that a node or substrate can only have one attribute for a given name. Assigning a new value to an existing attribute will overwrite the previous value.
     65
     66{{{
     67shopdl> annotate benito:node_type=qemu node-1$
     68Annotated 1 node
     69shopdl> annotate benito:node_type=embedded_pnode node-2$
     70Annotated 1 node
     71
     72shopdl> attributes node-.*
     73node-1:
     74    type: pc2133
     75    failureaction: fatal
     76    benito:node_type: qemu
     77node-2:
     78    type: pc2133
     79    failureaction: fatal
     80    benito:node_type: embedded_pnode
     81}}}
     82
     83Note also that you can quote the attribute name and value according to shell quoting rules. This allows you to embed spaces.
     84
     85{{{
     86shopdl> strip benito:node_type node-.*
     87Removed 2 attributes (searched 2 nodes)
     88Removed 0 attributes (searched 1 substrate)
     89}}}
     90
     91Again remember that {{{strip}}} will remove attributes from substrates as well as nodes.
     92
     93=== Save and/or Quit ===
     94
     95Save your results using {{{save}}}, quit using {{{quit}}}. {{{save}}} takes an optional parameter to specify output file.