*** Settings ***
Documentation     This testsuite is for testing SSL connection to OpenBMC.
Suite Teardown    Delete All Sessions

Resource          ../../lib/rest_client.robot
Resource          ../../lib/resource.txt
Resource          ../../lib/openbmc_ffdc.robot
Test Teardown     FFDC On Test Case Fail

*** Test Cases ***
Test SSL Connection
    [Documentation]  This testcase is for testing the SSL connection to the
    ...  OpenBMC machine.
    [Tags]  Test_SSL_Connection
    Initialize OpenBMC

Test Non-SSL Connection To Port 80
    [Documentation]  Test that OpenBMC machine does not accept the non-secure
    ...  http connection at port 80 and would expect a connection error.
    [Tags]  Test_Non_SSL_Connection_To_Port_80
    Create Session  openbmc  http://${OPENBMC_HOST}/  timeout=3
    Run Keyword And Expect Error  ConnectionError*  Get Request  openbmc  /list

Test Non-SSL Connection To Port 443
    [Documentation]  Test that OpenBmc does not accept the non-secure
    ...  http connection at port 443 and would expect a connection error.
    [Tags]  Test_Non_SSL_Connection_To_Port_443
    Create Session  openbmc  http://${OPENBMC_HOST}:443/
    Run Keyword And Expect Error  ConnectionError*  Get Request  openbmc  /list

*** Settings ***
Documentation     This testsuite is for testing SSL connection to OpenBMC.
Suite Teardown    Delete All Sessions

Resource          ../../lib/rest_client.robot
Resource          ../../lib/resource.txt
Resource          ../../lib/openbmc_ffdc.robot
Test Teardown     FFDC On Test Case Fail

*** Test Cases ***
Test SSL Connection
    [Documentation]  This testcase is for testing the SSL connection to the
    ...  OpenBMC machine.
    [Tags]  Test_SSL_Connection
    Initialize OpenBMC

Test Non-SSL Connection To Port 80
    [Documentation]  Test that OpenBMC machine does not accept the non-secure
    ...  http connection at port 80 and would expect a connection error.
    [Tags]  Test_Non_SSL_Connection_To_Port_80
    Create Session  openbmc  http://${OPENBMC_HOST}/  timeout=3
    Run Keyword And Expect Error  ConnectionError*  Get Request  openbmc  /list

Test Non-SSL Connection To Port 443
    [Documentation]  Test that OpenBmc does not accept the non-secure
    ...  http connection at port 443 and would expect a connection error.
    [Tags]  Test_Non_SSL_Connection_To_Port_443
    Create Session  openbmc  http://${OPENBMC_HOST}:443/  timeout=3
    Run Keyword And Expect Error  ConnectionError*  Get Request  openbmc  /list

Add timeout for the connection session to expire
Add timeout for the connection session to expire

From http://docs.python-requests.org/en/master/user/advanced/

"Most requests to external servers should have a timeout attached,
in case the server is not responding in a timely manner. By default,
requests do not time out unless a timeout value is set explicitly.
Without a timeout, your code may hang for minutes or more."

Resolves   openbmc/openbmc-test-automation#1334

Change-Id: I3ff5fb67a409a1004149482dc5618ce16f5bcada
Signed-off-by: George Keishing <bef0a9ecac45fb57611777c8270153994e13fd2e@in.ibm.com>

openbmc/openbmc-test-automation,openbmc/openbmc-test-automation