use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ExtendedCommunity in project bgpcep by opendaylight.
the class TrafficActionEcHandler method serializeExtendedCommunity.
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
Preconditions.checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.TrafficActionExtendedCommunity, "The extended community %s is not TrafficActionExtendedCommunityCase type.", extendedCommunity);
final TrafficActionExtendedCommunity trafficAction = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.TrafficActionExtendedCommunity) extendedCommunity).getTrafficActionExtendedCommunity();
byteAggregator.writeZero(RESERVED);
final BitArray flags = new BitArray(FLAGS_SIZE);
flags.set(SAMPLE_BIT, trafficAction.isSample());
flags.set(TERMINAL_BIT, trafficAction.isTerminalAction());
flags.toByteBuf(byteAggregator);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ExtendedCommunity in project bgpcep by opendaylight.
the class TrafficMarkingEcHandler method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
buffer.skipBytes(RESERVED);
final Dscp dscp = new Dscp(buffer.readUnsignedByte());
return new TrafficMarkingExtendedCommunityCaseBuilder().setTrafficMarkingExtendedCommunity(new TrafficMarkingExtendedCommunityBuilder().setGlobalAdministrator(dscp).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ExtendedCommunity in project bgpcep by opendaylight.
the class NonTransitiveAttributesFilterHandler method filterAttributes.
private Attributes filterAttributes(final Attributes attributes) {
final AttributesBuilder builder = new AttributesBuilder();
builder.setCNextHop(attributes.getCNextHop());
builder.setOrigin(attributes.getOrigin());
builder.setAsPath(attributes.getAsPath());
builder.setCommunities(attributes.getCommunities());
final List<UnrecognizedAttributes> oldAtt = attributes.getUnrecognizedAttributes();
if (oldAtt != null) {
builder.setUnrecognizedAttributes(attributes.getUnrecognizedAttributes().stream().filter(UnrecognizedAttributes::isTransitive).collect(Collectors.toList()));
}
final List<ExtendedCommunities> oldExt = attributes.getExtendedCommunities();
if (oldExt != null) {
builder.setExtendedCommunities(oldExt.stream().filter(ExtendedCommunity::isTransitive).collect(Collectors.toList()));
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ExtendedCommunity in project bgpcep by opendaylight.
the class CommunitiesBuilder method createExtComm.
static List<ExtendedCommunities> createExtComm(final List<String> extCom) {
final List<ExtendedCommunities> extendedCommunities = Lists.newArrayList();
for (String ec : extCom) {
ExtendedCommunity community = null;
switch(ec) {
case "as-4-generic-spec-extended-community":
community = CommunitiesBuilder.as4GenSpecBuild();
break;
case "as-4-route-target-extended-community":
community = CommunitiesBuilder.as4RTBuild();
break;
case "as-4-route-origin-extended-community":
community = CommunitiesBuilder.as4ROBuild();
break;
case "route-origin":
community = CommunitiesBuilder.rOBuild();
break;
case "route-target":
community = CommunitiesBuilder.rTBuild();
break;
case "route-origin-extended-community":
community = CommunitiesBuilder.rOECBuild();
break;
case "route-target-extended-community":
community = CommunitiesBuilder.rTECBuild();
break;
case "link-bandwidth-extended-community":
community = CommunitiesBuilder.linkBandBuild();
break;
case "opaque-extended-community":
community = CommunitiesBuilder.opaqueBuild();
break;
case "inet4-specific-extended-community":
community = CommunitiesBuilder.inet4Build();
break;
case "as-specific-extended-community":
community = CommunitiesBuilder.asSpecBuild();
break;
default:
LOG.debug("Not recognized Extended Community {}", ec);
break;
}
extendedCommunities.add(new ExtendedCommunitiesBuilder().setTransitive(true).setExtendedCommunity(community).build());
}
return extendedCommunities;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ExtendedCommunity in project bgpcep by opendaylight.
the class ESImpRouteTargetExtCom method serializeExtendedCommunity.
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
Preconditions.checkArgument(extendedCommunity instanceof EsImportRouteExtendedCommunityCase, "The extended community %s is not EsImportRouteExtendedCommunityCaseCase type.", extendedCommunity);
final EsImportRouteExtendedCommunity extCom = ((EsImportRouteExtendedCommunityCase) extendedCommunity).getEsImportRouteExtendedCommunity();
byteAggregator.writeBytes(IetfYangUtil.INSTANCE.bytesFor(extCom.getEsImport()));
}
Aggregations