forked from sonic-net/sonic-sairedis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support ASIC/SDK health event (sonic-net#1340)
* ASIC/SDK health event Signed-off-by: Stephen Sun <[email protected]> * Fix check error Signed-off-by: Stephen Sun <[email protected]> * Fix UT error Signed-off-by: Stephen Sun <[email protected]> * Improve coverage Signed-off-by: Stephen Sun <[email protected]> * Fix review comments Signed-off-by: Stephen Sun <[email protected]> --------- Signed-off-by: Stephen Sun <[email protected]>
- Loading branch information
Showing
25 changed files
with
631 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#include "NotificationSwitchAsicSdkHealthEvent.h" | ||
|
||
#include "swss/logger.h" | ||
|
||
#include "sai_serialize.h" | ||
|
||
using namespace sairedis; | ||
|
||
NotificationSwitchAsicSdkHealthEvent::NotificationSwitchAsicSdkHealthEvent( | ||
_In_ const std::string& serializedNotification): | ||
Notification( | ||
SAI_SWITCH_NOTIFICATION_TYPE_SWITCH_ASIC_SDK_HEALTH_EVENT, | ||
serializedNotification) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
sai_deserialize_switch_asic_sdk_health_event(serializedNotification, | ||
m_switchId, | ||
m_severity, | ||
m_timestamp, | ||
m_category, | ||
m_healthData, | ||
m_description); | ||
} | ||
|
||
NotificationSwitchAsicSdkHealthEvent::~NotificationSwitchAsicSdkHealthEvent() | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
sai_deserialize_free_switch_asic_sdk_health_event(m_description); | ||
} | ||
|
||
sai_object_id_t NotificationSwitchAsicSdkHealthEvent::getSwitchId() const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
return m_switchId; | ||
} | ||
|
||
sai_object_id_t NotificationSwitchAsicSdkHealthEvent::getAnyObjectId() const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
return m_switchId; | ||
} | ||
|
||
void NotificationSwitchAsicSdkHealthEvent::processMetadata( | ||
_In_ std::shared_ptr<saimeta::Meta> meta) const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
meta->meta_sai_on_switch_asic_sdk_health_event(m_switchId, | ||
m_severity, | ||
m_timestamp, | ||
m_category, | ||
m_healthData, | ||
m_description); | ||
} | ||
|
||
void NotificationSwitchAsicSdkHealthEvent::executeCallback( | ||
_In_ const sai_switch_notifications_t& switchNotifications) const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
if (switchNotifications.on_switch_asic_sdk_health_event) | ||
{ | ||
switchNotifications.on_switch_asic_sdk_health_event(m_switchId, | ||
m_severity, | ||
m_timestamp, | ||
m_category, | ||
m_healthData, | ||
m_description); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#pragma once | ||
|
||
#include "Notification.h" | ||
|
||
namespace sairedis | ||
{ | ||
class NotificationSwitchAsicSdkHealthEvent: | ||
public Notification | ||
{ | ||
public: | ||
|
||
NotificationSwitchAsicSdkHealthEvent( | ||
_In_ const std::string& serializedNotification); | ||
|
||
virtual ~NotificationSwitchAsicSdkHealthEvent(); | ||
|
||
public: | ||
|
||
virtual sai_object_id_t getSwitchId() const override; | ||
|
||
virtual sai_object_id_t getAnyObjectId() const override; | ||
|
||
virtual void processMetadata( | ||
_In_ std::shared_ptr<saimeta::Meta> meta) const override; | ||
|
||
virtual void executeCallback( | ||
_In_ const sai_switch_notifications_t& switchNotifications) const override; | ||
|
||
private: | ||
|
||
sai_object_id_t m_switchId; | ||
sai_switch_asic_sdk_health_severity_t m_severity; | ||
sai_switch_asic_sdk_health_category_t m_category; | ||
sai_timespec_t m_timestamp; | ||
sai_switch_health_data_t m_healthData; | ||
sai_u8_list_t m_description; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.