-
Notifications
You must be signed in to change notification settings - Fork 365
SAI NAT aging notification #987
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
20e1353
SAI NAT aging notification
arvbb e0999a4
Merge branch 'master' into master
arvbb baac383
UT changes for NAT notification
arvbb 6cc807b
SaiSerialize UT case
arvbb e1d41ed
Merge branch 'sonic-net:master' into master
arvbb 56e3648
NotificationProcessorTest UT case
arvbb feda97d
more UT
arvbb 1a36402
executeCallback test
arvbb fe40729
checking notification with db
arvbb 348bffd
NotificationHandler UT
arvbb c835dd1
Merge branch 'master' into master
arvbb 0511be5
Adding comments based on code-review
arvbb 219137f
Adding comments for delete part based on code-review
arvbb 97d5d23
Fixing aspellcheck error
arvbb 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,97 @@ | ||
| #include "NotificationNatEvent.h" | ||
|
|
||
| #include "swss/logger.h" | ||
|
|
||
| #include "sai_serialize.h" | ||
|
|
||
| using namespace sairedis; | ||
|
|
||
| NotificationNatEvent::NotificationNatEvent( | ||
| _In_ const std::string& serializedNotification): | ||
| Notification( | ||
| SAI_SWITCH_NOTIFICATION_TYPE_NAT_EVENT, | ||
| serializedNotification), | ||
| m_natEventNotificationData(nullptr) | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
| sai_deserialize_nat_event_ntf( | ||
| serializedNotification, | ||
| m_count, | ||
| &m_natEventNotificationData); | ||
| } | ||
|
|
||
| NotificationNatEvent::~NotificationNatEvent() | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
| sai_deserialize_free_nat_event_ntf(m_count, m_natEventNotificationData); | ||
| } | ||
|
|
||
| sai_object_id_t NotificationNatEvent::getSwitchId() const | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
| if (m_natEventNotificationData == nullptr) | ||
| { | ||
| return SAI_NULL_OBJECT_ID; | ||
| } | ||
|
|
||
| for (uint32_t idx = 0; idx < m_count; idx++) | ||
| { | ||
| auto& nat = m_natEventNotificationData[idx].nat_entry; | ||
|
|
||
| if (nat.switch_id != SAI_NULL_OBJECT_ID) | ||
| { | ||
| return nat.switch_id; | ||
| } | ||
| } | ||
|
|
||
| return SAI_NULL_OBJECT_ID; | ||
| } | ||
|
|
||
| sai_object_id_t NotificationNatEvent::getAnyObjectId() const | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
| if (m_natEventNotificationData == nullptr) | ||
| { | ||
| return SAI_NULL_OBJECT_ID; | ||
| } | ||
|
|
||
| for (uint32_t idx = 0; idx < m_count; idx++) | ||
| { | ||
| auto& nat = m_natEventNotificationData[idx].nat_entry; | ||
|
|
||
| if (nat.switch_id != SAI_NULL_OBJECT_ID) | ||
| { | ||
| return nat.switch_id; | ||
| } | ||
|
|
||
| if (nat.vr_id != SAI_NULL_OBJECT_ID) | ||
| { | ||
| return nat.vr_id; | ||
| } | ||
| } | ||
|
|
||
| return SAI_NULL_OBJECT_ID; | ||
| } | ||
|
|
||
| void NotificationNatEvent::processMetadata( | ||
| _In_ std::shared_ptr<saimeta::Meta> meta) const | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
| meta->meta_sai_on_nat_event(m_count, m_natEventNotificationData); | ||
| } | ||
|
|
||
| void NotificationNatEvent::executeCallback( | ||
| _In_ const sai_switch_notifications_t& switchNotifications) const | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
| if (switchNotifications.on_nat_event) | ||
| { | ||
| switchNotifications.on_nat_event(m_count, m_natEventNotificationData); | ||
| } | ||
| } |
This file contains hidden or 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 NotificationNatEvent: | ||
| public Notification | ||
| { | ||
| public: | ||
|
|
||
| NotificationNatEvent( | ||
| _In_ const std::string& serializedNotification); | ||
|
|
||
| virtual ~NotificationNatEvent(); | ||
|
|
||
| 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_nat_event_notification_data_t* m_natEventNotificationData; | ||
| }; | ||
| } |
This file contains hidden or 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.
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.
Uh oh!
There was an error while loading. Please reload this page.