Commit 97f70d1
authored
NAT : Update the CRM used counters for SNAT and DNAT entries (sonic-net#1655)
Issue : CRM used counters are not getting updated for SNAT and DNAT entries
Steps to recreate:
Add a static NAT entry and verify the CRM counters
root@sonic:/home/admin# config nat feature enable
root@sonic:/home/admin# config interface ip add Ethernet9 12.12.0.1/24
root@sonic:/home/admin# config interface ip add Ethernet11 125.56.90.12/24
root@sonic:/home/admin# config nat add interface Ethernet11 -nat_zone 1
root@sonic:/home/admin#
root@sonic:/home/admin# config nat add static basic 125.56.90.8 12.12.0.2
root@sonic:/home/admin# show nat translations
Static NAT Entries ..................... 2
Static NAPT Entries ..................... 0
Dynamic NAT Entries ..................... 0
Dynamic NAPT Entries ..................... 0
Static Twice NAT Entries ..................... 0
Static Twice NAPT Entries ..................... 0
Dynamic Twice NAT Entries ..................... 0
Dynamic Twice NAPT Entries ..................... 0
Total SNAT/SNAPT Entries ..................... 1
Total DNAT/DNAPT Entries ..................... 1
Total Entries ..................... 2
Protocol Source Destination Translated Source Translated Destination
---------- --------- ------------- ------------------- ------------------------
all 12.12.0.2 --- 125.56.90.8 ---
all --- 125.56.90.8 --- 12.12.0.2
root@sonic:/home/admin#
=============After polling interval of 300 seconds ========
root@sonic:/home/admin# crm show resources snat
Resource Name Used Count Available Count
--------------- ------------ -----------------
snat_entry 0 1024
root@sonic:/home/admin#
root@sonic:/home/admin# crm show resources dnat
Resource Name Used Count Available Count
--------------- ------------ -----------------
dnat_entry 0 1024
root@sonic:/home/admin#
Fix: Increment/Decrement the crm used counters for snat/dnat entries when entry is created/deleted.
Repeated the same steps to add static nat entry like above and verified the crm counters.
root@sonic:/home/admin# crm show resources dnat
Resource Name Used Count Available Count
--------------- ------------ -----------------
dnat_entry 1 1023
root@sonic:/home/admin# crm show resources snat
Resource Name Used Count Available Count
--------------- ------------ -----------------
snat_entry 1 1023
root@sonic:/home/admin#
Signed-off-by: Akhilesh Samineni [email protected]1 parent a4e05a7 commit 97f70d1
2 files changed
+85
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
790 | 792 | | |
791 | 793 | | |
792 | 794 | | |
| 795 | + | |
793 | 796 | | |
794 | 797 | | |
795 | 798 | | |
| |||
876 | 879 | | |
877 | 880 | | |
878 | 881 | | |
| 882 | + | |
879 | 883 | | |
880 | 884 | | |
881 | 885 | | |
| |||
947 | 951 | | |
948 | 952 | | |
949 | 953 | | |
| 954 | + | |
950 | 955 | | |
951 | 956 | | |
952 | 957 | | |
| |||
1138 | 1143 | | |
1139 | 1144 | | |
1140 | 1145 | | |
| 1146 | + | |
1141 | 1147 | | |
1142 | 1148 | | |
1143 | 1149 | | |
| |||
1336 | 1342 | | |
1337 | 1343 | | |
1338 | 1344 | | |
| 1345 | + | |
1339 | 1346 | | |
1340 | 1347 | | |
1341 | 1348 | | |
| |||
1514 | 1521 | | |
1515 | 1522 | | |
1516 | 1523 | | |
| 1524 | + | |
1517 | 1525 | | |
1518 | 1526 | | |
1519 | 1527 | | |
| |||
1670 | 1678 | | |
1671 | 1679 | | |
1672 | 1680 | | |
| 1681 | + | |
1673 | 1682 | | |
1674 | 1683 | | |
1675 | 1684 | | |
| |||
1760 | 1769 | | |
1761 | 1770 | | |
1762 | 1771 | | |
| 1772 | + | |
1763 | 1773 | | |
1764 | 1774 | | |
1765 | 1775 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | 290 | | |
294 | 291 | | |
295 | 292 | | |
| |||
353 | 350 | | |
354 | 351 | | |
355 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
356 | 428 | | |
357 | 429 | | |
358 | 430 | | |
| |||
0 commit comments