use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Community in project bgpcep by opendaylight.
the class TrafficMarkingEcHandler method serializeExtendedCommunity.
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.TrafficMarkingExtendedCommunity, "The extended community %s is not TrafficMarkingExtendedCommunity type.", extendedCommunity);
final TrafficMarkingExtendedCommunity trafficMarking = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.TrafficMarkingExtendedCommunity) extendedCommunity).getTrafficMarkingExtendedCommunity();
byteAggregator.writeZero(RESERVED);
ByteBufUtils.write(byteAggregator, trafficMarking.getGlobalAdministrator().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Community in project bgpcep by opendaylight.
the class TrafficRateEcHandler method serializeExtendedCommunity.
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.TrafficRateExtendedCommunity, "The extended community %s is not TrafficRateExtendedCommunity type.", extendedCommunity);
final TrafficRateExtendedCommunity trafficRate = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.TrafficRateExtendedCommunity) extendedCommunity).getTrafficRateExtendedCommunity();
byteAggregator.writeShort(trafficRate.getInformativeAs().getValue().intValue());
byteAggregator.writeBytes(trafficRate.getLocalAdministrator().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Community 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, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertNotNull(result.getAttributes());
attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().setCommunities(Collections.singletonList(new CommunitiesBuilder().setAsNumber(AsNumber.getDefaultInstance("65")).setSemantics(Uint16.TEN).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.types.rev200120.Community in project bgpcep by opendaylight.
the class SetCommunityTest method testReferenceReplace.
@Test
public void testReferenceReplace() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("set-community-reference-replace-test")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder().build());
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertEquals(this.multipleCom, result.getAttributes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Community in project bgpcep by opendaylight.
the class SetCommunityTest method testInlineRemove.
@Test
public void testInlineRemove() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("set-community-inline-remove-test")).findFirst().get();
RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(this.multipleCom);
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertEquals(this.emptyCom, result.getAttributes());
}
Aggregations