LCOV - code coverage report
Current view: top level - vnsw/agent/controller - controller_route_walker.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 5 5 100.0 %
Date: 2026-11-09 02:10:49 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
       3             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef vnsw_controller_route_walker_hpp
       7             : #define vnsw_controller_route_walker_hpp
       8             : 
       9             : #include <oper/agent_route_walker.h>
      10             : 
      11             : /*
      12             :  * Handles all kind of walks issued in context ofr controller i.e. bgp peer.
      13             :  * This walker is existing per peer. Internally it uses agent_route_walker.
      14             :  * Kind of walks supported are:
      15             :  * 1) NOTIFYALL - Walks all VRF and corresponding route table  to notify to peer
      16             :  * 2) NOTIFYMULTICAST - Only sends multicast entries from all tables to peer.
      17             :  * 3) DELPEER - Deletes path received from this peer from all.
      18             :  * 4) DELSTALE - Marks the path/info from this peer as stale and does not delete
      19             :  * it. In the case of unicast it marks peer path as stale and in multicast
      20             :  * it doesnt delete  the info sent by this peer.
      21             :  */
      22             : class ControllerRouteWalker : public AgentRouteWalker {
      23             : public:
      24             :     enum Type {
      25             :         NOTIFYALL,
      26             :         NOTIFYMULTICAST,
      27             :         DELPEER,
      28             :         DELSTALE,
      29             :     };
      30             : 
      31             :     ControllerRouteWalker(const std::string &name, Peer *peer);
      32         210 :     virtual ~ControllerRouteWalker() { }
      33             : 
      34             :     //Starts the walk- walk_done_cb is used to get callback when walk is over
      35             :     //i.e. all VRF and all corresponding route walks are over.
      36             :     void Start(Type type, bool associate,
      37             :                AgentRouteWalker::WalkDone walk_done_cb);
      38             :     void StartRouteWalk(VrfEntry *vrf, bool associate, Type type);
      39             :     //Callback for identifying walk complete of all route tables for given vrf
      40             :     void RouteWalkDoneForVrf(VrfEntry *vrf);
      41           2 :     void set_type(Type type) {type_ = type;}
      42             :     uint64_t sequence_number() const {return sequence_number_;}
      43          40 :     void set_sequence_number(uint64_t sequence_number) {
      44          40 :         sequence_number_ = sequence_number;
      45          40 :     }
      46             : 
      47             :     //Override vrf notification
      48             :     virtual bool VrfWalkNotify(DBTablePartBase *partition, DBEntryBase *e);
      49             :     //Override route notification
      50             :     virtual bool RouteWalkNotify(DBTablePartBase *partition, DBEntryBase *e);
      51             : 
      52             : private:
      53             :     //VRF notification handlers
      54             :     bool VrfNotifyInternal(DBTablePartBase *partition, DBEntryBase *e);
      55             :     bool VrfNotifyMulticast(DBTablePartBase *partition, DBEntryBase *e);
      56             :     bool VrfNotifyAll(DBTablePartBase *partition, DBEntryBase *e);
      57             :     bool VrfDelPeer(DBTablePartBase *partition, DBEntryBase *e);
      58             :     bool VrfDelStale(DBTablePartBase *partition, DBEntryBase *e);
      59             : 
      60             :     //Route notification handlers
      61             :     bool RouteNotifyInternal(DBTablePartBase *partition, DBEntryBase *e);
      62             :     bool RouteNotifyAll(DBTablePartBase *partition, DBEntryBase *e);
      63             :     bool RouteNotifyMulticast(DBTablePartBase *partition, DBEntryBase *e);
      64             :     bool RouteDelPeer(DBTablePartBase *partition, DBEntryBase *e);
      65             :     bool RouteDelStale(DBTablePartBase *partition, DBEntryBase *e);
      66             : 
      67             :     //Helpers
      68             :     bool IsDeleteWalk() const;
      69             :     bool IgnoreNotify();
      70             : 
      71             :     Peer *peer_;
      72             :     bool associate_;
      73             :     Type type_;
      74             :     uint64_t sequence_number_;
      75             :     DISALLOW_COPY_AND_ASSIGN(ControllerRouteWalker);
      76             : };
      77             : 
      78             : #endif

Generated by: LCOV version 1.14