xref: /openbmc/openbmc-test-automation/openpower/ext_interfaces/test_discovery.robot (revision 8023a8cfe6f7f766e2079e867691b34589a457da)
1*8023a8cfSSushil Singh*** Settings ***
2*8023a8cfSSushil SinghDocumentation        Test to discover the BMC.
3*8023a8cfSSushil Singh
4*8023a8cfSSushil SinghVariables            ../../data/variables.py
5*8023a8cfSSushil SinghLibrary              SSHLibrary
6*8023a8cfSSushil SinghLibrary              ../../lib/external_intf/management_console_utils.py
7*8023a8cfSSushil SinghLibrary              ../../lib/gen_robot_print.py
8*8023a8cfSSushil SinghLibrary              ../../lib/gen_print.py
9*8023a8cfSSushil SinghResource             ../../syslib/utils_os.robot
10*8023a8cfSSushil Singh
11*8023a8cfSSushil SinghSuite Setup          Suite Setup Execution
12*8023a8cfSSushil Singh
13*8023a8cfSSushil Singh*** Test Cases ***
14*8023a8cfSSushil Singh
15*8023a8cfSSushil SinghDiscover BMC With Different Service Type
16*8023a8cfSSushil Singh    [Documentation]  Discover all the BMC with different service type support.
17*8023a8cfSSushil Singh    [Tags]  Discover_BMC_With_Different_Service_Type
18*8023a8cfSSushil Singh    [Template]  Discover BMC With Service Type
19*8023a8cfSSushil Singh
20*8023a8cfSSushil Singh    # Service type
21*8023a8cfSSushil Singh    _obmc_rest._tcp
22*8023a8cfSSushil Singh    _obmc_redfish._tcp
23*8023a8cfSSushil Singh
24*8023a8cfSSushil Singh
25*8023a8cfSSushil Singh*** Keywords ***
26*8023a8cfSSushil Singh
27*8023a8cfSSushil SinghSuite Setup Execution
28*8023a8cfSSushil Singh    [Documentation]  Do the suite setup.
29*8023a8cfSSushil Singh
30*8023a8cfSSushil Singh    Should Not Be Empty  ${AVAHI_CLIENT}
31*8023a8cfSSushil Singh    Should Not Be Empty  ${AVAHI_CLIENT_USERNAME}
32*8023a8cfSSushil Singh    Should Not Be Empty  ${AVAHI_CLIENT_PASSWORD}
33*8023a8cfSSushil Singh    Login To OS  ${AVAHI_CLIENT}  ${AVAHI_CLIENT_USERNAME}  ${AVAHI_CLIENT_PASSWORD}
34*8023a8cfSSushil Singh    Check Avahi Package
35*8023a8cfSSushil Singh
36*8023a8cfSSushil Singh
37*8023a8cfSSushil SinghCheck Avahi Package
38*8023a8cfSSushil Singh    [Documentation]  To check for avahi-tools package.
39*8023a8cfSSushil Singh
40*8023a8cfSSushil Singh    # Expected command output as below.
41*8023a8cfSSushil Singh    # avahi-tools-0.6.31-19.el7.x86_64
42*8023a8cfSSushil Singh
43*8023a8cfSSushil Singh    ${command}=  Set Variable  rpm -qa | grep avahi-tools
44*8023a8cfSSushil Singh    ${resp_rpm}  ${stderr}=  Execute Command  ${command}  return_stderr=True
45*8023a8cfSSushil Singh    Should Be Empty  ${stderr}
46*8023a8cfSSushil Singh    Should Contain  ${resp_rpm}  avahi-tools  ignore_case=True  msg=avahi-tools is not available.
47*8023a8cfSSushil Singh
48*8023a8cfSSushil Singh
49*8023a8cfSSushil SinghDiscover BMC With Service Type
50*8023a8cfSSushil Singh    [Documentation]  To get the discoverd BMC list.
51*8023a8cfSSushil Singh    [Arguments]  ${service_type}
52*8023a8cfSSushil Singh
53*8023a8cfSSushil Singh    # Description of argument(s):
54*8023a8cfSSushil Singh    # service_type    BMC service type e.g.
55*8023a8cfSSushil Singh    #                 (REST Service = _obmc_rest._tcp, Redfish Service = _obmc_redfish._tcp).
56*8023a8cfSSushil Singh
57*8023a8cfSSushil Singh    # bmc_list:
58*8023a8cfSSushil Singh    # [1]:
59*8023a8cfSSushil Singh    #    [service]:          _obmc_XXXX._tcp
60*8023a8cfSSushil Singh    #    [hostname]:         System Name
61*8023a8cfSSushil Singh    #    [address]:          XXX.XXX.XXX.XXX
62*8023a8cfSSushil Singh    #    [port]:             XXX
63*8023a8cfSSushil Singh    #    [txt]:
64*8023a8cfSSushil Singh    # [2]:
65*8023a8cfSSushil Singh    #    [service]:          _obmc_XXXX._tcp
66*8023a8cfSSushil Singh    #    [hostname]:         System Name
67*8023a8cfSSushil Singh    #    [address]:          XXX.XXX.XXX.XXX
68*8023a8cfSSushil Singh    #    [port]:             XXX
69*8023a8cfSSushil Singh    #    [txt]:
70*8023a8cfSSushil Singh
71*8023a8cfSSushil Singh    ${resp_service}  ${stderr}=  Execute Command  avahi-browse -rt ${service_type}  return_stderr=True
72*8023a8cfSSushil Singh    ${bmc_list}  ${exc_msg}=  Get BMC Records  ${service_type}  ${resp_service}
73*8023a8cfSSushil Singh    Print Timen  Exception message is ${exc_msg}
74*8023a8cfSSushil Singh    Should Not Be Empty  ${bmc_list}
75*8023a8cfSSushil Singh    Rprint Vars  bmc_list
76