forked from sonic-net/sonic-swss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vxlanmgr.h
78 lines (63 loc) · 2.05 KB
/
vxlanmgr.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef __VXLANMGR__
#define __VXLANMGR__
#include "dbconnector.h"
#include "producerstatetable.h"
#include "orch.h"
#include <map>
#include <memory>
#include <string>
#include <utility>
namespace swss {
class VxlanMgr : public Orch
{
public:
VxlanMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const std::vector<std::string> &tableNames);
using Orch::doTask;
typedef struct VxlanInfo
{
std::string m_vxlanTunnel;
std::string m_sourceIp;
std::string m_vnet;
std::string m_vni;
std::string m_vxlan;
std::string m_vxlanIf;
std::string m_macAddress;
} VxlanInfo;
~VxlanMgr();
private:
void doTask(Consumer &consumer);
bool doVxlanCreateTask(const KeyOpFieldsValuesTuple & t);
bool doVxlanDeleteTask(const KeyOpFieldsValuesTuple & t);
bool doVxlanTunnelCreateTask(const KeyOpFieldsValuesTuple & t);
bool doVxlanTunnelDeleteTask(const KeyOpFieldsValuesTuple & t);
bool doVxlanTunnelMapCreateTask(const KeyOpFieldsValuesTuple & t);
bool doVxlanTunnelMapDeleteTask(const KeyOpFieldsValuesTuple & t);
/*
* Query the state of vrf by STATE_VRF_TABLE
* Return
* true: The state of vrf is OK
* false: the vrf hasn't been created
*/
bool isVrfStateOk(const std::string & vrfName);
bool isVxlanStateOk(const std::string & vxlanName);
std::pair<bool, std::string> getVxlanRouterMacAddress();
bool createVxlan(const VxlanInfo & info);
bool deleteVxlan(const VxlanInfo & info);
void clearAllVxlanDevices();
ProducerStateTable m_appVxlanTunnelTable,m_appVxlanTunnelMapTable;
Table m_cfgVxlanTunnelTable,m_cfgVnetTable,m_stateVrfTable,m_stateVxlanTable, m_appSwitchTable;
/*
* Vxlan Tunnel Cache
* Key: tunnel name
* Value: Field Value pairs of vxlan tunnel
*/
std::map<std::string, std::vector<FieldValueTuple> > m_vxlanTunnelCache;
/*
* Vnet Cache
* Key: Vnet name
* Value: Vxlan information of this vnet
*/
std::map<std::string, VxlanInfo> m_vnetCache;
};
}
#endif