1*** Settings ***
2Documentation    Management console utilities keywords.
3
4Library          ../../lib/gen_robot_valid.py
5Library          Collections
6Library          ../../lib/bmc_ssh_utils.py
7Library          SSHLibrary
8
9*** Variables ***
10&{daemon_command}  start=systemctl start avahi-daemon
11                  ...  stop=systemctl stop avahi-daemon
12                  ...  status=systemctl status avahi-daemon -l
13&{daemon_message}  start=Active: active (running)
14                  ...  stop=Active: inactive (dead)
15
16*** Keywords ***
17
18Set AvahiDaemon Service
19    [Documentation]  To enable or disable avahi service.
20    [Arguments]  ${command}
21
22    # Description of argument(s):
23    # command  Get command from dictionary.
24
25    ${service_command}=  Get From Dictionary  ${daemon_command}  ${command}
26    ${resp}  ${stderr}  ${rc}=  BMC Execute Command  ${service_command}  print_out=1
27    Should Be Equal As Integers  ${rc}  0
28
29
30Verify AvahiDaemon Service Status
31    [Documentation]  To check for avahi service.
32    [Arguments]  ${message}
33
34    # Description of argument(s):
35    # message  Get status message from dictionary.
36
37    ${service_command}=  Get From Dictionary  ${daemon_command}  status
38    ${service_message}=  Get From Dictionary  ${daemon_message}  ${message}
39    ${resp}  ${stderr}  ${rc}=  BMC Execute Command  ${service_command}  print_out=1
40    Should Contain  ${resp}  ${service_message}
41
42
43Get Lock Resource Information
44    [Documentation]  Get lock resource information.
45
46    ${code_base_dir_path}=  Get Code Base Dir Path
47    ${resource_lock_json}=  Evaluate
48    ...  json.load(open('${code_base_dir_path}data/resource_lock_table.json'))  modules=json
49    Rprint Vars  resource_lock_json
50
51    [Return]  ${resource_lock_json}
52