@@ -1079,6 +1079,8 @@ void processBulk(
1079
1079
}
1080
1080
}
1081
1081
1082
+ bool g_sleep = false ;
1083
+
1082
1084
int replay (int argc, char **argv)
1083
1085
{
1084
1086
// swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_DEBUG);
@@ -1246,17 +1248,51 @@ int replay(int argc, char **argv)
1246
1248
catch (const std::exception &e)
1247
1249
{
1248
1250
SWSS_LOG_NOTICE (" line: %s" , line.c_str ());
1249
- SWSS_LOG_NOTICE (" resp: %s" , response.c_str ());
1251
+ SWSS_LOG_NOTICE (" resp (expected): %s" , response.c_str ());
1252
+ SWSS_LOG_NOTICE (" got: %s" , sai_serialize_status (status).c_str ());
1253
+
1254
+ if (api == SAI_COMMON_API_GET && (status == SAI_STATUS_SUCCESS || status == SAI_STATUS_BUFFER_OVERFLOW))
1255
+ {
1256
+ // log each get parameter
1257
+ for (uint32_t i = 0 ; i < attr_count; ++i)
1258
+ {
1259
+ auto meta = sai_metadata_get_attr_metadata (object_type, attr_list[i].id );
1260
+
1261
+ auto val = sai_serialize_attr_value (*meta, attr_list[i]);
1262
+
1263
+ SWSS_LOG_NOTICE (" - %s:%s" , meta->attridname , val.c_str ());
1264
+ }
1265
+ }
1250
1266
1251
1267
exit (EXIT_FAILURE);
1252
1268
}
1269
+
1270
+ if (api == SAI_COMMON_API_GET && (status == SAI_STATUS_SUCCESS || status == SAI_STATUS_BUFFER_OVERFLOW))
1271
+ {
1272
+ // log each get parameter
1273
+ for (uint32_t i = 0 ; i < attr_count; ++i)
1274
+ {
1275
+ auto meta = sai_metadata_get_attr_metadata (object_type, attr_list[i].id );
1276
+
1277
+ auto val = sai_serialize_attr_value (*meta, attr_list[i]);
1278
+
1279
+ SWSS_LOG_NOTICE (" - %s:%s" , meta->attridname , val.c_str ());
1280
+ }
1281
+ }
1253
1282
}
1254
1283
}
1255
1284
1256
1285
infile.close ();
1257
1286
1258
1287
SWSS_LOG_NOTICE (" finished replaying %s with SUCCESS" , filename);
1259
1288
1289
+ if (g_sleep)
1290
+ {
1291
+ fprintf (stderr, " Reply SUCCESS, sleeping, watching for notifications\n " );
1292
+
1293
+ sleep (-1 );
1294
+ }
1295
+
1260
1296
return 0 ;
1261
1297
}
1262
1298
@@ -1273,6 +1309,8 @@ void printUsage()
1273
1309
std::cout << " Enable temporary view between init and apply" << std::endl << std::endl;
1274
1310
std::cout << " -i --inspectAsic:" << std::endl;
1275
1311
std::cout << " Inspect ASIC by ASIC DB" << std::endl << std::endl;
1312
+ std::cout << " -s --sleep:" << std::endl;
1313
+ std::cout << " Sleep after success reply, to notice any switch notifications" << std::endl << std::endl;
1276
1314
std::cout << " -h --help:" << std::endl;
1277
1315
std::cout << " Print out this message" << std::endl << std::endl;
1278
1316
}
@@ -1293,10 +1331,11 @@ int handleCmdLine(int argc, char **argv)
1293
1331
{ " skipNotifySyncd" , no_argument, 0 , ' C' },
1294
1332
{ " enableDebug" , no_argument, 0 , ' d' },
1295
1333
{ " inspectAsic" , no_argument, 0 , ' i' },
1334
+ { " sleep" , no_argument, 0 , ' s' },
1296
1335
{ 0 , 0 , 0 , 0 }
1297
1336
};
1298
1337
1299
- const char * const optstring = " hCdui " ;
1338
+ const char * const optstring = " hCduis " ;
1300
1339
1301
1340
int c = getopt_long (argc, argv, optstring, long_options, 0 );
1302
1341
@@ -1321,6 +1360,10 @@ int handleCmdLine(int argc, char **argv)
1321
1360
g_inspectAsic = true ;
1322
1361
break ;
1323
1362
1363
+ case ' s' :
1364
+ g_sleep = true ;
1365
+ break ;
1366
+
1324
1367
case ' h' :
1325
1368
printUsage ();
1326
1369
exit (EXIT_SUCCESS);
0 commit comments