Skip to content

[hash] Add Generic Hash YANG model#13253

Merged
liat-grozovik merged 3 commits intosonic-net:masterfrom
nazariig:master-hash-yang-rel
Feb 6, 2023
Merged

[hash] Add Generic Hash YANG model#13253
liat-grozovik merged 3 commits intosonic-net:masterfrom
nazariig:master-hash-yang-rel

Conversation

@nazariig
Copy link
Copy Markdown
Collaborator

@nazariig nazariig commented Jan 4, 2023

Signed-off-by: Nazarii Hnydyn [email protected]

HLD: sonic-net/SONiC#1101

Why I did it

  • Added YANG model as part of Generic Hash feature development

How I did it

  • Added YANG model and UTs

How to verify it

  1. make configure PLATFORM=mellanox
  2. make target/sonic-mellanox.bin

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211

Description for the changelog

  • N/A

Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.

  • N/A

Link to config_db schema for YANG module changes

  • N/A

A picture of a cute animal (not mandatory but encouraged)

      .---.        .-----------
     /     \  __  /    ------
    / /     \(  )/    -----
   //////   ' \/ `   ---
  //// / // :    : ---
 // /   /  /`    '--
//          //..\\
       ====UU====UU====
           '//||\\`
             ''``

@nazariig nazariig requested a review from qiluo-msft as a code owner January 4, 2023 13:08
@lguohan lguohan added the YANG YANG model related changes label Jan 8, 2023
@liat-grozovik
Copy link
Copy Markdown
Collaborator

@nazariig please provide more details on the change in the PR description
@qiluo-msft , @zhangyanzhao could you please cover it in the yang subgroup for review?

@liat-grozovik
Copy link
Copy Markdown
Collaborator

@qiluo-msft @dgsudharsan can u please review ?

@qiluo-msft qiluo-msft requested a review from ganglyu January 29, 2023 23:02
@ganglyu
Copy link
Copy Markdown
Contributor

ganglyu commented Jan 30, 2023

Would you please update doc/Configuration.md?

@nazariig
Copy link
Copy Markdown
Collaborator Author

Would you please update doc/Configuration.md?

@ganglyu can it go as a separate PR?

@liat-grozovik
Copy link
Copy Markdown
Collaborator

liat-grozovik commented Jan 30, 2023 via email

@nazariig nazariig force-pushed the master-hash-yang-rel branch from 0b561cb to 83e1cb0 Compare February 2, 2023 10:17
@nazariig
Copy link
Copy Markdown
Collaborator Author

nazariig commented Feb 2, 2023

Would you please update doc/Configuration.md?

@ganglyu done

Signed-off-by: Nazarii Hnydyn <[email protected]>
Signed-off-by: Nazarii Hnydyn <[email protected]>
Signed-off-by: Nazarii Hnydyn <[email protected]>
@nazariig nazariig force-pushed the master-hash-yang-rel branch from 83e1cb0 to 169636e Compare February 2, 2023 10:41
@nazariig
Copy link
Copy Markdown
Collaborator Author

nazariig commented Feb 2, 2023

/azpw run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@nazariig
Copy link
Copy Markdown
Collaborator Author

nazariig commented Feb 2, 2023

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@nazariig
Copy link
Copy Markdown
Collaborator Author

nazariig commented Feb 3, 2023

PR check failed due to:

test_pretest.py::test_disable_rsyslog_rate_limit[vlab-08] 
-------------------------------- live log call ---------------------------------
17:40:22 __init__.pytest_runtest_call             L0040 ERROR  | Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/_pytest/python.py", line 1464, in runtest
    self.ihook.pytest_pyfunc_call(pyfuncitem=self)
  File "/usr/local/lib/python2.7/dist-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pluggy/manager.py", line 87, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 81, in get_result
    _reraise(*ex)  # noqa
  File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python2.7/dist-packages/_pytest/python.py", line 174, in pytest_pyfunc_call
    testfunction(**testargs)
  File "/var/src/sonic-mgmt/tests/test_pretest.py", line 172, in test_disable_rsyslog_rate_limit
    duthost.modify_syslog_rate_limit(feature_name, rl_option='disable')
  File "/var/src/sonic-mgmt/tests/common/devices/multi_asic.py", line 476, in modify_syslog_rate_limit
    self.sonichost.shell_cmds(cmds=cmds)
  File "/var/src/sonic-mgmt/tests/common/devices/base.py", line 90, in _run
    raise RunAnsibleModuleFail("run module {} failed".format(self.module_name), res)
RunAnsibleModuleFail: run module shell_cmds failed, Ansible Results =>
{"changed": false, "cmds": ["docker exec -i teamd0 sed -i 's/^\\$SystemLogRateLimit/#\\$SystemLogRateLimit/g' /etc/rsyslog.conf", "docker exec -i teamd0 supervisorctl restart rsyslogd"], "delta": "0:00:02.672187", "end": "2023-02-02 17:40:22.063874", "failed": true, "msg": "At least running one of the commands failed", "results": [{"cmd": "docker exec -i teamd0 sed -i 's/^\\$SystemLogRateLimit/#\\$SystemLogRateLimit/g' /etc/rsyslog.conf", "rc": 0, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}, {"cmd": "docker exec -i teamd0 supervisorctl restart rsyslogd", "rc": 7, "stderr": "", "stderr_lines": [], "stdout": "rsyslogd: ERROR (not running)\nrsyslogd: ERROR (spawn error)\n", "stdout_lines": ["rsyslogd: ERROR (not running)", "rsyslogd: ERROR (spawn error)"]}], "start": "2023-02-02 17:40:19.391687"}

Thursday 02 February 2023  17:40:22 +0000 (0:00:03.319)       0:03:30.043 ***** 


=================================== FAILURES ===================================
___________________ test_disable_rsyslog_rate_limit[vlab-08] ___________________

duthosts = [<MultiAsicSonicHost vlab-08>], enum_dut_hostname = 'vlab-08'

    def test_disable_rsyslog_rate_limit(duthosts, enum_dut_hostname):
        duthost = duthosts[enum_dut_hostname]
        features_dict, succeed = duthost.get_feature_status()
        if not succeed:
            # Something unexpected happened.
            # We don't want to fail here because it's an util
            logging.warn("Failed to retrieve feature status")
            return
        config_facts = duthost.config_facts(host=duthost.hostname, source="running")
        try:
            is_dhcp_server_enable = config_facts["ansible_facts"]["DEVICE_METADATA"]["localhost"]["dhcp_server"]
        except KeyError:
            is_dhcp_server_enable = None
        for feature_name, state in features_dict.items():
            if 'enabled' not in state:
                continue
            # Skip dhcp_relay check if dhcp_server is enabled
            if is_dhcp_server_enable is not None and "enabled" in is_dhcp_server_enable and feature_name == "dhcp_relay":
                continue
>           duthost.modify_syslog_rate_limit(feature_name, rl_option='disable')

config_facts = {u'invocation': {u'module_args': {u'source': u'running', u'host': u'vlab-08', ...rnet1/5': u'', u'Ethernet1/6': u'', u'Ethernet1/7': u'', u'Ethernet1/8': u''}}}
duthost    = <MultiAsicSonicHost vlab-08>
duthosts   = [<MultiAsicSonicHost vlab-08>]
enum_dut_hostname = 'vlab-08'
feature_name = 'teamd'
features_dict = {'bgp': 'enabled', 'database': 'always_enabled', 'dhcp_relay': 'disabled', 'eventd': 'enabled', ...}
is_dhcp_server_enable = None
state      = 'enabled'
succeed    = True

test_pretest.py:172: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
common/devices/multi_asic.py:476: in modify_syslog_rate_limit
    self.sonichost.shell_cmds(cmds=cmds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SonicHost vlab-08>, module_args = ()
complex_args = {'cmds': ["docker exec -i teamd0 sed -i 's/^\\$SystemLogRateLimit/#\\$SystemLogRateLimit/g' /etc/rsyslog.conf", 'docker exec -i teamd0 supervisorctl restart rsyslogd']}
previous_frame = <frame object at 0x55e361df5c10>
filename = '/var/src/sonic-mgmt/tests/common/devices/multi_asic.py'
line_number = 476, function_name = 'modify_syslog_rate_limit'
lines = ['            self.sonichost.shell_cmds(cmds=cmds)\n'], index = 0
verbose = True, module_ignore_errors = False, module_async = False

    def _run(self, *module_args, **complex_args):
    
        previous_frame = inspect.currentframe().f_back
        filename, line_number, function_name, lines, index = inspect.getframeinfo(previous_frame)
    
        verbose = complex_args.pop('verbose', True)
    
        if verbose:
            logging.debug("{}::{}#{}: [{}] AnsibleModule::{}, args={}, kwargs={}"
                          .format(filename, function_name, line_number, self.hostname,
                                  self.module_name, json.dumps(module_args), json.dumps(complex_args)))
        else:
            logging.debug("{}::{}#{}: [{}] AnsibleModule::{} executing..."
                          .format(filename, function_name, line_number, self.hostname, self.module_name))
    
        module_ignore_errors = complex_args.pop('module_ignore_errors', False)
        module_async = complex_args.pop('module_async', False)
    
        if module_async:
            def run_module(module_args, complex_args):
                return self.module(*module_args, **complex_args)[self.hostname]
            pool = ThreadPool()
            result = pool.apply_async(run_module, (module_args, complex_args))
            return pool, result
    
        res = self.module(*module_args, **complex_args)[self.hostname]
    
        if verbose:
            logging.debug("{}::{}#{}: [{}] AnsibleModule::{} Result => {}"
                          .format(filename, function_name, line_number,
                                  self.hostname, self.module_name, json.dumps(res)))
        else:
            logging.debug("{}::{}#{}: [{}] AnsibleModule::{} done, is_failed={}, rc={}"
                          .format(filename, function_name, line_number, self.hostname,
                                  self.module_name, res.is_failed, res.get('rc', None)))
    
        if (res.is_failed or 'exception' in res) and not module_ignore_errors:
>           raise RunAnsibleModuleFail("run module {} failed".format(self.module_name), res)
E           RunAnsibleModuleFail: run module shell_cmds failed, Ansible Results =>
E           {"changed": false, "cmds": ["docker exec -i teamd0 sed -i 's/^\\$SystemLogRateLimit/#\\$SystemLogRateLimit/g' /etc/rsyslog.conf", "docker exec -i teamd0 supervisorctl restart rsyslogd"], "delta": "0:00:02.672187", "end": "2023-02-02 17:40:22.063874", "failed": true, "msg": "At least running one of the commands failed", "results": [{"cmd": "docker exec -i teamd0 sed -i 's/^\\$SystemLogRateLimit/#\\$SystemLogRateLimit/g' /etc/rsyslog.conf", "rc": 0, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}, {"cmd": "docker exec -i teamd0 supervisorctl restart rsyslogd", "rc": 7, "stderr": "", "stderr_lines": [], "stdout": "rsyslogd: ERROR (not running)\nrsyslogd: ERROR (spawn error)\n", "stdout_lines": ["rsyslogd: ERROR (not running)", "rsyslogd: ERROR (spawn error)"]}], "start": "2023-02-02 17:40:19.391687"}

complex_args = {'cmds': ["docker exec -i teamd0 sed -i 's/^\\$SystemLogRateLimit/#\\$SystemLogRateLimit/g' /etc/rsyslog.conf", 'docker exec -i teamd0 supervisorctl restart rsyslogd']}
filename   = '/var/src/sonic-mgmt/tests/common/devices/multi_asic.py'
function_name = 'modify_syslog_rate_limit'
index      = 0
line_number = 476
lines      = ['            self.sonichost.shell_cmds(cmds=cmds)\n']
module_args = ()
module_async = False
module_ignore_errors = False
previous_frame = <frame object at 0x55e361df5c10>
res        = {u'end': u'2023-02-02 17:40:22.063874', '_ansible_no_log': False, 'failed': Tr...l restart rsyslogd']}}, u'msg': u'At least running one of the commands failed'}
self       = <SonicHost vlab-08>
verbose    = True

common/devices/base.py:90: RunAnsibleModuleFail
--- generated xml file: /var/src/sonic-mgmt/tests/logs/test_pretest|||0.xml ----
=========================== short test summary info ============================
FAILED test_pretest.py::test_disable_rsyslog_rate_limit[vlab-08] - RunAnsible...
===================== 1 failed, 3 passed in 221.41 seconds =====================

@nazariig
Copy link
Copy Markdown
Collaborator Author

nazariig commented Feb 3, 2023

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@nazariig
Copy link
Copy Markdown
Collaborator Author

nazariig commented Feb 3, 2023

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@nazariig
Copy link
Copy Markdown
Collaborator Author

nazariig commented Feb 3, 2023

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik liat-grozovik changed the title [hash]: Add GH YANG model [hash] Add Generic Hash YANG model Feb 6, 2023
@liat-grozovik liat-grozovik merged commit 7cedb09 into sonic-net:master Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

YANG YANG model related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants