2 Documentation Test suite for multiple sessions in an USC TLS 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
19 [Documentation] Add multiple USC DTLS channels
20 FOR ${port_index} IN @{LIST_ECHO_SERVER_PORT}
21 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} port=${port_index} tcp=false remote=false
22 ${channel} Create Dictionary channel=${content}
23 ${input} Create Dictionary input=${channel}
24 ${data} json.dumps ${input}
25 ${resp} Post Request session ${REST_ADD_CHANNEL} data=${data}
27 Should Be Equal As Strings ${resp.status_code} 200
28 Should Contain ${resp.content} Succeed to connect
32 [Documentation] Check if the channels are correct
33 ${topo} Create Dictionary topology-id=usc
34 ${input} Create Dictionary input=${topo}
35 ${data} json.dumps ${input}
36 ${resp} Post Request session ${REST_VIEW_CHANNEL} data=${data}
38 Should Be Equal As Strings ${resp.status_code} 200
39 Should Contain ${resp.content} "topology"
40 ${len} Get Length ${LIST_ECHO_SERVER_PORT}
41 Should Contain ${resp.content} "sessions":${len}
42 Should Contain ${resp.content} "channel-type":"DTLS"
45 [Documentation] Send test messages multiple times
46 FOR ${port_index} IN @{LIST_ECHO_SERVER_PORT}
47 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} port=${port_index} tcp=false content=${TEST_MESSAGE}
48 ${channel} Create Dictionary channel=${content}
49 ${input} Create Dictionary input=${channel}
53 View Bytes In and Bytes Out
54 [Documentation] Check if the number of Bytes In and Bytes Out are correct
55 ${topo} Create Dictionary topology-id=usc
56 ${input} Create Dictionary input=${topo}
57 ${data} json.dumps ${input}
58 ${resp} Post Request session ${REST_VIEW_CHANNEL} data=${data}
60 Should Be Equal As Strings ${resp.status_code} 200
61 Should Contain ${resp.content} "topology"
62 ${len} Get Length ${TEST_MESSAGE}
63 ${len1} Get Length ${LIST_ECHO_SERVER_PORT}
64 ${len2} Get Length ${TEST_MESSAGE}
65 ${totalLen} Evaluate ${len1} * ${len2} * ${NUM_OF_MESSAGES}
66 Should Contain ${resp.content} "bytes-out":${totalLen}
67 Should Contain ${resp.content} "bytes-in":${totalLen}
70 [Documentation] Remove the channels
71 FOR ${port_index} IN @{LIST_ECHO_SERVER_PORT}
72 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} port=${port_index} tcp=false
73 ${channel} Create Dictionary channel=${content}
74 ${input} Create Dictionary input=${channel}
75 ${data} json.dumps ${input}
76 ${resp} Post Request session ${REST_REMOVE_SESSION} data=${data}
78 Should Be Equal As Strings ${resp.status_code} 200
79 Should Contain ${resp.content} Succeed to remove
83 [Documentation] Remove the channels
84 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} tcp=false
85 ${channel} Create Dictionary channel=${content}
86 ${input} Create Dictionary input=${channel}
87 ${data} json.dumps ${input}
88 ${resp} Post Request session ${REST_REMOVE_CHANNEL} data=${data}
90 Should Be Equal As Strings ${resp.status_code} 200
91 Should Contain ${resp.content} Succeed to remove
94 [Documentation] Check if the channels are correct
95 ${topo} Create Dictionary topology-id=usc
96 ${input} Create Dictionary input=${topo}
97 ${data} json.dumps ${input}
98 ${resp} Post Request session ${REST_VIEW_CHANNEL} data=${data}
100 Should Be Equal As Strings ${resp.status_code} 200
101 Should Contain ${resp.content} "topology"
106 FOR ${index} IN RANGE 0 ${NUM_OF_MESSAGES}
107 ${data} json.dumps ${body}
108 ${resp} Post Request session ${REST_SEND_MESSAGE} data=${data}
109 Should Be Equal As Strings ${resp.status_code} 200
110 Should Contain ${resp.content} Succeed to send request