2 Documentation Test suite for 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
16 [Documentation] Add an USC TLS channel
17 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} tcp=true 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":"TLS"
39 [Documentation] Send test messages multiple times to multiple sessions
40 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} port=${ECHO_SERVER_PORT} tcp=true 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
49 View Bytes In and Bytes Out
50 [Documentation] Check if the number of Bytes In and Bytes Out are correct
51 ${topo} Create Dictionary topology-id=usc
52 ${input} Create Dictionary input=${topo}
53 ${data} json.dumps ${input}
54 ${resp} Post Request session ${REST_VIEW_CHANNEL} data=${data}
56 Should Be Equal As Strings ${resp.status_code} 200
57 Should Contain ${resp.content} topology
58 ${len} Get Length ${TEST_MESSAGE}
59 ${totalLen} Evaluate ${len} * ${NUM_OF_MESSAGES}
60 Should Contain ${resp.content} "bytes-out":${totalLen}
61 Should Contain ${resp.content} "bytes-in":${totalLen}
64 [Documentation] Remove the channel
65 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} port=${ECHO_SERVER_PORT} tcp=true
66 ${channel} Create Dictionary channel=${content}
67 ${input} Create Dictionary input=${channel}
68 ${data} json.dumps ${input}
69 ${resp} Post Request session ${REST_REMOVE_CHANNEL} data=${data}
71 Should Be Equal As Strings ${resp.status_code} 200
72 Should Contain ${resp.content} Succeed to remove