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

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
       3             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef SRC_BGP_MVPN_MVPN_TABLE_H_
       7             : #define SRC_BGP_MVPN_MVPN_TABLE_H_
       8             : 
       9             : #include <map>
      10             : #include <set>
      11             : #include <string>
      12             : 
      13             : #include "bgp/bgp_attr.h"
      14             : #include "bgp/bgp_table.h"
      15             : #include "bgp/mvpn/mvpn_route.h"
      16             : #include "bgp/routing-instance/path_resolver.h"
      17             : 
      18             : class BgpPath;
      19             : class BgpRoute;
      20             : class BgpServer;
      21             : class MvpnManager;
      22             : class MvpnProjectManager;
      23             : class MvpnProjectManagerPartition;
      24             : 
      25             : class MvpnTable : public BgpTable {
      26             : public:
      27             :     static const int kPartitionCount = 1;
      28             : 
      29             :     struct RequestKey : BgpTable::RequestKey {
      30      114198 :         RequestKey(const MvpnPrefix &prefix, const IPeer *ipeer)
      31      114198 :             : prefix(prefix), peer(ipeer) {
      32      114198 :         }
      33             :         MvpnPrefix prefix;
      34             :         const IPeer *peer;
      35       40151 :         virtual const IPeer *GetPeer() const { return peer; }
      36             :     };
      37             : 
      38             :     MvpnTable(DB *db, const std::string &name);
      39             : 
      40             :     virtual std::unique_ptr<DBEntry> AllocEntry(const DBRequestKey *key) const;
      41             :     virtual std::unique_ptr<DBEntry> AllocEntryStr(const std::string &key) const;
      42             :     void CreateManager();
      43             :     void DestroyManager();
      44     1739579 :     virtual Address::Family family() const { return Address::MVPN; }
      45             :     bool IsMaster() const;
      46     1029357 :     virtual bool IsVpnTable() const { return IsMaster(); }
      47             : 
      48             :     virtual size_t Hash(const DBEntry *entry) const;
      49             :     virtual size_t Hash(const DBRequestKey *key) const;
      50      395096 :     virtual int PartitionCount() const { return kPartitionCount; }
      51             :     MvpnRoute *FindSPMSIRoute(MvpnRoute *leaf_ad_rt) { return NULL; }
      52             :     const ExtCommunity::ExtCommunityValue GetAutoVrfImportRouteTarget() const {
      53             :         return ExtCommunity::ExtCommunityValue();
      54             :     }
      55             : 
      56             :     virtual BgpRoute *RouteReplicate(BgpServer *server, BgpTable *src_table,
      57             :                                      BgpRoute *src_rt, const BgpPath *path,
      58             :                                      ExtCommunityPtr ptr);
      59             :     virtual bool Export(RibOut *ribout, Route *route,
      60             :                         const RibPeerSet &peerset,
      61             :                         UpdateInfoSList &info_slist);
      62             :     static DBTableBase *CreateTable(DB *db, const std::string &name);
      63             :     size_t HashFunction(const MvpnPrefix &prefix) const;
      64             :     PathResolver *CreatePathResolver();
      65         450 :     const MvpnManager *manager() const { return manager_; }
      66       72263 :     MvpnManager *manager() { return manager_; }
      67             : 
      68             :     bool RouteNotify(BgpServer *server, DBTablePartBase *root, DBEntryBase *e);
      69             :     const MvpnProjectManager *GetProjectManager() const;
      70             :     MvpnProjectManager *GetProjectManager();
      71             :     const MvpnProjectManagerPartition *GetProjectManagerPartition(
      72             :             BgpRoute *route) const;
      73             :     void UpdateSecondaryTablesForReplication(BgpRoute *rt,
      74             :         TableSet *secondary_tables);
      75             :     MvpnPrefix CreateType4LeafADRoutePrefix(const MvpnRoute *type3_rt);
      76             :     MvpnPrefix CreateType3SPMSIRoutePrefix(const MvpnRoute *type7_rt);
      77             :     MvpnPrefix CreateType2ADRoutePrefix();
      78             :     MvpnPrefix CreateType1ADRoutePrefix(const Ip4Address &originator_ip);
      79             :     MvpnPrefix CreateType1ADRoutePrefix();
      80             :     MvpnPrefix CreateType7SourceTreeJoinRoutePrefix(MvpnRoute *rt) const;
      81             :     MvpnPrefix CreateLocalType7Prefix(MvpnRoute *rt) const;
      82             :     MvpnRoute *FindType1ADRoute(const Ip4Address &originator_ip);
      83             :     MvpnRoute *FindType1ADRoute();
      84             :     const MvpnRoute *FindType7SourceTreeJoinRoute(MvpnRoute *rt) const;
      85             :     MvpnRoute *LocateType1ADRoute();
      86             :     MvpnRoute *LocateType3SPMSIRoute(const MvpnRoute *type7_join_rt);
      87             :     MvpnRoute *LocateType4LeafADRoute(const MvpnRoute *type3_spmsi_rt);
      88             :     MvpnRoute *FindRoute(const MvpnPrefix &prefix);
      89             :     const MvpnRoute *FindRoute(const MvpnPrefix &prefix) const;
      90             :     void CreateMvpnManagers();
      91             :     bool IsProjectManagerUsable() const;
      92             : 
      93             : private:
      94             :     friend class BgpMulticastTest;
      95             :     typedef std::set<std::string> MvpnManagerNetworks;
      96             :     typedef std::map<std::string, MvpnManagerNetworks>
      97             :         MvpnProjectManagerNetworks;
      98             : 
      99             :     void DeleteMvpnManager();
     100             :     virtual BgpRoute *TableFind(DBTablePartition *rtp,
     101             :                                 const DBRequestKey *prefix);
     102             :     MvpnRoute *LocateRoute(const MvpnPrefix &prefix);
     103             :     UpdateInfo *GetMvpnUpdateInfo(RibOut *ribout, MvpnRoute *route,
     104             :                                   const RibPeerSet &peerset);
     105             :     void GetPeerSet(RibOut *ribout, MvpnRoute *route,
     106             :                     const RibPeerSet &peerset, RibPeerSet *new_peerset);
     107             :     BgpRoute *ReplicateType7SourceTreeJoin(BgpServer *server,
     108             :         MvpnTable *src_table, MvpnRoute *src_rt, const BgpPath *src_path,
     109             :         ExtCommunityPtr ext_community);
     110             :     BgpRoute *ReplicatePath(BgpServer *server, const MvpnPrefix &mprefix,
     111             :         MvpnTable *src_table, MvpnRoute *src_rt, const BgpPath *src_path,
     112             :         ExtCommunityPtr comm);
     113      834462 :     const MvpnTable *table() const { return this; }
     114             : 
     115             :     MvpnManager *manager_;
     116             : 
     117             :     DISALLOW_COPY_AND_ASSIGN(MvpnTable);
     118             : };
     119             : 
     120             : #endif  // SRC_BGP_MVPN_MVPN_TABLE_H_

Generated by: LCOV version 1.14