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

Generated by: LCOV version 1.14