BUG-6954: Create Application Peer with Route Counter 86/47086/1
authorClaudio D. Gasparini <cgaspari@cisco.com>
Mon, 17 Oct 2016 10:04:07 +0000 (12:04 +0200)
committerClaudio D. Gasparini <cgaspari@cisco.com>
Tue, 18 Oct 2016 16:57:01 +0000 (18:57 +0200)
Create Application Peer with Route Counter

Change-Id: I41faaa0dedebb158139987617a1106ddd9c584a5
Signed-off-by: Claudio D. Gasparini <cgaspari@cisco.com>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ApplicationPeer.java

index 6dc18e334475634f0481fe101ba5d1571dbd69f5..a028b437b98c4ac4127c7ca976861c4b1a92888a 100644 (file)
@@ -25,6 +25,8 @@ import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
 import org.opendaylight.protocol.bgp.openconfig.spi.BGPConfigModuleTracker;
 import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
 import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContextRegistry;
+import org.opendaylight.protocol.bgp.rib.impl.stats.peer.BGPPeerStats;
+import org.opendaylight.protocol.bgp.rib.impl.stats.peer.BGPPeerStatsImpl;
 import org.opendaylight.protocol.bgp.rib.spi.ExportPolicyPeerTracker;
 import org.opendaylight.protocol.bgp.rib.spi.IdentifierUtils;
 import org.opendaylight.protocol.bgp.rib.spi.RouterIds;
@@ -74,6 +76,7 @@ public class ApplicationPeer implements AutoCloseable, org.opendaylight.protocol
     private DOMTransactionChain writerChain;
     private EffectiveRibInWriter effectiveRibInWriter;
     private AdjRibInWriter adjRibInWriter;
+    private BGPPeerStats peerStats;
 
     public ApplicationPeer(final ApplicationRibId applicationRibId, final Ipv4Address ipAddress, final RIB rib,
         final BGPConfigModuleTracker moduleTracker) {
@@ -109,9 +112,10 @@ public class ApplicationPeer implements AutoCloseable, org.opendaylight.protocol
         this.adjRibInWriter = AdjRibInWriter.create(this.rib.getYangRibId(), PeerRole.Internal, simpleRoutingPolicy, this.writerChain);
         final RIBSupportContextRegistry context = this.rib.getRibSupportContext();
         this.adjRibInWriter = this.adjRibInWriter.transform(peerId, context, localTables, Collections.emptyMap());
-        //TODO need to create effective rib in adjRibInWriter with route counter here
+        this.peerStats = new BGPPeerStatsImpl(this.name, localTables);
         this.effectiveRibInWriter = EffectiveRibInWriter.create(this.rib.getService(), this.rib.createPeerChain(this), this.peerIId,
-            this.rib.getImportPolicyPeerTracker(), context, PeerRole.Internal);
+            this.rib.getImportPolicyPeerTracker(), context, PeerRole.Internal, this.peerStats.getEffectiveRibInRouteCounters(),
+        this.peerStats.getAdjRibInRouteCounters());
         if (moduleTracker != null) {
             moduleTracker.onInstanceCreate();
         }