use of org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer in project bgpcep by opendaylight.
the class MatchAsPathSetTest method testMatchAsPathAny.
@Test
public void testMatchAsPathAny() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("reject-match-as-path-any-set")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().build());
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertNotNull(result.getAttributes());
attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().setAsPath(new AsPathBuilder().setSegments(Collections.singletonList(new SegmentsBuilder().setAsSequence(Collections.singletonList(AsNumber.getDefaultInstance("65"))).build())).build()).build());
result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertNull(result.getAttributes());
}
use of org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer in project bgpcep by opendaylight.
the class MatchAsPathSetTest method testMatchAsPathAll.
@Test
public void testMatchAsPathAll() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("reject-match-as-path-all-set")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().setAsPath(new AsPathBuilder().setSegments(Collections.singletonList(new SegmentsBuilder().setAsSequence(Collections.singletonList(AsNumber.getDefaultInstance("65"))).build())).build()).build());
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertNotNull(result.getAttributes());
attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().setAsPath(new AsPathBuilder().setSegments(Arrays.asList(new SegmentsBuilder().setAsSet(Arrays.asList(AsNumber.getDefaultInstance("65"), AsNumber.getDefaultInstance("64"))).build(), new SegmentsBuilder().setAsSet(Collections.singletonList(AsNumber.getDefaultInstance("63"))).build())).build()).build());
result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertNull(result.getAttributes());
}
use of org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer in project bgpcep by opendaylight.
the class MatchBgpNeighborSetTest method testMatchToBgpNeighborAny.
@Test
public void testMatchToBgpNeighborAny() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("reject-to-neighbor-test")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().build());
doReturn(new PeerId("bgp://127.0.0.2")).when(this.exportParameters).getFromPeerId();
doReturn(new PeerId("bgp://42.42.42.42")).when(this.exportParameters).getToPeerId();
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertNotNull(result.getAttributes());
doReturn(new PeerId("bgp://127.0.0.1")).when(this.exportParameters).getToPeerId();
result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertNull(result.getAttributes());
}
use of org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer in project bgpcep by opendaylight.
the class MatchBgpNeighborSetTest method testMatchFromBgpNeighborAny.
@Test
public void testMatchFromBgpNeighborAny() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("reject-from-neighbor-test")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().build());
doReturn(new PeerId("bgp://42.42.42.42")).when(this.exportParameters).getFromPeerId();
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertNotNull(result.getAttributes());
doReturn(new PeerId("bgp://127.0.0.1")).when(this.exportParameters).getFromPeerId();
result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertNull(result.getAttributes());
}
use of org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer in project bgpcep by opendaylight.
the class MatchCommunityTest method testComAny.
@Test
public void testComAny() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("community-any-test")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().build());
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertNotNull(result.getAttributes());
attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().setCommunities(Collections.singletonList(new CommunitiesBuilder().setAsNumber(AsNumber.getDefaultInstance("65")).setSemantics(10).build())).build());
result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertNull(result.getAttributes());
}
Aggregations