2 Documentation Test suite for SFC Service Nodes, Operates Nodes from Restconf APIs.
3 Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
4 Suite Teardown Delete All Sessions
7 Library OperatingSystem
8 Library RequestsLibrary
9 Variables ../../../variables/Variables.py
10 Resource ../../../libraries/Utils.robot
13 ${SERVICE_NODES_URI} /restconf/config/service-node:service-nodes/
14 ${SERVICE_NODES_FILE} ../../../variables/sfc/service-nodes.json
15 ${SN_NODE100_URI} /restconf/config/service-node:service-nodes/service-node/node-100
16 ${SN_NODE100_FILE} ../../../variables/sfc/sn_node_100.json
20 [Documentation] Add Service Nodes from JSON file
21 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
22 ${body} OperatingSystem.Get File ${SERVICE_NODES_FILE}
23 ${jsonbody} To Json ${body}
24 ${nodes} Get From Dictionary ${jsonbody} service-nodes
25 ${resp} RequestsLibrary.Get session ${SERVICE_NODES_URI}
26 Should Be Equal As Strings ${resp.status_code} 200
27 ${result} To JSON ${resp.content}
28 ${node} Get From Dictionary ${result} service-nodes
29 Lists Should be Equal ${node} ${nodes}
31 Delete All Service Nodes
32 [Documentation] Delete all Service Nodes
33 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
34 ${resp} RequestsLibrary.Get session ${SERVICE_NODES_URI}
35 Should Be Equal As Strings ${resp.status_code} 200
36 Remove All Elements At URI ${SERVICE_NODES_URI}
37 ${resp} RequestsLibrary.Get session ${SERVICE_NODES_URI}
38 Should Be Equal As Strings ${resp.status_code} 404
41 [Documentation] Get one Service Node
42 Remove All Elements At URI ${SERVICE_NODES_URI}
43 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
44 ${elements}= Create List node-101 firewall-101-2 10.3.1.101
45 Check For Elements At URI ${SERVICE_NODES_URI}service-node/node-101 ${elements}
47 Get A Non-existing Service Node
48 [Documentation] Get A Non-existing Service Node
49 Remove All Elements At URI ${SERVICE_NODES_URI}
50 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
51 ${resp} RequestsLibrary.Get session ${SERVICE_NODES_URI}service-node/non-existing-sf
52 Should Be Equal As Strings ${resp.status_code} 404
55 [Documentation] Delete A Service Node
56 Remove All Elements At URI ${SERVICE_NODES_URI}
57 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
58 Remove All Elements At URI ${SERVICE_NODES_URI}service-node/node-101
59 ${resp} RequestsLibrary.Get session ${SERVICE_NODES_URI}
60 Should Be Equal As Strings ${resp.status_code} 200
61 Should Not Contain ${resp.content} node-101
63 Delete A Non-existing Service Node
64 [Documentation] Delete A Non existing Service Node
65 Remove All Elements At URI ${SERVICE_NODES_URI}
66 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
67 ${body} OperatingSystem.Get File ${SERVICE_NODES_FILE}
68 ${jsonbody} To Json ${body}
69 ${nodes} Get From Dictionary ${jsonbody} service-nodes
70 Remove All Elements At URI ${SERVICE_NODES_URI}service-node/non-existing-sn
71 ${resp} RequestsLibrary.Get session ${SERVICE_NODES_URI}
72 Should Be Equal As Strings ${resp.status_code} 200
73 ${result} To JSON ${resp.content}
74 ${node} Get From Dictionary ${result} service-nodes
75 Lists Should be Equal ${node} ${nodes}
78 [Documentation] Put one Service Node
79 Remove All Elements At URI ${SERVICE_NODES_URI}
80 Add Elements To URI From File ${SN_NODE100_URI} ${SN_NODE100_FILE}
81 ${elements}= Create List node-100 10.3.1.100 dpi-100-1 firewall-102-1
82 Check For Elements At URI ${SN_NODE100_URI} ${elements}
83 Check For Elements At URI ${SERVICE_NODES_URI} ${elements}
85 Clean All Service Nodes After Tests
86 [Documentation] Delete all Service Nodes From Datastore After Tests
87 Remove All Elements At URI ${SERVICE_NODES_URI}