Skip to content
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

Merged
merged 3 commits into from
Nov 22, 2019

Conversation

kirankella
Copy link
Contributor

@kirankella kirankella commented Sep 24, 2019

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

Copy link
Contributor

@stepanblyschak stepanblyschak left a 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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inconsistent indentation here

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inconsistent indentation here

Copy link
Contributor Author

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");

Copy link
Contributor

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

Copy link
Contributor Author

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.

sai_status_t vs_remove_nat_entry(
_In_ const sai_nat_entry_t *nat_entry)
{
MUTEX();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3-spaces indentation here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@kirankella
Copy link
Contributor Author

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(
Copy link
Contributor

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?

Copy link
Collaborator

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

Copy link
Contributor

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()
Copy link
Contributor

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?

Copy link
Collaborator

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" ?

Copy link
Contributor

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.

Copy link
Collaborator

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 ?

@lguohan lguohan requested a review from kcudnik November 13, 2019 05:39
@lguohan
Copy link
Contributor

lguohan commented Nov 13, 2019

retest this please

meta/saiserialize.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@kcudnik kcudnik left a 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

meta/saiserialize.cpp Show resolved Hide resolved
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
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

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(
Copy link
Collaborator

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()
Copy link
Collaborator

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" ?

@kirankella
Copy link
Contributor Author

looks very good, could you add unittests for that comparison logic ? they could be in separate PR to not make this too big

@kcudnik @lguohan We can add the unittests in a separate PR like you mentioned.

@lguohan
Copy link
Contributor

lguohan commented Nov 20, 2019

retest this please

@kcudnik
Copy link
Collaborator

kcudnik commented Nov 20, 2019

@kirankella can you address my comments?

@lguohan lguohan merged commit 5ef1764 into sonic-net:master Nov 22, 2019
AkhileshSamineni added a commit to AkhileshSamineni/sonic-swss that referenced this pull request Dec 10, 2019
 - 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
@abdosi abdosi added the Request for 201911 Branch Label for changes in master that applies for 201911 Branch also label Dec 31, 2019
abdosi pushed a commit that referenced this pull request Jan 3, 2020
* Changes in sonic-sairedis repo to support the NAT feature.

Signed-off-by: kiran.kella@broadcom.com
pettershao-ragilenetworks pushed a commit to pettershao-ragilenetworks/sonic-sairedis that referenced this pull request Nov 18, 2022
…#519)

* Changes in sonic-sairedis repo to support the NAT feature.

Signed-off-by: kiran.kella@broadcom.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Included in 201911 Branch Request for 201911 Branch Label for changes in master that applies for 201911 Branch also
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants