source: axis/Ftopo.java @ 5bbad08

compt_changesinfo-ops
Last change on this file since 5bbad08 was 5bbad08, checked in by Ted Faber <faber@…>, 12 years ago

Accomodate new info format

  • Property mode set to 100644
File size: 2.9 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        for (ElementType e: top.getElements()) {
61            ComputerType c = e.getComputer();
62            if ( c != null) {
63                System.out.println("\t" + c.getName());
64                for (String name : c.getLocalname()) 
65                    System.out.println("\t\t" + name);
66                for (AttributeType a: c.getAttribute()) 
67                    System.out.println("\t\t" + a.getAttribute() + " " +
68                            a.getValue());
69                for ( InterfaceType i : c.get_interface()) {
70                    System.out.println("\t\tInterface " + i.getName() + ":");
71                    for ( AttributeType a: i.getAttribute()) 
72                        System.out.println("\t\t\t" + a.getAttribute() + " " +
73                                a.getValue());
74                }
75            }
76        }
77
78        System.out.println();
79        // The visualization info is pretty straightforward
80        System.out.println("Visualization info (Legacy Emulab):" );
81        for (VisnodeType v: resp.getVis()) 
82            System.out.println("\t" + v.getName() + ":" + v.getX() + ":" + 
83                    v.getY() + ":" + v.getType());
84        System.out.println();
85
86        // The legacy emulab visualization information is in two lists, the
87        // nodes and lans.
88        System.out.println("Vtopo info (Legacy Emulab)");
89        vt = resp.getVtopo();
90        System.out.println("Nodes");
91        for (VtoponodeType vn: vt.getNode()) 
92            System.out.println("\t" + vn.getVname()+" "+vn.getIps());
93        System.out.println("Lans");
94        for (VtopolanType vl: vt.getLan()) 
95            System.out.println("\t" + vl.getVname() + " " + vl.getVnode() +
96                    " " + vl.getIp() + " " + vl.getBandwidth() + " " +
97                    vl.getDelay() + " " + vl.getMember());
98
99    }
100}
Note: See TracBrowser for help on using the repository browser.