2 Library OperatingSystem
5 Library RequestsLibrary
6 Resource ClusterManagement.robot
7 Resource ../variables/jsonrpc/JsonrpcVariables.robot
8 Resource ../variables/Variables.robot
9 Resource SSHKeywords.robot
13 Run Read Service Python Script on Controller Vm
14 [Arguments] ${host_index}=${FIRST_CONTROLLER_INDEX}
15 [Documentation] This keyword creates a new virtual environment, installs pyzmq & zmq and starts the read service on controller vm
16 ${host_index} Builtin.Convert To Integer ${host_index}
17 ${host} ClusterManagement.Resolve IP Address For Member ${host_index}
18 ${connections} SSHKeywords.Open_Connection_To_ODL_System ${host}
19 SSHLibrary.Switch Connection ${connections}
20 SSHLibrary.Put File ${READ_SERVICE_SCRIPT} ${WORKSPACE}/${BUNDLEFOLDER}/ mode=664
21 ${module} OperatingSystem.Get File ${JSONRPCCONFIG_MODULE_JSON}
22 ${data} OperatingSystem.Get File ${JSONRPCCONFIG_DATA_JSON}
23 ${cmd} Builtin.Set Variable nohup python ${WORKSPACE}/${BUNDLEFOLDER}/odl-jsonrpc-test-read tcp://0.0.0.0:${DEFAULT_PORT} 'config' ${DEFAULT_ENDPOINT} '${module.replace("\n","").replace(" ","")}' '${data.replace("\n","").replace(" ","")}'
25 SSHKeywords.Virtual_Env_Set_Path /tmp/jsonrpc_venv
26 SSHKeywords.Virtual_Env_Create_Python3 True
27 SSHKeywords.Virtual_Env_Install_Package pyzmq
28 SSHKeywords.Virtual_Env_Install_Package zmq
29 SSHKeywords.Virtual_Env_Activate_On_Current_Session True
30 ${stdout} SSHLibrary.Write rm -rf nohup.out
31 ${stdout} SSHLibrary.Write ${cmd} &
32 ${stdout} SSHLibrary.Write echo
35 ${stdout} SSHLibrary.Execute Command /usr/sbin/ss -nlt
37 ${stdout} SSHLibrary.Execute Command cat nohup.out
39 SSHLibrary.Close_Connection
41 Mount Read Service Endpoint
42 [Arguments] ${controller_index}=${FIRST_CONTROLLER_INDEX} ${file}=${READ_SERVICE_PEER_PAYLOAD} ${endpoint}=${DEFAULT_ENDPOINT}
43 [Documentation] This keyword mounts an endpoint after starting service
44 ${JSON1} OperatingSystem.Get File ${file}
46 ${response_json} ClusterManagement.Put_As_Json_To_Member ${READ_SERVICE_PEER_PUT_URL}${endpoint} ${JSON1} ${controller_index}
47 Builtin.Log ${response_json}
49 Verify Data On Mounted Endpoint
50 [Arguments] ${controller_index}=${FIRST_CONTROLLER_INDEX} ${endpoint}=${DEFAULT_ENDPOINT}
51 [Documentation] This keyword verifies if the data we get on the mount point is same as what we put
52 ${resp} ClusterManagement.Get_From_Member ${READ_SERVICE_PEER_GET_1}${endpoint}${READ_SERVICE_PEER_GET_2} ${controller_index}
53 ${response_json} Builtin.Convert To String ${resp}
55 Verify Restconf Get On Mounted Endpoint ${response_json} ${READSERVICE_NAME}
57 Verify Restconf Get On Mounted Endpoint
58 [Arguments] ${output} ${name}
59 [Documentation] This keyword parses restconf get of mountpoint
60 Builtin.Should Match Regexp ${output} "name":"${name}"