Enable GUI headerless run, init, new GUI directory structure.

Resolves openbmc/openbmc-test-automation#736

Change-Id: I9d6cb1eca31585dc2f85b78ae03de8ac8c799fd9
Signed-off-by: Sathyajith M S <sathyajith.ms@in.ibm.com>
diff --git a/gui/obmc_asmi/lib/resource.robot b/gui/obmc_asmi/lib/resource.robot
new file mode 100644
index 0000000..bfba9ab
--- /dev/null
+++ b/gui/obmc_asmi/lib/resource.robot
@@ -0,0 +1,93 @@
+*** Settings ***
+Documentation  This is a resource file of OpenBMC ASMI It contains the
+...            user-defined keywords which are available to all gui modules
+
+Library      String
+Library      Collections
+Library      DateTime
+Library      XvfbRobot
+Library      OperatingSystem
+Library      Selenium2Library  120  120
+Library      AngularJSLibrary
+Library      SSHLibrary  30 Seconds
+Library      Process
+Library      supporting_libs.py
+Library      ../../../lib/gen_print.py
+Library      ../../../lib/gen_robot_print.py
+Library      ../../../lib/gen_valid.py
+Library      ../../../lib/gen_robot_ssh.py
+Library      ../../../lib/bmc_ssh_utils.py
+Resource     ../../../lib/resource.txt
+Variables    ../data/resource_variables.py
+
+*** Variables ***
+# TO Do: Change the variable once the code finally switches to the OpenBMC.
+${obmc_gui_url}     https://openbmc-test.mybluemix.net/#/login
+# Default Browser.
+${default_browser}  chrome
+
+*** Keywords ***
+Launch OpenBMC GUI Browser
+    [Documentation]  Launch the OpenBMC GUI URL on a browser.
+    # By default uses headless mode, otherwise, the GUI browser.
+    ${op_system}=  Get Operating System
+    Run Keyword If  '${op_system}' == 'windows'
+    ...     Launch Browser in Windows Platform
+    ...  ELSE
+    ...     Launch Headless Browser
+
+Get Operating System
+    [Documentation]  Identify platform/OS.
+    ${curdir_lower_case}=  Convert To Lowercase  ${CURDIR}
+    ${windows_platform}=  Run Keyword And Return Status
+    ...  Should Contain  ${curdir_lower_case}  c:\
+    ${op_system}=  Run Keyword If  '${windows_platform}' == 'True'
+    ...     Set Variable  windows
+    ...   ELSE
+    ...     Set Variable  linux
+    [Return]  ${op_system}
+
+Launch Browser in Windows Platform
+    [Documentation]  Open the browse with the URL and login on windows platform.
+    ${BROWSER_ID}=  Open Browser  ${obmc_gui_url}  ${default_browser}
+    Maximize Browser Window
+    Set Global Variable  ${BROWSER_ID}
+
+Launch Headless Browser
+    [Documentation]  Launch headless browser.
+    Start Virtual Display  1920  1080
+    ${BROWSER_ID}=  Open Browser  ${obmc_gui_url}
+    Set Global Variable  ${BROWSER_ID}
+    Set Window Size  1920  1080
+
+OpenBMC Test Setup
+    [Documentation]  Verify all the preconditions to be tested.
+    Rprint Timen  ${TEST NAME}:${TESTDOCUMENTATION} ==> [STARTED]
+    Print Dashes  0  100  1  =
+    Login OpenBMC GUI
+
+Login OpenBMC GUI
+    [Documentation]  Perform login to open BMC GUI.
+    [Arguments]  ${username}=${OPENBMC_USERNAME}
+    ...  ${password}=${OPENBMC_PASSWORD}
+    # Description of argument(s):
+    # username      The username.
+    # password      The password.
+    Go To  ${obmc_gui_url}
+    Input Text  ${xpath_textbox_username}  ${username}
+    Input Password  ${xpath_textbox_password}  ${password}
+    Click Button  ${xpath_button_login}
+    Wait Until Element Is Enabled  ${xpath_button_logout}
+
+LogOut OpenBMC GUI
+    [Documentation]  Log out of OpenBMC GUI.
+    SSHLibrary.Close All Connections
+    click button  ${xpath_button_logout}
+    Wait Until Page Contains Element  ${xpath_button_login}
+
+OpenBMC Test Closure
+    [Documentation]  Do final closure activities of test case execution.
+    Rprint Pgm Footer
+    Print Dashes  0  100  1  =
+    LogOut OpenBMC GUI
+