@@ -13,42 +13,22 @@ extern "C" {
13
13
#include < unistd.h>
14
14
15
15
#include < sairedis.h>
16
+ #include < logger.h>
17
+
16
18
#include " orchdaemon.h"
17
- #include " logger .h"
19
+ #include " saihelper .h"
18
20
19
21
using namespace std ;
20
22
using namespace swss ;
21
23
22
24
extern sai_switch_notification_t switch_notifications;
23
25
24
- #define UNREFERENCED_PARAMETER (P ) (P)
26
+ extern sai_switch_api_t *sai_switch_api;
27
+ extern sai_router_interface_api_t *sai_router_intfs_api;
25
28
26
- /* Initialize all global api pointers */
27
- sai_switch_api_t * sai_switch_api;
28
- sai_virtual_router_api_t * sai_virtual_router_api;
29
- sai_port_api_t * sai_port_api;
30
- sai_vlan_api_t * sai_vlan_api;
31
- sai_router_interface_api_t * sai_router_intfs_api;
32
- sai_hostif_api_t * sai_hostif_api;
33
- sai_neighbor_api_t * sai_neighbor_api;
34
- sai_next_hop_api_t * sai_next_hop_api;
35
- sai_next_hop_group_api_t * sai_next_hop_group_api;
36
- sai_route_api_t * sai_route_api;
37
- sai_lag_api_t * sai_lag_api;
38
- sai_policer_api_t * sai_policer_api;
39
- sai_tunnel_api_t * sai_tunnel_api;
40
- sai_queue_api_t * sai_queue_api;
41
- sai_scheduler_api_t * sai_scheduler_api;
42
- sai_scheduler_group_api_t * sai_scheduler_group_api;
43
- sai_wred_api_t * sai_wred_api;
44
- sai_qos_map_api_t * sai_qos_map_api;
45
- sai_buffer_api_t * sai_buffer_api;
46
- sai_acl_api_t * sai_acl_api;
47
- sai_mirror_api_t * sai_mirror_api;
48
- sai_fdb_api_t * sai_fdb_api;
29
+ #define UNREFERENCED_PARAMETER (P ) (P)
49
30
50
31
/* Global variables */
51
- map<string, string> gProfileMap ;
52
32
sai_object_id_t gVirtualRouterId ;
53
33
sai_object_id_t gUnderlayIfId ;
54
34
MacAddress gMacAddress ;
@@ -64,108 +44,6 @@ string gRecordFile;
64
44
/* Global database mutex */
65
45
mutex gDbMutex ;
66
46
67
- const char *test_profile_get_value (
68
- _In_ sai_switch_profile_id_t profile_id,
69
- _In_ const char *variable)
70
- {
71
- SWSS_LOG_ENTER ();
72
-
73
- auto it = gProfileMap .find (variable);
74
-
75
- if (it == gProfileMap .end ())
76
- return NULL ;
77
- return it->second .c_str ();
78
- }
79
-
80
- int test_profile_get_next_value (
81
- _In_ sai_switch_profile_id_t profile_id,
82
- _Out_ const char **variable,
83
- _Out_ const char **value)
84
- {
85
- SWSS_LOG_ENTER ();
86
-
87
- static auto it = gProfileMap .begin ();
88
-
89
- if (value == NULL )
90
- {
91
- // Restarts enumeration
92
- it = gProfileMap .begin ();
93
- }
94
- else if (it == gProfileMap .end ())
95
- {
96
- return -1 ;
97
- }
98
- else
99
- {
100
- *variable = it->first .c_str ();
101
- *value = it->second .c_str ();
102
- it++;
103
- }
104
-
105
- if (it != gProfileMap .end ())
106
- return 0 ;
107
- else
108
- return -1 ;
109
- }
110
-
111
- const service_method_table_t test_services = {
112
- test_profile_get_value,
113
- test_profile_get_next_value
114
- };
115
-
116
- void initSaiApi ()
117
- {
118
- SWSS_LOG_ENTER ();
119
-
120
- sai_api_initialize (0 , (service_method_table_t *)&test_services);
121
-
122
- sai_api_query (SAI_API_SWITCH, (void **)&sai_switch_api);
123
- sai_api_query (SAI_API_VIRTUAL_ROUTER, (void **)&sai_virtual_router_api);
124
- sai_api_query (SAI_API_PORT, (void **)&sai_port_api);
125
- sai_api_query (SAI_API_FDB, (void **)&sai_fdb_api);
126
- sai_api_query (SAI_API_VLAN, (void **)&sai_vlan_api);
127
- sai_api_query (SAI_API_HOST_INTERFACE, (void **)&sai_hostif_api);
128
- sai_api_query (SAI_API_MIRROR, (void **)&sai_mirror_api);
129
- sai_api_query (SAI_API_ROUTER_INTERFACE, (void **)&sai_router_intfs_api);
130
- sai_api_query (SAI_API_NEIGHBOR, (void **)&sai_neighbor_api);
131
- sai_api_query (SAI_API_NEXT_HOP, (void **)&sai_next_hop_api);
132
- sai_api_query (SAI_API_NEXT_HOP_GROUP, (void **)&sai_next_hop_group_api);
133
- sai_api_query (SAI_API_ROUTE, (void **)&sai_route_api);
134
- sai_api_query (SAI_API_LAG, (void **)&sai_lag_api);
135
- sai_api_query (SAI_API_POLICER, (void **)&sai_policer_api);
136
- sai_api_query (SAI_API_TUNNEL, (void **)&sai_tunnel_api);
137
- sai_api_query (SAI_API_QUEUE, (void **)&sai_queue_api);
138
- sai_api_query (SAI_API_SCHEDULER, (void **)&sai_scheduler_api);
139
- sai_api_query (SAI_API_WRED, (void **)&sai_wred_api);
140
- sai_api_query (SAI_API_QOS_MAPS, (void **)&sai_qos_map_api);
141
- sai_api_query (SAI_API_BUFFERS, (void **)&sai_buffer_api);
142
- sai_api_query (SAI_API_SCHEDULER_GROUP, (void **)&sai_scheduler_group_api);
143
- sai_api_query (SAI_API_ACL, (void **)&sai_acl_api);
144
-
145
- sai_log_set (SAI_API_SWITCH, SAI_LOG_NOTICE);
146
- sai_log_set (SAI_API_VIRTUAL_ROUTER, SAI_LOG_NOTICE);
147
- sai_log_set (SAI_API_PORT, SAI_LOG_NOTICE);
148
- sai_log_set (SAI_API_FDB, SAI_LOG_NOTICE);
149
- sai_log_set (SAI_API_VLAN, SAI_LOG_NOTICE);
150
- sai_log_set (SAI_API_HOST_INTERFACE, SAI_LOG_NOTICE);
151
- sai_log_set (SAI_API_MIRROR, SAI_LOG_NOTICE);
152
- sai_log_set (SAI_API_ROUTER_INTERFACE, SAI_LOG_NOTICE);
153
- sai_log_set (SAI_API_NEIGHBOR, SAI_LOG_NOTICE);
154
- sai_log_set (SAI_API_NEXT_HOP, SAI_LOG_NOTICE);
155
- sai_log_set (SAI_API_NEXT_HOP_GROUP, SAI_LOG_NOTICE);
156
- sai_log_set (SAI_API_ROUTE, SAI_LOG_NOTICE);
157
- sai_log_set (SAI_API_LAG, SAI_LOG_NOTICE);
158
- sai_log_set (SAI_API_POLICER, SAI_LOG_NOTICE);
159
- sai_log_set (SAI_API_TUNNEL, SAI_LOG_NOTICE);
160
- sai_log_set (SAI_API_QUEUE, SAI_LOG_NOTICE);
161
- sai_log_set (SAI_API_SCHEDULER, SAI_LOG_NOTICE);
162
- sai_log_set (SAI_API_WRED, SAI_LOG_NOTICE);
163
- sai_log_set (SAI_API_QOS_MAPS, SAI_LOG_NOTICE);
164
- sai_log_set (SAI_API_BUFFERS, SAI_LOG_NOTICE);
165
- sai_log_set (SAI_API_SCHEDULER_GROUP, SAI_LOG_NOTICE);
166
- sai_log_set (SAI_API_ACL, SAI_LOG_NOTICE);
167
- }
168
-
169
47
string getTimestamp ()
170
48
{
171
49
char buffer[64 ];
0 commit comments