[f93a65c] | 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 | |
---|
[5bbad08] | 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 | |
---|
[f93a65c] | 28 | // Get the port and construct the (simple) request. |
---|
[5bbad08] | 29 | FeddPortType port = getPort(urlString); |
---|
[f93a65c] | 30 | InfoRequestType req = new InfoRequestType( |
---|
[5bbad08] | 31 | new IDType(null, null, null, exptName, null), true, true); |
---|
[f93a65c] | 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 | |
---|
[b56eb7e] | 46 | if (!resp.getExperimentStatus().equals(StatusType.active)) { |
---|
| 47 | System.err.println("Experiment not active"); |
---|
| 48 | System.exit(20); |
---|
| 49 | } |
---|
| 50 | |
---|
[f93a65c] | 51 | |
---|
[5bbad08] | 52 | // Walk the topdl description |
---|
[f93a65c] | 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)"); |
---|
[b035f90] | 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:"); |
---|
[f93a65c] | 74 | for (ElementType e: top.getElements()) { |
---|
| 75 | ComputerType c = e.getComputer(); |
---|
| 76 | if ( c != null) { |
---|
| 77 | System.out.println("\t" + c.getName()); |
---|
[5bbad08] | 78 | for (String name : c.getLocalname()) |
---|
| 79 | System.out.println("\t\t" + name); |
---|
[f93a65c] | 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 | } |
---|