Skip to content

[crm] Add support for snat, dnat and ipmc crm resources #1511

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 5 commits into from
Dec 29, 2020

Conversation

PrabhuSreenivasan
Copy link
Contributor

@PrabhuSreenivasan PrabhuSreenivasan commented Nov 19, 2020

Signed-off-by: Prabhu Sreenivasan [email protected]

What I did
Added support for snat, dnat and ipmc resources under CRM module.

Why I did it
New feature NAT adds new resources snat_enty and dnat_entry that needs to be monitored. ipmc_entry tracks IP multicast resources used by switch.

Associated PRs
sonic-net/sonic-utilities/pull/1258
sonic-net/sonic-buildimage#6012

How I verified it

root@sonic:/home/admin# crm show resources snat

Resource Name      Used Count    Available Count
---------------  ------------  -----------------
snat_entry                  0               1024

root@sonic:/home/admin# crm show resources dnat

Resource Name      Used Count    Available Count
---------------  ------------  -----------------
dnat_entry                  0               1024

root@sonic:/home/admin# crm show resources ipmc

Resource Name      Used Count    Available Count
---------------  ------------  -----------------
ipmc_entry                  0              24576

root@sonic:/home/admin# crm show resources all

Resource Name           Used Count    Available Count
--------------------  ------------  -----------------
ipv4_route                      54              32698
ipv6_route                       2              10238
ipv4_nexthop                     0              65460
ipv6_nexthop                     0              65460
ipv4_neighbor                    0              24576
ipv6_neighbor                    0              12288
nexthop_group_member             0              32768
nexthop_group                    0                256
fdb_entry                        0              65535
ipmc_entry                       0              24576
snat_entry                       0               1024
dnat_entry                       0               1024


Stage    Bind Point    Resource Name      Used Count    Available Count
-------  ------------  ---------------  ------------  -----------------
INGRESS  PORT          acl_group                   0                256
INGRESS  PORT          acl_table                   0                  3
INGRESS  LAG           acl_group                   0                256
INGRESS  LAG           acl_table                   0                  3
INGRESS  VLAN          acl_group                   0                256
INGRESS  VLAN          acl_table                   0                  9
INGRESS  RIF           acl_group                   0                256
INGRESS  RIF           acl_table                   0                  9
INGRESS  SWITCH        acl_group                   0                256
INGRESS  SWITCH        acl_table                   0                  9
EGRESS   PORT          acl_group                   0                256
EGRESS   PORT          acl_table                   0                  2
EGRESS   LAG           acl_group                   0                256
EGRESS   LAG           acl_table                   0                  2
EGRESS   VLAN          acl_group                   0                256
EGRESS   VLAN          acl_table                   0                  2
EGRESS   RIF           acl_group                   0                256
EGRESS   RIF           acl_table                   0                  2
EGRESS   SWITCH        acl_group                   0                256
EGRESS   SWITCH        acl_table                   0                  2


Table ID    Resource Name    Used Count    Available Count
----------  ---------------  ------------  -----------------

Details if related

@PrabhuSreenivasan
Copy link
Contributor Author

Retest this please

@PrabhuSreenivasan
Copy link
Contributor Author

The tests depend on sonic-net/sonic-utilities/pull/1258 for the new commands and hence failing. Shall I remove the tests till the CLI commands gets merged?

SWSS_LOG_ERROR("Failed to get switch attribute %u , rv:%d", attr.id, status);
if(status != SAI_STATUS_NOT_SUPPORTED)
{
SWSS_LOG_ERROR("Failed to get switch attribute %u , rv:%d", attr.id, status);
Copy link
Contributor

Choose a reason for hiding this comment

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

if it is not supported, i think it is better to remove query. otherwise, in the syslog, we are going to continously having this error log for this unsupported attribute. it will cause confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you mean to remove it from m_resourcesMap on the first failure with SAI_STATUS_NOT_SUPPORTED?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

please note that the default poll interval is 5 minutes and the logs will be observed once every 5 minutes (poll interval)

Copy link
Collaborator

Choose a reason for hiding this comment

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

@PrabhuSreenivasan , we change the polling interval to 1 sec while running tests and this can come pretty often in that case causing test failures.

Copy link
Contributor Author

@PrabhuSreenivasan PrabhuSreenivasan Dec 2, 2020

Choose a reason for hiding this comment

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

@lguohan, @prsunny, I have updated the code to remove any unavailable resource from the map.

for (const auto &cnt : m_resourcesMap.at(i.second).countersMap)
try
{
for (const auto &cnt : m_resourcesMap.at(i.second).countersMap)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you are erasing the unsupported resource, do we hit this case?

Copy link
Contributor Author

@PrabhuSreenivasan PrabhuSreenivasan Dec 3, 2020

Choose a reason for hiding this comment

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

The code iterates over the const map crmUsedCntsTableMap which includes the unsupported resources as well. The out_of_range exception will be hit when it tries to access m_resourcesMap.at(i.second).countersMap for any of the unsupported resources.

@PrabhuSreenivasan
Copy link
Contributor Author

retest this please

@prsunny
Copy link
Collaborator

prsunny commented Dec 9, 2020

@PrabhuSreenivasan , could you please look into the VS test errors for:

test_crm.TestCrm.test_Configure_snat
test_crm.TestCrm.test_Configure_dnat
test_crm.TestCrm.test_Configure_ipmc

https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/sonic-swss-build-pr/2518/

@PrabhuSreenivasan
Copy link
Contributor Author

@PrabhuSreenivasan , could you please look into the VS test errors for:

test_crm.TestCrm.test_Configure_snat
test_crm.TestCrm.test_Configure_dnat
test_crm.TestCrm.test_Configure_ipmc

https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/sonic-swss-build-pr/2518/

@prsunny, The test relies on crm CLI commands for snat, dnat, ipmc and those commands will be available when the associated PR sonic-net/sonic-utilities/pull/1258 gets merged.

@ben-gale
Copy link
Collaborator

All, @arlakshm - this has been quiet for 6 days - can we get some review input so we can move forwards please? The clock is ticking ...

prsunny
prsunny previously approved these changes Dec 16, 2020
@ben-gale
Copy link
Collaborator

@arlakshm , @lguohan, @prsunny - What's the next step here? This has been inactive for 6 days now - how do we move towards merge pls?

arlakshm
arlakshm previously approved these changes Dec 23, 2020
@PrabhuSreenivasan PrabhuSreenivasan dismissed stale reviews from arlakshm and prsunny via 053fe31 December 24, 2020 11:18
@lgtm-com
Copy link

lgtm-com bot commented Dec 24, 2020

This pull request introduces 3 alerts when merging 053fe31 into c39a4b1 - view on LGTM.com

new alerts:

  • 3 for Unused local variable

Signed-off-by: Prabhu Sreenivasan <[email protected]>
@arlakshm
Copy link
Contributor

@PrabhuSreenivasan, the unit tests are failing. Please take a look.

@lgtm-com
Copy link

lgtm-com bot commented Dec 25, 2020

This pull request introduces 1 alert and fixes 7 when merging 59b19a7 into 9ed3026 - view on LGTM.com

new alerts:

  • 1 for Syntax error

fixed alerts:

  • 4 for Unused import
  • 1 for Redundant comparison
  • 1 for Unused local variable
  • 1 for Variable defined multiple times

Signed-off-by: Prabhu Sreenivasan <[email protected]>
@arlakshm
Copy link
Contributor

@PrabhuSreenivasan, majority of the Unit tests are commented out. Please re-enable them so that this PR can be merged.
This change is required to fix the https://github.com/Azure/sonic-buildimage/issues/6302

Signed-off-by: Prabhu Sreenivasan <[email protected]>
@PrabhuSreenivasan
Copy link
Contributor Author

Looks like it picked up 532 which did not have CRM changes. The latest one https://sonic-jenkins.westus2.cloudapp.azure.com/job/vs/job/buildimage-vs-all/533/ has the changes. will trigger test again.

@PrabhuSreenivasan
Copy link
Contributor Author

retest vs please

@PrabhuSreenivasan
Copy link
Contributor Author

@PrabhuSreenivasan, majority of the Unit tests are commented out. Please re-enable them so that this PR can be merged.
This change is required to fix the Azure/sonic-buildimage#6302

Done.

Copy link
Contributor

@arlakshm arlakshm left a comment

Choose a reason for hiding this comment

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

lgtm

@arlakshm arlakshm merged commit a43f6be into sonic-net:master Dec 29, 2020
@rlhui rlhui linked an issue Dec 30, 2020 that may be closed by this pull request
@PrabhuSreenivasan PrabhuSreenivasan deleted the crm_ipmc_nat branch January 4, 2021 06:28
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
* [config][vxlan]fix 'vxlan evpn_nvo add' command error
Remove extra 'CONFIG_DB' argument from db.cfgdb.get_keys()
Signed-off-by: shikenghua <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

orchagent reporting error 'Unknown attribute snat_entry_threshold_type'
5 participants