Skip to content

[crm]: Add utility for CRM configuration#187

Merged
lguohan merged 3 commits intosonic-net:masterfrom
volodymyrsamotiy:master
Feb 21, 2018
Merged

[crm]: Add utility for CRM configuration#187
lguohan merged 3 commits intosonic-net:masterfrom
volodymyrsamotiy:master

Conversation

@volodymyrsamotiy
Copy link
Copy Markdown
Collaborator

Signed-off-by: Volodymyr Samotiy volodymyrs@mellanox.com

Initial CRM UI utility implementation for review. Please do not merge yet.

Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
Copy link
Copy Markdown
Contributor

@prsunny prsunny left a comment

Choose a reason for hiding this comment

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

As mentioned in section <2.7.3 Show CLI command>, should we also incorporate this to show utility?

for res in ["ipv4_route", "ipv6_route", "ipv4_nexthop", "ipv6_nexthop", "ipv4_neighbor", "ipv6_neighbor",
"nexthop_group_member", "nexthop_group_object", "acl_table", "acl_group", "acl_entry",
"acl_counter", "fdb_entry"]:
data.append([res, crm_info[res + "_threshold_type"], crm_info[res + "_low_threshold"], crm_info[res + "_high_threshold"]])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is crm_info[] from config_db prefixed with "crm" as mentioned in the design spec (CRM_IPV4_ROUTE_THRESHOLD_TYPE)?. Can you place the config_db output for understanding?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Currently "CONFIG_DB" output looks as following:

127.0.0.1:6379[4]> HGETALL CRM|Config
 1) "ipv4_route_threshold_type"
 2) "percentage"
 3) "ipv4_route_low_threshold"
 4) "70"
 5) "ipv4_route_high_threshold"
 6) "85"
...

crm/main.py Outdated
print tabulate(data, headers=header, tablefmt="simple", missingval="")
print '\n'

def show_acl_table_resources(self, table_id):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Show table resource requires user to specify table_id? Just thinking if we can also display the complete table. What do you say?

Was this intended in design spec, [resources|thresholds] acl group [entry|counter]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Currently it requires table_id, I agree that it is better to display complete table. Will check what we can do.

@click.argument('value', type=click.Choice(['percentage', 'used', 'free']))
@click.pass_context
def type(ctx, value):
"""CRM threshod type configuration"""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo - threshold.. Please correct the ones below as well

@prsunny
Copy link
Copy Markdown
Contributor

prsunny commented Jan 25, 2018

Can you show one sample output for any one of the threshold and resource?

@volodymyrsamotiy
Copy link
Copy Markdown
Collaborator Author

Yes, I will incorporate this script to the "show" and "config" utilities.

@volodymyrsamotiy
Copy link
Copy Markdown
Collaborator Author

Please find "threshold" sample output below.

# crm show thresholds all


Resource Name         Threshold Type      Low Threshold    High Threshold
--------------------  ----------------  ---------------  ----------------
ipv4_route            percentage                     70                85
ipv6_route            percentage                     70                85
ipv4_nexthop          percentage                     70                85
ipv6_nexthop          percentage                     70                85
ipv4_neighbor         percentage                     70                85
ipv6_neighbor         percentage                     70                85
nexthop_group_member  percentage                     70                85
nexthop_group_object  percentage                     70                85
acl_table             percentage                     70                85
acl_group             percentage                     70                85
acl_entry             percentage                     70                85
acl_counter           percentage                     70                85
fdb_entry             percentage                     70                85

@volodymyrsamotiy
Copy link
Copy Markdown
Collaborator Author

Please find "resource" sample output below.

# crm show resources all


Resource Name           Used Count    Available Count
--------------------  ------------  -----------------
ipv4_route                    6417              96925
ipv6_route                    6414              96925
ipv4_nexthop                     5              57314
ipv6_nexthop                     4              57314
ipv4_neighbor                    5              96925
ipv6_neighbor                    4              22114
nexthop_group_member             8              57314
nexthop_group_object             2              57314
fdb_entry                        1              96925




Stage    Bind Point    Resource Name      Used Count    Available Count
-------  ------------  ---------------  ------------  -----------------
INGRESS  PORT          acl_group                   0                399
INGRESS  PORT          acl_table                   0                393
INGRESS  LAG           acl_group                   0                399
INGRESS  LAG           acl_table                   0                393
INGRESS  VLAN          acl_group                   0                399
INGRESS  VLAN          acl_table                   0                393
INGRESS  RIF           acl_group                   0                399
INGRESS  RIF           acl_table                   0                393
INGRESS  SWITCH        acl_group                   0                399
INGRESS  SWITCH        acl_table                   0                393
EGRESS   PORT          acl_group                   0                399
EGRESS   PORT          acl_table                   1                393
...

Copy link
Copy Markdown
Contributor

@prsunny prsunny left a comment

Choose a reason for hiding this comment

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

Approving. Few pending changes are not critical and can be addressed in future commits

@lguohan
Copy link
Copy Markdown
Contributor

lguohan commented Feb 9, 2018

can you change the name to nexthop_group since other object do not have this suffix.

nexthop_group_object             2              57314

@lguohan
Copy link
Copy Markdown
Contributor

lguohan commented Feb 9, 2018

can give the output for acl_entry/acl_counter for a table?

* Change "show acl table" command in order to show complete table without passing table ID
* Rename "nexthop_group_object" resource to "nexthop_group"
* Change CRM polling interval represantation from minutes to seconds

Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
@volodymyrsamotiy
Copy link
Copy Markdown
Collaborator Author

  • Changed "show acl table" command in order to show complete table without passing table ID
  • Renamed "nexthop_group_object" resource to "nexthop_group"
  • Changed CRM polling interval represantation from minutes to seconds

@volodymyrsamotiy
Copy link
Copy Markdown
Collaborator Author

Below is the output for the ACL per table resources: entry and counter.
(now ACL tables are also shown in "crm show resources all" command)

# crm show resources acl table


Table ID         Resource Name      Used Count    Available Count
---------------  ---------------  ------------  -----------------
0x70000000002bd  acl_entry                   1              13813
0x70000000002bd  acl_counter                 1              13813


crm/main.py Outdated

crm_stats = countersdb.get_all(countersdb.COUNTERS_DB, 'CRM:ACL_TABLE_STATS:{0}'.format(table_id))
# Retrieve all ACL table keys from CRM:ACL_TABLE_STATS
output = os.popen("docker exec -i database redis-cli --raw -n 2 KEYS *CRM:ACL_TABLE_STATS*").readlines()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In general, subprocess is being used instead of os.popen

countersdb.connect(countersdb.COUNTERS_DB)

header = ("Resource Name", "Used Count", "Available Count")
header = ("Table ID", "Resource Name", "Used Count", "Available Count")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just checking, is it possible to display Table name as well, if it's available in the DB?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Looks like no, currently we cannot display ACL table name here.

* Use subprocess instead of os.popen
* Fix incorrect output of ACL table info

Signed-off-by: Volodymyr Samotiy <volodymyrs@mellanox.com>
@lguohan lguohan merged commit 1a1b071 into sonic-net:master Feb 21, 2018
zhenggen-xu added a commit to zhenggen-xu/sonic-utilities that referenced this pull request Jun 6, 2018
            RB=1288101
            G=lnos-reviewers
            R=ntrianta,pmao,rmolina,sfardeen,zxu

* github:
  [acl_loader] Support Service ACL binding to multiple services (sonic-net#236)
  [show] Rename 'show session' to 'show mirror session' (sonic-net#235)
  [pfcstat]: create python cli tool to show pfc counters (sonic-net#233)
  [queuestat] add python CLI tool to show queue counters
  [acl-loader] Not to crash upon invalid rule (sonic-net#232)
  Show FDB type in fdbshow/show mac (sonic-net#231)
  [show] add 'show runningconfiguration all' subcommand (sonic-net#230)
  [reboot scripts] remove -t option in docker exec commands (sonic-net#228)
  [reboot] reduce stop service to only stop syncd (sonic-net#223)
  [crm]: Fix failures in CLI show commands (sonic-net#221)
  [Fast-reboot]: Gracefully shutdown syncd in fast-reboot (sonic-net#212)
  add fast-reboot support for nephos platform by stop kernel modules (sonic-net#220)
  [config bgp] Convert user input ipv6 addr to lower case before comparing (sonic-net#218)
  [PFCWD]: set default configuration when enabled by default (sonic-net#213)
  Add fast-reboot support for Aboot based images (sonic-net#214)
  sonic-utilities: Format show vlan config output (sonic-net#210)
  [AAA] Support login(ascii) authentication type (sonic-net#217)
  [sfputil] Adapt new way of getting PLATFORM(sonic-net#216)
  [Fast-Reboot]: Adapt fast-reboot-dump script for SAIv1.2  (sonic-net#211)
  Refactor fast-reboot script. Generate fast-reboot-dumps into configurable directory (sonic-net#208)
  Find correct opennsl module name before stopping it (sonic-net#207)
  [crm]: Add utility for CRM configuration (sonic-net#187)
  [reboot] update reboot script to retrieve platform with new format (sonic-net#206)
  Adapt to config engine change to load platform info properly (sonic-net#205)
  [config] Add qos clear and qos reload support (sonic-net#204)
  Dump default routes from APPL_DB table before fast-reboot (sonic-net#203)
  [acl_loader] Fix a crash issue when appdb is not consistent with cfgdb (sonic-net#202)
  [pfcwd]: add command to set pfcwd polling interval (sonic-net#192)
  [acl-loader] Prevent from hanging if run by non-root user (sonic-net#199)
  [config] Store ConfigDB init indicator boolean value as 1/0 in Redis to be language-agnostic (sonic-net#197)
  Get Vlan Id from SAI Vlan Object if bvid present (sonic-net#196)
  [TACACS+]: Fix aaa show error without configuration (sonic-net#191)
  'config bgp [shutdown|startup] neighbor <hostname>' now affects all sessions for neighbor (sonic-net#195)
  [sonic-clear] add a clear fdb command (sonic-net#186)
header = ("Table ID", "Resource Name", "Used Count", "Available Count")

# Retrieve all ACL table keys from CRM:ACL_TABLE_STATS
proc = Popen("docker exec -i database redis-cli --raw -n 2 KEYS *CRM:ACL_TABLE_STATS*", stdout=PIPE, stderr=PIPE, shell=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It exec another script to make DB operation. Could you please use redis-py or existing XxxxDBConnector/etc to do DB changes?

vdahiya12 pushed a commit to vdahiya12/sonic-utilities that referenced this pull request Jul 23, 2021
…common classes (sonic-net#187)

#### Description
Existing test will mix true swsscommon package with the mocked one in sonic_py_common

#### Motivation and Context
This is blocking sonic-net/sonic-buildimage#7655

#### How Has This Been Tested?
Unit test
mihirpat1 pushed a commit to mihirpat1/sonic-utilities that referenced this pull request Sep 15, 2023
…net#187)

Add a stop function to thermal manager. Allow thermalctld to call the stop function to stop run_policy function fast
stepanblyschak pushed a commit to stepanblyschak/sonic-utilities that referenced this pull request Aug 9, 2025
… add check_sids (sonic-net#187)

<!--
 Please make sure you've read and understood our contributing guidelines:
 https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

 failure_prs.log skip_prs.log Make sure all your commits include a signature generated with `git commit -s` **

 If this is a bug fix, make sure your description includes "closes #xxxx",
 "fixes #xxxx" or "resolves #xxxx" so that GitHub automatically closes the related
 issue when the PR is merged.

 If you are adding/modifying/removing any command or utility script, please also
 make sure to add/modify/remove any unit tests from the tests
 directory as appropriate.

 If you are modifying or removing an existing 'show', 'config' or 'sonic-clear'
 subcommand, or you are adding a new subcommand, please make sure you also
 update the Command Line Reference Guide (doc/Command-Reference.md) to reflect
 your changes.

 Please provide the following information:
-->

#### What I did

1. Skip checking offload flags for static routes and static SIDs in FRR in check_frr_pending_routes.
2. Add check_sids to check consistency between MY_SID tables of ASIC_DB and APPL_DB

#### How I did it

#### How to verify it

Run on a device supporting SRv6

#### Previous command output (if the output of a command-line utility has changed)

#### New command output (if the output of a command-line utility has changed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants