-
Notifications
You must be signed in to change notification settings - Fork 274
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
Changes in sonic-sairedis repo to support the NAT feature. #519
Conversation
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.
LGTM overall, please check indentation inconsistencies and extra newlines
|
||
if (status == SAI_STATUS_SUCCESS) | ||
{ | ||
meta_generic_validation_post_get(meta_key, nat_entry->switch_id, attr_count, attr_list); |
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.
inconsistent indentation here
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.
Done
|
||
if (status == SAI_STATUS_SUCCESS) | ||
{ | ||
meta_generic_validation_post_remove(meta_key); |
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.
inconsistent indentation here
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.
Done
if (nat_entry == NULL) | ||
{ | ||
SWSS_LOG_ERROR("nat_entry pointer is NULL"); | ||
|
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.
extra newline. Same for many lines
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.
Inline with newlines added in other similar functions like meta_sai_create_fdb_entry and meta_sai_validate_fdb_entry. Let me know if the newlines are not needed.
vslib/src/sai_vs_nat.cpp
Outdated
sai_status_t vs_remove_nat_entry( | ||
_In_ const sai_nat_entry_t *nat_entry) | ||
{ | ||
MUTEX(); |
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.
3-spaces indentation here.
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.
Done
- Added natsyncd and warmboot related changes. Link to NAT HLD : https://github.com/Azure/SONiC/blob/master/doc/nat/nat_design_spec.md Depends on: sonic-swss : sonic-swss-common : sonic-net/sonic-swss-common#304 sonic-linux-kernel : sonic-net/sonic-linux-kernel#100 sonic-sairedis : sonic-net/sonic-sairedis#519
Signed-off-by: kiran.kella@broadcom.com
123395c
to
c2cb0ec
Compare
Resolved merge conflict with latest master and updated vs library for nat pytests.. |
* | ||
* @return Best match object if found or nullptr. | ||
*/ | ||
std::shared_ptr<SaiObj> findCurrentBestMatchForNatEntry( |
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.
@kcudnik , can you check the comparison logic here?
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.
looks good but some unittest would be helpful
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.
@kirankella, can you add unit test?
@@ -1098,6 +1099,45 @@ void processRoutes(bool defaultOnly) | |||
} | |||
} | |||
|
|||
void processNatEntries() |
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.
@kcudnik , can you the code logic here?
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.
what do you mean "the code" ?
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.
I mean this function processNatEntries.
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.
i dont understand the question "can you the code logic here?" what this mean ? do you want to to review the code (obvious since i review entire PR) can you explain more ?
retest this please |
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.
looks very good, could you add unittests for that comparison logic ? they could be in separate PR to not make this too big
case SAI_NAT_ENTRY_ATTR_HIT_BIT_COR: | ||
case SAI_NAT_ENTRY_ATTR_HIT_BIT: | ||
|
||
// when reading asic view, ignore Nat entry hit-bit attribute |
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.
why thos need to be skipped?
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.
@kcudnik These 2 attributes in a NAT entry are not required in the comparison. They are dynamic attributes meant to be used for querying the active hardware status for the traffic flows.
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.
if thats the case then those attributes should be read only
* | ||
* @return Best match object if found or nullptr. | ||
*/ | ||
std::shared_ptr<SaiObj> findCurrentBestMatchForNatEntry( |
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.
looks good but some unittest would be helpful
@@ -1098,6 +1099,45 @@ void processRoutes(bool defaultOnly) | |||
} | |||
} | |||
|
|||
void processNatEntries() |
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.
what do you mean "the code" ?
retest this please |
@kirankella can you address my comments? |
- Added natsyncd and warmboot related changes. Link to NAT HLD : https://github.com/Azure/SONiC/blob/master/doc/nat/nat_design_spec.md Depends on: sonic-swss : sonic-swss-common : sonic-net/sonic-swss-common#304 sonic-linux-kernel : sonic-net/sonic-linux-kernel#100 sonic-sairedis : sonic-net/sonic-sairedis#519
* Changes in sonic-sairedis repo to support the NAT feature. Signed-off-by: kiran.kella@broadcom.com
…#519) * Changes in sonic-sairedis repo to support the NAT feature. Signed-off-by: kiran.kella@broadcom.com
Changes in the SAI redis APIs and the syncd to support NAT.
Related PRs for this feature:
sonic-buildimage repo - sonic-net/sonic-buildimage#3494
sonic-swss repo - sonic-net/sonic-swss#1059
sonic-swss repo - sonic-net/sonic-swss#1125
sonic-swss repo - sonic-net/sonic-swss#1126
sonic-utilities repo - sonic-net/sonic-utilities#645
sonic-linux-kernel repo - sonic-net/sonic-linux-kernel#100
sonic-swss-common repo - sonic-net/sonic-swss-common#304
Requirment is that the SAI library implements the SAI NAT specification (SAI 1.5).
Signed-off-by: kiran.kella@broadcom.com