3 Library RequestsLibrary
4 Resource SSHKeywords.robot
5 Resource ../variables/Variables.robot
8 ${mount_point_url} /restconf/operational/network-topology:network-topology/topology/topology-netconf/
9 ${device_status} /restconf/operational/odl-netconf-callhome-server:netconf-callhome-server
10 ${whitelist} /restconf/config/odl-netconf-callhome-server:netconf-callhome-server/allowed-devices
11 ${substring1} "netconf-node-topology:connection-status":"connected"
12 ${substring2} "node-id":"netopeer"
13 ${substring3} "netconf-node-topology:available-capabilities"
17 [Arguments] ${status} ${id}=netopeer
18 [Documentation] Checks the operational device status.
19 @{expectedValues} Create List "unique-id":"${id}" "callhome-status:device-status":"${status}"
20 Run Keyword If '${status}'=='FAILED_NOT_ALLOWED' or '${status}'=='FAILED_AUTH_FAILURE' Remove Values From List ${expectedValues} "unique-id":"${id}"
21 Utils.Check For Elements At URI ${device_status} ${expectedValues}
24 [Documentation] Pulls the netopeer image from the docker repository. Points ODL(CallHome Server) IP in the files used by netopeer(CallHome Client).
25 ${stdout} ${stderr} ${rc}= SSHLibrary.Execute Command docker pull sdnhub/netopeer return_stdout=True return_stderr=True
27 ${stdout} ${stderr} ${rc}= SSHLibrary.Execute Command docker images return_stdout=True return_stderr=True
29 Reset Docker Compose Configuration
31 Reset Docker Compose Configuration
32 [Documentation] Resets the docker compose configurations.
33 SSHLibrary.Put File ${CURDIR}/../variables/netconf/callhome/docker-compose.yaml .
34 SSHLibrary.Put File ${CURDIR}/../variables/netconf/callhome/datastore-server.xml .
35 SSHLibrary.Execute_Command sed -i -e 's/ODL_SYSTEM_IP/${ODL_SYSTEM_IP}/g' docker-compose.yaml
36 SSHLibrary.Execute_Command sed -i -e 's/ODL_SYSTEM_IP/${ODL_SYSTEM_IP}/g' datastore-server.xml
39 [Documentation] Get the scripts ready to set credentials and control whitelist maintained by the CallHome server.
40 SSHLibrary.Put File ${CURDIR}/../variables/netconf/callhome/whitelist_add.sh .
41 SSHLibrary.Put File ${CURDIR}/../variables/netconf/callhome/credentials_set.sh .
42 SSHLibrary.Execute_Command chmod +x whitelist_add.sh
43 SSHLibrary.Execute_Command chmod +x credentials_set.sh
44 SSHLibrary.Execute_Command sed -i -e 's/ODL_SYSTEM_IP/${ODL_SYSTEM_IP}/g' credentials_set.sh
45 SSHLibrary.Execute_Command sed -i -e 's/ODL_SYSTEM_IP/${ODL_SYSTEM_IP}/g' whitelist_add.sh
47 Install Docker Compose on tools system
48 [Documentation] Install docker-compose on tools system.
49 ${netopeer_conn_id} = SSHKeywords.Open_Connection_To_Tools_System
50 Builtin.Set Suite Variable ${netopeer_conn_id}
51 SSHLibrary.Write sudo curl -L "https://github.com/docker/compose/releases/download/1.11.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
52 ${output}= Wait Until Keyword Succeeds 30s 2s SSHLibrary.Read_Until_Prompt
53 ${stdout} ${stderr} ${rc}= SSHLibrary.Execute Command sudo chmod +x /usr/local/bin/docker-compose return_stdout=True return_stderr=True
56 Uninstall Docker Compose on tools system
57 [Documentation] Uninstall docker-compose on tools system
58 ${stdout} ${stderr} ${rc}= SSHLibrary.Execute Command pip uninstall docker-compose return_stdout=True return_stderr=True
62 [Documentation] Tearing down the setup.
63 Uninstall Docker Compose on tools system
64 RequestsLibrary.Delete_All_Sessions
65 SSHLibrary.Close_All_Connections
68 [Documentation] Tears down the docker running netopeer and deletes entry from the whitelist.
69 ${stdout} ${stderr} ${rc}= SSHLibrary.Execute Command docker-compose down return_stdout=True return_stderr=True
71 ${stdout} ${stderr} ${rc}= SSHLibrary.Execute Command docker ps -a return_stdout=True return_stderr=True
73 ${resp} = RequestsLibrary.Delete_Request session ${whitelist}
76 [Documentation] Get the suite ready for callhome test cases.
77 RequestsLibrary.Create_Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
78 Install Docker Compose on tools system
81 ${netconf_mount_expected_values} Create list ${substring1} ${substring2} ${substring3}
82 Set Suite Variable ${netconf_mount_expected_values}