9e332413d2ac451c2ca93ff894f211f6af2586cb
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / BGPPeer.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.bgp.rib.impl;
9
10 import static org.opendaylight.protocol.bgp.rib.impl.AdjRibInWriter.isAnnounceNone;
11 import static org.opendaylight.protocol.bgp.rib.impl.AdjRibInWriter.isLearnNone;
12
13 import com.google.common.base.MoreObjects;
14 import com.google.common.base.MoreObjects.ToStringHelper;
15 import com.google.common.base.Preconditions;
16 import com.google.common.collect.Lists;
17 import com.google.common.net.InetAddresses;
18 import java.util.ArrayList;
19 import java.util.Arrays;
20 import java.util.HashMap;
21 import java.util.HashSet;
22 import java.util.List;
23 import java.util.Map;
24 import java.util.Optional;
25 import java.util.Set;
26 import java.util.stream.Collectors;
27 import javax.annotation.concurrent.GuardedBy;
28 import org.opendaylight.controller.config.yang.bgp.rib.impl.BGPPeerRuntimeMXBean;
29 import org.opendaylight.controller.config.yang.bgp.rib.impl.BGPPeerRuntimeRegistration;
30 import org.opendaylight.controller.config.yang.bgp.rib.impl.BGPPeerRuntimeRegistrator;
31 import org.opendaylight.controller.config.yang.bgp.rib.impl.BgpPeerState;
32 import org.opendaylight.controller.config.yang.bgp.rib.impl.BgpSessionState;
33 import org.opendaylight.controller.config.yang.bgp.rib.impl.RouteTable;
34 import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
35 import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
36 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
37 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
38 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
39 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
40 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionStatistics;
41 import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
42 import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContext;
43 import org.opendaylight.protocol.bgp.rib.spi.BGPSession;
44 import org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener;
45 import org.opendaylight.protocol.bgp.rib.spi.BGPTerminationReason;
46 import org.opendaylight.protocol.bgp.rib.spi.IdentifierUtils;
47 import org.opendaylight.protocol.bgp.rib.spi.Peer;
48 import org.opendaylight.protocol.bgp.rib.spi.RouterIds;
49 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.DestinationIpv4Builder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.destination.ipv4.Ipv4Prefixes;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.destination.ipv4.Ipv4PrefixesBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4CaseBuilder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Update;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.Attributes;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.AttributesBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes1;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes2;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.RouteRefresh;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.mp.capabilities.add.path.capability.AddressFamilies;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlri;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlriBuilder;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpUnreachNlri;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpUnreachNlriBuilder;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.peer.rpc.rev160322.BgpPeerRpcService;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.peer.rpc.rev160322.PeerContext;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerId;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.SimpleRoutingPolicy;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.rib.PeerKey;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
78 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
79 import org.opendaylight.yangtools.yang.binding.Notification;
80 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
81 import org.slf4j.Logger;
82 import org.slf4j.LoggerFactory;
83
84 /**
85  * Class representing a peer. We have a single instance for each peer, which provides translation from BGP events into
86  * RIB actions.
87  */
88 public class BGPPeer implements BGPSessionListener, Peer, AutoCloseable, BGPPeerRuntimeMXBean, TransactionChainListener {
89
90     private static final Logger LOG = LoggerFactory.getLogger(BGPPeer.class);
91
92     @GuardedBy("this")
93     private final Set<TablesKey> tables = new HashSet<>();
94     @GuardedBy("this")
95     private BGPSession session;
96     @GuardedBy("this")
97     private byte[] rawIdentifier;
98     @GuardedBy("this")
99     private DOMTransactionChain chain;
100     @GuardedBy("this")
101     private AdjRibInWriter ribWriter;
102     @GuardedBy("this")
103     private EffectiveRibInWriter effRibInWriter;
104
105     private final RIB rib;
106     private final String name;
107     private BGPPeerRuntimeRegistrator registrator;
108     private BGPPeerRuntimeRegistration runtimeReg;
109     private long sessionEstablishedCounter = 0L;
110     private final Map<TablesKey, AdjRibOutListener> adjRibOutListenerSet = new HashMap();
111     private final RpcProviderRegistry rpcRegistry;
112     private RoutedRpcRegistration<BgpPeerRpcService> rpcRegistration;
113     private final PeerRole peerRole;
114     private final Optional<SimpleRoutingPolicy> simpleRoutingPolicy;
115
116     public BGPPeer(final String name, final RIB rib, final PeerRole role, final SimpleRoutingPolicy peerStatus, final RpcProviderRegistry rpcRegistry) {
117         this.peerRole = role;
118         this.simpleRoutingPolicy = Optional.ofNullable(peerStatus);
119         this.rib = Preconditions.checkNotNull(rib);
120         this.name = name;
121         this.chain = rib.createPeerChain(this);
122         this.ribWriter = AdjRibInWriter.create(rib.getYangRibId(), this.peerRole, this.simpleRoutingPolicy, this.chain);
123         this.rpcRegistry = rpcRegistry;
124     }
125
126     public BGPPeer(final String name, final RIB rib, final PeerRole role, final RpcProviderRegistry rpcRegistry) {
127         this(name, rib, role, null, rpcRegistry);
128     }
129
130     @Override
131     public synchronized void close() {
132         releaseConnection();
133         this.chain.close();
134     }
135
136     @Override
137     public void onMessage(final BGPSession session, final Notification msg) {
138         if (!(msg instanceof Update) && !(msg instanceof RouteRefresh)) {
139             LOG.info("Ignoring unhandled message class {}", msg.getClass());
140             return;
141         }
142         if (msg instanceof Update) {
143             onUpdateMessage((Update) msg);
144         } else {
145             onRouteRefreshMessage((RouteRefresh) msg, session);
146         }
147     }
148
149     private void onRouteRefreshMessage(final RouteRefresh message, final BGPSession session) {
150         final Class<? extends AddressFamily> rrAfi = message.getAfi();
151         final Class<? extends SubsequentAddressFamily> rrSafi = message.getSafi();
152
153         final TablesKey key = new TablesKey(rrAfi, rrSafi);
154         final AdjRibOutListener listener = this.adjRibOutListenerSet.get(key);
155         if (listener != null) {
156             listener.close();
157             this.adjRibOutListenerSet.remove(listener);
158             createAdjRibOutListener(RouterIds.createPeerId(session.getBgpId()), key, true);
159         } else {
160             LOG.info("Ignoring RouteRefresh message. Afi/Safi is not supported: {}, {}.", rrAfi, rrSafi);
161         }
162     }
163
164     private void onUpdateMessage(final Update message) {
165         // update AdjRibs
166         final Attributes attrs = message.getAttributes();
167         MpReachNlri mpReach = null;
168         final boolean isAnyNlriAnnounced = message.getNlri() != null;
169         if (isAnyNlriAnnounced) {
170             mpReach = prefixesToMpReach(message);
171         } else if (attrs != null && attrs.getAugmentation(Attributes1.class) != null) {
172             mpReach = attrs.getAugmentation(Attributes1.class).getMpReachNlri();
173         }
174         if (mpReach != null) {
175             this.ribWriter.updateRoutes(mpReach, nextHopToAttribute(attrs, mpReach));
176         }
177         MpUnreachNlri mpUnreach = null;
178         if (message.getWithdrawnRoutes() != null) {
179             mpUnreach = prefixesToMpUnreach(message, isAnyNlriAnnounced);
180         } else if (attrs != null && attrs.getAugmentation(Attributes2.class) != null) {
181             mpUnreach = attrs.getAugmentation(Attributes2.class).getMpUnreachNlri();
182         }
183         if (mpUnreach != null) {
184             this.ribWriter.removeRoutes(mpUnreach);
185         }
186     }
187
188     private static Attributes nextHopToAttribute(final Attributes attrs, final MpReachNlri mpReach) {
189         if (attrs.getCNextHop() == null && mpReach.getCNextHop() != null) {
190             final AttributesBuilder attributesBuilder = new AttributesBuilder(attrs);
191             attributesBuilder.setCNextHop(mpReach.getCNextHop());
192             return attributesBuilder.build();
193         }
194         return attrs;
195     }
196
197     /**
198      * Creates MPReach for the prefixes to be handled in the same way as linkstate routes
199      *
200      * @param message Update message containing prefixes in NLRI
201      * @return MpReachNlri with prefixes from the nlri field
202      */
203     private static MpReachNlri prefixesToMpReach(final Update message) {
204         final List<Ipv4Prefixes> prefixes = new ArrayList<>();
205         for (final Ipv4Prefix p : message.getNlri().getNlri()) {
206             prefixes.add(new Ipv4PrefixesBuilder().setPrefix(p).build());
207         }
208         final MpReachNlriBuilder b = new MpReachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(
209             UnicastSubsequentAddressFamily.class).setAdvertizedRoutes(
210                 new AdvertizedRoutesBuilder().setDestinationType(
211                     new DestinationIpv4CaseBuilder().setDestinationIpv4(
212                         new DestinationIpv4Builder().setIpv4Prefixes(prefixes).build()).build()).build());
213         if (message.getAttributes() != null) {
214             b.setCNextHop(message.getAttributes().getCNextHop());
215         }
216         return b.build();
217     }
218
219     /**
220      * Create MPUnreach for the prefixes to be handled in the same way as linkstate routes
221      *
222      * @param message Update message containing withdrawn routes
223      * @param isAnyNlriAnnounced
224      * @return MpUnreachNlri with prefixes from the withdrawn routes field
225      */
226     private static MpUnreachNlri prefixesToMpUnreach(final Update message, final boolean isAnyNlriAnnounced) {
227         final List<Ipv4Prefixes> prefixes = new ArrayList<>();
228         for (final Ipv4Prefix p : message.getWithdrawnRoutes().getWithdrawnRoutes()) {
229             boolean nlriAnounced = false;
230             if(isAnyNlriAnnounced) {
231                 nlriAnounced = message.getNlri().getNlri().contains(p);
232             }
233
234             if(!nlriAnounced) {
235                 prefixes.add(new Ipv4PrefixesBuilder().setPrefix(p).build());
236             }
237         }
238         return new MpUnreachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setWithdrawnRoutes(
239                 new WithdrawnRoutesBuilder().setDestinationType(
240                     new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
241                         new DestinationIpv4Builder().setIpv4Prefixes(prefixes).build()).build()).build()).build();
242     }
243
244     @Override
245     public synchronized void onSessionUp(final BGPSession session) {
246         final List<AddressFamilies> addPathTablesType = session.getAdvertisedAddPathTableTypes();
247         LOG.info("Session with peer {} went up with tables {} and Add Path tables {}", this.name, addPathTablesType,
248             session.getAdvertisedAddPathTableTypes());
249         this.session = session;
250
251         this.rawIdentifier = InetAddresses.forString(session.getBgpId().getValue()).getAddress();
252         final PeerId peerId = RouterIds.createPeerId(session.getBgpId());
253
254         this.tables.addAll(this.session.getAdvertisedTableTypes().stream().map(t -> new TablesKey(t.getAfi(), t.getSafi())).collect(Collectors.toList()));
255         final boolean announceNone = isAnnounceNone(this.simpleRoutingPolicy);
256         if(!announceNone) {
257             createAdjRibOutListener(peerId);
258         }
259         addBgp4Support(peerId, announceNone);
260
261         if(!isLearnNone(this.simpleRoutingPolicy)) {
262             final YangInstanceIdentifier peerIId = this.rib.getYangRibId().node(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.rib.Peer.QNAME).node(IdentifierUtils.domPeerId(peerId));
263             this.effRibInWriter = EffectiveRibInWriter.create(this.rib.getService(), this.rib.createPeerChain(this), peerIId, ((RIBImpl) this.rib).getImportPolicyPeerTracker(),
264                 this.rib.getRibSupportContext(), this.peerRole);
265         }
266         this.ribWriter = this.ribWriter.transform(peerId, this.rib.getRibSupportContext(), this.tables, addPathTablesType);
267         this.sessionEstablishedCounter++;
268         if (this.registrator != null) {
269             this.runtimeReg = this.registrator.register(this);
270         }
271
272         if (this.rpcRegistry != null) {
273             this.rpcRegistration = this.rpcRegistry.addRoutedRpcImplementation(BgpPeerRpcService.class, new BgpPeerRpc(session, this.tables));
274             final KeyedInstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.rib.Peer, PeerKey> path =
275                 this.rib.getInstanceIdentifier().child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.rib.Peer.class, new PeerKey(peerId));
276             this.rpcRegistration.registerPath(PeerContext.class, path);
277         }
278     }
279
280     private void createAdjRibOutListener(final PeerId peerId) {
281         this.tables.forEach(key->createAdjRibOutListener(peerId, key, true));
282     }
283
284     //try to add a support for old-school BGP-4, if peer did not advertise IPv4-Unicast MP capability
285     private void addBgp4Support(final PeerId peerId, final boolean announceNone) {
286         final TablesKey key = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
287         this.tables.add(key);
288         if (!announceNone) {
289             createAdjRibOutListener(peerId, key, false);
290         }
291     }
292
293     private void createAdjRibOutListener(final PeerId peerId, final TablesKey key, final boolean mpSupport) {
294         final RIBSupportContext context = this.rib.getRibSupportContext().getRIBSupportContext(key);
295
296         // not particularly nice
297         if (context != null && this.session instanceof BGPSessionImpl) {
298             this.adjRibOutListenerSet.put(key, AdjRibOutListener.create(peerId, key, this.rib.getYangRibId(), this.rib.getCodecsRegistry(),
299                 context.getRibSupport(), ((RIBImpl) this.rib).getService(), ((BGPSessionImpl) this.session).getLimiter(), mpSupport));
300         }
301     }
302
303     private synchronized void cleanup() {
304         // FIXME: BUG-196: support graceful
305         for (final AdjRibOutListener adjRibOutListener : this.adjRibOutListenerSet.values()) {
306             adjRibOutListener.close();
307         }
308         this.adjRibOutListenerSet.clear();
309         if (this.effRibInWriter != null) {
310             this.effRibInWriter.close();
311         }
312         this.ribWriter.removePeer();
313         this.tables.clear();
314     }
315
316     @Override
317     public void onSessionDown(final BGPSession session, final Exception e) {
318         if(e.getMessage().equals(BGPSessionImpl.END_OF_INPUT)) {
319             LOG.info("Session with peer {} went down", this.name);
320         } else {
321             LOG.info("Session with peer {} went down", this.name, e);
322         }
323         releaseConnection();
324     }
325
326     @Override
327     public void onSessionTerminated(final BGPSession session, final BGPTerminationReason cause) {
328         LOG.info("Session with peer {} terminated: {}", this.name, cause);
329         releaseConnection();
330     }
331
332     @Override
333     public String toString() {
334         return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
335     }
336
337     protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
338         toStringHelper.add("name", this.name);
339         toStringHelper.add("tables", this.tables);
340         return toStringHelper;
341     }
342
343     @Override
344     public String getName() {
345         return this.name;
346     }
347
348     @Override
349     public void releaseConnection() {
350         if (this.rpcRegistration != null) {
351             this.rpcRegistration.close();
352         }
353         addPeerToDisconnectedSharedList();
354         cleanup();
355         dropConnection();
356     }
357
358     private void addPeerToDisconnectedSharedList() {
359         if(this.session != null) {
360             this.rib.getCacheDisconnectedPeers().insertDesconectedPeer(this.session.getBgpId());
361         }
362     }
363
364     @GuardedBy("this")
365     private void dropConnection() {
366         if (this.runtimeReg != null) {
367             this.runtimeReg.close();
368             this.runtimeReg = null;
369         }
370         if (this.session != null) {
371             try {
372                 this.session.close();
373             } catch (final Exception e) {
374                 LOG.warn("Error closing session with peer", e);
375             }
376             this.session = null;
377         }
378     }
379
380     @Override
381     public boolean isSessionActive() {
382         return this.session != null;
383     }
384
385     @Override
386     public synchronized byte[] getRawIdentifier() {
387         return Arrays.copyOf(this.rawIdentifier, this.rawIdentifier.length);
388     }
389
390     @Override
391     public void resetSession() {
392         releaseConnection();
393     }
394
395     @Override
396     public void resetStats() {
397         if (this.session instanceof BGPSessionStatistics) {
398             ((BGPSessionStatistics) this.session).resetSessionStats();
399         }
400     }
401
402     public synchronized void registerRootRuntimeBean(final BGPPeerRuntimeRegistrator registrator) {
403         this.registrator = registrator;
404     }
405
406     @Override
407     public BgpSessionState getBgpSessionState() {
408         if (this.session instanceof BGPSessionStatistics) {
409             return ((BGPSessionStatistics) this.session).getBgpSesionState();
410         }
411         return new BgpSessionState();
412     }
413
414     @Override
415     public synchronized BgpPeerState getBgpPeerState() {
416         final BgpPeerState peerState = new BgpPeerState();
417         final List<RouteTable> routes = Lists.newArrayList();
418         for (final TablesKey tablesKey : this.tables) {
419             final RouteTable routeTable = new RouteTable();
420             routeTable.setTableType("afi=" + tablesKey.getAfi().getSimpleName() + ",safi=" + tablesKey.getSafi().getSimpleName());
421             routeTable.setRoutesCount(this.rib.getRoutesCount(tablesKey));
422             routes.add(routeTable);
423         }
424         peerState.setRouteTable(routes);
425         peerState.setSessionEstablishedCount(this.sessionEstablishedCounter);
426         return peerState;
427     }
428
429     @Override
430     public void onTransactionChainFailed(final TransactionChain<?, ?> chain, final AsyncTransaction<?, ?> transaction, final Throwable cause) {
431         LOG.error("Transaction chain failed.", cause);
432         this.chain.close();
433         this.chain = this.rib.createPeerChain(this);
434         this.ribWriter = AdjRibInWriter.create(this.rib.getYangRibId(), this.peerRole, this.simpleRoutingPolicy, this.chain);
435         releaseConnection();
436     }
437
438     @Override
439     public void onTransactionChainSuccessful(final TransactionChain<?, ?> chain) {
440         LOG.debug("Transaction chain {} successfull.", chain);
441     }
442
443     @Override
444     public void markUptodate(final TablesKey tablesKey) {
445         this.ribWriter.markTableUptodate(tablesKey);
446     }
447 }