forked from sonic-net/sonic-swss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sflowmgr.h
67 lines (55 loc) · 1.95 KB
/
sflowmgr.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
#pragma once
#include "dbconnector.h"
#include "orch.h"
#include "producerstatetable.h"
#include <map>
#include <set>
#include <string>
namespace swss {
#define SFLOW_SAMPLE_RATE_KEY_400G "400000"
#define SFLOW_SAMPLE_RATE_KEY_100G "100000"
#define SFLOW_SAMPLE_RATE_KEY_50G "50000"
#define SFLOW_SAMPLE_RATE_KEY_40G "40000"
#define SFLOW_SAMPLE_RATE_KEY_25G "25000"
#define SFLOW_SAMPLE_RATE_KEY_10G "10000"
#define SFLOW_SAMPLE_RATE_KEY_1G "1000"
#define SFLOW_SAMPLE_RATE_VALUE_400G "40000"
#define SFLOW_SAMPLE_RATE_VALUE_100G "10000"
#define SFLOW_SAMPLE_RATE_VALUE_50G "5000"
#define SFLOW_SAMPLE_RATE_VALUE_40G "4000"
#define SFLOW_SAMPLE_RATE_VALUE_25G "2500"
#define SFLOW_SAMPLE_RATE_VALUE_10G "1000"
#define SFLOW_SAMPLE_RATE_VALUE_1G "100"
#define SFLOW_ERROR_SPEED_STR "error"
struct SflowPortInfo
{
bool local_conf;
std::string speed;
std::string rate;
std::string admin;
};
/* Port to Local config map */
typedef std::map<std::string, SflowPortInfo> SflowPortConfMap;
class SflowMgr : public Orch
{
public:
SflowMgr(DBConnector *cfgDb, DBConnector *appDb, const std::vector<std::string> &tableNames);
using Orch::doTask;
private:
Table m_cfgSflowTable;
Table m_cfgSflowSessionTable;
ProducerStateTable m_appSflowTable;
ProducerStateTable m_appSflowSessionTable;
SflowPortConfMap m_sflowPortConfMap;
bool m_intfAllConf;
bool m_gEnable;
void doTask(Consumer &consumer);
void sflowHandleService(bool enable);
void sflowUpdatePortInfo(Consumer &consumer);
void sflowHandleSessionAll(bool enable);
void sflowHandleSessionLocal(bool enable);
void sflowCheckAndFillValues(std::string alias, std::vector<FieldValueTuple> &fvs);
void sflowGetPortInfo(std::vector<FieldValueTuple> &fvs, SflowPortInfo &local_info);
void sflowGetGlobalInfo(std::vector<FieldValueTuple> &fvs, std::string speed);
};
}