Skip to content

Test failure for test_passw_hardening #6428

@ZhaohuiS

Description

@ZhaohuiS

Description

  1. test_passw_hardening failed because of these parameters in the case test_passw_hardening_history
    passw_hardening_ob = PasswHardening(state='enabled',
                                        expiration='0',
                                        expiration_warning='0',

It defines expiration=0 and expiration_warning=0 in case test_passw_hardening_history, but in yang module, it starts from 1, not from 0. That's why the command doesn't work. Please see the error message as below.

https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/yang-models/sonic-passwh.yang#:~:text=type%20uint16%20%7B-,range%201..365%3B,-%7D

  1. Is it possible to disable passw-harden or clean related config whenever case passed or failed, in case of blocking access to testbed and blocking other test cases?
E           RunAnsibleModuleFail: run module command failed, Ansible Results =>
E           {
E               "changed": true, 
E               "cmd": [
E                   "sudo", 
E                   "config", 
E                   "passw-hardening", 
E                   "policies", 
E                   "expiration", 
E                   "0"
E               ], 
E               "delta": "0:00:01.862049", 
E               "end": "2022-09-28 05:38:24.984160", 
E               "failed": true, 
E               "invocation": {
E                   "module_args": {
E                       "_raw_params": "sudo config passw-hardening policies expiration 0", 
E                       "_uses_shell": false, 
E                       "argv": null, 
E                       "chdir": null, 
E                       "creates": null, 
E                       "executable": null, 
E                       "removes": null, 
E                       "stdin": null, 
E                       "stdin_add_newline": true, 
E                       "strip_empty_ends": true, 
E                       "warn": true
E                   }
E               }, 
E               "msg": "non-zero return code", 
E               "rc": 1, 
E               "start": "2022-09-28 05:38:23.122111", 
E               "stderr": "libyang[0]: Value \"0\" does not satisfy the constraint \"1..365\" (range, length, or pattern). (path: /sonic-passwh:sonic-passwh/PASSW_HARDENING/POLICIES/expiration)\nAborted!", 
E               "stderr_lines": [
E                   "libyang[0]: Value \"0\" does not satisfy the constraint \"1..365\" (range, length, or pattern). (path: /sonic-passwh:sonic-passwh/PASSW_HARDENING/POLICIES/expiration)", 
E                   "Aborted!"
E               ], 
E               "stdout": "sonic_yang(6):Note: Below table(s) have no YANG models: CONSOLE_SWITCH, DEVICE_NEIGHBOR_METADATA, DHCP_SERVER, RESTAPI, SNMP, SNMP_COMMUNITY\nsonic_yang(6):Note: Below table(s) have no YANG models: CONSOLE_SWITCH, DEVICE_NEIGHBOR_METADATA, DHCP_SERVER, RESTAPI, SNMP, SNMP_COMMUNITY\nsonic_yang(3):Data Loading Failed:Value \"0\" does not satisfy the constraint \"1..365\" (range, length, or pattern).\nError: Failed to validate configuration: Data Loading Failed\nValue \"0\" does not satisfy the constraint \"1..365\" (range, length, or pattern).", 
E               "stdout_lines": [
E                   "sonic_yang(6):Note: Below table(s) have no YANG models: CONSOLE_SWITCH, DEVICE_NEIGHBOR_METADATA, DHCP_SERVER, RESTAPI, SNMP, SNMP_COMMUNITY", 
E                   "sonic_yang(6):Note: Below table(s) have no YANG models: CONSOLE_SWITCH, DEVICE_NEIGHBOR_METADATA, DHCP_SERVER, RESTAPI, SNMP, SNMP_COMMUNITY", 
E                   "sonic_yang(3):Data Loading Failed:Value \"0\" does not satisfy the constraint \"1..365\" (range, length, or pattern).", 
E                   "Error: Failed to validate configuration: Data Loading Failed", 
E                   "Value \"0\" does not satisfy the constraint \"1..365\" (range, length, or pattern)."
E               ], 
E               "warnings": [
E                   "Consider using 'become', 'become_method', and 'become_user' rather than running sudo"
E               ]
E           }

Steps to reproduce the issue:

  1. run passw_hardening/test_passw_hardening.py with 202205 image.

Describe the results you received:

Describe the results you expected:

Additional information you deem important:

**Output of `show version`:**

```
(paste your output here)
```

**Attach debug file `sudo generate_dump`:**

```
(paste your output here)
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions