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
14 Run Read Service Python Script on Controller Vm
15 [Documentation] This keyword creates a new virtual environment, installs pyzmq & zmq and starts the read service on controller vm
16 [Arguments] ${host_index}=${FIRST_CONTROLLER_INDEX}
17 ${host_index} Builtin.Convert To Integer ${host_index}
18 ${host} ClusterManagement.Resolve IP Address For Member ${host_index}
19 ${connections} SSHKeywords.Open_Connection_To_ODL_System ${host}
20 SSHLibrary.Switch Connection ${connections}
21 SSHLibrary.Put File ${READ_SERVICE_SCRIPT} ${WORKSPACE}/${BUNDLEFOLDER}/ mode=664
22 ${module} OperatingSystem.Get File ${JSONRPCCONFIG_MODULE_JSON}
23 ${data} OperatingSystem.Get File ${JSONRPCCONFIG_DATA_JSON}
24 ${cmd} Builtin.Set Variable
25 ... 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(" ","")}'
27 SSHKeywords.Virtual_Env_Set_Path /tmp/jsonrpc_venv
28 SSHKeywords.Virtual_Env_Create_Python3 True
29 SSHKeywords.Virtual_Env_Install_Package pyzmq
30 SSHKeywords.Virtual_Env_Install_Package zmq
31 SSHKeywords.Virtual_Env_Activate_On_Current_Session True
32 ${stdout} SSHLibrary.Write rm -rf nohup.out
33 ${stdout} SSHLibrary.Write ${cmd} &
34 ${stdout} SSHLibrary.Write echo
37 ${stdout} SSHLibrary.Execute Command /usr/sbin/ss -nlt
39 ${stdout} SSHLibrary.Execute Command cat nohup.out
41 SSHLibrary.Close_Connection
43 Mount Read Service Endpoint
44 [Documentation] This keyword mounts an endpoint after starting service
45 [Arguments] ${controller_index}=${FIRST_CONTROLLER_INDEX} ${file}=${READ_SERVICE_PEER_PAYLOAD} ${endpoint}=${DEFAULT_ENDPOINT}
46 ${JSON1} OperatingSystem.Get File ${file}
48 ${response_json} ClusterManagement.Put_As_Json_To_Member
49 ... ${READ_SERVICE_PEER_URL}=${endpoint}
51 ... ${controller_index}
52 Builtin.Log ${response_json}
54 Verify Data On Mounted Endpoint
55 [Documentation] This keyword verifies if the data we get on the mount point is same as what we put
56 [Arguments] ${controller_index}=${FIRST_CONTROLLER_INDEX} ${endpoint}=${DEFAULT_ENDPOINT}
57 ${resp} ClusterManagement.Get_From_Member
58 ... ${READ_SERVICE_PEER_URL}=${endpoint}${READ_SERVICE_PEER_MOUNT_PATH}?content=config
59 ... ${controller_index}
60 ${response_json} Builtin.Convert To String ${resp}
62 Verify Restconf Get On Mounted Endpoint ${response_json} ${READSERVICE_NAME}
64 Verify Restconf Get On Mounted Endpoint
65 [Documentation] This keyword parses restconf get of mountpoint
66 [Arguments] ${output} ${name}
67 Builtin.Should Match Regexp ${output} "name":"${name}"