625 | | The first step in out transformation is to take a topology and add attributes that will be used by other applications. In our example, the other applications will be further refinements in the same program. |
626 | | |
627 | | Here is a function that walks a topology, determines the degree of each computer, and adds an [TopdlLibrary#AttributeClass attribute] to each computer with that attribute in it. It demostrates editing a topology using the [TopdlLibrary#TopdlClassFeatures set_attribute] function common to topdl classes. |
| 629 | The first step in our transformation is to take a topology and add attributes that will be used by other applications. In our example, the other applications will be further refinements in the same program. |
| 630 | |
| 631 | Here is a function that walks a topology, determines the degree of each computer, and adds an [TopdlLibrary#AttributeClass attribute] to each computer with that degree in it. It demostrates editing a topology using the [TopdlLibrary#TopdlClassFeatures set_attribute] function common to topdl classes. |
797 | | == Putting it all together == |
| 801 | == Putting It All Together == |
| 802 | |
| 803 | The complete example is [attachment:example.py attached to this page.] It consists of : |
| 804 | |
| 805 | * Parsing an input and output filename from the command line |
| 806 | * Reading a topology from the input filename (you can use [attachment:topo.xml the example]). |
| 807 | * Calling the topology manipulation subroutines developed above in sequence |
| 808 | * Calling the ns2 output routine above using the output filename |
| 809 | |
| 810 | This is by no means the most efficient way to change the initial topology to the final topology; it was organized this way to demonstrate the various features. There is sample [attachment: out.tcl ns2 output] attached as well. |
| 811 | |
| 812 | The intent of the examples is to give you a starting point for using the topdl library. If you have questions or comments, [mailto:faber@isi.edu contact us]. |