OpenSDN source code
mpls_index.h
Go to the documentation of this file.
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  */
21 
22 class ResourceManager;
23 class ResourceKey;
24 class NextHopKey;
25 
27 public:
28  enum Type {
32  EDGEMCAST
33  };
35  virtual ~MplsIndexResourceKey();
36  virtual void Backup(ResourceData *data, uint16_t op) {assert(0);}
37  Type type() const {return type_;}
38 private:
40 };
41 
42 //Nexthop mpls label
44 public:
46  virtual ~NexthopIndexResourceKey();
47 
48  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  const NextHopKey *GetNhKey() const { return nh_key_.get(); }
55 private:
56  std::unique_ptr<NextHopKey> nh_key_;
58 };
59 
60 //Route mpls label
62 public:
64  const std::string &vrf_name,
65  const std::string route_str);
66  virtual ~RouteMplsResourceKey();
67 
68  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_;
75 };
76 
78 public:
80  const std::string &name);
81  virtual ~TestMplsResourceKey();
82 
83  virtual const std::string ToString() { return "";}
84  virtual bool IsLess(const ResourceKey &rhs) const;
85  virtual void Backup(ResourceData *data, uint16_t op) { }
86 
87  const std::string name_;
89 };
90 
91 #endif
MplsIndexResourceKey(ResourceManager *rm, Type type)
Definition: mpls_index.cc:26
virtual ~MplsIndexResourceKey()
Definition: mpls_index.cc:31
virtual void Backup(ResourceData *data, uint16_t op)
Definition: mpls_index.h:36
Type type() const
Definition: mpls_index.h:37
const NextHopKey * GetNhKey() const
Definition: mpls_index.h:54
NexthopIndexResourceKey(ResourceManager *rm, NextHopKey *nh_key)
Definition: mpls_index.cc:35
std::unique_ptr< NextHopKey > nh_key_
Definition: mpls_index.h:56
DISALLOW_COPY_AND_ASSIGN(NexthopIndexResourceKey)
void BackupVlanResource(ResourceData *data, uint16_t op)
Definition: mpls_index.cc:143
void BackupVrfResource(ResourceData *data, uint16_t op)
Definition: mpls_index.cc:116
virtual void Backup(ResourceData *data, uint16_t op)
Definition: mpls_index.cc:59
virtual bool IsLess(const ResourceKey &rhs) const
Definition: mpls_index.cc:44
virtual ~NexthopIndexResourceKey()
Definition: mpls_index.cc:41
void BackupInterfaceResource(ResourceData *data, uint16_t op)
Definition: mpls_index.cc:77
virtual const std::string ToString()
Definition: mpls_index.h:48
ResourceManager * rm()
const std::string vrf_name_
Definition: mpls_index.h:72
virtual const std::string ToString()
Definition: mpls_index.h:68
virtual ~RouteMplsResourceKey()
Definition: mpls_index.cc:177
RouteMplsResourceKey(ResourceManager *rm, const std::string &vrf_name, const std::string route_str)
Definition: mpls_index.cc:170
virtual bool IsLess(const ResourceKey &rhs) const
Definition: mpls_index.cc:180
virtual void Backup(ResourceData *data, uint16_t op)
Definition: mpls_index.cc:194
DISALLOW_COPY_AND_ASSIGN(RouteMplsResourceKey)
const std::string route_key_
Definition: mpls_index.h:73
DISALLOW_COPY_AND_ASSIGN(TestMplsResourceKey)
virtual void Backup(ResourceData *data, uint16_t op)
Definition: mpls_index.h:85
virtual const std::string ToString()
Definition: mpls_index.h:83
virtual bool IsLess(const ResourceKey &rhs) const
Definition: mpls_index.cc:226
const std::string name_
Definition: mpls_index.h:87
TestMplsResourceKey(ResourceManager *rm, const std::string &name)
Definition: mpls_index.cc:218
virtual ~TestMplsResourceKey()
Definition: mpls_index.cc:223
SandeshTraceBufferPtr VrfMplsDataTraceBuf
SandeshTraceBufferPtr RouteMplsDataTraceBuf
SandeshTraceBufferPtr VlanMplsDataTraceBuf
SandeshTraceBufferPtr InterfaceMplsDataTraceBuf
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
Definition: sandesh_trace.h:19