[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 | |
---|
| 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 | // Put each embedding mapping (object containing embedding info) into a |
---|
| 43 | // List keyed by testbed. |
---|
| 44 | System.out.println("From embedding:"); |
---|
| 45 | for (EmbeddingMapType m: resp.getEmbedding()) { |
---|
| 46 | List<EmbeddingMapType> al = null; |
---|
| 47 | |
---|
| 48 | if (tbNodes.containsKey(m.getTestbed())) { |
---|
| 49 | al = tbNodes.get(m.getTestbed()); |
---|
| 50 | } |
---|
| 51 | else { |
---|
| 52 | al = new ArrayList<EmbeddingMapType>(); |
---|
| 53 | tbNodes.put(m.getTestbed(), al); |
---|
| 54 | } |
---|
| 55 | al.add(m); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | for (String tb: tbNodes.keySet()) { |
---|
| 59 | System.out.println("Testbed: " + tb); |
---|
| 60 | for ( EmbeddingMapType m : tbNodes.get(tb)) { |
---|
| 61 | System.out.print("\t" + m.getToponame() + " "); |
---|
| 62 | for ( String pn : m.getPhysname()) |
---|
| 63 | System.out.print(pn + " " ); |
---|
| 64 | System.out.println(); |
---|
| 65 | } |
---|
| 66 | System.out.println(); |
---|
| 67 | } |
---|
| 68 | System.out.println(); |
---|
| 69 | |
---|
| 70 | // There's a topdl description in there, too |
---|
| 71 | top = resp.getExperimentdescription().getTopdldescription(); |
---|
| 72 | if ( top == null ) { |
---|
| 73 | System.err.println("Bad response: no Topdl"); |
---|
| 74 | System.exit(20); |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | System.out.println("From Topdl (sampling)"); |
---|
| 78 | for (ElementType e: top.getElements()) { |
---|
| 79 | ComputerType c = e.getComputer(); |
---|
| 80 | if ( c != null) { |
---|
| 81 | System.out.println("\t" + c.getName()); |
---|
| 82 | for (AttributeType a: c.getAttribute()) |
---|
| 83 | System.out.println("\t\t" + a.getAttribute() + " " + |
---|
| 84 | a.getValue()); |
---|
| 85 | for ( InterfaceType i : c.get_interface()) { |
---|
| 86 | System.out.println("\t\tInterface " + i.getName() + ":"); |
---|
| 87 | for ( AttributeType a: i.getAttribute()) |
---|
| 88 | System.out.println("\t\t\t" + a.getAttribute() + " " + |
---|
| 89 | a.getValue()); |
---|
| 90 | } |
---|
| 91 | } |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | System.out.println(); |
---|
| 95 | // The visualization info is pretty straightforward |
---|
| 96 | System.out.println("Visualization info (Legacy Emulab):" ); |
---|
| 97 | for (VisnodeType v: resp.getVis()) |
---|
| 98 | System.out.println("\t" + v.getName() + ":" + v.getX() + ":" + |
---|
| 99 | v.getY() + ":" + v.getType()); |
---|
| 100 | System.out.println(); |
---|
| 101 | |
---|
| 102 | // The legacy emulab visualization information is in two lists, the |
---|
| 103 | // nodes and lans. |
---|
| 104 | System.out.println("Vtopo info (Legacy Emulab)"); |
---|
| 105 | vt = resp.getVtopo(); |
---|
| 106 | System.out.println("Nodes"); |
---|
| 107 | for (VtoponodeType vn: vt.getNode()) |
---|
| 108 | System.out.println("\t" + vn.getVname()+" "+vn.getIps()); |
---|
| 109 | System.out.println("Lans"); |
---|
| 110 | for (VtopolanType vl: vt.getLan()) |
---|
| 111 | System.out.println("\t" + vl.getVname() + " " + vl.getVnode() + |
---|
| 112 | " " + vl.getIp() + " " + vl.getBandwidth() + " " + |
---|
| 113 | vl.getDelay() + " " + vl.getMember()); |
---|
| 114 | |
---|
| 115 | } |
---|
| 116 | } |
---|