2 Documentation Test suite for callhome 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 callhome 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"
37 Should Contain ${resp.content} "call-home":"CallHome"
40 [Documentation] Send test messages multiple times
41 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} port=${ECHO_SERVER_PORT} tcp=true content=${TEST_MESSAGE}
42 ${channel} Create Dictionary channel=${content}
43 ${input} Create Dictionary input=${channel}
44 FOR ${index} IN RANGE 0 ${NUM_OF_MESSAGES}
45 ${data} json.dumps ${input}
46 ${resp} Post Request session ${REST_SEND_MESSAGE} data=${data}
47 Should Be Equal As Strings ${resp.status_code} 200
48 Should Contain ${resp.content} Succeed to send request
51 View Bytes In and Bytes Out
52 [Documentation] Check if the number of Bytes In and Bytes Out are correct
53 ${topo} Create Dictionary topology-id=usc
54 ${input} Create Dictionary input=${topo}
55 ${data} json.dumps ${input}
56 ${resp} Post Request session ${REST_VIEW_CHANNEL} data=${data}
58 Should Be Equal As Strings ${resp.status_code} 200
59 Should Contain ${resp.content} "topology"
60 ${len} Get Length ${TEST_MESSAGE}
61 ${totalLen} Evaluate ${len} * ${NUM_OF_MESSAGES}
62 Should Contain ${resp.content} "bytes-out":${totalLen}
63 Should Contain ${resp.content} "bytes-in":${totalLen}
66 [Documentation] Remove the channel
67 ${content} Create Dictionary hostname=${TOOLS_SYSTEM_IP} tcp=true
68 ${channel} Create Dictionary channel=${content}
69 ${input} Create Dictionary input=${channel}
70 ${data} json.dumps ${input}
71 ${resp} Post Request session ${REST_REMOVE_CHANNEL} data=${data}
73 Should Be Equal As Strings ${resp.status_code} 200
74 Should Contain ${resp.content} Succeed to remove