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