-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding local-users-passwords-reset feature service, YANG model and it…
…s tests
- Loading branch information
Showing
10 changed files
with
94 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
files/image_config/local-users-passwords-reset/local-users-passwords-reset.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import syslog | ||
|
||
|
||
SYSLOG_IDENTIFIER = os.path.basename(__file__) | ||
|
||
|
||
def log_info(msg): | ||
syslog.openlog(SYSLOG_IDENTIFIER) | ||
syslog.syslog(syslog.LOG_INFO, msg) | ||
syslog.closelog() | ||
|
||
|
||
def main(): | ||
log_info("Azmy wrote this") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
14 changes: 14 additions & 0 deletions
14
files/image_config/local-users-passwords-reset/local-users-passwords-reset.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=Update Local users' passwords config based on configdb | ||
Requires=config-setup.service | ||
After=config-setup.service | ||
Before=systemd-logind.service sshd.service getty.target [email protected] | ||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=no | ||
ExecStart=/usr/bin/local-users-passwords-reset.py | ||
[Install] | ||
WantedBy=sonic.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/sonic-yang-models/tests/yang_model_tests/tests/local-users-passwords-reset.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"LOCAL_USERS_PASSWORDS_RESET_TEST_STATE": { | ||
"desc": "Configure Local users' passwords reset feature state." | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/sonic-yang-models/tests/yang_model_tests/tests_config/local-users-passwords-reset.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"LOCAL_USERS_PASSWORDS_RESET_TEST_STATE": { | ||
"sonic-local-users-passwords-reset:sonic-local-users-passwords-reset": { | ||
"sonic-local-users-passwords-reset:LOCAL_USERS_PASSWORDS_RESET": { | ||
"global": { | ||
"state": "enabled" | ||
} | ||
} | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/sonic-yang-models/yang-models/sonic-local-users-passwords-reset.yang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module local-users-passwords-reset { | ||
yang-version 1.1; | ||
namespace "http://github.com/sonic-net/local-users-passwords-reset"; | ||
|
||
import sonic-types { | ||
prefix stypes; | ||
} | ||
|
||
description "LONG_RESET_BUTTON YANG Module for SONiC-based OS"; | ||
revision 2024-01-04 { | ||
description "First Revision"; | ||
} | ||
|
||
container sonic-local-users-passwords-reset { | ||
container LOCAL_USERS_PASSWORDS_RESET { | ||
description "LOCAL_USERS_PASSWORDS_RESET part of config_db.json"; | ||
container global { | ||
leaf state { | ||
type stypes:admin_mode; | ||
description "Local users' passwords reset feature state"; | ||
default disabled; | ||
} | ||
} /* end of container global */ | ||
} /* end of container LOCAL_USERS_PASSWORDS_RESET */ | ||
} /* end of top level container */ | ||
} |