2 Library OperatingSystem
5 Library RequestsLibrary
6 Resource ClusterManagement.robot
7 Resource ../variables/jsonrpc/JsonrpcVariables.robot
8 Resource ../variables/Variables.robot
12 Run Read Service Python Script on Controller Vm
13 [Arguments] ${host_index}=${FIRST_CONTROLLER_INDEX} ${ub_system}=${FALSE}
14 [Documentation] This keyword installs pip,zmq,pyzmq and starts the read service on controller vm
15 ${cmd} Builtin.Set Variable If ${ub_system} ${UB_PIP} ${CENTOS_PIP}
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 ${stdout} ${stderr} ${rc}= SSHLibrary.Execute Command ${cmd} return_stdout=True return_stderr=True
24 ${stdout} ${stderr} ${rc}= SSHLibrary.Execute Command sudo pip install --upgrade pip return_stdout=True return_stderr=True
27 ${stdout} ${stderr} ${rc}= SSHLibrary.Execute Command sudo pip install zmq pyzmq return_stdout=True return_stderr=True
30 ${module} OperatingSystem.Get File ${INTERFACES_MODULE_JSON}
31 ${data} OperatingSystem.Get File ${INTERFACES_DATA_JSON}
32 ${cmd} Builtin.Set Variable nohup python ${WORKSPACE}/${BUNDLEFOLDER}/odl-jsonrpc-test-read tcp://0.0.0.0:${DEFAULT_PORT} 'config' ${DEFAULT_ENDPOINT} '${module}' '${data}'
34 ${stdout} SSHLibrary.Write echo | rm -rf nohup.out
35 ${stdout} SSHLibrary.Write echo | nohup python ${WORKSPACE}/${BUNDLEFOLDER}/odl-jsonrpc-test-read tcp://0.0.0.0:${DEFAULT_PORT} 'config' ${DEFAULT_ENDPOINT} '${module}' '${data}' &
36 ${stdout} SSHLibrary.Write echo
38 ${stdout} SSHLibrary.Execute Command cat nohup.out
40 SSHLibrary.Close_Connection
42 Mount Read Service Endpoint
43 [Arguments] ${controller_index}=${FIRST_CONTROLLER_INDEX} ${file}=${READ_SERVICE_PEER_PAYLOAD} ${endpoint}=${DEFAULT_ENDPOINT}
44 [Documentation] This keyword mounts an endpoint after starting service
45 ${JSON1} OperatingSystem.Get File ${file}
47 ${response_json} ClusterManagement.Put_As_Json_To_Member ${READ_SERVICE_PEER_PUT_URL}${endpoint} ${JSON1} ${controller_index}
48 Builtin.Log ${response_json}
50 Verify Data On Mounted Endpoint
51 [Arguments] ${controller_index}=${FIRST_CONTROLLER_INDEX} ${endpoint}=${DEFAULT_ENDPOINT}
52 [Documentation] This keyword verifies if the data we get on the mount point is same as what we put
53 ${resp} ClusterManagement.Get_From_Member ${READ_SERVICE_PEER_GET_1}${endpoint}${READ_SERVICE_PEER_GET_2} ${controller_index}
54 ${response_json} Builtin.Convert To String ${resp}
56 Verify Restconf Get On Mounted Endpoint ${response_json} ${READSERVICE_NAME} ${INTERFACE_MODULE_DEFAULT_DATA}
58 Verify Restconf Get On Mounted Endpoint
59 [Arguments] ${output} ${name} ${type}
60 [Documentation] This keyword parses restconf get of mountpoint
61 Builtin.Should Match Regexp ${output} "name":"${name}"
62 Builtin.Should Match Regexp ${output} "type":"${type}"