Search in sources :

Example 11 with DefaultPath

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

the class MeteredConstraintTest method setUp.

@Before
public void setUp() {
    resourceContext = createMock(ResourceContext.class);
    Annotations annotations1 = DefaultAnnotations.builder().set(METERED, METERED1).build();
    Annotations annotations2 = DefaultAnnotations.builder().set(METERED, METERED2).build();
    meteredLink = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID1, PN1)).dst(cp(DID2, PN2)).type(DIRECT).annotations(annotations1).build();
    nonMeteredLink = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID2, PN3)).dst(cp(DID3, PN4)).type(DIRECT).annotations(annotations2).build();
    unAnnotatedLink = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID1, PN5)).dst(cp(DID3, PN6)).type(DIRECT).build();
    meteredPath = new DefaultPath(PROVIDER_ID, Arrays.asList(meteredLink, nonMeteredLink), ScalarWeight.toWeight(10));
    nonMeteredPath = new DefaultPath(PROVIDER_ID, Arrays.asList(nonMeteredLink, unAnnotatedLink), ScalarWeight.toWeight(10));
}
Also used : ResourceContext(org.onosproject.net.intent.ResourceContext) DefaultAnnotations(org.onosproject.net.DefaultAnnotations) Annotations(org.onosproject.net.Annotations) DefaultPath(org.onosproject.net.DefaultPath) Before(org.junit.Before)

Example 12 with DefaultPath

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

the class ObstacleConstraintTest method setUp.

@Before
public void setUp() {
    resourceContext = createMock(ResourceContext.class);
    link1 = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID1, PN1)).dst(cp(DID2, PN2)).type(DIRECT).build();
    link2 = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID2, PN3)).dst(cp(DID3, PN4)).type(DIRECT).build();
    host1 = new DefaultHost(PROVIDER_ID, HostId.hostId("00:00:00:00:00:01/None"), MacAddress.valueOf(0), VlanId.vlanId(), new HostLocation(DID5, PN1, 1), ImmutableSet.of(), DefaultAnnotations.EMPTY);
    host2 = new DefaultHost(PROVIDER_ID, HostId.hostId("00:00:00:00:00:02/None"), MacAddress.valueOf(0), VlanId.vlanId(), new HostLocation(DID6, PN1, 1), ImmutableSet.of(), DefaultAnnotations.EMPTY);
    edgelink1 = createEdgeLink(host1, true);
    edgelink2 = createEdgeLink(host2, false);
    path = new DefaultPath(PROVIDER_ID, Arrays.asList(link1, link2), ScalarWeight.toWeight(10));
    pathWithEdgeLink = new DefaultPath(PROVIDER_ID, Arrays.asList(edgelink1, link1, link2, edgelink2), ScalarWeight.toWeight(10));
}
Also used : DefaultHost(org.onosproject.net.DefaultHost) ResourceContext(org.onosproject.net.intent.ResourceContext) HostLocation(org.onosproject.net.HostLocation) DefaultPath(org.onosproject.net.DefaultPath) Before(org.junit.Before)

Example 13 with DefaultPath

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

the class TierConstraintTest method setUp.

@Before
public void setUp() {
    resourceContext = createMock(ResourceContext.class);
    Annotations annotations1 = DefaultAnnotations.builder().set(TIER, TIER1).build();
    Annotations annotations2 = DefaultAnnotations.builder().set(TIER, TIER2).build();
    Annotations annotations3 = DefaultAnnotations.builder().set(TIER, TIER3).build();
    link1 = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID1, PN1)).dst(cp(DID2, PN2)).type(DIRECT).annotations(annotations1).build();
    link2 = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID2, PN3)).dst(cp(DID3, PN4)).type(DIRECT).annotations(annotations2).build();
    link3 = DefaultLink.builder().providerId(PROVIDER_ID).src(cp(DID2, PN5)).dst(cp(DID4, PN6)).type(DIRECT).annotations(annotations3).build();
    path12 = new DefaultPath(PROVIDER_ID, Arrays.asList(link1, link2), ScalarWeight.toWeight(10));
    path13 = new DefaultPath(PROVIDER_ID, Arrays.asList(link1, link3), ScalarWeight.toWeight(10));
    path23 = new DefaultPath(PROVIDER_ID, Arrays.asList(link2, link3), ScalarWeight.toWeight(10));
}
Also used : ResourceContext(org.onosproject.net.intent.ResourceContext) DefaultAnnotations(org.onosproject.net.DefaultAnnotations) Annotations(org.onosproject.net.Annotations) DefaultPath(org.onosproject.net.DefaultPath) Before(org.junit.Before)

Example 14 with DefaultPath

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

the class PointToPointIntentCompiler method compile.

@Override
public List<Intent> compile(PointToPointIntent intent, List<Intent> installable) {
    log.trace("compiling {} {}", intent, installable);
    ConnectPoint ingressPoint = intent.filteredIngressPoint().connectPoint();
    ConnectPoint egressPoint = intent.filteredEgressPoint().connectPoint();
    // Idea: use suggested path as primary and another path from path service as protection
    if (intent.suggestedPath() != null && intent.suggestedPath().size() > 0) {
        Path path = new DefaultPath(PID, intent.suggestedPath(), new ScalarWeight(1));
        // Check intent constraints against suggested path and suggested path availability
        if (checkPath(path, intent.constraints()) && pathAvailable(intent)) {
            allocateIntentBandwidth(intent, path);
            return asList(createLinkCollectionIntent(ImmutableSet.copyOf(intent.suggestedPath()), DEFAULT_COST, intent));
        }
    }
    if (ingressPoint.deviceId().equals(egressPoint.deviceId())) {
        return createZeroHopLinkCollectionIntent(intent);
    }
    // proceed with no protected paths
    if (!ProtectionConstraint.requireProtectedPath(intent)) {
        return createUnprotectedLinkCollectionIntent(intent);
    }
    try {
        // attempt to compute and implement backup path
        return createProtectedIntent(ingressPoint, egressPoint, intent, installable);
    } catch (PathNotFoundException e) {
        log.warn("Could not find disjoint Path for {}", intent);
        // no disjoint path extant -- maximum one path exists between devices
        return createSinglePathIntent(ingressPoint, egressPoint, intent, installable);
    }
}
Also used : Path(org.onosproject.net.Path) DefaultPath(org.onosproject.net.DefaultPath) DisjointPath(org.onosproject.net.DisjointPath) DefaultPath(org.onosproject.net.DefaultPath) PathNotFoundException(org.onosproject.net.intent.impl.PathNotFoundException) ConnectPoint(org.onosproject.net.ConnectPoint) ScalarWeight(org.onlab.graph.ScalarWeight)

Example 15 with DefaultPath

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

the class AbstractPathService method edgeToEdgePathD.

// Produces a direct edge-to-edge path.
private DisjointPath edgeToEdgePathD(EdgeLink srcLink, EdgeLink dstLink, DisjointPath path, LinkWeigher weigher) {
    Path primary = null;
    Path backup = null;
    if (path != null) {
        primary = path.primary();
        backup = path.backup();
    }
    if (backup == null) {
        return new DefaultDisjointPath(PID, (DefaultPath) edgeToEdgePath(srcLink, dstLink, primary, weigher));
    }
    return new DefaultDisjointPath(PID, (DefaultPath) edgeToEdgePath(srcLink, dstLink, primary, weigher), (DefaultPath) edgeToEdgePath(srcLink, dstLink, backup, weigher));
}
Also used : DefaultPath(org.onosproject.net.DefaultPath) DefaultDisjointPath(org.onosproject.net.DefaultDisjointPath) Path(org.onosproject.net.Path) DisjointPath(org.onosproject.net.DisjointPath) DefaultDisjointPath(org.onosproject.net.DefaultDisjointPath)

Aggregations

DefaultPath (org.onosproject.net.DefaultPath)19 Link (org.onosproject.net.Link)10 ArrayList (java.util.ArrayList)7 Before (org.junit.Before)7 Path (org.onosproject.net.Path)6 DefaultLink (org.onosproject.net.DefaultLink)5 ResourceContext (org.onosproject.net.intent.ResourceContext)5 ScalarWeight (org.onlab.graph.ScalarWeight)4 CoreService (org.onosproject.core.CoreService)4 DisjointPath (org.onosproject.net.DisjointPath)4 Test (org.junit.Test)3 Annotations (org.onosproject.net.Annotations)3 ConnectPoint (org.onosproject.net.ConnectPoint)3 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)3 DeviceId (org.onosproject.net.DeviceId)3 EdgeLink (org.onosproject.net.EdgeLink)3 FlowRuleIntent (org.onosproject.net.intent.FlowRuleIntent)3 Intent (org.onosproject.net.intent.Intent)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2