Search in sources :

Example 1 with DefaultVirtualNetworkProvider

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;
}
Also used : DefaultVirtualNetwork(org.onosproject.incubator.net.virtual.DefaultVirtualNetwork) VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) TestUtils(org.onlab.junit.TestUtils) DefaultVirtualNetworkProvider(org.onosproject.incubator.net.virtual.impl.provider.DefaultVirtualNetworkProvider) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) ConnectPoint(org.onosproject.net.ConnectPoint) VirtualLink(org.onosproject.incubator.net.virtual.VirtualLink) TopologyService(org.onosproject.net.topology.TopologyService)

Aggregations

TestUtils (org.onlab.junit.TestUtils)1 DefaultVirtualNetwork (org.onosproject.incubator.net.virtual.DefaultVirtualNetwork)1 VirtualDevice (org.onosproject.incubator.net.virtual.VirtualDevice)1 VirtualLink (org.onosproject.incubator.net.virtual.VirtualLink)1 VirtualNetwork (org.onosproject.incubator.net.virtual.VirtualNetwork)1 DefaultVirtualNetworkProvider (org.onosproject.incubator.net.virtual.impl.provider.DefaultVirtualNetworkProvider)1 ConnectPoint (org.onosproject.net.ConnectPoint)1 TopologyService (org.onosproject.net.topology.TopologyService)1