Register MVPN TableType 11/71511/4
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Fri, 11 May 2018 11:14:13 +0000 (13:14 +0200)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Mon, 14 May 2018 06:18:13 +0000 (08:18 +0200)
- minor fixups

JIRA: BGPCEP-396
Change-Id: Ibd87a1230817c3e09c352ec2a230944dd2d1f8d4
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
14 files changed:
bgp/mvpn/pom.xml
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/BGPActivator.java
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/TableTypeActivator.java [new file with mode: 0644]
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/attributes/PEDistinguisherLabelsAttributeHandler.java
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/spi/pojo/attributes/tunnel/identifier/SimpleTunnelIdentifierRegistry.java
bgp/mvpn/src/main/resources/META-INF/services/org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryProviderActivator [new file with mode: 0644]
bgp/mvpn/src/main/resources/org/opendaylight/blueprint/bgp-mvpn.xml
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/attributes/PEDistinguisherLabelsAttributeHandlerTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/attributes/PMSITunnelAttributeHandlerTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/attributes/tunnel/identifier/OpaqueUtilTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/attributes/tunnel/identifier/PAddressPMulticastGroupUtilTest.java
features/bgp/odl-bgpcep-bgp-evpn/pom.xml
features/bgp/odl-bgpcep-bgp-mvpn/pom.xml
features/bgp/odl-bgpcep-bgp/pom.xml

index 82138008bedf88b53255bd1ac6297fc7d54ebc24..8af1e54ba153338e09e3c2dcac70a6919ab8f0ea 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>bgp-parser-spi</artifactId>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>bgp-inet</artifactId>
+        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>bgp-bmp-api</artifactId>
index f27801336fb323de2b6c9f96daf5687c778ec2f0..ab8247673c1b78c046ed8b81d15665a63a637358 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.protocol.bgp.mvpn.impl.attributes.extended.community.Sou
 import org.opendaylight.protocol.bgp.mvpn.impl.attributes.extended.community.VrfRouteImportHandler;
 import org.opendaylight.protocol.bgp.parser.spi.AbstractBGPExtensionProviderActivator;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.McastVpnSubsequentAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.bgp.rib.route.attributes.extended.communities.extended.community.SourceAs4ExtendedCommunityCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.bgp.rib.route.attributes.extended.communities.extended.community.SourceAsExtendedCommunityCase;
 
@@ -28,7 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn
  */
 public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
     @VisibleForTesting
-    static final int MVPN_SAFI = 5;
+    private static final int MVPN_SAFI = 5;
 
     private static void registerAttributesHandler(
             final BGPExtensionProviderContext context,
@@ -69,10 +70,15 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         regs.add(context.registerExtendedCommunitySerializer(SourceAsExtendedCommunityCase.class, sourceASHandler));
     }
 
+    private static void registerAfiSafi(final BGPExtensionProviderContext context, final List<AutoCloseable> regs) {
+        regs.add(context.registerSubsequentAddressFamily(McastVpnSubsequentAddressFamily.class, MVPN_SAFI));
+    }
+
     @Override
     protected List<AutoCloseable> startImpl(final BGPExtensionProviderContext context) {
         final List<AutoCloseable> regs = new ArrayList<>();
         TunnelIdentifierActivator.registerTunnelIdentifierHandlers(context, regs);
+        registerAfiSafi(context, regs);
         registerNlriHandler(context, regs);
         registerExtendedCommunities(context, regs);
         registerAttributesHandler(context, regs);
diff --git a/bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/TableTypeActivator.java b/bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/TableTypeActivator.java
new file mode 100644 (file)
index 0000000..734b836
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.protocol.bgp.mvpn.impl;
+
+import com.google.common.collect.Lists;
+import java.util.List;
+import org.opendaylight.protocol.bgp.openconfig.spi.AbstractBGPTableTypeRegistryProviderActivator;
+import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryProvider;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.McastVpnSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.IPV4MCASTVPN;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.IPV6MCASTVPN;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
+import org.opendaylight.yangtools.concepts.AbstractRegistration;
+
+/**
+ * Registers MCast VPN Family types.
+ *
+ * @author Claudio D. Gasparini
+ */
+public final class TableTypeActivator extends AbstractBGPTableTypeRegistryProviderActivator {
+    @Override
+    protected List<AbstractRegistration> startBGPTableTypeRegistryProviderImpl(
+            final BGPTableTypeRegistryProvider provider) {
+        return Lists.newArrayList(
+                provider.registerBGPTableType(
+                        Ipv4AddressFamily.class, McastVpnSubsequentAddressFamily.class, IPV4MCASTVPN.class),
+                provider.registerBGPTableType(
+                        Ipv6AddressFamily.class, McastVpnSubsequentAddressFamily.class, IPV6MCASTVPN.class)
+        );
+    }
+}
index b975a9f24b6c906adaf11d780841c2096983db61..f9308038ab0862ae8389f2512a24aa82f74822ec 100644 (file)
@@ -77,15 +77,15 @@ public final class PEDistinguisherLabelsAttributeHandler implements AttributePar
     public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
         Preconditions.checkArgument(attribute instanceof Attributes,
                 "Attribute parameter is not a PathAttribute object.");
-        final PeDistinguisherLabelsAttributeAugmentation ipv4Att =
+        final PeDistinguisherLabelsAttributeAugmentation att =
                 ((Attributes) attribute).getAugmentation(PeDistinguisherLabelsAttributeAugmentation.class);
 
-        if (ipv4Att == null) {
+        if (att == null) {
             return;
         }
 
         final List<PeDistinguisherLabelAttribute> distinguishers
-                = ipv4Att.getPeDistinguisherLabelsAttribute().getPeDistinguisherLabelAttribute();
+                = att.getPeDistinguisherLabelsAttribute().getPeDistinguisherLabelAttribute();
         final ByteBuf buffer = Unpooled.buffer();
         for (final PeDistinguisherLabelAttribute peDist : distinguishers) {
             if (peDist.getPeAddress().getIpv4Address() != null) {
index 7eaec04d1476a115b063b36b7109c967993eb98a..62f212f657af09929f496d50420078cfaa72b543 100644 (file)
@@ -22,8 +22,6 @@ public final class SimpleTunnelIdentifierRegistry {
     public static final int NO_TUNNEL_INFORMATION_PRESENT = 0;
     private static final SimpleTunnelIdentifierRegistry SINGLETON = new SimpleTunnelIdentifierRegistry();
     private static final Logger LOG = LoggerFactory.getLogger(SimpleTunnelIdentifierRegistry.class);
-    private static final String SKIP_SERIALIZATION = "Skipping serialization of PMSI Tunnel Attribute {}";
-    private static final String SKIP_PARSE = "Skipping parsing of PMSI Tunnel Attribute type {}";
     private final HandlerRegistry<DataContainer, TunnelIdentifierParser, TunnelIdentifierSerializer> handlers =
             new HandlerRegistry<>();
 
@@ -37,7 +35,7 @@ public final class SimpleTunnelIdentifierRegistry {
     public TunnelIdentifier parse(final int tunnelType, final ByteBuf buffer) {
         final TunnelIdentifierParser parser = this.handlers.getParser(tunnelType);
         if (!buffer.isReadable() || parser == null) {
-            LOG.debug(SKIP_PARSE, tunnelType);
+            LOG.debug("Skipping parsing of PMSI Tunnel Attribute type {}", tunnelType);
             return null;
         }
         return parser.parse(buffer);
@@ -45,12 +43,12 @@ public final class SimpleTunnelIdentifierRegistry {
 
     public int serialize(final TunnelIdentifier tunnel, final ByteBuf tunnelBuffer) {
         if (tunnel == null) {
-            LOG.debug(SKIP_SERIALIZATION);
+            LOG.debug("Skipping serialization of PMSI Tunnel Attribute {}");
             return NO_TUNNEL_INFORMATION_PRESENT;
         }
         final TunnelIdentifierSerializer serializer = this.handlers.getSerializer(tunnel.getImplementedInterface());
         if (serializer == null) {
-            LOG.debug(SKIP_SERIALIZATION, tunnel);
+            LOG.debug("Skipping serialization of PMSI Tunnel Attribute {}", tunnel);
             return NO_TUNNEL_INFORMATION_PRESENT;
         }
         return serializer.serialize(tunnel, tunnelBuffer);
diff --git a/bgp/mvpn/src/main/resources/META-INF/services/org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryProviderActivator b/bgp/mvpn/src/main/resources/META-INF/services/org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryProviderActivator
new file mode 100644 (file)
index 0000000..d72a408
--- /dev/null
@@ -0,0 +1,7 @@
+# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+#
+# This program and the accompanying materials are made available
+# under the terms of the Eclipse Public License v1.0 which
+# accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+org.opendaylight.protocol.bgp.mvpn.impl.TableTypeActivator
\ No newline at end of file
index 5294a0237b05e90583c4cda03f378587cd7c4836..24f9f7045339167942d25100e73d3265af2f6391 100644 (file)
 
   <service ref="BGPActivator" interface="org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator"
           odl:type="org.opendaylight.protocol.bgp.mvpn.impl.BGPActivator"/>
+
+  <bean id="TableTypeActivator" class="org.opendaylight.protocol.bgp.mvpn.impl.TableTypeActivator"/>
+
+  <service ref="TableTypeActivator"
+           interface="org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryProviderActivator"
+           odl:type="org.opendaylight.protocol.bgp.mvpn.impl.TableTypeActivator"/>
 </blueprint>
\ No newline at end of file
index 2da2c84e22401fcef4d7d90202f8967b009b5a74..e72f062c9272f78d4b67901f2c958ebfce19d817 100644 (file)
@@ -34,7 +34,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.pe.distinguisher.labels.attribute.pe.distinguisher.labels.attribute.PeDistinguisherLabelAttributeBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel;
 
-public class PEDistinguisherLabelsAttributeHandlerTest {
+public final class PEDistinguisherLabelsAttributeHandlerTest {
     /**
      * ATT - TYPE - ATT LENGTH.
      * PE ADDRESS - MPLS LABEL
index 0f268a00d93392801c0115c1f211258ebcc28eb3..4fcada764cd0e3c641a40f16454337116c00b9cf 100644 (file)
@@ -49,7 +49,7 @@ import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.AttributesBuilder;
 
-public class PMSITunnelAttributeHandlerTest {
+public final class PMSITunnelAttributeHandlerTest {
 
     private AttributeRegistry handler;
 
index 9fc14cf26356e86aa3e857ca5d9d0ab223b8c4ed..57dce106366cc99f691488c7f66a2eca82175031 100644 (file)
@@ -24,7 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tun
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.mldp.p2mp.lsp.OpaqueValue;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.mldp.p2mp.lsp.OpaqueValueBuilder;
 
-public class OpaqueUtilTest {
+public final class OpaqueUtilTest {
     private static final byte[] OPAQUE_WRONG = {
         (byte) 0xfc, (byte) 0x00, (byte) 0x03, // Opaque Type - Length
         (byte) 0xb5, (byte) 0xeb, (byte) 0x2d,  //Value
index 2ccdc117c3a2bee50fd1c5b99cb445bb509fcd94..a088285fafc7023c235edb03a78aea3232e214c7 100644 (file)
@@ -24,7 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev180329.PAddressPMulticastGroup;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
-public class PAddressPMulticastGroupUtilTest {
+public final class PAddressPMulticastGroupUtilTest {
     private static final String IPV6_MODEL = "2001::1";
     private static final IpAddress IPV6 = new IpAddress(new Ipv6Address(IPV6_MODEL));
     private static final byte[] IPV4_ADDRESS_EXPECTED = {(byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01};
index ea1414ca23e4f43238e44ecdd86370dcd83a30f6..48021d91fa46944473e4854529f0b37b5e452e3d 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>bgp-evpn</artifactId>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>odl-bgpcep-bgp-mvpn</artifactId>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>odl-bgpcep-bgp-parser</artifactId>
index 662c547c1e397613cf8d3150f74a9eb450408f03..654bb462a36314ac0e06072371ac85eb05289255 100644 (file)
             <type>xml</type>
             <classifier>features</classifier>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>odl-bgpcep-bgp-inet</artifactId>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
     </dependencies>
 </project>
\ No newline at end of file
index 1023ec51c613f881abfdbafb868b5c5977a7d2c1..31d26e7d6e4f3d08d568894e507bc349ffa559dd 100644 (file)
             <classifier>features</classifier>
             <type>xml</type>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>odl-bgpcep-bgp-mvpn</artifactId>
+            <classifier>features</classifier>
+            <type>xml</type>
+        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>odl-bgpcep-bgp-l3vpn</artifactId>