1 | |
---|
2 | // WSDL generated classes |
---|
3 | import edu.isi.www.fedd_types.*; |
---|
4 | import edu.isi.www.fedd_wsdl.*; |
---|
5 | import edu.isi.www.topdl.*; |
---|
6 | |
---|
7 | // The fault thrown by failed commands |
---|
8 | import org.apache.axis.AxisFault; |
---|
9 | |
---|
10 | // Sets and maps |
---|
11 | import java.util.*; |
---|
12 | |
---|
13 | class 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 | // Get the port and construct the (simple) request. |
---|
23 | FeddPortType port = getPort("https://users.isi.deterlab.net:23235"); |
---|
24 | InfoRequestType req = new InfoRequestType( |
---|
25 | new IDType(null, null, null, args[0], null)); |
---|
26 | InfoResponseType resp = null; |
---|
27 | Map<String, List<EmbeddingMapType> > tbNodes = |
---|
28 | new TreeMap<String, List<EmbeddingMapType>>(); |
---|
29 | VtopoType vt = null; |
---|
30 | TopologyType top = null; |
---|
31 | |
---|
32 | |
---|
33 | try { |
---|
34 | /* Build the message and make the call */ |
---|
35 | resp = port.info(req); |
---|
36 | } |
---|
37 | catch (AxisFault f) { |
---|
38 | System.err.println("Error getting info: " + f); |
---|
39 | System.exit(20); |
---|
40 | } |
---|
41 | |
---|
42 | if (!resp.getExperimentStatus().equals(StatusType.active)) { |
---|
43 | System.err.println("Experiment not active"); |
---|
44 | System.exit(20); |
---|
45 | } |
---|
46 | |
---|
47 | // Put each embedding mapping (object containing embedding info) into a |
---|
48 | // List keyed by testbed. |
---|
49 | System.out.println("From embedding:"); |
---|
50 | for (EmbeddingMapType m: resp.getEmbedding()) { |
---|
51 | List<EmbeddingMapType> al = null; |
---|
52 | |
---|
53 | if (tbNodes.containsKey(m.getTestbed())) { |
---|
54 | al = tbNodes.get(m.getTestbed()); |
---|
55 | } |
---|
56 | else { |
---|
57 | al = new ArrayList<EmbeddingMapType>(); |
---|
58 | tbNodes.put(m.getTestbed(), al); |
---|
59 | } |
---|
60 | al.add(m); |
---|
61 | } |
---|
62 | |
---|
63 | for (String tb: tbNodes.keySet()) { |
---|
64 | System.out.println("Testbed: " + tb); |
---|
65 | for ( EmbeddingMapType m : tbNodes.get(tb)) { |
---|
66 | System.out.print("\t" + m.getToponame() + " "); |
---|
67 | for ( String pn : m.getPhysname()) |
---|
68 | System.out.print(pn + " " ); |
---|
69 | System.out.println(); |
---|
70 | } |
---|
71 | System.out.println(); |
---|
72 | } |
---|
73 | System.out.println(); |
---|
74 | |
---|
75 | // There's a topdl description in there, too |
---|
76 | top = resp.getExperimentdescription().getTopdldescription(); |
---|
77 | if ( top == null ) { |
---|
78 | System.err.println("Bad response: no Topdl"); |
---|
79 | System.exit(20); |
---|
80 | } |
---|
81 | |
---|
82 | System.out.println("From Topdl (sampling)"); |
---|
83 | for (ElementType e: top.getElements()) { |
---|
84 | ComputerType c = e.getComputer(); |
---|
85 | if ( c != null) { |
---|
86 | System.out.println("\t" + c.getName()); |
---|
87 | for (AttributeType a: c.getAttribute()) |
---|
88 | System.out.println("\t\t" + a.getAttribute() + " " + |
---|
89 | a.getValue()); |
---|
90 | for ( InterfaceType i : c.get_interface()) { |
---|
91 | System.out.println("\t\tInterface " + i.getName() + ":"); |
---|
92 | for ( AttributeType a: i.getAttribute()) |
---|
93 | System.out.println("\t\t\t" + a.getAttribute() + " " + |
---|
94 | a.getValue()); |
---|
95 | } |
---|
96 | } |
---|
97 | } |
---|
98 | |
---|
99 | System.out.println(); |
---|
100 | // The visualization info is pretty straightforward |
---|
101 | System.out.println("Visualization info (Legacy Emulab):" ); |
---|
102 | for (VisnodeType v: resp.getVis()) |
---|
103 | System.out.println("\t" + v.getName() + ":" + v.getX() + ":" + |
---|
104 | v.getY() + ":" + v.getType()); |
---|
105 | System.out.println(); |
---|
106 | |
---|
107 | // The legacy emulab visualization information is in two lists, the |
---|
108 | // nodes and lans. |
---|
109 | System.out.println("Vtopo info (Legacy Emulab)"); |
---|
110 | vt = resp.getVtopo(); |
---|
111 | System.out.println("Nodes"); |
---|
112 | for (VtoponodeType vn: vt.getNode()) |
---|
113 | System.out.println("\t" + vn.getVname()+" "+vn.getIps()); |
---|
114 | System.out.println("Lans"); |
---|
115 | for (VtopolanType vl: vt.getLan()) |
---|
116 | System.out.println("\t" + vl.getVname() + " " + vl.getVnode() + |
---|
117 | " " + vl.getIp() + " " + vl.getBandwidth() + " " + |
---|
118 | vl.getDelay() + " " + vl.getMember()); |
---|
119 | |
---|
120 | } |
---|
121 | } |
---|