Search in sources :

Example 16 with DisjointPath

use of org.onosproject.net.DisjointPath in project onos by opennetworkinglab.

the class VirtualNetworkTopologyManagerTest method testGetDisjointPathsUsingNullRiskProfile.

/**
 * Test getDisjointPaths() methods using a null risk profile.
 */
@Test(expected = NullPointerException.class)
public void testGetDisjointPathsUsingNullRiskProfile() {
    VirtualNetwork virtualNetwork = setupVirtualNetworkTopology();
    TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
    Topology topology = topologyService.currentTopology();
    VirtualDevice srcVirtualDevice = getVirtualDevice(virtualNetwork.id(), DID1);
    VirtualDevice dstVirtualDevice = getVirtualDevice(virtualNetwork.id(), DID2);
    // test the getDisjointPaths() method using a null risk profile.
    Set<DisjointPath> paths = topologyService.getDisjointPaths(topology, srcVirtualDevice.id(), dstVirtualDevice.id(), (Map<Link, Object>) null);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) Topology(org.onosproject.net.topology.Topology) DisjointPath(org.onosproject.net.DisjointPath) Link(org.onosproject.net.Link) VirtualLink(org.onosproject.incubator.net.virtual.VirtualLink) TopologyService(org.onosproject.net.topology.TopologyService) Test(org.junit.Test)

Example 17 with DisjointPath

use of org.onosproject.net.DisjointPath in project onos by opennetworkinglab.

the class VirtualNetworkTopologyManagerTest method testGetDisjointPathsUsingNullWeight.

/**
 * Test getDisjointPaths() methods using a null weight.
 */
@Test(expected = NullPointerException.class)
public void testGetDisjointPathsUsingNullWeight() {
    VirtualNetwork virtualNetwork = setupVirtualNetworkTopology();
    TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
    Topology topology = topologyService.currentTopology();
    VirtualDevice srcVirtualDevice = getVirtualDevice(virtualNetwork.id(), DID1);
    VirtualDevice dstVirtualDevice = getVirtualDevice(virtualNetwork.id(), DID2);
    // test the getDisjointPaths() method using a null weight.
    Set<DisjointPath> paths = topologyService.getDisjointPaths(topology, srcVirtualDevice.id(), dstVirtualDevice.id(), (LinkWeigher) null);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) Topology(org.onosproject.net.topology.Topology) DisjointPath(org.onosproject.net.DisjointPath) TopologyService(org.onosproject.net.topology.TopologyService) Test(org.junit.Test)

Example 18 with DisjointPath

use of org.onosproject.net.DisjointPath in project onos by opennetworkinglab.

the class VirtualNetworkTopologyManagerTest method testGetDisjointPathsUsingNullSrcDeviceId.

/**
 * Test getDisjointPaths() methods using a null src device identifier.
 */
@Test(expected = NullPointerException.class)
public void testGetDisjointPathsUsingNullSrcDeviceId() {
    VirtualNetwork virtualNetwork = setupVirtualNetworkTopology();
    TopologyService topologyService = manager.get(virtualNetwork.id(), TopologyService.class);
    Topology topology = topologyService.currentTopology();
    VirtualDevice srcVirtualDevice = getVirtualDevice(virtualNetwork.id(), DID1);
    VirtualDevice dstVirtualDevice = getVirtualDevice(virtualNetwork.id(), DID2);
    // test the getDisjointPaths() method using a null src device identifier.
    Set<DisjointPath> paths = topologyService.getDisjointPaths(topology, null, dstVirtualDevice.id());
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) VirtualDevice(org.onosproject.incubator.net.virtual.VirtualDevice) Topology(org.onosproject.net.topology.Topology) DisjointPath(org.onosproject.net.DisjointPath) TopologyService(org.onosproject.net.topology.TopologyService) Test(org.junit.Test)

Example 19 with DisjointPath

use of org.onosproject.net.DisjointPath in project onos by opennetworkinglab.

the class PathPainterTopovMessageHandler method hilightAndSendPaths.

private void hilightAndSendPaths() {
    PathLinkMap linkMap = new PathLinkMap();
    allPathLinks.forEach(linkMap::add);
    Set<Link> selectedPathLinks;
    // the other containing all paths links.
    if (currentMode.equals(Mode.DISJOINT)) {
        DisjointPath dp = (DisjointPath) paths.get(pathIndex);
        selectedPathLinks = paths.isEmpty() ? ImmutableSet.of() : Sets.newHashSet(dp.primary().links());
        selectedPathLinks.addAll(dp.backup().links());
    } else {
        selectedPathLinks = paths.isEmpty() ? ImmutableSet.of() : ImmutableSet.copyOf(paths.get(pathIndex).links());
    }
    Highlights highlights = new Highlights();
    if (highlightDelay > 0) {
        highlights.delay(highlightDelay);
    }
    for (PathLink plink : linkMap.biLinks()) {
        plink.computeHilight(selectedPathLinks, allPathLinks);
        highlights.add(plink.highlight(null));
    }
    if (src != null) {
        highlights = addBadge(highlights, srcType, src.toString(), SRC);
    }
    if (dst != null) {
        highlights = addBadge(highlights, dstType, dst.toString(), DST);
    }
    sendMessage(highlightsMessage(highlights));
}
Also used : Highlights(org.onosproject.ui.topo.Highlights) Link(org.onosproject.net.Link) DisjointPath(org.onosproject.net.DisjointPath)

Aggregations

DisjointPath (org.onosproject.net.DisjointPath)19 Test (org.junit.Test)7 VirtualNetwork (org.onosproject.incubator.net.virtual.VirtualNetwork)7 Path (org.onosproject.net.Path)7 DefaultDisjointPath (org.onosproject.net.DefaultDisjointPath)6 VirtualDevice (org.onosproject.incubator.net.virtual.VirtualDevice)5 Topology (org.onosproject.net.topology.Topology)5 TopologyService (org.onosproject.net.topology.TopologyService)5 DefaultPath (org.onosproject.net.DefaultPath)4 DeviceId (org.onosproject.net.DeviceId)4 EdgeLink (org.onosproject.net.EdgeLink)3 Link (org.onosproject.net.Link)3 ImmutableSet (com.google.common.collect.ImmutableSet)2 ArrayList (java.util.ArrayList)2 GraphPathSearch (org.onlab.graph.GraphPathSearch)2 DefaultEdgeLink (org.onosproject.net.DefaultEdgeLink)2 Intent (org.onosproject.net.intent.Intent)2 LinkCollectionIntent (org.onosproject.net.intent.LinkCollectionIntent)2 DefaultTopologyVertex (org.onosproject.net.topology.DefaultTopologyVertex)2 LinkWeigher (org.onosproject.net.topology.LinkWeigher)2