LCOV - code coverage report
Current view: top level - vnsw/agent/uve - vn_uve_table_base.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 3 5 60.0 %
Date: 2026-11-09 02:10:49 Functions: 1 2 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef vnsw_agent_vn_uve_table_base_h
       7             : #define vnsw_agent_vn_uve_table_base_h
       8             : 
       9             : #include <string>
      10             : #include <set>
      11             : #include <map>
      12             : #include <vector>
      13             : #include <mutex>
      14             : 
      15             : #include <virtual_network_types.h>
      16             : #include <oper/vn.h>
      17             : #include <uve/vn_uve_entry_base.h>
      18             : 
      19             : //The container class for objects representing VirtualNetwork UVEs
      20             : //Defines routines for storing and managing (add, delete, change and send)
      21             : //VirtualNetwork UVEs
      22             : class VnUveTableBase {
      23             : public:
      24             :     struct VnUveInterfaceState :public DBState {
      25         167 :         VnUveInterfaceState(const std::string &vm, const std::string &vn)
      26         167 :             : vm_name_(vm), vn_name_(vn) {
      27         167 :         }
      28             :         std::string vm_name_;
      29             :         std::string vn_name_;
      30             :     };
      31             : 
      32             :     typedef boost::shared_ptr<VnUveEntryBase> VnUveEntryPtr;
      33             :     typedef std::map<std::string, VnUveEntryPtr> UveVnMap;
      34             :     typedef std::pair<std::string, VnUveEntryPtr> UveVnPair;
      35             :     VnUveTableBase(Agent *agent, uint32_t default_intvl);
      36             :     virtual ~VnUveTableBase();
      37             : 
      38             :     void RegisterDBClients();
      39             :     void Shutdown(void);
      40             :     void SendVnAclRuleCount();
      41             :     bool TimerExpiry();
      42             : 
      43             : protected:
      44             :     void Delete(const std::string &name);
      45             :     VnUveEntryBase* UveEntryFromVn(const VnEntry *vn);
      46             :     //The following API is made protected for UT.
      47             :     virtual void DispatchVnMsg(const UveVirtualNetworkAgent &uve);
      48           0 :     virtual void SendVnAceStats(VnUveEntryBase *entry, const VnEntry *vn) {
      49           0 :     }
      50             : 
      51             :     UveVnMap uve_vn_map_;
      52             :     Agent *agent_;
      53             :     /* For exclusion between kTaskFlowStatsCollector and kTaskDBExclude */
      54             :     std::mutex uve_vn_map_mutex_;
      55             : private:
      56             :     VnUveEntryBase* Add(const VnEntry *vn);
      57             :     void Add(const std::string &vn);
      58             :     virtual VnUveEntryPtr Allocate(const VnEntry *vn);
      59             :     virtual VnUveEntryPtr Allocate();
      60             :     void VnNotify(DBTablePartBase *partition, DBEntryBase *e);
      61             :     void InterfaceNotify(DBTablePartBase *partition, DBEntryBase *e);
      62             :     void SendDeleteVnMsg(const std::string &vn);
      63             :     void MarkChanged(const VnEntry *vn);
      64             :     void InterfaceDeleteHandler(const std::string &vm, const std::string &vn,
      65             :                                 const Interface* intf);
      66             :     void InterfaceAddHandler(const VnEntry* vn, const Interface* intf,
      67             :                              const std::string &vm_name,
      68             :                              VnUveInterfaceState *state);
      69             :     void set_expiry_time(int time);
      70             :     void SendVnMsg(VnUveEntryBase *entry, const VnEntry *vn);
      71             : 
      72             :     DBTableBase::ListenerId vn_listener_id_;
      73             :     DBTableBase::ListenerId intf_listener_id_;
      74             : 
      75             :     // Last visited VmEntry by timer
      76             :     std::string timer_last_visited_;
      77             :     Timer *timer_;
      78             :     int expiry_time_;
      79             : 
      80             :     DISALLOW_COPY_AND_ASSIGN(VnUveTableBase);
      81             : };
      82             : 
      83             : #endif // vnsw_agent_vn_uve_table_base_h

Generated by: LCOV version 1.14