use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class ImportAttributeTestUtil method createOutput.
public static Attributes createOutput() {
final AttributesBuilder attBuilder = new AttributesBuilder();
attBuilder.setCNextHop(createNexHop());
attBuilder.setOrigin(createOrigin());
return attBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class MatchAsPathSetTest method testMatchAsPathInverse.
@Test
public void testMatchAsPathInverse() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("reject-match-as-path-inverse-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(Collections.singletonList(new SegmentsBuilder().setAsSequence(Collections.singletonList(AsNumber.getDefaultInstance("200"))).build())).build()).build());
result = this.statementRegistry.applyExportStatement(this.baseAttributes, this.exportParameters, attributeContainer, statement);
assertNull(result.getAttributes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder 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());
}
Aggregations