-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support TWAMP Light notification in syncd
Signed-off-by: yoush <[email protected]>
- Loading branch information
Showing
17 changed files
with
488 additions
and
9 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,77 @@ | ||
#include "NotificationTwampSessionEvent.h" | ||
|
||
#include "swss/logger.h" | ||
|
||
#include "meta/sai_serialize.h" | ||
|
||
using namespace sairedis; | ||
|
||
NotificationTwampSessionEvent::NotificationTwampSessionEvent( | ||
_In_ const std::string& serializedNotification): | ||
Notification( | ||
SAI_SWITCH_NOTIFICATION_TYPE_TWAMP_SESSION_EVENT, | ||
serializedNotification), | ||
m_twampSessionEventNotificationData(nullptr) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
sai_deserialize_twamp_session_event_ntf( | ||
serializedNotification, | ||
m_count, | ||
&m_twampSessionEventNotificationData); | ||
} | ||
|
||
NotificationTwampSessionEvent::~NotificationTwampSessionEvent() | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
sai_deserialize_free_twamp_session_event_ntf(m_count, m_twampSessionEventNotificationData); | ||
} | ||
|
||
sai_object_id_t NotificationTwampSessionEvent::getSwitchId() const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
// this notification don't contain switch id field | ||
|
||
return SAI_NULL_OBJECT_ID; | ||
} | ||
|
||
sai_object_id_t NotificationTwampSessionEvent::getAnyObjectId() const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
if (m_twampSessionEventNotificationData == nullptr) | ||
{ | ||
return SAI_NULL_OBJECT_ID; | ||
} | ||
|
||
for (uint32_t idx = 0; idx < m_count; idx++) | ||
{ | ||
if (m_twampSessionEventNotificationData[idx].twamp_session_id != SAI_NULL_OBJECT_ID) | ||
{ | ||
return m_twampSessionEventNotificationData[idx].twamp_session_id; | ||
} | ||
} | ||
|
||
return SAI_NULL_OBJECT_ID; | ||
} | ||
|
||
void NotificationTwampSessionEvent::processMetadata( | ||
_In_ std::shared_ptr<saimeta::Meta> meta) const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
meta->meta_sai_on_twamp_session_event(m_count, m_twampSessionEventNotificationData); | ||
} | ||
|
||
void NotificationTwampSessionEvent::executeCallback( | ||
_In_ const sai_switch_notifications_t& switchNotifications) const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
if (switchNotifications.on_twamp_session_event) | ||
{ | ||
switchNotifications.on_twamp_session_event(m_count, m_twampSessionEventNotificationData); | ||
} | ||
} |
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,35 @@ | ||
#pragma once | ||
|
||
#include "Notification.h" | ||
|
||
namespace sairedis | ||
{ | ||
class NotificationTwampSessionEvent: | ||
public Notification | ||
{ | ||
public: | ||
|
||
NotificationTwampSessionEvent( | ||
_In_ const std::string& serializedNotification); | ||
|
||
virtual ~NotificationTwampSessionEvent(); | ||
|
||
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: | ||
|
||
uint32_t m_count; | ||
|
||
sai_twamp_session_event_notification_data_t *m_twampSessionEventNotificationData; | ||
}; | ||
} |
Oops, something went wrong.