Migrate request invocations (ovsdb)
[integration/test.git] / csit / libraries / ODLMicroKeywords.robot
1 *** Settings ***
2 Documentation       A test suite which contains keywords of ODL micro which are used commonly.
3
4 Library             Collections
5 Library             OperatingSystem
6 Library             SSHLibrary
7 Library             String
8 Library             XML
9 Library             Collections
10 Library             RequestsLibrary
11
12
13 *** Keywords ***
14 Download ODL Micro
15     [Documentation]    Create SSH Connection and deploy odl micro
16     SSHLibrary.Open_Connection    ${ODL_SYSTEM_IP}    alias=ODL_System
17     SSHLibrary.Set_Client_Configuration    timeout=10s
18     SSHLibrary.Set_Client_Configuration    prompt=${ODL_SYSTEM_PROMPT}
19     SSHKeywords.Flexible_SSH_Login    ${ODL_SYSTEM_USER}    ${ODL_SYSTEM_PASSWORD}    delay=4s
20     ${file_name} =    NexusKeywords.Deploy_Test_Tool
21     ...    odl-micro
22     ...    micro-netconf
23     ...    micro
24     ...    ${BASE_URL}
25     ...    build_version=${ODL_MICRO_VERSION}
26     ...    build_location=org/opendaylight/odlmicro
27     BuiltIn.Set_Suite_Variable    ${FILENAME}    ${filename}
28
29 Run ODL Micro
30     [Documentation]    Run ODL Micro
31     SSHLibrary.Switch_Connection    ODL_System
32     SSHLibrary.Write    tar -xvf ${FILE_NAME} -C ${ODL_MICRO_WORKSPACE}/
33     SSHLibrary.Write    cd ${ODL_MICRO_WORKSPACE}/micro-netconf-${ODL_MICRO_VERSION}
34     ${response} =    SSHLibrary.Execute_Command    ls
35     BuiltIn.Log    ${response}
36     ${command} =    NexusKeywords.Compose_Full_Java_Command
37     ...    -Xms128M -Xmx2048m -XX:+UnlockDiagnosticVMOptions -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dcom.sun.management.jmxremote -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom -cp "etc/initial/:lib/*" org.opendaylight.netconf.micro.NetconfMain > /tmp/odlmicro.log 2>&1
38     BuiltIn.Log    ${command}
39     SSHLibrary.Write    ${command}
40
41 Get pid
42     [Arguments]    ${process_name}
43     ${pid} =    SSHLibrary.Execute Command
44     ...    ps -fu ${ODL_SYSTEM_USER} | grep "${process_name}" | grep -v "grep" | awk '{print $2}'
45     RETURN    ${pid}
46
47 Check netstat
48     [Arguments]    ${portno}    ${session}=ODL_Micro_instance
49     SSHLibrary.Switch_Connection    ${session}
50     SSHLibrary.Write    netstat -tunpl
51     SSHLibrary.Read Until Regexp    .*${portno}
52
53 Check Process Stats
54     [Arguments]    ${process_name}
55     SSHLibrary.Open_Connection    ${ODL_SYSTEM_IP}    alias=ODL_Micro_instance
56     SSHLibrary.Set_Client_Configuration    timeout=10s
57     SSHLibrary.Set_Client_Configuration    prompt=${ODL_SYSTEM_PROMPT}
58     SSHKeywords.Flexible_SSH_Login    ${ODL_SYSTEM_USER}    ${ODL_SYSTEM_PASSWORD}    delay=4s
59     ${mock_pid} =    Get pid    ${process_name}
60     IF    '${mock_pid}' == '${EMPTY}'
61         BuiltIn.Fail    No ${process_name} process is running
62     END
63
64 Kill process
65     [Arguments]    ${process_name}    ${ssh_alias}=ODL_Micro_instance
66     SSHLibrary.Switch_Connection    ${ssh_alias}
67     ${mock_pid} =    Get pid    ${process_name}
68     SSHLibrary.Execute_Command    kill -9 ${mock_pid}
69
70 Download Netconf Testtool
71     [Documentation]    Download netconf testtool from opendaylight nexus
72     SSHLibrary.Open_Connection    ${TOOLS_SYSTEM_IP}    alias=Netconf_System
73     SSHLibrary.Set_Client_Configuration    timeout=10s
74     SSHLibrary.Set_Client_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
75     SSHKeywords.Flexible_SSH_Login    ${TOOLS_SYSTEM_USER}    ${TOOLS_SYSTEM_PASSWORD}    delay=4s
76     ${file_name} =    NexusKeywords.Deploy_Test_Tool
77     ...    netconf
78     ...    netconf-testtool
79     ...    build_version=${NETCONF_TESTTOOL_VERSION}
80     ...    build_location=org/opendaylight/netconf
81     Set Global Variable    ${NETCONF_FILENAME}    ${filename}
82     ${file_name} =    NexusKeywords.Deploy_Test_Tool
83     ...    netconf
84     ...    netconf-testtool
85     ...    rest-perf-client
86     ...    build_version=${NETCONF_TESTTOOL_VERSION}
87     ...    build_location=org/opendaylight/netconf
88     Set Global Variable    ${RESTPERF_FILENAME}    ${filename}
89
90 Run Netconf Testtool
91     [Arguments]    ${ssh_alias}=Netconf_System
92     NetconfKeywords.Start_Testtool
93     ...    ${NETCONF_FILENAME}
94     ...    device-count=1
95     ...    schemas=${CURDIR}/../variables/netconf/CRUD/schemas