BGPCEP-754: Remove simple-routing-policy 86/68886/3
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Wed, 14 Feb 2018 15:43:30 +0000 (16:43 +0100)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Wed, 14 Feb 2018 15:43:30 +0000 (16:43 +0100)
Can be replace by configuring a rib policy

Change-Id: I12ef5f2571b01020e23ee073c8745ca9fe972a1a
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
12 files changed:
bgp/openconfig-api/src/main/yang/bgp-openconfig-extensions.yang
bgp/rib-api/src/main/yang/bgp-rib.yang
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AdjRibInWriter.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ApplicationPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ExportPolicyPeerTrackerImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/OpenConfigMappingUtil.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AdjRibsInWriterTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ExportPolicyPeerTrackerImplTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/OpenConfigMappingUtilTest.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/ExportPolicyPeerTracker.java

index 0f9ae2d9f9aac7f7d2475710d869ac105aae59c0..5486fb18b70b4982804cc0bb6fa839b4d4e40f56 100644 (file)
@@ -113,12 +113,6 @@ module bgp-openconfig-extensions {
                       configured as a route reflector.";
                   }
             }
-            augment bgp/neighbors/neighbor/config {
-                ext:augment-identifier neighbor-config-augmentation;
-                leaf simple-routing-policy {
-                    type bgp-rib:simple-routing-policy;
-                }
-            }
             augment bgp/neighbors/neighbor/state {
                 ext:augment-identifier neighbor_state-augmentation;
                 uses bgp-op:bgp-neighbor_state;
index ba56b6389960aefc1e795f27ff9b348e8d741e5f..fa2aca5e5c0230b27879652368afb5d321db04c7 100644 (file)
@@ -57,13 +57,6 @@ module bgp-rib {
         }
     }
 
-    typedef simple-routing-policy {
-        type enumeration {
-            enum announce-none { description "Don't announce routes to this peer"; }
-            enum learn-none { description "Don't learn routes from this peer"; }
-        }
-    }
-
     grouping route {
         uses bgp-msg:path-attributes;
     }
@@ -115,9 +108,6 @@ module bgp-rib {
                     type peer-role;
                     mandatory true;
                 }
-                leaf simple-routing-policy {
-                    type simple-routing-policy;
-                }
                 list supported-tables {
                     key "afi safi";
                     uses bgp-mp:bgp-add-path-table-type;
index f5723bac3abe34f756ea50e4f60a825c15ddb2a2..aa78d0b13901479096e195c00a982b06df26d461 100644 (file)
@@ -20,7 +20,6 @@ import java.util.Collections;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.Optional;
 import java.util.Set;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -39,7 +38,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpUnreachNlri;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.SimpleRoutingPolicy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.Peer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.peer.AdjRibIn;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.peer.AdjRibOut;
@@ -89,8 +87,6 @@ final class AdjRibInWriter {
     private static final NodeIdentifier PEER_TABLES = new NodeIdentifier(SupportedTables.QNAME);
     private static final NodeIdentifier TABLES = new NodeIdentifier(Tables.QNAME);
     private static final QName SEND_RECEIVE = QName.create(SupportedTables.QNAME, "send-receive").intern();
-    private static final NodeIdentifier SIMPLE_ROUTING_POLICY_NID =
-            new NodeIdentifier(QName.create(Peer.QNAME, "simple-routing-policy").intern());
 
     // FIXME: is there a utility method to construct this?
     private static final ContainerNode EMPTY_ADJRIBIN = Builders.containerBuilder()
@@ -105,16 +101,13 @@ final class AdjRibInWriter {
     private final YangInstanceIdentifier ribPath;
     private final DOMTransactionChain chain;
     private final PeerRole role;
-    private final Optional<SimpleRoutingPolicy> simpleRoutingPolicy;
 
     private AdjRibInWriter(final YangInstanceIdentifier ribPath, final DOMTransactionChain chain, final PeerRole role,
-            final Optional<SimpleRoutingPolicy> simpleRoutingPolicy, final YangInstanceIdentifier peerPath,
-            final Map<TablesKey, TableContext> tables) {
+            final YangInstanceIdentifier peerPath, final Map<TablesKey, TableContext> tables) {
         this.ribPath = requireNonNull(ribPath);
         this.chain = requireNonNull(chain);
         this.tables = requireNonNull(tables);
         this.role = requireNonNull(role);
-        this.simpleRoutingPolicy = simpleRoutingPolicy;
         this.peerPath = peerPath;
     }
 
@@ -122,12 +115,11 @@ final class AdjRibInWriter {
      * Create a new writer using a transaction chain.
      *
      * @param role                peer's role
-     * @param simpleRoutingPolicy simple Routing Policy {@link SimpleRoutingPolicy}
      * @param chain               transaction chain  @return A fresh writer instance
      */
     static AdjRibInWriter create(@Nonnull final YangInstanceIdentifier ribId, @Nonnull final PeerRole role,
-            final Optional<SimpleRoutingPolicy> simpleRoutingPolicy, @Nonnull final DOMTransactionChain chain) {
-        return new AdjRibInWriter(ribId, chain, role, simpleRoutingPolicy, null, Collections.emptyMap());
+            @Nonnull final DOMTransactionChain chain) {
+        return new AdjRibInWriter(ribId, chain, role, null, Collections.emptyMap());
     }
 
     /**
@@ -175,7 +167,7 @@ final class AdjRibInWriter {
                 }
             }
         }, MoreExecutors.directExecutor());
-        return new AdjRibInWriter(this.ribPath, this.chain, this.role, this.simpleRoutingPolicy, newPeerPath, tb);
+        return new AdjRibInWriter(this.ribPath, this.chain, this.role, newPeerPath, tb);
     }
 
     /**
@@ -220,20 +212,18 @@ final class AdjRibInWriter {
     private void installAdjRibsOutTables(final YangInstanceIdentifier newPeerPath, final RIBSupportContext rs,
             final NodeIdentifierWithPredicates instanceIdentifierKey, final TablesKey tableKey,
             final SendReceive sendReceive, final DOMDataWriteTransaction tx) {
-        if (!isAnnounceNone(this.simpleRoutingPolicy)) {
-            final NodeIdentifierWithPredicates supTablesKey = RibSupportUtils.toYangKey(SupportedTables.QNAME, tableKey);
-            final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> tt =
-                    Builders.mapEntryBuilder().withNodeIdentifier(supTablesKey);
-            for (final Entry<QName, Object> e : supTablesKey.getKeyValues().entrySet()) {
-                tt.withChild(ImmutableNodes.leafNode(e.getKey(), e.getValue()));
-            }
-            if (sendReceive != null) {
-                tt.withChild(ImmutableNodes.leafNode(SEND_RECEIVE, sendReceive.toString().toLowerCase(Locale.ENGLISH)));
-            }
-            tx.put(LogicalDatastoreType.OPERATIONAL, newPeerPath.node(PEER_TABLES).node(supTablesKey), tt.build());
-            rs.createEmptyTableStructure(tx, newPeerPath.node(EMPTY_ADJRIBOUT.getIdentifier())
-                    .node(TABLES).node(instanceIdentifierKey));
+        final NodeIdentifierWithPredicates supTablesKey = RibSupportUtils.toYangKey(SupportedTables.QNAME, tableKey);
+        final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> tt =
+                Builders.mapEntryBuilder().withNodeIdentifier(supTablesKey);
+        for (final Entry<QName, Object> e : supTablesKey.getKeyValues().entrySet()) {
+            tt.withChild(ImmutableNodes.leafNode(e.getKey(), e.getValue()));
         }
+        if (sendReceive != null) {
+            tt.withChild(ImmutableNodes.leafNode(SEND_RECEIVE, sendReceive.toString().toLowerCase(Locale.ENGLISH)));
+        }
+        tx.put(LogicalDatastoreType.OPERATIONAL, newPeerPath.node(PEER_TABLES).node(supTablesKey), tt.build());
+        rs.createEmptyTableStructure(tx, newPeerPath.node(EMPTY_ADJRIBOUT.getIdentifier())
+                .node(TABLES).node(instanceIdentifierKey));
     }
 
     private YangInstanceIdentifier createEmptyPeerStructure(final PeerId newPeerId, final DOMDataWriteTransaction tx) {
@@ -251,18 +241,10 @@ final class AdjRibInWriter {
         pb.withNodeIdentifier(peerKey);
         pb.withChild(ImmutableNodes.leafNode(PEER_ID, peerId));
         pb.withChild(ImmutableNodes.leafNode(PEER_ROLE, PeerRoleUtil.roleForString(this.role)));
-        if (this.simpleRoutingPolicy.isPresent() && this.role != PeerRole.Internal) {
-            pb.withChild(ImmutableNodes.leafNode(SIMPLE_ROUTING_POLICY_NID,
-                    simpleRoutingPolicyString(this.simpleRoutingPolicy.get())));
-        }
         pb.withChild(ImmutableMapNodeBuilder.create().withNodeIdentifier(PEER_TABLES).build());
         pb.withChild(EMPTY_ADJRIBIN);
-        if (!isLearnNone(this.simpleRoutingPolicy)) {
-            pb.withChild(EMPTY_EFFRIBIN);
-        }
-        if (!isAnnounceNone(this.simpleRoutingPolicy)) {
-            pb.withChild(EMPTY_ADJRIBOUT);
-        }
+        pb.withChild(EMPTY_EFFRIBIN);
+        pb.withChild(EMPTY_ADJRIBOUT);
         return pb.build();
     }
 
@@ -324,23 +306,4 @@ final class AdjRibInWriter {
         ctx.removeRoutes(tx, nlri);
         tx.submit();
     }
-
-    static boolean isAnnounceNone(final java.util.Optional<SimpleRoutingPolicy> peerStatus) {
-        return peerStatus.isPresent() && peerStatus.get() == SimpleRoutingPolicy.AnnounceNone;
-    }
-
-    static boolean isLearnNone(final java.util.Optional<SimpleRoutingPolicy> peerStatus) {
-        return peerStatus.isPresent() && peerStatus.get() == SimpleRoutingPolicy.LearnNone;
-    }
-
-    private static String simpleRoutingPolicyString(final SimpleRoutingPolicy simpleRoutingPolicy) {
-        switch (simpleRoutingPolicy) {
-            case AnnounceNone:
-                return "announce-none";
-            case LearnNone:
-                return "learn-none";
-            default:
-                throw new IllegalArgumentException("Unhandled Simple Routing Policy " + simpleRoutingPolicy);
-        }
-    }
 }
index 6cf71dc6e2ac2d3a74a76c155b245fe2a7af80c6..264e04662fa6a923d4e275bc68d326737522c747 100644 (file)
@@ -17,7 +17,6 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Optional;
 import java.util.Set;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -48,7 +47,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.ApplicationRibId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.SimpleRoutingPolicy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.Peer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.peer.AdjRibIn;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables;
@@ -124,20 +122,18 @@ public class ApplicationPeer extends BGPPeerStateImpl implements org.opendayligh
         this.chain = this.rib.createPeerChain(this);
         this.writerChain = this.rib.createPeerChain(this);
 
-        final Optional<SimpleRoutingPolicy> simpleRoutingPolicy = Optional.of(SimpleRoutingPolicy.AnnounceNone);
         this.peerId = RouterIds.createPeerId(this.ipAddress);
         final Set<TablesKey> localTables = this.rib.getLocalTablesKeys();
         localTables.forEach(tablesKey -> {
             final ExportPolicyPeerTracker exportTracker = this.rib.getExportPolicyPeerTracker(tablesKey);
             if (exportTracker != null) {
-                exportTracker.registerPeer(this.peerId, null, this.peerIId, PeerRole.Internal, simpleRoutingPolicy);
+                exportTracker.registerPeer(this.peerId, null, this.peerIId, PeerRole.Internal);
             }
             this.supportedTables.add(RibSupportUtils.toYangTablesKey(tablesKey));
         });
         setAdvertizedGracefulRestartTableTypes(Collections.emptyList());
 
-        this.adjRibInWriter = AdjRibInWriter.create(this.rib.getYangRibId(), PeerRole.Internal, simpleRoutingPolicy,
-                this.writerChain);
+        this.adjRibInWriter = AdjRibInWriter.create(this.rib.getYangRibId(), PeerRole.Internal, this.writerChain);
         final RIBSupportContextRegistry context = this.rib.getRibSupportContext();
         final RegisterAppPeerListener registerAppPeerListener = () -> {
             synchronized (this) {
index 16ee00370b9da47b7ce0fe74698a21fb93dc07f6..a1d4043947db0ccba8814ed19b3df56c8a529966 100644 (file)
@@ -8,10 +8,7 @@
 package org.opendaylight.protocol.bgp.rib.impl;
 
 import static java.util.Objects.requireNonNull;
-import static org.opendaylight.protocol.bgp.rib.impl.AdjRibInWriter.isAnnounceNone;
-import static org.opendaylight.protocol.bgp.rib.impl.AdjRibInWriter.isLearnNone;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.MoreObjects.ToStringHelper;
 import com.google.common.base.Objects;
@@ -82,7 +79,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.peer
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.peer.rpc.rev171207.PeerContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.SimpleRoutingPolicy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.PeerKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
@@ -109,7 +105,6 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee
     private final Map<TablesKey, AdjRibOutListener> adjRibOutListenerSet = new HashMap<>();
     private final RpcProviderRegistry rpcRegistry;
     private final PeerRole peerRole;
-    private final Optional<SimpleRoutingPolicy> simpleRoutingPolicy;
     @GuardedBy("this")
     private AbstractRegistration trackerRegistration;
     @GuardedBy("this")
@@ -130,14 +125,13 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee
     private Map<TablesKey, SendReceive> addPathTableMaps = Collections.emptyMap();
 
     public BGPPeer(final IpAddress neighborAddress, final RIB rib, final PeerRole role,
-            final SimpleRoutingPolicy peerStatus, final RpcProviderRegistry rpcRegistry,
+            final RpcProviderRegistry rpcRegistry,
             final Set<TablesKey> afiSafisAdvertized,
             final Set<TablesKey> afiSafisGracefulAdvertized) {
         //FIXME BUG-6971 Once Peer Group is implemented, pass it
         super(rib.getInstanceIdentifier(), null, neighborAddress, afiSafisAdvertized,
                 afiSafisGracefulAdvertized);
         this.peerRole = role;
-        this.simpleRoutingPolicy = Optional.ofNullable(peerStatus);
         this.rib = requireNonNull(rib);
         this.name = Ipv4Util.toStringIP(neighborAddress);
         this.rpcRegistry = rpcRegistry;
@@ -147,13 +141,6 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee
         this.chain = rib.createPeerChain(this);
     }
 
-    @VisibleForTesting
-    BGPPeer(final IpAddress neighborAddress, final RIB rib, final PeerRole role,
-            final RpcProviderRegistry rpcRegistry, final Set<TablesKey> afiSafisAdvertized,
-            final Set<TablesKey> afiSafisGracefulAdvertized) {
-        this(neighborAddress, rib, role, null, rpcRegistry, afiSafisAdvertized, afiSafisGracefulAdvertized);
-    }
-
     private static Attributes nextHopToAttribute(final Attributes attrs, final MpReachNlri mpReach) {
         if (attrs.getCNextHop() == null && mpReach.getCNextHop() != null) {
             final AttributesBuilder attributesBuilder = new AttributesBuilder(attrs);
@@ -219,8 +206,7 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee
     }
 
     public synchronized void instantiateServiceInstance() {
-        this.ribWriter = AdjRibInWriter.create(this.rib.getYangRibId(), this.peerRole, this.simpleRoutingPolicy,
-                this.chain);
+        this.ribWriter = AdjRibInWriter.create(this.rib.getYangRibId(), this.peerRole, this.chain);
         setActive(true);
     }
 
@@ -326,33 +312,28 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee
 
         setAdvertizedGracefulRestartTableTypes(advertizedGracefulRestartTableTypes.stream()
                 .map(t -> new TablesKey(t.getAfi(), t.getSafi())).collect(Collectors.toList()));
-        final boolean announceNone = isAnnounceNone(this.simpleRoutingPolicy);
         this.addPathTableMaps = mapTableTypesFamilies(addPathTablesType);
 
-        if (!announceNone) {
-            for (final TablesKey key : this.tables) {
-                createAdjRibOutListener(key, true);
-            }
+        for (final TablesKey key : this.tables) {
+            createAdjRibOutListener(key, true);
         }
 
         for(final TablesKey tablesKey :this.tables) {
             final ExportPolicyPeerTracker exportTracker = this.rib.getExportPolicyPeerTracker(tablesKey);
             if (exportTracker != null) {
                 this.tableRegistration.add(exportTracker.registerPeer(this.peerId, this.addPathTableMaps.get(tablesKey),
-                        this.peerIId, this.peerRole, this.simpleRoutingPolicy));
+                        this.peerIId, this.peerRole));
             }
         }
-        addBgp4Support(announceNone);
-
-        if (!isLearnNone(this.simpleRoutingPolicy)) {
-            this.effRibInWriter = EffectiveRibInWriter.create(this.rib.getService(),
-                    this.rib.createPeerChain(this),
-                    this.peerIId, this.rib.getImportPolicyPeerTracker(),
-                    this.rib.getRibSupportContext(),
-                    this.peerRole,
-                    this.tables);
-            registerPrefixesCounters(this.effRibInWriter, this.effRibInWriter);
-        }
+        addBgp4Support();
+
+        this.effRibInWriter = EffectiveRibInWriter.create(this.rib.getService(),
+                this.rib.createPeerChain(this),
+                this.peerIId, this.rib.getImportPolicyPeerTracker(),
+                this.rib.getRibSupportContext(),
+                this.peerRole,
+                this.tables);
+        registerPrefixesCounters(this.effRibInWriter, this.effRibInWriter);
         this.ribWriter = this.ribWriter.transform(this.peerId, this.rib.getRibSupportContext(), this.tables,
                 this.addPathTableMaps);
 
@@ -369,14 +350,14 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee
     }
 
     //try to add a support for old-school BGP-4, if peer did not advertise IPv4-Unicast MP capability
-    private void addBgp4Support(final boolean announceNone) {
+    private void addBgp4Support() {
         final TablesKey key = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
-        if (this.tables.add(key) && !announceNone) {
+        if (this.tables.add(key)) {
             createAdjRibOutListener(key, false);
             final ExportPolicyPeerTracker exportTracker = this.rib.getExportPolicyPeerTracker(key);
             if (exportTracker != null) {
                 this.tableRegistration.add(exportTracker.registerPeer(peerId,  null, this.peerIId,
-                        this.peerRole, this.simpleRoutingPolicy));
+                        this.peerRole));
             }
         }
     }
@@ -508,8 +489,7 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee
         LOG.error("Transaction chain failed.", cause);
         this.chain.close();
         this.chain = this.rib.createPeerChain(this);
-        this.ribWriter = AdjRibInWriter.create(this.rib.getYangRibId(), this.peerRole, this.simpleRoutingPolicy,
-                this.chain);
+        this.ribWriter = AdjRibInWriter.create(this.rib.getYangRibId(), this.peerRole, this.chain);
         releaseConnection();
     }
 
index 5fec91ad6d34819fbac4ab3becc5bcb2fccba5cd..4e50ed1e5006d00e2abefc878920e252dc21ba12 100644 (file)
@@ -24,7 +24,6 @@ import org.opendaylight.protocol.concepts.AbstractRegistration;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.SendReceive;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.SimpleRoutingPolicy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
@@ -60,9 +59,9 @@ final class ExportPolicyPeerTrackerImpl implements ExportPolicyPeerTracker {
     }
 
     private synchronized AbstractRegistration addToExportGroups(final PeerId peerId,
-        final YangInstanceIdentifier peerPath, final PeerRole peerRole) {
+            final YangInstanceIdentifier peerPath, final PeerRole peerRole) {
         final PeerExportGroupRegistry peerExp = this.groups.computeIfAbsent(peerRole,
-            k -> new PeerExportGroupImpl(this.policyDatabase.exportPolicyForRole(peerRole)));
+                k -> new PeerExportGroupImpl(this.policyDatabase.exportPolicyForRole(peerRole)));
 
         final AbstractRegistration registration = peerExp.registerPeer(peerId, new PeerExporTuple(peerPath, peerRole));
 
@@ -79,16 +78,12 @@ final class ExportPolicyPeerTrackerImpl implements ExportPolicyPeerTracker {
 
     @Override
     public synchronized AbstractRegistration registerPeer(final PeerId peerId, final SendReceive sendReceive,
-        final YangInstanceIdentifier peerPath, final PeerRole peerRole,
-        final Optional<SimpleRoutingPolicy> optSimpleRoutingPolicy) {
+            final YangInstanceIdentifier peerPath, final PeerRole peerRole) {
         if (sendReceive != null) {
             this.peerAddPathTables.put(peerId, sendReceive);
             LOG.debug("Supported Add BestPath table {} added to peer {}", sendReceive, peerId);
         }
-        final SimpleRoutingPolicy simpleRoutingPolicy = optSimpleRoutingPolicy.orElse(null);
-        if (SimpleRoutingPolicy.AnnounceNone != simpleRoutingPolicy) {
-            this.peerTables.put(peerId, false);
-        }
+        this.peerTables.put(peerId, false);
         this.peerRoles.put(peerPath, peerRole);
         LOG.debug("Supported table {} added to peer {} role {}", this.localTableKey, peerId, peerRole);
         final AbstractRegistration registration = addToExportGroups(peerId, peerPath, peerRole);
index c4159bae5a74ff6bf99b0762770b56484ad1cea0..c0459b81cfa27786218c68f54b7a7e0d53af3f22 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.protocol.bgp.rib.impl.config;
 import static java.util.Objects.requireNonNull;
 import static org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.getHoldTimer;
 import static org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.getPeerAs;
-import static org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.getSimpleRoutingPolicy;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
@@ -225,8 +224,7 @@ public final class BgpPeer implements PeerBean, BGPPeerStateConsumer {
             final Set<TablesKey> afiSafisAdvertized = OpenConfigMappingUtil
                     .toTableKey(afisSAfis.getAfiSafi(), tableTypeRegistry);
             this.bgpPeer = new BGPPeer(this.neighborAddress, rib,
-                    OpenConfigMappingUtil.toPeerRole(neighbor),
-                    getSimpleRoutingPolicy(neighbor), BgpPeer.this.rpcRegistry,
+                    OpenConfigMappingUtil.toPeerRole(neighbor), BgpPeer.this.rpcRegistry,
                     afiSafisAdvertized, Collections.emptySet());
             final List<BgpParameters> bgpParameters = getBgpParameters(neighbor, rib, tableTypeRegistry);
             final KeyMapping keyMapping = OpenConfigMappingUtil.getNeighborKey(neighbor);
index a516deb513b31ebaf0a4159a838dea5c884230b8..39c2ff320cd935e58988b2824a4313e74ef163db 100644 (file)
@@ -71,12 +71,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.open
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.Config2Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.GlobalConfigAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.GlobalConfigAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.NeighborConfigAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.NeighborConfigAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.ApplicationRibId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.SimpleRoutingPolicy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
@@ -195,16 +192,6 @@ public final class OpenConfigMappingUtil {
         return new ClusterIdentifier(globalConfig.getRouterId());
     }
 
-    public static SimpleRoutingPolicy getSimpleRoutingPolicy(final Neighbor neighbor) {
-        if (neighbor.getConfig() != null) {
-            final NeighborConfigAugmentation augmentation = neighbor.getConfig().getAugmentation(NeighborConfigAugmentation.class);
-            if (augmentation != null) {
-                return augmentation.getSimpleRoutingPolicy();
-            }
-        }
-        return null;
-    }
-
     private static org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers.Config getTimersConfig(final Neighbor neighbor) {
         final Timers timers = neighbor.getTimers();
         return timers != null ? timers.getConfig() : null;
@@ -292,7 +279,7 @@ public final class OpenConfigMappingUtil {
     public static Neighbor fromBgpPeer(final List<AddressFamilies> addPathCapabilities,
         final List<BgpTableType> advertisedTables, final Integer holdTimer, final IpAddress ipAddress,
         final Boolean isActive, final Rfc2385Key password, final PortNumber portNumber, final Integer retryTimer,
-        final AsNumber remoteAs, final PeerRole peerRole, final SimpleRoutingPolicy simpleRoutingPolicy, final BGPTableTypeRegistryConsumer bgpTableTypeRegistryConsumer) {
+        final AsNumber remoteAs, final PeerRole peerRole, final BGPTableTypeRegistryConsumer bgpTableTypeRegistryConsumer) {
         final NeighborBuilder neighborBuilder = new NeighborBuilder();
         neighborBuilder.setNeighborAddress(ipAddress);
         neighborBuilder.setKey(new NeighborKey(ipAddress));
@@ -313,7 +300,6 @@ public final class OpenConfigMappingUtil {
                 .setPeerType(toPeerType(peerRole))
                 .setSendCommunity(CommunityType.NONE)
                 .setRouteFlapDamping(Boolean.FALSE)
-                .addAugmentation(NeighborConfigAugmentation.class, setNeighborAugmentation(simpleRoutingPolicy))
                 .build());
         neighborBuilder.setTimers(new TimersBuilder().setConfig(
             new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers.ConfigBuilder()
@@ -341,13 +327,6 @@ public final class OpenConfigMappingUtil {
         return neighborBuilder.build();
     }
 
-    private static NeighborConfigAugmentation setNeighborAugmentation(final SimpleRoutingPolicy simpleRoutingPolicy) {
-        if (simpleRoutingPolicy != null) {
-            return new NeighborConfigAugmentationBuilder().setSimpleRoutingPolicy(simpleRoutingPolicy).build();
-        }
-        return null;
-    }
-
     public static PeerRole toPeerRole(final Neighbor neighbor) {
         if (isRrClient(neighbor)) {
             return PeerRole.RrClient;
index f01ced5adc1af9fb3cbf7fed4cb18cd7ca70e2d0..5a542181e7812d0e0b7ffce7aaf016817c9fdad5 100644 (file)
@@ -9,13 +9,11 @@ package org.opendaylight.protocol.bgp.rib.impl;
 
 import static org.junit.Assert.assertNotNull;
 import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.never;
 
 import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.CheckedFuture;
 import java.util.Collections;
 import java.util.Map;
-import java.util.Optional;
 import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
@@ -33,7 +31,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Rib;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.SimpleRoutingPolicy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.Peer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.peer.AdjRibIn;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.peer.SupportedTables;
@@ -47,32 +44,26 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public class AdjRibsInWriterTest {
 
+    private static final TablesKey K4 = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
+    private static final Map<TablesKey, SendReceive> ADD_PATH_TABLE_MAPS = Collections.singletonMap(K4, SendReceive.Both);
+    private final Set<TablesKey> tableTypes = Sets.newHashSet(K4);
+    private final String peerIp = "12.34.56.78";
     @Mock
     private DOMTransactionChain chain;
-
     @Mock
     private DOMDataWriteTransaction tx;
-
     @Mock
     private RIBSupportContextRegistry registry;
-
     @Mock
     private RIBSupportContext context;
-
     private AdjRibInWriter writer;
 
-    private static final TablesKey K4 = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
-    private final Set<TablesKey> tableTypes = Sets.newHashSet(K4);
-    private static final Map<TablesKey, SendReceive> ADD_PATH_TABLE_MAPS = Collections.singletonMap(K4, SendReceive.Both);
-
-    private final String peerIp = "12.34.56.78";
-
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         Mockito.doReturn("MockedTrans").when(this.tx).toString();
         Mockito.doReturn(this.tx).when(this.chain).newWriteOnlyTransaction();
-        final CheckedFuture<?, ?> checkedFuture =  Mockito.mock(CheckedFuture.class);
+        final CheckedFuture<?, ?> checkedFuture = Mockito.mock(CheckedFuture.class);
         Mockito.doNothing().when(checkedFuture).addListener(any(), any());
         Mockito.doReturn(checkedFuture).when(this.tx).submit();
         Mockito.doNothing().when(this.tx).put(Mockito.eq(LogicalDatastoreType.OPERATIONAL), Mockito.any(YangInstanceIdentifier.class), Mockito.any(NormalizedNode.class));
@@ -83,41 +74,26 @@ public class AdjRibsInWriterTest {
 
     @Test
     public void testTransform() {
-        this.writer = AdjRibInWriter.create(YangInstanceIdentifier.of(Rib.QNAME), PeerRole.Ebgp, Optional.empty(), this.chain);
+        this.writer = AdjRibInWriter.create(YangInstanceIdentifier.of(Rib.QNAME), PeerRole.Ebgp, this.chain);
         assertNotNull(this.writer);
         final YangInstanceIdentifier peerPath = YangInstanceIdentifier.builder().node(Rib.QNAME).node(Peer.QNAME).nodeWithKey(Peer.QNAME,
-            AdjRibInWriter.PEER_ID_QNAME, this.peerIp).build();
+                AdjRibInWriter.PEER_ID_QNAME, this.peerIp).build();
         this.writer.transform(new PeerId(this.peerIp), this.registry, this.tableTypes, ADD_PATH_TABLE_MAPS);
         verifyPeerSkeletonInsertedCorrectly(peerPath);
         // verify supported tables were inserted for ipv4
         Mockito.verify(this.tx).put(Mockito.eq(LogicalDatastoreType.OPERATIONAL), Mockito.eq(peerPath.node(SupportedTables.QNAME)
-            .node(RibSupportUtils.toYangKey(SupportedTables.QNAME, K4))), Mockito.any(NormalizedNode.class));
+                .node(RibSupportUtils.toYangKey(SupportedTables.QNAME, K4))), Mockito.any(NormalizedNode.class));
         verifyUptodateSetToFalse(peerPath);
     }
 
     private void verifyUptodateSetToFalse(final YangInstanceIdentifier peerPath) {
         final YangInstanceIdentifier path = peerPath.node(AdjRibIn.QNAME).node(Tables.QNAME).node(RibSupportUtils.toYangTablesKey(K4))
-            .node(Attributes.QNAME).node(AdjRibInWriter.ATTRIBUTES_UPTODATE_FALSE.getNodeType());
+                .node(Attributes.QNAME).node(AdjRibInWriter.ATTRIBUTES_UPTODATE_FALSE.getNodeType());
         Mockito.verify(this.tx).merge(Mockito.eq(LogicalDatastoreType.OPERATIONAL), Mockito.eq(path), Mockito.eq(AdjRibInWriter.ATTRIBUTES_UPTODATE_FALSE));
     }
 
     private void verifyPeerSkeletonInsertedCorrectly(final YangInstanceIdentifier peerPath) {
         Mockito.verify(this.tx).put(Mockito.eq(LogicalDatastoreType.OPERATIONAL), Mockito.eq(peerPath),
-            Mockito.eq(this.writer.peerSkeleton(IdentifierUtils.peerKey(peerPath), this.peerIp)));
-    }
-
-    @Test
-    public void testAnnounceNoneTransform() {
-        this.writer = AdjRibInWriter.create(YangInstanceIdentifier.of(Rib.QNAME), PeerRole.Ebgp, Optional.of(SimpleRoutingPolicy.AnnounceNone), this.chain);
-        assertNotNull(this.writer);
-        final YangInstanceIdentifier peerPath = YangInstanceIdentifier.builder().node(Rib.QNAME).node(Peer.QNAME).nodeWithKey(Peer.QNAME,
-            AdjRibInWriter.PEER_ID_QNAME, this.peerIp).build();
-        this.writer.transform(new PeerId(this.peerIp), this.registry, this.tableTypes, ADD_PATH_TABLE_MAPS);
-        verifyPeerSkeletonInsertedCorrectly(peerPath);
-        // verify supported tables were not inserted for ipv4, AnnounceNone
-        Mockito.verify(this.tx, never()).put(Mockito.eq(LogicalDatastoreType.OPERATIONAL), Mockito.eq(peerPath.node(SupportedTables.QNAME)
-            .node(RibSupportUtils.toYangKey(SupportedTables.QNAME, K4))), Mockito.any(NormalizedNode.class));
-        verifyUptodateSetToFalse(peerPath);
-
+                Mockito.eq(this.writer.peerSkeleton(IdentifierUtils.peerKey(peerPath), this.peerIp)));
     }
 }
\ No newline at end of file
index ef9ad867d55611dbc110b77a81dad1de35564f42..273651be1c860316df8dc9ad471526700c3dffe0 100644 (file)
@@ -17,14 +17,12 @@ import static org.opendaylight.protocol.bgp.rib.impl.AdjRibInWriter.PEER_ID_QNAM
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Optional;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.SendReceive;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRib;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.SimpleRoutingPolicy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.Peer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
@@ -55,10 +53,10 @@ public class ExportPolicyPeerTrackerImplTest {
     public void testExportPolicyPeerTrackerImpl() throws Exception {
         final ExportPolicyPeerTrackerImpl exportPpt = new ExportPolicyPeerTrackerImpl(PD, TABLE_KEY);
 
-        TABLE_REGISTRATION.add(exportPpt.registerPeer(PEER_ID1, SendReceive.Both, YII_PEER1, PeerRole.RrClient, Optional.empty()));
-        TABLE_REGISTRATION.add(exportPpt.registerPeer(PEER_ID2, SendReceive.Receive, YII_PEER2, PeerRole.Ibgp, Optional.of(SimpleRoutingPolicy.AnnounceNone)));
-        TABLE_REGISTRATION.add(exportPpt.registerPeer(PEER_ID3, SendReceive.Send, YII_PEER3, PeerRole.Ebgp, Optional.of(SimpleRoutingPolicy.LearnNone)));
-        TABLE_REGISTRATION.add(exportPpt.registerPeer(PEER_ID4, null, YII_PEER4, PeerRole.Ibgp, Optional.empty()));
+        TABLE_REGISTRATION.add(exportPpt.registerPeer(PEER_ID1, SendReceive.Both, YII_PEER1, PeerRole.RrClient));
+        TABLE_REGISTRATION.add(exportPpt.registerPeer(PEER_ID2, SendReceive.Receive, YII_PEER2, PeerRole.Ibgp));
+        TABLE_REGISTRATION.add(exportPpt.registerPeer(PEER_ID3, SendReceive.Send, YII_PEER3, PeerRole.Ebgp));
+        TABLE_REGISTRATION.add(exportPpt.registerPeer(PEER_ID4, null, YII_PEER4, PeerRole.Ibgp));
 
         assertEquals(PeerRole.RrClient, exportPpt.getRole(YII_PEER1));
         assertEquals(PeerRole.Ibgp, exportPpt.getRole(YII_PEER2));
@@ -71,7 +69,7 @@ public class ExportPolicyPeerTrackerImplTest {
         assertTrue(exportPpt.getPeerGroup(PeerRole.Ibgp).containsPeer(PEER_ID4));
 
         assertTrue(exportPpt.isTableSupported(PEER_ID1));
-        assertFalse(exportPpt.isTableSupported(PEER_ID2));
+        assertTrue(exportPpt.isTableSupported(PEER_ID2));
         assertTrue(exportPpt.isTableSupported(PEER_ID3));
         assertTrue(exportPpt.isTableSupported(PEER_ID4));
         assertFalse(exportPpt.isTableSupported(PEER_ID5));
index 3076416ea690cf5d454303f4316ad31714a26e9e..0a3073b0c2600b7f5211004242283cb325d0b108 100644 (file)
@@ -22,7 +22,6 @@ import static org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.SHORT;
 import static org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.createAfiSafi;
 import static org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.createNeighborExpected;
 import static org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.createTransport;
-import static org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.getSimpleRoutingPolicy;
 import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil.INSTANCE;
 
 import com.google.common.collect.ImmutableList;
@@ -94,13 +93,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.open
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.Config2Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.GlobalConfigAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.GlobalConfigAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.NeighborConfigAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.NeighborConfigAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.Protocol1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.ApplicationRibId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.SimpleRoutingPolicy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
@@ -281,16 +277,6 @@ public class OpenConfigMappingUtilTest {
         assertEquals(CLUSTER_ID.getValue(), OpenConfigMappingUtil.getClusterIdentifier(configBuilder.build()).getValue());
     }
 
-    @Test
-    public void testGetSimpleRoutingPolicy() {
-        final NeighborBuilder neighborBuilder = new NeighborBuilder();
-        assertNull(getSimpleRoutingPolicy(neighborBuilder.build()));
-        neighborBuilder.setConfig(new ConfigBuilder()
-                .addAugmentation(NeighborConfigAugmentation.class,
-                        new NeighborConfigAugmentationBuilder().setSimpleRoutingPolicy(SimpleRoutingPolicy.LearnNone).build()).build());
-        assertEquals(SimpleRoutingPolicy.LearnNone, getSimpleRoutingPolicy(neighborBuilder.build()));
-    }
-
     @Test
     public void isAppNeighbor() {
         assertFalse(OpenConfigMappingUtil.isApplicationPeer(new NeighborBuilder().setConfig(new ConfigBuilder().build()).build()));
@@ -444,7 +430,7 @@ public class OpenConfigMappingUtilTest {
 
     @Test
     public void fromBgpPeer() {
-        final Neighbor result = OpenConfigMappingUtil.fromBgpPeer(FAMILIES, TABLE_TYPES, 30, NEIGHBOR_ADDRESS, true, null, PORT_NUMBER, 30, AS, PeerRole.Ibgp, null, this.tableTypeRegistry);
+        final Neighbor result = OpenConfigMappingUtil.fromBgpPeer(FAMILIES, TABLE_TYPES, 30, NEIGHBOR_ADDRESS, true, null, PORT_NUMBER, 30, AS, PeerRole.Ibgp, this.tableTypeRegistry);
         final List<AfiSafi> afisafis = new ArrayList<>();
         afisafis.add(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class)
             .addAugmentation(AfiSafi1.class, new AfiSafi1Builder().setReceive(true).setSendMax(Shorts.checkedCast(ALL_PATHS)).build()).build());
index f750bb8630c1331a2b0036f1235154c1c97e6d2a..71f61e9d98ca272e624e87de5a18f9bbdccb366a 100644 (file)
@@ -8,14 +8,12 @@
 
 package org.opendaylight.protocol.bgp.rib.spi;
 
-import java.util.Optional;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import org.opendaylight.protocol.concepts.AbstractRegistration;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.SendReceive;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.SimpleRoutingPolicy;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
@@ -29,12 +27,10 @@ public interface ExportPolicyPeerTracker {
      * @param sendReceive         send receive add ath configuration of the peer
      * @param peerPath            Yii of the peer
      * @param peerRole            Role of the peer
-     * @param simpleRoutingPolicy optional
-     */
+l     */
     @Nonnull
     AbstractRegistration registerPeer(@Nonnull PeerId peerId, @Nullable SendReceive sendReceive,
-            @Nonnull YangInstanceIdentifier peerPath, @Nonnull PeerRole peerRole,
-            @Nonnull Optional<SimpleRoutingPolicy> simpleRoutingPolicy);
+            @Nonnull YangInstanceIdentifier peerPath, @Nonnull PeerRole peerRole);
 
     /**
      * Returns PeerExportGroup per role.