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
6 Library OperatingSystem
8 Library RequestsLibrary
10 Library ../../../../libraries/Common.py
11 Variables ../../../../variables/Variables.py
12 Resource ../../../../libraries/UscUtils.robot
18 [Documentation] Add multiple USC TLS channels
19 FOR ${port_index} IN @{LIST_ECHO_SERVER_PORT}
20 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} port=${port_index} tcp=true remote=false
21 ${channel} Create Dictionary channel=${content}
22 ${input} Create Dictionary input=${channel}
23 ${data} json.dumps ${input}
24 ${resp} Post Request session ${REST_ADD_CHANNEL} data=${data}
26 Should Be Equal As Strings ${resp.status_code} 200
27 Should Contain ${resp.content} Succeed to connect
31 [Documentation] Check if the channels are correct
32 ${topo} Create Dictionary topology-id=usc
33 ${input} Create Dictionary input=${topo}
34 ${data} json.dumps ${input}
35 ${resp} Post Request session ${REST_VIEW_CHANNEL} data=${data}
37 Should Be Equal As Strings ${resp.status_code} 200
38 Should Contain ${resp.content} "topology"
39 ${len} Get Length ${LIST_ECHO_SERVER_PORT}
40 Should Contain ${resp.content} "sessions":${len}
41 Should Contain ${resp.content} "channel-type":"TLS"
44 [Documentation] Send test messages multiple times
45 FOR ${port_index} IN @{LIST_ECHO_SERVER_PORT}
46 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} port=${port_index} tcp=true content=${TEST_MESSAGE}
47 ${channel} Create Dictionary channel=${content}
48 ${input} Create Dictionary input=${channel}
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 ${len1} Get Length ${LIST_ECHO_SERVER_PORT}
62 ${len2} Get Length ${TEST_MESSAGE}
63 ${totalLen} Evaluate ${len1} * ${len2} * ${NUM_OF_MESSAGES}
64 Should Contain ${resp.content} "bytes-out":${totalLen}
65 Should Contain ${resp.content} "bytes-in":${totalLen}
68 [Documentation] Remove the channels
69 FOR ${port_index} IN @{LIST_ECHO_SERVER_PORT}
70 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} port=${port_index} tcp=true
71 ${channel} Create Dictionary channel=${content}
72 ${input} Create Dictionary input=${channel}
73 ${data} json.dumps ${input}
74 ${resp} Post Request session ${REST_REMOVE_SESSION} data=${data}
76 Should Be Equal As Strings ${resp.status_code} 200
77 Should Contain ${resp.content} Succeed to remove
81 [Documentation] Remove the channels
82 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} tcp=true
83 ${channel} Create Dictionary channel=${content}
84 ${input} Create Dictionary input=${channel}
85 ${data} json.dumps ${input}
86 ${resp} Post Request session ${REST_REMOVE_CHANNEL} data=${data}
88 Should Be Equal As Strings ${resp.status_code} 200
89 Should Contain ${resp.content} Succeed to remove
92 [Documentation] Check if the channels are correct
93 ${topo} Create Dictionary topology-id=usc
94 ${input} Create Dictionary input=${topo}
95 ${data} json.dumps ${input}
96 ${resp} Post Request session ${REST_VIEW_CHANNEL} data=${data}
98 Should Be Equal As Strings ${resp.status_code} 200
99 Should Contain ${resp.content} "topology"
104 FOR ${index} IN RANGE 0 ${NUM_OF_MESSAGES}
105 ${data} json.dumps ${body}
106 ${resp} Post Request session ${REST_SEND_MESSAGE} data=${data}
107 Should Be Equal As Strings ${resp.status_code} 200
108 Should Contain ${resp.content} Succeed to send request