Skip to content

Commit

Permalink
[orchagent, cfgmgr] Add response publisher and state recording
Browse files Browse the repository at this point in the history
* Add response publisher.
* Add APPL STATE DB recording.
* Add response path into vrforch.

Submission containing materials of a third party:
    Copyright Google LLC; Licensed under Apache 2.0

Co-authored-by: Runming Wu <[email protected]>
Co-authored-by: Yilan Ji <[email protected]>
Co-authored-by: Akarsh Gupta <[email protected]>
Co-authored-by: Jay Hu <[email protected]>

Signed-off-by: Don Newton [email protected]
  • Loading branch information
PINS Working Group authored and bocon13 committed Oct 28, 2021
1 parent bfba0ad commit 60885bd
Show file tree
Hide file tree
Showing 29 changed files with 910 additions and 78 deletions.
26 changes: 13 additions & 13 deletions cfgmgr/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,67 +23,67 @@ else
DBGFLAGS = -g
endif

vlanmgrd_SOURCES = vlanmgrd.cpp vlanmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
vlanmgrd_SOURCES = vlanmgrd.cpp vlanmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
vlanmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
vlanmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
vlanmgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS)

teammgrd_SOURCES = teammgrd.cpp teammgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
teammgrd_SOURCES = teammgrd.cpp teammgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
teammgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
teammgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
teammgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS)

portmgrd_SOURCES = portmgrd.cpp portmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
portmgrd_SOURCES = portmgrd.cpp portmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
portmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
portmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
portmgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS)

intfmgrd_SOURCES = intfmgrd.cpp intfmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
intfmgrd_SOURCES = intfmgrd.cpp intfmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
intfmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
intfmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
intfmgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS)

buffermgrd_SOURCES = buffermgrd.cpp buffermgr.cpp buffermgrdyn.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
buffermgrd_SOURCES = buffermgrd.cpp buffermgr.cpp buffermgrdyn.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
buffermgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
buffermgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
buffermgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS)

vrfmgrd_SOURCES = vrfmgrd.cpp vrfmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
vrfmgrd_SOURCES = vrfmgrd.cpp vrfmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
vrfmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
vrfmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
vrfmgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS)

nbrmgrd_SOURCES = nbrmgrd.cpp nbrmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
nbrmgrd_SOURCES = nbrmgrd.cpp nbrmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
nbrmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI) $(LIBNL_CFLAGS)
nbrmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI) $(LIBNL_CPPFLAGS)
nbrmgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS) $(LIBNL_LIBS)

vxlanmgrd_SOURCES = vxlanmgrd.cpp vxlanmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
vxlanmgrd_SOURCES = vxlanmgrd.cpp vxlanmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
vxlanmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
vxlanmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
vxlanmgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS)

sflowmgrd_SOURCES = sflowmgrd.cpp sflowmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
sflowmgrd_SOURCES = sflowmgrd.cpp sflowmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
sflowmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
sflowmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
sflowmgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS)

natmgrd_SOURCES = natmgrd.cpp natmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
natmgrd_SOURCES = natmgrd.cpp natmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
natmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
natmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
natmgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS)

coppmgrd_SOURCES = coppmgrd.cpp coppmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
coppmgrd_SOURCES = coppmgrd.cpp coppmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
coppmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
coppmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
coppmgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS)

tunnelmgrd_SOURCES = tunnelmgrd.cpp tunnelmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
tunnelmgrd_SOURCES = tunnelmgrd.cpp tunnelmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
tunnelmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
tunnelmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
tunnelmgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS)

macsecmgrd_SOURCES = macsecmgrd.cpp macsecmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
macsecmgrd_SOURCES = macsecmgrd.cpp macsecmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp $(top_srcdir)/orchagent/response_publisher.cpp shellcmd.h
macsecmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
macsecmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
macsecmgrd_LDADD = $(COMMON_LIBS) $(SAIMETA_LIBS)
4 changes: 4 additions & 0 deletions cfgmgr/buffermgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
/* Global database mutex */
mutex gDbMutex;

Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/coppmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
/* Global database mutex */
mutex gDbMutex;

Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/intfmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
/* Global database mutex */
mutex gDbMutex;

Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/macsecmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
/* Global database mutex */
mutex gDbMutex;

Expand Down
5 changes: 4 additions & 1 deletion cfgmgr/natmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
mutex gDbMutex;
NatMgr *natmgr = NULL;

Expand Down Expand Up @@ -200,4 +204,3 @@ int main(int argc, char **argv)
}
return -1;
}

4 changes: 4 additions & 0 deletions cfgmgr/nbrmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
/* Global database mutex */
mutex gDbMutex;

Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/portmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
/* Global database mutex */
mutex gDbMutex;

Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/sflowmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
/* Global database mutex */
mutex gDbMutex;

Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/teammgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;

bool received_sigterm = false;

Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/tunnelmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
/* Global database mutex */
mutex gDbMutex;

Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/vlanmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
/* Global database mutex */
mutex gDbMutex;

Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/vrfmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
/* Global database mutex */
mutex gDbMutex;

Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/vxlanmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
/* Global database mutex */
mutex gDbMutex;
MacAddress gMacAddress;
Expand Down
3 changes: 2 additions & 1 deletion orchagent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ orchagent_SOURCES = \
isolationgrouporch.cpp \
muxorch.cpp \
macsecorch.cpp \
lagid.cpp
lagid.cpp \
response_publisher.cpp

orchagent_SOURCES += flex_counter/flex_counter_manager.cpp flex_counter/flex_counter_stat_manager.cpp
orchagent_SOURCES += debug_counter/debug_counter.cpp debug_counter/drop_counter.cpp
Expand Down
69 changes: 46 additions & 23 deletions orchagent/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ extern "C" {
#include <getopt.h>
#include <unistd.h>
#include <inttypes.h>
#include <sstream>
#include <stdexcept>
#include <stdlib.h>
#include <string.h>

Expand Down Expand Up @@ -54,8 +56,10 @@ int gBatchSize = DEFAULT_BATCH_SIZE;

bool gSairedisRecord = true;
bool gSwssRecord = true;
bool gResponsePublisherRecord = true;
bool gLogRotate = false;
bool gSaiRedisLogRotate = false;
bool gResponsePublisherLogRotate = false;
bool gSyncMode = false;
sai_redis_communication_mode_t gRedisCommunicationMode = SAI_REDIS_COMMUNICATION_MODE_REDIS_ASYNC;
string gAsicInstance;
Expand All @@ -64,6 +68,12 @@ extern bool gIsNatSupported;

ofstream gRecordOfs;
string gRecordFile;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;

#define SAIREDIS_RECORD_ENABLE 0x1
#define SWSS_RECORD_ENABLE (0x1 << 1)
#define RESPONSE_PUBLISHER_RECORD_ENABLE (0x1 << 2)

string gMySwitchType = "";
int32_t gVoqMySwitchId = -1;
Expand All @@ -76,11 +86,13 @@ void usage()
{
cout << "usage: orchagent [-h] [-r record_type] [-d record_location] [-f swss_rec_filename] [-j sairedis_rec_filename] [-b batch_size] [-m MAC] [-i INST_ID] [-s] [-z mode] [-k bulk_size]" << endl;
cout << " -h: display this message" << endl;
cout << " -r record_type: record orchagent logs with type (default 3)" << endl;
cout << " -r record_type: record orchagent logs with type (default 7)" << endl;
cout << " Bit 0: sairedis.rec, Bit 1: swss.rec, Bit 2: responsepublisher.rec. For example:" << endl;
cout << " 0: do not record logs" << endl;
cout << " 1: record SAI call sequence as sairedis.rec" << endl;
cout << " 2: record SwSS task sequence as swss.rec" << endl;
cout << " 3: enable both above two records" << endl;
cout << " 7: enable sairedis.rec, swss.rec and responsepublisher.rec" << endl;
cout << " -d record_location: set record logs folder location (default .)" << endl;
cout << " -b batch_size: set consumer table pop operation batch size (default 128)" << endl;
cout << " -m MAC: set switch MAC address" << endl;
Expand All @@ -99,6 +111,7 @@ void sighup_handler(int signo)
*/
gLogRotate = true;
gSaiRedisLogRotate = true;
gResponsePublisherLogRotate = true;
}

void syncd_apply_view()
Expand Down Expand Up @@ -321,6 +334,7 @@ int main(int argc, char **argv)
string record_location = ".";
string swss_rec_filename = "swss.rec";
string sairedis_rec_filename = "sairedis.rec";
int record_type = 7; // All recordings enabled by default.

while ((opt = getopt(argc, argv, "b:m:r:f:j:d:i:hsz:k:")) != -1)
{
Expand All @@ -346,28 +360,13 @@ int main(int argc, char **argv)
gMacAddress = MacAddress(optarg);
break;
case 'r':
if (!strcmp(optarg, "0"))
{
gSairedisRecord = false;
gSwssRecord = false;
}
else if (!strcmp(optarg, "1"))
{
gSwssRecord = false;
}
else if (!strcmp(optarg, "2"))
{
gSairedisRecord = false;
}
else if (!strcmp(optarg, "3"))
{
continue; /* default behavior */
}
else
{
usage();
exit(EXIT_FAILURE);
}
// Disable all recordings if atoi() fails i.e. returns 0 due to
// invalid command line argument.
record_type = atoi(optarg);
if (record_type < 0 || record_type > 7) {
usage();
exit(EXIT_FAILURE);
}
break;
case 'd':
record_location = optarg;
Expand Down Expand Up @@ -434,6 +433,14 @@ int main(int argc, char **argv)
attr.value.ptr = (void *)on_fdb_event;
attrs.push_back(attr);

// Initialize recording parameters.
gSairedisRecord =
(record_type & SAIREDIS_RECORD_ENABLE) == SAIREDIS_RECORD_ENABLE;
gSwssRecord = (record_type & SWSS_RECORD_ENABLE) == SWSS_RECORD_ENABLE;
gResponsePublisherRecord =
(record_type & RESPONSE_PUBLISHER_RECORD_ENABLE) ==
RESPONSE_PUBLISHER_RECORD_ENABLE;

/* Disable/enable SwSS recording */
if (gSwssRecord)
{
Expand All @@ -447,6 +454,22 @@ int main(int argc, char **argv)
gRecordOfs << getTimestamp() << "|recording started" << endl;
}

// Disable/Enable response publisher recording.
if (gResponsePublisherRecord) {
gResponsePublisherRecordFile =
record_location + "/" + "responsepublisher.rec";
gResponsePublisherRecordOfs.open(gResponsePublisherRecordFile,
std::ofstream::out | std::ofstream::app);
if (!gResponsePublisherRecordOfs.is_open()) {
SWSS_LOG_ERROR("Failed to open Response Publisher recording file %s",
gResponsePublisherRecordFile.c_str());
gResponsePublisherRecord = false;
} else {
gResponsePublisherRecordOfs << getTimestamp() << "|recording started"
<< endl;
}
}

attr.id = SAI_SWITCH_ATTR_PORT_STATE_CHANGE_NOTIFY;
attr.value.ptr = (void *)on_port_state_change;
attrs.push_back(attr);
Expand Down
Loading

0 comments on commit 60885bd

Please sign in to comment.