2 Documentation Test suite for callhome DTLS channel
3 Suite Setup Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
4 Suite Teardown Delete All Sessions
7 Library OperatingSystem
9 Library RequestsLibrary
11 Library ../../../../libraries/Common.py
12 Variables ../../../../variables/Variables.py
13 Resource ../../../../libraries/UscUtils.robot
17 [Documentation] Add an USC TLS callhome channel
18 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} tcp=false port=${ECHO_SERVER_PORT} remote=false
19 ${channel} Create Dictionary channel=${content}
20 ${input} Create Dictionary input=${channel}
21 ${data} json.dumps ${input}
22 ${resp} Post Request session ${REST_ADD_CHANNEL} data=${data}
24 Should Be Equal As Strings ${resp.status_code} 200
25 Should Contain ${resp.content} Succeed to connect
28 [Documentation] Check if the channel is correct
29 ${topo} Create Dictionary topology-id=usc
30 ${input} Create Dictionary input=${topo}
31 ${data} json.dumps ${input}
32 ${resp} Post Request session ${REST_VIEW_CHANNEL} data=${data}
34 Should Be Equal As Strings ${resp.status_code} 200
35 Should Contain ${resp.content} "topology"
36 Should Contain ${resp.content} "sessions":1
37 Should Contain ${resp.content} "channel-type":"DTLS"
38 Should Contain ${resp.content} "call-home":"CallHome"
41 [Documentation] Send test messages multiple times
42 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} port=${ECHO_SERVER_PORT} tcp=false content=${TEST_MESSAGE}
43 ${channel} Create Dictionary channel=${content}
44 ${input} Create Dictionary input=${channel}
45 FOR ${index} IN RANGE 0 ${NUM_OF_MESSAGES}
46 ${data} json.dumps ${input}
47 ${resp} Post Request session ${REST_SEND_MESSAGE} data=${data}
48 Should Be Equal As Strings ${resp.status_code} 200
49 Should Contain ${resp.content} Succeed to send request
52 View Bytes In and Bytes Out
53 [Documentation] Check if the number of Bytes In and Bytes Out are correct
54 ${topo} Create Dictionary topology-id=usc
55 ${input} Create Dictionary input=${topo}
56 ${data} json.dumps ${input}
57 ${resp} Post Request session ${REST_VIEW_CHANNEL} data=${data}
59 Should Be Equal As Strings ${resp.status_code} 200
60 Should Contain ${resp.content} "topology"
61 ${len} Get Length ${TEST_MESSAGE}
62 ${totalLen} Evaluate ${len} * ${NUM_OF_MESSAGES}
63 Should Contain ${resp.content} "bytes-out":${totalLen}
64 Should Contain ${resp.content} "bytes-in":${totalLen}
67 [Documentation] Remove the channel
68 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} tcp=false
69 ${channel} Create Dictionary channel=${content}
70 ${input} Create Dictionary input=${channel}
71 ${data} json.dumps ${input}
72 ${resp} Post Request session ${REST_REMOVE_CHANNEL} data=${data}
74 Should Be Equal As Strings ${resp.status_code} 200
75 Should Contain ${resp.content} Succeed to remove