-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support TWAMP Light notification in syncd #1306
Merged
kcudnik
merged 1 commit into
sonic-net:master
from
CentecNetworks:devpr_yoush_support_twamp_light_in_sairedis
Dec 15, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just return here ? and valid variable is not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for comments.
It should check the object type of session_id whether it is TWAMP session. So we add valid variable and set as true when the object type is TWAMP session, otherwise use default value as false. If the valid variable is false, it would just return the error log.