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;
}
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);
}
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);
}
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);
}
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());
}
Aggregations