Hide RibSupportUtils 45/106645/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 23 Jun 2023 09:20:04 +0000 (11:20 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 23 Jun 2023 09:30:32 +0000 (11:30 +0200)
We do not want to leak this utility to the outside world. Also remove
unused methods.

JIRA: BGPCEP-1016
Change-Id: I7f52d9e51dd1ef37468363e8bcd9dcf50c374167
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RibSupportUtils.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/RibSupportUtilsTest.java

index b7819a2cbb85fe2eef98d6f98431f63a2d961153..06d0952648304826bbe027b7adf75b394de962c6 100644 (file)
@@ -9,8 +9,6 @@ package org.opendaylight.protocol.bgp.rib.impl;
 
 import com.google.common.collect.ImmutableList;
 import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.BgpAddPathTableType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.rib.peer.SupportedTablesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.AddressFamily;
@@ -19,15 +17,11 @@ import org.opendaylight.yangtools.util.ImmutableOffsetMapTemplate;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 
-public final class RibSupportUtils {
+final class RibSupportUtils {
     private static final ImmutableOffsetMapTemplate<QName> AFI_SAFI_TEMPLATE =
             ImmutableOffsetMapTemplate.ordered(ImmutableList.of(QName.create(Tables.QNAME, "afi").intern(),
                 QName.create(Tables.QNAME, "safi").intern()));
 
-    private static final ImmutableOffsetMapTemplate<QName> ADD_PATH_AFI_SAFI_TEMPLATE =
-            ImmutableOffsetMapTemplate.ordered(ImmutableList.of(QName.create(BgpAddPathTableType.QNAME, "afi").intern(),
-                QName.create(BgpAddPathTableType.QNAME, "safi").intern()));
-
     private RibSupportUtils() {
         // Hidden on purpose
     }
@@ -38,7 +32,7 @@ public final class RibSupportUtils {
      * @param tablesKey Tables key representing table.
      * @return NodeIdentifierWithPredicates of {@link Tables} for specified AFI, SAFI combination.
      */
-    public static NodeIdentifierWithPredicates toYangTablesKey(final TablesKey tablesKey) {
+    static NodeIdentifierWithPredicates toYangTablesKey(final TablesKey tablesKey) {
         return toYangKey(Tables.QNAME, tablesKey.getAfi(), tablesKey.getSafi());
     }
 
@@ -50,7 +44,7 @@ public final class RibSupportUtils {
      * @param safi Class representing SAFI
      * @return NodeIdentifierWithPredicates of 'id' for specified AFI, SAFI combination.
      */
-    public static NodeIdentifierWithPredicates toYangKey(final QName id, final AddressFamily afi,
+    static NodeIdentifierWithPredicates toYangKey(final QName id, final AddressFamily afi,
             final SubsequentAddressFamily safi) {
         return NodeIdentifierWithPredicates.of(id, AFI_SAFI_TEMPLATE.instantiateWithValues(
             BindingReflections.getQName(afi), BindingReflections.getQName(safi)));
@@ -63,32 +57,7 @@ public final class RibSupportUtils {
      * @param tablesKey  Tables key representing table.
      * @return NodeIdentifierWithPredicates of 'id' for specified AFI, SAFI combination.
      */
-    public static NodeIdentifierWithPredicates toYangKey(final QName id, final TablesKey tablesKey) {
+    static NodeIdentifierWithPredicates toYangKey(final QName id, final TablesKey tablesKey) {
         return toYangKey(id, tablesKey.getAfi(), tablesKey.getSafi());
     }
-
-    /**
-     * Creates Yang Instance Identifier path argument from supplied {@link TablesKey}.
-     *
-     * @param id QNAME representing node
-     * @param tablesKey  Add PAth Tables key representing table.
-     * @return NodeIdentifierWithPredicates of 'id' for specified AFI, SAFI combination.
-     */
-    public static NodeIdentifierWithPredicates toYangKey(final QName id, final SupportedTablesKey tablesKey) {
-        return toYangPathKey(id, tablesKey.getAfi(), tablesKey.getSafi());
-    }
-
-    /**
-     * Creates Yang Instance Identifier path argument from supplied AFI and SAFI.
-     *
-     * @param id   QNAME representing node
-     * @param afi  Class representing AFI
-     * @param safi Class representing SAFI
-     * @return NodeIdentifierWithPredicates of 'id' for specified AFI, SAFI combination.
-     */
-    public static NodeIdentifierWithPredicates toYangPathKey(final QName id, final AddressFamily afi,
-            final SubsequentAddressFamily safi) {
-        return NodeIdentifierWithPredicates.of(id, ADD_PATH_AFI_SAFI_TEMPLATE.instantiateWithValues(
-            BindingReflections.getQName(afi), BindingReflections.getQName(safi)));
-    }
 }
index 996a8491cd9acad03d5f364f09ce22a2831173d7..cb10ef1ae84f211237362909f6fd19a9902ef845 100644 (file)
@@ -60,13 +60,6 @@ public class RibSupportUtilsTest {
         assertTrue(m.containsValue(UnicastSubsequentAddressFamily.QNAME));
     }
 
-    @Test
-    public void toYangPathKey() {
-        final NodeIdentifierWithPredicates result = RibSupportUtils.toYangPathKey(SupportedTables.QNAME,
-            Ipv4AddressFamily.VALUE, UnicastSubsequentAddressFamily.VALUE);
-        assertEquals(NII_PATH.toString(), result.toString());
-    }
-
     @Test
     public void toYangKey() {
         final NodeIdentifierWithPredicates result = RibSupportUtils.toYangKey(SupportedTables.QNAME, TABLE_KEY);