use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.as.path.SegmentsBuilder 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());
attBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.singletonList(new SegmentsBuilder().setAsSequence(Collections.singletonList(AS)).build())).build());
return attBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.as.path.SegmentsBuilder in project bgpcep by opendaylight.
the class AsPathLengthTest method testASPathLengthLe.
@Test
public void testASPathLengthLe() {
final AsPathBuilder asPath = new AsPathBuilder();
asPath.setSegments(Collections.singletonList(new SegmentsBuilder().setAsSequence(Arrays.asList(AsNumber.getDefaultInstance("1"), AsNumber.getDefaultInstance("2"), AsNumber.getDefaultInstance("3"))).build()));
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("as-path-le-length-test")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().setAsPath(asPath.build()).build());
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertNotNull(result.getAttributes());
asPath.setSegments(Collections.singletonList(new SegmentsBuilder().setAsSequence(Collections.singletonList(AsNumber.getDefaultInstance("3"))).build()));
attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().setAsPath(asPath.build()).build());
result = this.statementRegistry.applyExportStatement(this.baseAttributes, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertNull(result.getAttributes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.as.path.SegmentsBuilder in project bgpcep by opendaylight.
the class AsPathLengthTest method testASPathLengthGe.
@Test
public void testASPathLengthGe() {
final AsPathBuilder asPath = new AsPathBuilder();
asPath.setSegments(Collections.singletonList(new SegmentsBuilder().setAsSequence(Arrays.asList(AsNumber.getDefaultInstance("1"), AsNumber.getDefaultInstance("2"), AsNumber.getDefaultInstance("3"))).build()));
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("as-path-ge-length-test")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().setAsPath(asPath.build()).build());
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertNull(result.getAttributes());
asPath.setSegments(Collections.singletonList(new SegmentsBuilder().setAsSequence(Collections.singletonList(AsNumber.getDefaultInstance("3"))).build()));
attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().setAsPath(asPath.build()).build());
result = this.statementRegistry.applyExportStatement(this.baseAttributes, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertNotNull(result.getAttributes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.as.path.SegmentsBuilder in project bgpcep by opendaylight.
the class AbstractAddPathTest method createSimpleUpdateEbgp.
private static Update createSimpleUpdateEbgp(final Ipv4Prefix prefix) {
final AttributesBuilder attBuilder = new AttributesBuilder();
attBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build());
attBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.singletonList(new SegmentsBuilder().setAsSequence(Collections.singletonList(AS_NUMBER)).build())).build());
addAttributeAugmentation(attBuilder, prefix, null);
return new UpdateBuilder().setAttributes(attBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.as.path.SegmentsBuilder 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, IPV4UNICAST.class, 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, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertNull(result.getAttributes());
}
Aggregations