The VirtualTopologyGenerator class is used to programmatically define a virtual network topology consisting of Virtual Machines (VMs) and the links between them. It allows you to define VM specifications, establish links with specific bandwidths, and automatically generates a dummy workload based on the link connections.
Once the topology is defined, you can export the configuration to a JSON file using wrtieJSON(String jsonFileName).
VirtualTopologyGenerator generator = new VirtualTopologyGenerator();
// 1. Create and add VMs
// Parameters: name, pes, mips, ram, storage, bw, starttime, endtime
VirtualTopologyGenerator.VMSpec vm1 = generator.addVM("VM1", 1, 1000, 512, 10000, 100, 0.0, 10.0);
VirtualTopologyGenerator.VMSpec vm2 = generator.addVM("VM2", 2, 2000, 1024, 20000, 200, 0.0, 10.0);
// 2. Add links between VMs
// Parameters: linkname, source_VMSpec, dest_VMSpec, bandwidth
generator.addLink("link1", vm1, vm2, 50L);
// 3. Export to JSON
generator.wrtieJSON("topology.json");