- Add missing mandatory to local-admistrator leaf.
- Rename as-4-generic-spec-common-ec grouping to
a more proper name, as-4-specific-common.
Change-Id: Idcf56922c33b0084ab286ef493e57dd2010c2792
Signed-off-by: Claudio D. Gasparini <cgaspari@cisco.com>
}
}
- grouping as-4-generic-spec-common-ec {
- container as-4-generic-spec-extended-community {
+ grouping as-4-spec-common {
+ container as-4-specific-common {
leaf as-number {
description "Carries a 4-octet Autonomous System (AS) number";
reference "https://tools.ietf.org/html/rfc5668#section-2";
leaf local-administrator {
type uint16;
+ mandatory true;
}
}
}
case as-4-generic-spec-extended-community-case {
container as-4-generic-spec-extended-community {
reference "https://www.ietf.org/archive/id/draft-ietf-idr-as4octet-extcomm-generic-subtype-08.txt";
- uses as-4-generic-spec-common-ec;
+ uses as-4-spec-common;
}
}
case as-4-route-target-extended-community-case {
container as-4-route-target-extended-community {
reference "https://tools.ietf.org/html/rfc5668";
- uses as-4-generic-spec-common-ec;
+ uses as-4-spec-common;
}
}
case as-4-route-origin-extended-community-case {
container as-4-route-origin-extended-community {
reference "https://tools.ietf.org/html/rfc5668";
- uses as-4-generic-spec-common-ec;
+ uses as-4-spec-common;
}
}
}
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf body) throws BGPDocumentedException, BGPParsingException {
return new As4GenericSpecExtendedCommunityCaseBuilder().setAs4GenericSpecExtendedCommunity(new As4GenericSpecExtendedCommunityBuilder()
- .setAs4GenericSpecExtendedCommunity(FourOctAsCommonECUtil.parseCommon(body)).build()).build();
+ .setAs4SpecificCommon(FourOctAsCommonECUtil.parseCommon(body)).build()).build();
}
@Override
Preconditions.checkArgument(extendedCommunity instanceof As4GenericSpecExtendedCommunityCase,
"The extended community %s is not As4GenericSpecExtendedCommunityCase type.", extendedCommunity);
FourOctAsCommonECUtil.serializeCommon(((As4GenericSpecExtendedCommunityCase) extendedCommunity).getAs4GenericSpecExtendedCommunity()
- .getAs4GenericSpecExtendedCommunity(), body);
+ .getAs4SpecificCommon(), body);
}
@Override
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf body) throws BGPDocumentedException, BGPParsingException {
return new As4RouteOriginExtendedCommunityCaseBuilder().setAs4RouteOriginExtendedCommunity(new As4RouteOriginExtendedCommunityBuilder()
- .setAs4GenericSpecExtendedCommunity(FourOctAsCommonECUtil.parseCommon(body)).build()).build();
+ .setAs4SpecificCommon(FourOctAsCommonECUtil.parseCommon(body)).build()).build();
}
@Override
Preconditions.checkArgument(extendedCommunity instanceof As4RouteOriginExtendedCommunityCase,
"The extended community %s is not As4RouteOriginExtendedCommunityCase type.", extendedCommunity);
FourOctAsCommonECUtil.serializeCommon(((As4RouteOriginExtendedCommunityCase) extendedCommunity)
- .getAs4RouteOriginExtendedCommunity().getAs4GenericSpecExtendedCommunity(), body);
+ .getAs4RouteOriginExtendedCommunity().getAs4SpecificCommon(), body);
}
@Override
@Override
public ExtendedCommunity parseExtendedCommunity(final ByteBuf body) throws BGPDocumentedException, BGPParsingException {
return new As4RouteTargetExtendedCommunityCaseBuilder().setAs4RouteTargetExtendedCommunity(new As4RouteTargetExtendedCommunityBuilder()
- .setAs4GenericSpecExtendedCommunity(FourOctAsCommonECUtil.parseCommon(body)).build()).build();
+ .setAs4SpecificCommon(FourOctAsCommonECUtil.parseCommon(body)).build()).build();
}
@Override
Preconditions.checkArgument(extendedCommunity instanceof As4RouteTargetExtendedCommunityCase,
"The extended community %s is not As4RouteTargetExtendedCommunityCase type.", extendedCommunity);
FourOctAsCommonECUtil.serializeCommon(((As4RouteTargetExtendedCommunityCase) extendedCommunity).getAs4RouteTargetExtendedCommunity()
- .getAs4GenericSpecExtendedCommunity(), body);
+ .getAs4SpecificCommon(), body);
}
@Override
public void testHandler() throws BGPDocumentedException, BGPParsingException {
final As4GenericSpecExtendedCommunityCase expected = new As4GenericSpecExtendedCommunityCaseBuilder()
.setAs4GenericSpecExtendedCommunity(new As4GenericSpecExtendedCommunityBuilder()
- .setAs4GenericSpecExtendedCommunity(AS_COMMON).build()).build();
+ .setAs4SpecificCommon(AS_COMMON).build()).build();
final ExtendedCommunity exComm = this.handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
Assert.assertEquals(expected, exComm);
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.as._4.generic.spec.common.ec.As4GenericSpecExtendedCommunity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.as._4.generic.spec.common.ec.As4GenericSpecExtendedCommunityBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.as._4.spec.common.As4SpecificCommon;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.as._4.spec.common.As4SpecificCommonBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.ExtendedCommunity;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.As4GenericSpecExtendedCommunityCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.As4RouteOriginExtendedCommunityCase;
static final byte[] INPUT = {
0, 0, 0, 20, 0, 100
};
- static final As4GenericSpecExtendedCommunity AS_COMMON = new As4GenericSpecExtendedCommunityBuilder().setAsNumber(new AsNumber(20L))
+ static final As4SpecificCommon AS_COMMON = new As4SpecificCommonBuilder().setAsNumber(new AsNumber(20L))
.setLocalAdministrator(100).build();
RouteOrigin4OctectASEcHandler handler;
final As4RouteOriginExtendedCommunityCase expected = new As4RouteOriginExtendedCommunityCaseBuilder()
.setAs4RouteOriginExtendedCommunity(new As4RouteOriginExtendedCommunityBuilder()
- .setAs4GenericSpecExtendedCommunity(AS_COMMON).build()).build();
+ .setAs4SpecificCommon(AS_COMMON).build()).build();
final ExtendedCommunity exComm = this.handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
Assert.assertEquals(expected, exComm);
public void testHandler() throws BGPDocumentedException, BGPParsingException {
final As4RouteTargetExtendedCommunityCase expected = new As4RouteTargetExtendedCommunityCaseBuilder()
.setAs4RouteTargetExtendedCommunity(new As4RouteTargetExtendedCommunityBuilder()
- .setAs4GenericSpecExtendedCommunity(AS_COMMON).build()).build();
+ .setAs4SpecificCommon(AS_COMMON).build()).build();
final ExtendedCommunity exComm = this.handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
Assert.assertEquals(expected, exComm);
import io.netty.buffer.ByteBuf;
import org.opendaylight.protocol.util.ByteBufWriteUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.as._4.generic.spec.common.ec.As4GenericSpecExtendedCommunity;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.as._4.generic.spec.common.ec.As4GenericSpecExtendedCommunityBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.as._4.spec.common.As4SpecificCommon;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.as._4.spec.common.As4SpecificCommonBuilder;
public final class FourOctAsCommonECUtil {
private FourOctAsCommonECUtil() {
throw new UnsupportedOperationException();
}
- public static As4GenericSpecExtendedCommunity parseCommon(final ByteBuf body) {
- return new As4GenericSpecExtendedCommunityBuilder().setAsNumber(new AsNumber(body.readUnsignedInt()))
+ public static As4SpecificCommon parseCommon(final ByteBuf body) {
+ return new As4SpecificCommonBuilder().setAsNumber(new AsNumber(body.readUnsignedInt()))
.setLocalAdministrator(body.readUnsignedShort()).build();
}
- public static void serializeCommon(final As4GenericSpecExtendedCommunity extComm, final ByteBuf body) {
+ public static void serializeCommon(final As4SpecificCommon extComm, final ByteBuf body) {
body.writeInt(extComm.getAsNumber().getValue().intValue());
ByteBufWriteUtil.writeUnsignedShort(extComm.getLocalAdministrator(), body);
}