Update As4 Extended communities 53/38253/2
authorClaudio D. Gasparini <cgaspari@cisco.com>
Mon, 2 May 2016 08:15:09 +0000 (10:15 +0200)
committerMilos Fabian <milfabia@cisco.com>
Tue, 3 May 2016 07:32:29 +0000 (07:32 +0000)
- 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>
bgp/concepts/src/main/yang/bgp-types.yang
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/four/octect/as/specific/Generic4OctASEcHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/four/octect/as/specific/RouteOrigin4OctectASEcHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/four/octect/as/specific/RouteTarget4OctectASEcHandler.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/four/octect/as/specific/Generic4OctASEcHandlerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/four/octect/as/specific/RouteOrigin4OctectASEcHandlerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/four/octect/as/specific/RouteTarget4OctectASEcHandlerTest.java
bgp/parser-spi/src/main/java/org/opendaylight/protocol/bgp/parser/spi/extended/community/FourOctAsCommonECUtil.java

index 782f27db0992945d80fb064ada22e6e26ff41b27..7435c8e71a3f7609846b9e58fdfa0e0164b193e5 100644 (file)
@@ -164,8 +164,8 @@ module bgp-types {
         }
     }
 
-    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";
@@ -176,6 +176,7 @@ module bgp-types {
 
             leaf local-administrator {
                 type uint16;
+                mandatory true;
             }
         }
     }
@@ -262,19 +263,19 @@ module bgp-types {
             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;
                 }
             }
         }
index 84308f1367f3450d417b3e5fa817452cfa1d80d9..989fbae766e502654d906f07ef65e39f35054ce0 100644 (file)
@@ -25,7 +25,7 @@ public final class Generic4OctASEcHandler extends Abstract4OctetAsExtendedCommun
     @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
@@ -33,7 +33,7 @@ public final class Generic4OctASEcHandler extends Abstract4OctetAsExtendedCommun
         Preconditions.checkArgument(extendedCommunity instanceof As4GenericSpecExtendedCommunityCase,
             "The extended community %s is not As4GenericSpecExtendedCommunityCase type.", extendedCommunity);
         FourOctAsCommonECUtil.serializeCommon(((As4GenericSpecExtendedCommunityCase) extendedCommunity).getAs4GenericSpecExtendedCommunity()
-            .getAs4GenericSpecExtendedCommunity(), body);
+            .getAs4SpecificCommon(), body);
     }
 
     @Override
index bb5419b536c4a01e24e1ae1cf8059da13ca2477b..9401948f68e1dbe7e784c86ec4f7f32b529a1e3b 100644 (file)
@@ -25,7 +25,7 @@ public final class RouteOrigin4OctectASEcHandler extends Abstract4OctetAsExtende
     @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
@@ -33,7 +33,7 @@ public final class RouteOrigin4OctectASEcHandler extends Abstract4OctetAsExtende
         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
index b14ba048fbcfbf1ce51fa7f53e0fe44de4b9b4d4..f0d9f8618a8cbc03454dad608ba24b65d86645a7 100644 (file)
@@ -25,7 +25,7 @@ public final class RouteTarget4OctectASEcHandler extends Abstract4OctetAsExtende
     @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
@@ -33,7 +33,7 @@ public final class RouteTarget4OctectASEcHandler extends Abstract4OctetAsExtende
         Preconditions.checkArgument(extendedCommunity instanceof As4RouteTargetExtendedCommunityCase,
             "The extended community %s is not As4RouteTargetExtendedCommunityCase type.", extendedCommunity);
         FourOctAsCommonECUtil.serializeCommon(((As4RouteTargetExtendedCommunityCase) extendedCommunity).getAs4RouteTargetExtendedCommunity()
-            .getAs4GenericSpecExtendedCommunity(), body);
+            .getAs4SpecificCommon(), body);
     }
 
     @Override
index 0b413d5ac4a209a13908052bcf2d920bb4f8d4c8..7caf7b208b9d3b875f9e776a1a84f699e1e21ac9 100644 (file)
@@ -36,7 +36,7 @@ public final class Generic4OctASEcHandlerTest {
     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);
index c4f4d7e525923a4a4b8f20fc27bc35738c55143e..13adc3574fda1ef4751f482f475bf5f42ff4e4c0 100644 (file)
@@ -16,8 +16,8 @@ import org.junit.Test;
 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;
@@ -29,7 +29,7 @@ public final class RouteOrigin4OctectASEcHandlerTest {
     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;
 
@@ -43,7 +43,7 @@ public final class RouteOrigin4OctectASEcHandlerTest {
 
         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);
index 623edfbd3973c53476a10e715d4a8522c2d84c9a..50c1d3d92bd31b4d19b9a6b522fb6ed1fd0d8497 100644 (file)
@@ -36,7 +36,7 @@ public class RouteTarget4OctectASEcHandlerTest {
     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);
index a488dc2f00e05e6950c3026fe95a9d0b8cb7c854..1ce8f93447d0c31cfcf110ba66c2e8e40c318d70 100644 (file)
@@ -11,20 +11,20 @@ package org.opendaylight.protocol.bgp.parser.spi.extended.community;
 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);
     }