source: axis/Ftopo.java

Last change on this file was b035f90, checked in by Ted Faber <faber@…>, 12 years ago

Print testbed information (experiment, project)

  • Property mode set to 100644
File size: 3.4 KB
Line 
1
2// WSDL generated classes
3import edu.isi.www.fedd_types.*;
4import edu.isi.www.fedd_wsdl.*;
5import edu.isi.www.topdl.*;
6
7// The fault thrown by failed commands
8import org.apache.axis.AxisFault;
9
10// Sets and maps
11import java.util.*;
12
13class Ftopo extends FeddCommand {
14    /**
15     * Terminate the experiment with the menmonic name given on the command
16     * line.
17     */
18    public static void main(String args[]) throws 
19            javax.xml.rpc.ServiceException, java.net.MalformedURLException,
20            java.rmi.RemoteException {
21
22        String exptName = "test";
23        String urlString = "https://users.isi.deterlab.net:23235";
24
25        if (args.length > 0) exptName = args[0];
26        if (args.length > 1) urlString = args[1];
27
28        // Get the port and construct the (simple) request.
29        FeddPortType port = getPort(urlString);
30        InfoRequestType req = new InfoRequestType(
31                new IDType(null, null, null, exptName, null), true, true);
32        InfoResponseType resp = null;
33        VtopoType vt = null;
34        TopologyType top = null;
35
36
37        try {
38            /* Build the message and make the call */
39            resp = port.info(req);
40        }
41        catch (AxisFault f) {
42            System.err.println("Error getting info: " + f);
43            System.exit(20);
44        }
45
46        if (!resp.getExperimentStatus().equals(StatusType.active)) {
47            System.err.println("Experiment not active");
48            System.exit(20);
49        }
50
51
52        // Walk the topdl description
53        top = resp.getExperimentdescription().getTopdldescription();
54        if ( top == null ) { 
55            System.err.println("Bad response: no Topdl");
56            System.exit(20);
57        }
58
59        System.out.println("From Topdl (sampling)");
60        System.out.println("Testbed information:");
61        for (ElementType e: top.getElements()) {
62            TestbedType t = e.getTestbed();
63            if ( t != null ) {
64                System.out.println("\t" + t.getUri());
65                for ( String name : t.getLocalname()) 
66                    System.out.println("\t\tTestbed name: " + name);
67                for (AttributeType a: t.getAttribute()) 
68                    System.out.println("\t\t" + a.getAttribute() + " " +
69                            a.getValue());
70            }
71        }
72
73        System.out.println("Node information:");
74        for (ElementType e: top.getElements()) {
75            ComputerType c = e.getComputer();
76            if ( c != null) {
77                System.out.println("\t" + c.getName());
78                for (String name : c.getLocalname()) 
79                    System.out.println("\t\t" + name);
80                for (AttributeType a: c.getAttribute()) 
81                    System.out.println("\t\t" + a.getAttribute() + " " +
82                            a.getValue());
83                for ( InterfaceType i : c.get_interface()) {
84                    System.out.println("\t\tInterface " + i.getName() + ":");
85                    for ( AttributeType a: i.getAttribute()) 
86                        System.out.println("\t\t\t" + a.getAttribute() + " " +
87                                a.getValue());
88                }
89            }
90        }
91
92        System.out.println();
93        // The visualization info is pretty straightforward
94        System.out.println("Visualization info (Legacy Emulab):" );
95        for (VisnodeType v: resp.getVis()) 
96            System.out.println("\t" + v.getName() + ":" + v.getX() + ":" + 
97                    v.getY() + ":" + v.getType());
98        System.out.println();
99
100        // The legacy emulab visualization information is in two lists, the
101        // nodes and lans.
102        System.out.println("Vtopo info (Legacy Emulab)");
103        vt = resp.getVtopo();
104        System.out.println("Nodes");
105        for (VtoponodeType vn: vt.getNode()) 
106            System.out.println("\t" + vn.getVname()+" "+vn.getIps());
107        System.out.println("Lans");
108        for (VtopolanType vl: vt.getLan()) 
109            System.out.println("\t" + vl.getVname() + " " + vl.getVnode() +
110                    " " + vl.getIp() + " " + vl.getBandwidth() + " " +
111                    vl.getDelay() + " " + vl.getMember());
112
113    }
114}
Note: See TracBrowser for help on using the repository browser.