use of org.onosproject.net.domain.DomainPointToPointIntent in project onos by opennetworkinglab.
the class DomainIntentInstallerTest method createDomainIntents.
/**
* Creates domain Intents.
*
* @return the domain Intents
*/
private List<Intent> createDomainIntents() {
FilteredConnectPoint ingress = new FilteredConnectPoint(CP1);
FilteredConnectPoint egress = new FilteredConnectPoint(CP2);
DomainPointToPointIntent intent = DomainPointToPointIntent.builder().appId(APP_ID).key(KEY1).priority(DEFAULT_PRIORITY).filteredIngressPoint(ingress).filteredEgressPoint(egress).links(ImmutableList.of()).build();
return ImmutableList.of(intent);
}
use of org.onosproject.net.domain.DomainPointToPointIntent in project onos by opennetworkinglab.
the class LinkCollectionIntentCompilerDomainP2PTest method testCompilationMultiHopDomainP2P.
/**
* We test the proper compilation of a domain with two devices.
*/
@Test
public void testCompilationMultiHopDomainP2P() {
intent = LinkCollectionIntent.builder().appId(APP_ID).selector(selector).treatment(treatment).applyTreatmentOnEgress(true).links(domainP2Plinks).filteredIngressPoints(ImmutableSet.of(new FilteredConnectPoint(d1p10))).filteredEgressPoints(ImmutableSet.of(new FilteredConnectPoint(d3p10))).constraints(domainConstraint).build();
sut.activate();
List<Intent> compiled = sut.compile(intent, Collections.emptyList());
assertThat(compiled, hasSize(2));
DomainPointToPointIntent domainIntent = ((DomainPointToPointIntent) compiled.get(0));
ConnectPoint ingress = domainIntent.filteredIngressPoints().iterator().next().connectPoint();
assertThat(ingress, equalTo(d2p0));
ConnectPoint egress = domainIntent.filteredEgressPoints().iterator().next().connectPoint();
assertThat(egress, equalTo(d4p0));
assertThat(domainIntent.links(), hasSize(1));
Collection<FlowRule> rules = ((FlowRuleIntent) compiled.get(1)).flowRules();
assertThat(rules, hasSize(2));
sut.deactivate();
}
use of org.onosproject.net.domain.DomainPointToPointIntent in project onos by opennetworkinglab.
the class LinkCollectionIntentCompilerDomainP2PTest method testCompilationDomainEndP2P.
/**
* We test the proper compilation of a domain ending with a domain device.
*/
@Test
public void testCompilationDomainEndP2P() {
intent = LinkCollectionIntent.builder().appId(APP_ID).selector(selector).treatment(treatment).applyTreatmentOnEgress(true).links(ImmutableSet.of(link(d1p0, d2p0))).filteredIngressPoints(ImmutableSet.of(new FilteredConnectPoint(d1p10))).filteredEgressPoints(ImmutableSet.of(new FilteredConnectPoint(d2p10))).constraints(domainConstraint).build();
sut.activate();
List<Intent> compiled = sut.compile(intent, Collections.emptyList());
assertThat(compiled, hasSize(2));
DomainPointToPointIntent domainIntent = ((DomainPointToPointIntent) compiled.get(0));
ConnectPoint ingress = domainIntent.filteredIngressPoints().iterator().next().connectPoint();
assertThat(ingress, equalTo(d2p0));
ConnectPoint egress = domainIntent.filteredEgressPoints().iterator().next().connectPoint();
assertThat(egress, equalTo(d2p10));
assertThat(domainIntent.links(), hasSize(0));
Collection<FlowRule> rules = ((FlowRuleIntent) compiled.get(1)).flowRules();
assertThat(rules, hasSize(1));
sut.deactivate();
}
use of org.onosproject.net.domain.DomainPointToPointIntent in project onos by opennetworkinglab.
the class LinkCollectionIntentCompilerDomainP2PTest method testCompilationDomainFullP2P.
/**
* We test the proper compilation of a path fully inside of a domain.
*/
@Test
public void testCompilationDomainFullP2P() {
intent = LinkCollectionIntent.builder().appId(APP_ID).selector(selector).treatment(treatment).applyTreatmentOnEgress(true).links(ImmutableSet.of(link(d2p0, d4p0))).filteredIngressPoints(ImmutableSet.of(new FilteredConnectPoint(d2p10))).filteredEgressPoints(ImmutableSet.of(new FilteredConnectPoint(d4p10))).constraints(domainConstraint).build();
sut.activate();
List<Intent> compiled = sut.compile(intent, Collections.emptyList());
assertThat(compiled, hasSize(1));
DomainPointToPointIntent domainIntent = ((DomainPointToPointIntent) compiled.get(0));
ConnectPoint ingress = domainIntent.filteredIngressPoints().iterator().next().connectPoint();
assertThat(ingress, equalTo(d2p10));
ConnectPoint egress = domainIntent.filteredEgressPoints().iterator().next().connectPoint();
assertThat(egress, equalTo(d4p10));
assertThat(domainIntent.links(), hasSize(1));
sut.deactivate();
}
use of org.onosproject.net.domain.DomainPointToPointIntent in project onos by opennetworkinglab.
the class LinkCollectionIntentCompilerDomainP2PTest method testCompilationDomainStartP2P.
/**
* We test the proper compilation of a domain starting with a domain device.
*/
@Test
public void testCompilationDomainStartP2P() {
intent = LinkCollectionIntent.builder().appId(APP_ID).selector(selector).treatment(treatment).applyTreatmentOnEgress(true).links(ImmutableSet.of(link(d2p0, d1p0))).filteredIngressPoints(ImmutableSet.of(new FilteredConnectPoint(d2p10))).filteredEgressPoints(ImmutableSet.of(new FilteredConnectPoint(d1p10))).constraints(domainConstraint).build();
sut.activate();
List<Intent> compiled = sut.compile(intent, Collections.emptyList());
assertThat(compiled, hasSize(2));
DomainPointToPointIntent domainIntent = ((DomainPointToPointIntent) compiled.get(0));
ConnectPoint ingress = domainIntent.filteredIngressPoints().iterator().next().connectPoint();
assertThat(ingress, equalTo(d2p10));
ConnectPoint egress = domainIntent.filteredEgressPoints().iterator().next().connectPoint();
assertThat(egress, equalTo(d2p0));
assertThat(domainIntent.links(), hasSize(0));
Collection<FlowRule> rules = ((FlowRuleIntent) compiled.get(1)).flowRules();
assertThat(rules, hasSize(1));
sut.deactivate();
}
Aggregations