use of org.onosproject.incubator.net.virtual.impl.provider.DefaultVirtualNetworkProvider in project onos by opennetworkinglab.
the class VirtualNetworkManagerTest method setupVirtualNetworkTopology.
/**
* Method to create the virtual network for {@code tenantIdValue} for further testing.
*/
private VirtualNetwork setupVirtualNetworkTopology(String tenantIdValue) {
manager.registerTenantId(TenantId.tenantId(tenantIdValue));
VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue));
VirtualDevice virtualDevice1 = manager.createVirtualDevice(virtualNetwork.id(), DID1);
VirtualDevice virtualDevice2 = manager.createVirtualDevice(virtualNetwork.id(), DID2);
VirtualDevice virtualDevice3 = manager.createVirtualDevice(virtualNetwork.id(), DID3);
VirtualDevice virtualDevice4 = manager.createVirtualDevice(virtualNetwork.id(), DID4);
VirtualDevice virtualDevice5 = manager.createVirtualDevice(virtualNetwork.id(), DID5);
ConnectPoint cp1 = new ConnectPoint(virtualDevice1.id(), PortNumber.portNumber(1));
manager.createVirtualPort(virtualNetwork.id(), virtualDevice1.id(), PortNumber.portNumber(1), cp1);
ConnectPoint cp2 = new ConnectPoint(virtualDevice1.id(), PortNumber.portNumber(2));
manager.createVirtualPort(virtualNetwork.id(), virtualDevice1.id(), PortNumber.portNumber(2), cp2);
ConnectPoint cp3 = new ConnectPoint(virtualDevice2.id(), PortNumber.portNumber(3));
manager.createVirtualPort(virtualNetwork.id(), virtualDevice2.id(), PortNumber.portNumber(3), cp3);
ConnectPoint cp4 = new ConnectPoint(virtualDevice2.id(), PortNumber.portNumber(4));
manager.createVirtualPort(virtualNetwork.id(), virtualDevice2.id(), PortNumber.portNumber(4), cp4);
ConnectPoint cp5 = new ConnectPoint(virtualDevice3.id(), PortNumber.portNumber(5));
manager.createVirtualPort(virtualNetwork.id(), virtualDevice3.id(), PortNumber.portNumber(5), cp5);
cp6 = new ConnectPoint(virtualDevice3.id(), PortNumber.portNumber(6));
manager.createVirtualPort(virtualNetwork.id(), virtualDevice3.id(), PortNumber.portNumber(6), cp6);
cp7 = new ConnectPoint(virtualDevice4.id(), PortNumber.portNumber(7));
manager.createVirtualPort(virtualNetwork.id(), virtualDevice4.id(), PortNumber.portNumber(7), cp7);
ConnectPoint cp8 = new ConnectPoint(virtualDevice4.id(), PortNumber.portNumber(8));
manager.createVirtualPort(virtualNetwork.id(), virtualDevice4.id(), PortNumber.portNumber(8), cp8);
ConnectPoint cp9 = new ConnectPoint(virtualDevice5.id(), PortNumber.portNumber(9));
manager.createVirtualPort(virtualNetwork.id(), virtualDevice5.id(), PortNumber.portNumber(9), cp9);
VirtualLink link1 = manager.createVirtualLink(virtualNetwork.id(), cp1, cp3);
virtualNetworkManagerStore.updateLink(link1, link1.tunnelId(), Link.State.ACTIVE);
VirtualLink link2 = manager.createVirtualLink(virtualNetwork.id(), cp3, cp1);
virtualNetworkManagerStore.updateLink(link2, link2.tunnelId(), Link.State.ACTIVE);
VirtualLink link3 = manager.createVirtualLink(virtualNetwork.id(), cp4, cp5);
virtualNetworkManagerStore.updateLink(link3, link3.tunnelId(), Link.State.ACTIVE);
VirtualLink link4 = manager.createVirtualLink(virtualNetwork.id(), cp5, cp4);
virtualNetworkManagerStore.updateLink(link4, link4.tunnelId(), Link.State.ACTIVE);
VirtualLink link5 = manager.createVirtualLink(virtualNetwork.id(), cp8, cp9);
virtualNetworkManagerStore.updateLink(link5, link5.tunnelId(), Link.State.ACTIVE);
VirtualLink link6 = manager.createVirtualLink(virtualNetwork.id(), cp9, cp8);
virtualNetworkManagerStore.updateLink(link6, link6.tunnelId(), Link.State.ACTIVE);
topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
topologyProvider = new DefaultVirtualNetworkProvider();
try {
TestUtils.setField(topologyProvider, "topologyService", topologyService);
} catch (TestUtils.TestUtilsException e) {
e.printStackTrace();
}
return virtualNetwork;
}
Aggregations