File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 5
5
#include " swss/tokenize.h"
6
6
#include < limits.h>
7
7
8
+ extern " C" {
9
+ #include < sai.h>
10
+ }
11
+
8
12
#include < iostream>
9
13
#include < map>
10
14
@@ -65,12 +69,10 @@ std::set<sai_object_id_t> initViewRemovedVidSet;
65
69
*/
66
70
volatile bool g_asicInitViewMode = false ;
67
71
68
- #ifdef SAITHRIFT
69
72
/*
70
- * SAI switch global needed for RPC server
73
+ * SAI switch global needed for RPC server and for remove_switch
71
74
*/
72
75
sai_object_id_t gSwitchId ;
73
- #endif
74
76
75
77
struct cmdOptions
76
78
{
@@ -1234,10 +1236,8 @@ sai_status_t handle_generic(
1234
1236
if (object_type == SAI_OBJECT_TYPE_SWITCH)
1235
1237
{
1236
1238
on_switch_create (switch_id);
1237
- #ifdef SAITHRIFT
1238
1239
gSwitchId = real_object_id;
1239
1240
SWSS_LOG_NOTICE (" Initialize gSwitchId with ID = 0x%lx" , gSwitchId );
1240
- #endif
1241
1241
}
1242
1242
}
1243
1243
@@ -3395,6 +3395,15 @@ int syncd_main(int argc, char **argv)
3395
3395
}
3396
3396
}
3397
3397
3398
+ SWSS_LOG_NOTICE (" Removing the switch gSwitchId=0x%lx" , gSwitchId );
3399
+ sai_switch_api_t *sai_switch_api = NULL ;
3400
+ sai_api_query (SAI_API_SWITCH, (void **)&sai_switch_api);
3401
+ status = sai_switch_api->remove_switch (gSwitchId );
3402
+ if (status != SAI_STATUS_SUCCESS)
3403
+ {
3404
+ SWSS_LOG_NOTICE (" Can't delete a switch. gSwitchId=0x%lx status=0xx" , gSwitchId , status);
3405
+ }
3406
+
3398
3407
SWSS_LOG_NOTICE (" calling api uninitialize" );
3399
3408
3400
3409
status = sai_api_uninitialize ();
You can’t perform that action at this time.
0 commit comments