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 testReferenceRemove.
@Test
public void testReferenceRemove() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("set-community-reference-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());
}
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 testInlineAdd.
@Test
public void testInlineAdd() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("set-community-inline-add-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 testReferenceAdd.
@Test
public void testReferenceAdd() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("set-community-reference-add-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 LinkBandwidthEC method serializeExtendedCommunity.
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf body) {
Preconditions.checkArgument(extendedCommunity instanceof LinkBandwidthCase, "The extended community %s is not LinkBandwidthCase type.", extendedCommunity);
final LinkBandwidthExtendedCommunity lb = ((LinkBandwidthCase) extendedCommunity).getLinkBandwidthExtendedCommunity();
body.writeShort(AS_TRANS);
ByteBufWriteUtil.writeFloat32(lb.getBandwidth(), body);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Community in project bgpcep by opendaylight.
the class CommunitiesAttributeParser method parseAttribute.
@Override
public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder, final RevisedErrorHandling errorHandling, final PeerSpecificParserConstraint constraint) throws BGPDocumentedException, BGPTreatAsWithdrawException {
final int readable = buffer.readableBytes();
if (readable == 0 && errorHandling != RevisedErrorHandling.NONE) {
throw new BGPTreatAsWithdrawException(BGPError.ATTR_LENGTH_ERROR, "Empty Community attribute");
}
if (readable % COMMUNITY_LENGTH != 0) {
throw errorHandling.reportError(BGPError.ATTR_LENGTH_ERROR, "Community attribute length must be a multiple of %s, have %s", COMMUNITY_LENGTH, readable);
}
final int count = readable / COMMUNITY_LENGTH;
final List<Communities> set = new ArrayList<>(count);
for (int i = 0; i < count; ++i) {
set.add((Communities) parseCommunity(this.refCache, buffer.readSlice(COMMUNITY_LENGTH)));
}
builder.setCommunities(set);
}
Aggregations