Search in sources :

Example 11 with VirtualNetwork

use of org.onosproject.incubator.net.virtual.VirtualNetwork in project onos by opennetworkinglab.

the class VirtualNetworkIntentManagerTest method setupVirtualNetworkTopology.

/**
 * Method to create the virtual network for further testing.
 *
 * @return virtual network
 */
private VirtualNetwork setupVirtualNetworkTopology() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    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);
    Port port1 = new DefaultPort(virtualDevice1, PortNumber.portNumber(1), true);
    cp1 = new ConnectPoint(virtualDevice1.id(), port1.number());
    manager.createVirtualPort(virtualNetwork.id(), virtualDevice1.id(), port1.number(), cp1);
    Port port2 = new DefaultPort(virtualDevice1, PortNumber.portNumber(2), true);
    cp2 = new ConnectPoint(virtualDevice1.id(), port2.number());
    manager.createVirtualPort(virtualNetwork.id(), virtualDevice1.id(), port2.number(), cp2);
    Port port3 = new DefaultPort(virtualDevice2, PortNumber.portNumber(3), true);
    cp3 = new ConnectPoint(virtualDevice2.id(), port3.number());
    manager.createVirtualPort(virtualNetwork.id(), virtualDevice2.id(), port3.number(), cp3);
    Port port4 = new DefaultPort(virtualDevice2, PortNumber.portNumber(4), true);
    cp4 = new ConnectPoint(virtualDevice2.id(), port4.number());
    manager.createVirtualPort(virtualNetwork.id(), virtualDevice2.id(), port4.number(), cp4);
    Port port5 = new DefaultPort(virtualDevice3, PortNumber.portNumber(5), true);
    cp5 = new ConnectPoint(virtualDevice3.id(), port5.number());
    manager.createVirtualPort(virtualNetwork.id(), virtualDevice3.id(), port5.number(), cp5);
    Port port6 = new DefaultPort(virtualDevice3, PortNumber.portNumber(6), true);
    cp6 = new ConnectPoint(virtualDevice3.id(), port6.number());
    manager.createVirtualPort(virtualNetwork.id(), virtualDevice3.id(), port6.number(), cp6);
    link1 = manager.createVirtualLink(virtualNetwork.id(), cp1, cp3);
    virtualNetworkManagerStore.updateLink(link1, link1.tunnelId(), Link.State.ACTIVE);
    link2 = manager.createVirtualLink(virtualNetwork.id(), cp3, cp1);
    virtualNetworkManagerStore.updateLink(link2, link2.tunnelId(), Link.State.ACTIVE);
    link3 = manager.createVirtualLink(virtualNetwork.id(), cp4, cp5);
    virtualNetworkManagerStore.updateLink(link3, link3.tunnelId(), Link.State.ACTIVE);
    link4 = manager.createVirtualLink(virtualNetwork.id(), cp5, cp4);
    virtualNetworkManagerStore.updateLink(link4, link4.tunnelId(), Link.State.ACTIVE);
    vnetIntentService = new VirtualNetworkIntentManager(manager, virtualNetwork.id());
    vnetIntentService.intentStore = intentStore;
    return virtualNetwork;
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) Port(org.onosproject.net.Port) DefaultPort(org.onosproject.net.DefaultPort) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) ConnectPoint(org.onosproject.net.ConnectPoint) DefaultPort(org.onosproject.net.DefaultPort)

Example 12 with VirtualNetwork

use of org.onosproject.incubator.net.virtual.VirtualNetwork in project onos by opennetworkinglab.

the class VirtualNetworkLinkManagerTest method testGetIngressLinksByNullId.

/**
 * Tests querying for ingress links using a null connect point.
 */
@Test(expected = NullPointerException.class)
public void testGetIngressLinksByNullId() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    LinkService linkService = manager.get(virtualNetwork.id(), LinkService.class);
    // test the getIngressLinks() method with a null connect point.
    linkService.getIngressLinks(null);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) LinkService(org.onosproject.net.link.LinkService) Test(org.junit.Test)

Example 13 with VirtualNetwork

use of org.onosproject.incubator.net.virtual.VirtualNetwork in project onos by opennetworkinglab.

the class VirtualNetworkLinkManagerTest method testGetLinkByNullDst.

/**
 * Tests the getLink() method using a null dst connect point.
 */
@Test(expected = NullPointerException.class)
public void testGetLinkByNullDst() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    VirtualDevice srcVirtualDevice = manager.createVirtualDevice(virtualNetwork.id(), DID1);
    VirtualDevice dstVirtualDevice = manager.createVirtualDevice(virtualNetwork.id(), DID2);
    ConnectPoint src = new ConnectPoint(srcVirtualDevice.id(), PortNumber.portNumber(1));
    ConnectPoint dst = new ConnectPoint(dstVirtualDevice.id(), PortNumber.portNumber(2));
    manager.createVirtualLink(virtualNetwork.id(), src, dst);
    manager.createVirtualLink(virtualNetwork.id(), dst, src);
    LinkService linkService = manager.get(virtualNetwork.id(), LinkService.class);
    // test the getLink() method with a null dst connect point.
    linkService.getLink(src, null);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) ConnectPoint(org.onosproject.net.ConnectPoint) LinkService(org.onosproject.net.link.LinkService) Test(org.junit.Test)

Example 14 with VirtualNetwork

use of org.onosproject.incubator.net.virtual.VirtualNetwork in project onos by opennetworkinglab.

the class VirtualNetworkLinkManagerTest method testGetLinkByNullSrc.

/**
 * Tests the getLink() method using a null src connect point.
 */
@Test(expected = NullPointerException.class)
public void testGetLinkByNullSrc() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    VirtualDevice srcVirtualDevice = manager.createVirtualDevice(virtualNetwork.id(), DID1);
    VirtualDevice dstVirtualDevice = manager.createVirtualDevice(virtualNetwork.id(), DID2);
    ConnectPoint src = new ConnectPoint(srcVirtualDevice.id(), PortNumber.portNumber(1));
    ConnectPoint dst = new ConnectPoint(dstVirtualDevice.id(), PortNumber.portNumber(2));
    manager.createVirtualLink(virtualNetwork.id(), src, dst);
    manager.createVirtualLink(virtualNetwork.id(), dst, src);
    LinkService linkService = manager.get(virtualNetwork.id(), LinkService.class);
    // test the getLink() method with a null src connect point.
    linkService.getLink(null, dst);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) ConnectPoint(org.onosproject.net.ConnectPoint) LinkService(org.onosproject.net.link.LinkService) Test(org.junit.Test)

Example 15 with VirtualNetwork

use of org.onosproject.incubator.net.virtual.VirtualNetwork in project onos by opennetworkinglab.

the class VirtualNetworkManagerTest method testRemoveVnetTwice.

/**
 * Tests removal of a virtual network twice.
 */
@Test(expected = IllegalStateException.class)
public void testRemoveVnetTwice() {
    manager.registerTenantId(TenantId.tenantId(tenantIdValue1));
    VirtualNetwork virtualNetwork = manager.createVirtualNetwork(TenantId.tenantId(tenantIdValue1));
    manager.removeVirtualNetwork(virtualNetwork.id());
    manager.removeVirtualNetwork(virtualNetwork.id());
}
Also used : DefaultVirtualNetwork(org.onosproject.incubator.net.virtual.DefaultVirtualNetwork) VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) Test(org.junit.Test)

Aggregations

VirtualNetwork (org.onosproject.incubator.net.virtual.VirtualNetwork)98 Test (org.junit.Test)82 VirtualDevice (org.onosproject.incubator.net.virtual.VirtualDevice)38 DefaultVirtualNetwork (org.onosproject.incubator.net.virtual.DefaultVirtualNetwork)24 ConnectPoint (org.onosproject.net.ConnectPoint)24 TopologyService (org.onosproject.net.topology.TopologyService)24 Topology (org.onosproject.net.topology.Topology)23 DeviceService (org.onosproject.net.device.DeviceService)15 VirtualLink (org.onosproject.incubator.net.virtual.VirtualLink)12 DisjointPath (org.onosproject.net.DisjointPath)11 LinkService (org.onosproject.net.link.LinkService)10 ArrayList (java.util.ArrayList)8 HostService (org.onosproject.net.host.HostService)8 TenantId (org.onosproject.net.TenantId)7 Path (org.onosproject.net.Path)6 PathService (org.onosproject.net.topology.PathService)5 TopologyCluster (org.onosproject.net.topology.TopologyCluster)5 VirtualHost (org.onosproject.incubator.net.virtual.VirtualHost)4 VirtualPort (org.onosproject.incubator.net.virtual.VirtualPort)4 Link (org.onosproject.net.Link)4