LCOV - code coverage report
Current view: top level - vnsw/agent/nexthop_server - nexthop_manager.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 0 23 0.0 %
Date: 2026-08-03 02:19:58 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Implementation of NexthopManager class. It does the following:
       3             :  *   - instantiates NexthopServer object so that interested clients can
       4             :  *      register for nexthop notification.
       5             :  *   - registers with the vrouter-agent nexthopDB for "db.nexthop.0"
       6             :  *      table to get nexthop updates. The nexthops are actually stored
       7             :  *      in the NexthopServer object.
       8             :  */
       9             : #include "db/db.h"
      10             : #include "cmn/agent_signal.h"
      11             : #include "io/event_manager.h"
      12             : #include "nexthop_manager.h"
      13             : #include "oper/tunnel_nh.h"
      14             : #include <sys/wait.h>
      15             : 
      16           0 : NexthopManager::NexthopManager(EventManager *evm, const std::string &endpoint)
      17           0 :   : evm_(evm), nh_table_(NULL), nh_listener_(DBTableBase::kInvalidId),
      18           0 :     nh_server_(new NexthopDBServer(*(evm->io_service()), endpoint))
      19             : {
      20           0 : }
      21             : 
      22           0 : NexthopManager::~NexthopManager()
      23             : {
      24           0 : }
      25             : 
      26             : void
      27           0 : NexthopManager::Initialize(DB *database)
      28             : {
      29           0 :     nh_table_ = database->FindTable("db.nexthop.0");
      30           0 :     assert(nh_table_);
      31           0 :     nh_listener_ =
      32           0 :       nh_table_->Register(boost::bind(&NexthopManager::EventObserver, this,
      33             :                                       _1, _2));
      34           0 : }
      35             : 
      36             : void
      37           0 : NexthopManager::Terminate()
      38             : {
      39           0 :     nh_table_->Unregister(nh_listener_);
      40           0 : }
      41             : 
      42             : void
      43           0 : NexthopManager::EventObserver(DBTablePartBase *db_part, DBEntryBase *entry)
      44             : {
      45           0 :     NextHop *nh = static_cast <NextHop *>(entry);
      46           0 :     if (nh->GetType () == NextHop::TUNNEL) {
      47           0 :         TunnelNH *tnh = (TunnelNH *) nh;
      48           0 :         if (nh->IsDeleted()) {
      49           0 :             nh_server_->FindAndRemoveNexthop(tnh->GetDip()->to_string());
      50             :         } else {
      51           0 :             nh_server_->FindOrCreateNexthop(tnh->GetDip()->to_string());
      52             :         }
      53             :     }
      54           0 : }

Generated by: LCOV version 1.14