2 Documentation Test suite for an USC 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
8 Library RequestsLibrary
10 Library ../../../../libraries/Common.py
11 Variables ../../../../variables/Variables.py
12 Resource ../../../../libraries/UscUtils.robot
16 [Documentation] Add an USC DTLS channel
17 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} tcp=false port=${ECHO_SERVER_PORT} remote=false
18 ${channel} Create Dictionary channel=${content}
19 ${input} Create Dictionary input=${channel}
20 ${data} json.dumps ${input}
21 ${resp} Post Request session ${REST_ADD_CHANNEL} data=${data}
23 Should Be Equal As Strings ${resp.status_code} 200
24 Should Contain ${resp.content} Succeed to connect
27 [Documentation] Check if the channel is correct
28 ${topo} Create Dictionary topology-id=usc
29 ${input} Create Dictionary input=${topo}
30 ${data} json.dumps ${input}
31 ${resp} Post Request session ${REST_VIEW_CHANNEL} data=${data}
33 Should Be Equal As Strings ${resp.status_code} 200
34 Should Contain ${resp.content} "topology"
35 Should Contain ${resp.content} "sessions":1
36 Should Contain ${resp.content} "channel-type":"DTLS"
39 [Documentation] Send test messages multiple times to multiple sessions
40 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} port=${ECHO_SERVER_PORT} tcp=false content=${TEST_MESSAGE}
41 ${channel} Create Dictionary channel=${content}
42 ${input} Create Dictionary input=${channel}
43 FOR ${index} IN RANGE 0 ${NUM_OF_MESSAGES}
44 ${data} json.dumps ${input}
45 ${resp} Post Request session ${REST_SEND_MESSAGE} data=${data}
46 Should Be Equal As Strings ${resp.status_code} 200
47 Should Contain ${resp.content} Succeed to send request
50 View Bytes In and Bytes Out
51 [Documentation] Check if the number of Bytes In and Bytes Out are correct
52 ${topo} Create Dictionary topology-id=usc
53 ${input} Create Dictionary input=${topo}
54 ${data} json.dumps ${input}
55 ${resp} Post Request session ${REST_VIEW_CHANNEL} data=${data}
57 Should Be Equal As Strings ${resp.status_code} 200
58 Should Contain ${resp.content} "topology"
59 ${len} Get Length ${TEST_MESSAGE}
60 ${totalLen} Evaluate ${len} * ${NUM_OF_MESSAGES}
61 Should Contain ${resp.content} "bytes-out":${totalLen}
62 Should Contain ${resp.content} "bytes-in":${totalLen}
65 [Documentation] Remove the channel
66 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} tcp=false
67 ${channel} Create Dictionary channel=${content}
68 ${input} Create Dictionary input=${channel}
69 ${data} json.dumps ${input}
70 ${resp} Post Request session ${REST_REMOVE_CHANNEL} data=${data}
72 Should Be Equal As Strings ${resp.status_code} 200
73 Should Contain ${resp.content} Succeed to remove