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

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
       3             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef vnsw_agent_mpls_index_resource_hpp
       7             : #define vnsw_agent_mpls_index_resource_hpp
       8             : 
       9             : /*
      10             :  * MPLS index allocator using index_vector
      11             :  * All the key types below carve out mpls label from same index vector.
      12             :  *
      13             :  * Uses Resource::MPLS_INDEX
      14             :  */
      15             : #include <resource_manager/index_resource.h>
      16             : #include <resource_manager/resource_backup.h>
      17             : extern SandeshTraceBufferPtr InterfaceMplsDataTraceBuf;
      18             : extern SandeshTraceBufferPtr VrfMplsDataTraceBuf;
      19             : extern SandeshTraceBufferPtr VlanMplsDataTraceBuf;
      20             : extern SandeshTraceBufferPtr RouteMplsDataTraceBuf;
      21             : 
      22             : class ResourceManager;
      23             : class ResourceKey;
      24             : class NextHopKey;
      25             : 
      26             : class MplsIndexResourceKey : public IndexResourceKey {
      27             : public:
      28             :     enum Type {
      29             :         NEXTHOP,
      30             :         ROUTE,
      31             :         TEST,
      32             :         EDGEMCAST
      33             :     };
      34             :     MplsIndexResourceKey(ResourceManager *rm, Type type);
      35             :     virtual ~MplsIndexResourceKey();
      36           0 :     virtual void Backup(ResourceData *data, uint16_t op) {assert(0);}
      37       61440 :     Type type() const {return type_;}
      38             : private:
      39             :     Type type_;
      40             : };
      41             : 
      42             : //Nexthop mpls label
      43             : class NexthopIndexResourceKey : public MplsIndexResourceKey {
      44             : public:
      45             :     NexthopIndexResourceKey(ResourceManager *rm, NextHopKey *nh_key);
      46             :     virtual ~NexthopIndexResourceKey();
      47             : 
      48           0 :     virtual const std::string ToString() { return "";}
      49             :     virtual bool IsLess(const ResourceKey &rhs) const;
      50             :     virtual void Backup(ResourceData *data, uint16_t op);
      51             :     void BackupInterfaceResource(ResourceData *data, uint16_t op);
      52             :     void BackupVrfResource(ResourceData *data, uint16_t op);
      53             :     void BackupVlanResource(ResourceData *data, uint16_t op);
      54       48554 :     const NextHopKey *GetNhKey() const { return nh_key_.get(); }
      55             : private:
      56             :     std::unique_ptr<NextHopKey> nh_key_;
      57             :     DISALLOW_COPY_AND_ASSIGN(NexthopIndexResourceKey);
      58             : };
      59             : 
      60             : //Route mpls label
      61             : class RouteMplsResourceKey : public MplsIndexResourceKey {
      62             : public:
      63             :     RouteMplsResourceKey(ResourceManager *rm,
      64             :                           const std::string &vrf_name,
      65             :                           const std::string route_str);
      66             :     virtual ~RouteMplsResourceKey();
      67             : 
      68           0 :     virtual const std::string ToString() { return "";}
      69             :     virtual bool IsLess(const ResourceKey &rhs) const;
      70             :     virtual void Backup(ResourceData *data, uint16_t op);
      71             : private:
      72             :     const std::string vrf_name_;
      73             :     const std::string route_key_;
      74             :     DISALLOW_COPY_AND_ASSIGN(RouteMplsResourceKey);
      75             : };
      76             : 
      77             : class TestMplsResourceKey : public MplsIndexResourceKey {
      78             : public:
      79             :     TestMplsResourceKey(ResourceManager *rm,
      80             :                          const std::string &name);
      81             :     virtual ~TestMplsResourceKey();
      82             : 
      83           0 :     virtual const std::string ToString() { return "";}
      84             :     virtual bool IsLess(const ResourceKey &rhs) const;
      85           0 :     virtual void Backup(ResourceData *data, uint16_t op) { }
      86             : 
      87             :     const std::string name_;
      88             :     DISALLOW_COPY_AND_ASSIGN(TestMplsResourceKey);
      89             : };
      90             : 
      91             : #endif

Generated by: LCOV version 1.14