@@ -17,11 +17,27 @@ using namespace swss;
17
17
#define SELECT_TIMEOUT 1000
18
18
#define PFC_WD_POLL_MSECS 100
19
19
20
+ /* Switch table key */
21
+ #define SWITCH_TABLE_KEY " switch"
22
+
20
23
extern sai_switch_api_t * sai_switch_api;
21
24
extern sai_object_id_t gSwitchId ;
22
25
extern bool gSaiRedisLogRotate ;
23
26
24
27
extern void syncd_apply_view ();
28
+
29
+ /*
30
+ * Global supported objects variables
31
+ */
32
+ int32_t gSupportedObjectTypeList [SAI_OBJECT_TYPE_MAX];
33
+ uint32_t gSupportedObjectTypeListCount ;
34
+
35
+ /* Global Snapshot support flag */
36
+ bool gIsSnapshotSupported = false ;
37
+
38
+ /* Global Threshold support flag */
39
+ bool gIsThresholdSupported = false ;
40
+
25
41
/*
26
42
* Global orch daemon variables
27
43
*/
@@ -46,6 +62,94 @@ OrchDaemon::OrchDaemon(DBConnector *applDb, DBConnector *configDb, DBConnector *
46
62
m_stateDb(stateDb)
47
63
{
48
64
SWSS_LOG_ENTER ();
65
+
66
+ SWSS_LOG_DEBUG (" gSupportedObjectTypeListCount %d object types\n " , gSupportedObjectTypeListCount );
67
+ if (gSupportedObjectTypeListCount )
68
+ {
69
+ bool isTamCollectorSupported = false ;
70
+ bool isTamReportSupported = false ;
71
+ bool isTamTransportSupported = false ;
72
+ bool isTamSupported = false ;
73
+ bool isTamTelemetrySupported = false ;
74
+ bool isTamEventThresholdSupported = false ;
75
+
76
+ /* Run through supported objects and check if all objects needed for IFA feature are supported or not */
77
+ for (uint32_t iter = 0 ; iter < gSupportedObjectTypeListCount ; iter++)
78
+ {
79
+ switch (gSupportedObjectTypeList [iter])
80
+ {
81
+ case SAI_OBJECT_TYPE_TAM_COLLECTOR:
82
+ {
83
+ isTamCollectorSupported = true ;
84
+ break ;
85
+ }
86
+ case SAI_OBJECT_TYPE_TAM_REPORT:
87
+ {
88
+ isTamReportSupported = true ;
89
+ break ;
90
+ }
91
+ case SAI_OBJECT_TYPE_TAM_TRANSPORT:
92
+ {
93
+ isTamTransportSupported = true ;
94
+ break ;
95
+ }
96
+ case SAI_OBJECT_TYPE_TAM:
97
+ {
98
+ isTamSupported = true ;
99
+ break ;
100
+ }
101
+ case SAI_OBJECT_TYPE_TAM_TELEMETRY:
102
+ {
103
+ isTamTelemetrySupported = true ;
104
+ break ;
105
+ }
106
+ case SAI_OBJECT_TYPE_TAM_EVENT_THRESHOLD:
107
+ {
108
+ isTamEventThresholdSupported = true ;
109
+ break ;
110
+ }
111
+ }
112
+ }
113
+
114
+ /* Snapshot support */
115
+ if (isTamCollectorSupported && isTamSupported && isTamTelemetrySupported &&
116
+ isTamReportSupported && isTamTransportSupported)
117
+ {
118
+ if (isTamSupported && isTamTelemetrySupported)
119
+ SWSS_LOG_DEBUG (" TAM and telemetry objects supported." );
120
+
121
+ /* Added snapshot supported field in APP DB's switch table */
122
+ Table m_appSwitchTable (m_applDb, APP_SWITCH_TABLE_NAME);
123
+ string key = SWITCH_TABLE_KEY;
124
+ vector<FieldValueTuple> fvVector;
125
+ FieldValueTuple snapshot_supported (SNAPSHOT_SUPPORTED_FIELD, " True" );
126
+ fvVector.push_back (snapshot_supported);
127
+
128
+ m_appSwitchTable.set (key, fvVector);
129
+
130
+ SWSS_LOG_DEBUG (" APP Switch Table updated with snapshot supported entry\n " );
131
+
132
+ gIsSnapshotSupported = true ;
133
+ }
134
+
135
+ /* Threshold support */
136
+ if (isTamCollectorSupported && isTamSupported && isTamTelemetrySupported &&
137
+ isTamReportSupported && isTamTransportSupported && isTamEventThresholdSupported)
138
+ {
139
+ /* Added threshold_supported field in APP DB's switch table */
140
+ Table m_appSwitchTable (m_applDb, APP_SWITCH_TABLE_NAME);
141
+ string key = SWITCH_TABLE_KEY;
142
+ vector<FieldValueTuple> fvVector;
143
+ FieldValueTuple threshold_supported (THRESHOLD_SUPPORTED_FIELD, " True" );
144
+ fvVector.push_back (threshold_supported);
145
+
146
+ m_appSwitchTable.set (key, fvVector);
147
+
148
+ SWSS_LOG_DEBUG (" APP Switch Table updated with threshold_supported entry\n " );
149
+
150
+ gIsThresholdSupported = true ;
151
+ }
152
+ }
49
153
}
50
154
51
155
OrchDaemon::~OrchDaemon ()
0 commit comments