Adding intgration test for unimgr project
[integration/test.git] / csit / libraries / UnimgrKeywords.robot
1 *** Settings ***
2 Documentation    Unimgr keywords defination that will be used in Unimgr suite.
3 Library    OperatingSystem
4 Library    SSHLibrary
5 Library    String
6 Resource    ../../../libraries/OVSDB.robot
7 Resource    ../../../libraries/Utils.robot
8 Variables    ../../../variables/Variables.py
9
10 *** Variables ***
11 ${Bridge_Name}    ovsbr0
12 ${UniMgr_Variables_DIR}    ../variables/unimgr
13
14 *** Keywords ***
15 Setup Unimgr Test Environment
16     [Documentation]    Establish the Opendayligh session and prepair the Mininet VMs
17     Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
18     Prepair Unimgr Test Environment     ${TOOLS_SYSTEM_IP}
19     Prepair Unimgr Test Environment     ${TOOLS_SYSTEM_2_IP}
20
21 Prepair Unimgr Test Environment
22     [Arguments]    ${Mininet_IP}
23     [Documentation]    delete the ovs bridge and manager then set the manager to a passive mode ptcp:6640.
24     Run Command On Remote System    ${Mininet_IP}    sudo ovs-vsctl del-manager
25     Run Command On Remote System    ${Mininet_IP}    sudo ovs-vsctl del-br ${Bridge_Name}
26     Run Command On Remote System    ${Mininet_IP}    sudo ovs-vsctl set-manager ptcp:${OVSDBPORT}
27     ${stdout}=    Run Command On Remote System    ${Mininet_IP}    sudo ovs-vsctl show
28     Should Contain     ${stdout}    "ptcp:${OVSDBPORT}"
29
30 Get Add Uni Json
31     [Arguments]    ${IP-Address}    ${MAC-Address}
32     [Documentation]    read the add_uni.json file and replace the IPaddress and MACaddress with the give arguments.
33     ${json}    OperatingSystem.Get File    ${UniMgr_Variables_DIR}/add_uni.json
34     ${temp}    Replace String    ${json}    {mac-address}    ${MAC-Address}
35     ${uniJson}    Replace String    ${temp}    {uni-ip}    ${IP-Address}
36     [Return]    ${uniJson}
37
38 Get Add Evc Json
39     [Arguments]    ${UNI1-IP}    ${UNI2-IP}
40     [Documentation]    read the add_evc.json file and replace the IP-address with the give arguments.
41     ${Json}    OperatingSystem.Get File    ${UniMgr_Variables_DIR}/add_evc.json
42     ${temp}    Replace String    ${Json}    {uni1-ip}    ${UNI1-IP}
43     ${evcJson}    Replace String    ${temp}    {uni2-ip}    ${UNI2-IP}
44     [Return]    ${evcJson}