use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ExtendedCommunity in project bgpcep by opendaylight.
the class OpaqueEcHandler method serializeExtendedCommunity.
@Override
public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
Preconditions.checkArgument(extendedCommunity instanceof OpaqueExtendedCommunityCase, "The extended community %s is not OpaqueExtendedCommunityCase type.", extendedCommunity);
final OpaqueExtendedCommunity opaqueExtendedCommunity = ((OpaqueExtendedCommunityCase) extendedCommunity).getOpaqueExtendedCommunity();
byteAggregator.writeBytes(opaqueExtendedCommunity.getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ExtendedCommunity in project bgpcep by opendaylight.
the class SourceAS4OctectHandler method parseExtendedCommunity.
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf body) {
final SourceAs4ExtendedCommunityBuilder builder = new SourceAs4ExtendedCommunityBuilder().setGlobalAdministrator(new AsNumber(ByteBufUtils.readUint32(body)));
body.skipBytes(LOCAL_LENGTH);
return new SourceAs4ExtendedCommunityCaseBuilder().setSourceAs4ExtendedCommunity(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ExtendedCommunity in project bgpcep by opendaylight.
the class CommunitiesBuilder method createExtComm.
static List<ExtendedCommunities> createExtComm(final List<String> extCom) {
final List<ExtendedCommunities> extendedCommunities = new ArrayList<>();
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;
}
Aggregations