From 6234ba319854923bdcf7b06041e6e08bef151c8f Mon Sep 17 00:00:00 2001 From: Kamil Cudnik Date: Fri, 11 Nov 2016 17:36:24 -0800 Subject: [PATCH] orchagent: Adding init and apply view and enable recording (#133) --- orchagent/main.cpp | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/orchagent/main.cpp b/orchagent/main.cpp index 881c6ad42514..7b3d0e4e2189 100644 --- a/orchagent/main.cpp +++ b/orchagent/main.cpp @@ -14,6 +14,7 @@ extern "C" { #include #include +#include using namespace std; using namespace swss; @@ -168,7 +169,32 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } + SWSS_LOG_NOTICE("Enabling sairedis recording"); + sai_attribute_t attr; + attr.id = SAI_REDIS_SWITCH_ATTR_RECORD; + attr.value.booldata = true; + + status = sai_switch_api->set_switch_attribute(&attr); + + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to enable recording %d", status); + exit(EXIT_FAILURE); + } + + SWSS_LOG_NOTICE("Notify syncd INIT_VIEW"); + + attr.id = SAI_REDIS_SWITCH_ATTR_NOTIFY_SYNCD; + attr.value.s32 = SAI_REDIS_NOTIFY_SYNCD_INIT_VIEW; + status = sai_switch_api->set_switch_attribute(&attr); + + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to notify syncd INIT_VIEW %d", status); + exit(EXIT_FAILURE); + } + attr.id = SAI_SWITCH_ATTR_SRC_MAC_ADDRESS; if (!gMacAddress) { @@ -231,7 +257,20 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } - try { + try + { + SWSS_LOG_NOTICE("Notify syncd APPLY_VIEW"); + + attr.id = SAI_REDIS_SWITCH_ATTR_NOTIFY_SYNCD; + attr.value.s32 = SAI_REDIS_NOTIFY_SYNCD_APPLY_VIEW; + status = sai_switch_api->set_switch_attribute(&attr); + + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to notify syncd APPLY_VIEW %d", status); + exit(EXIT_FAILURE); + } + orchDaemon->start(); } catch (char const *e)