2 Documentation Test suite for SFC Service Nodes, Operates Nodes from Restconf APIs.
4 Suite Teardown Delete All Sessions
5 Test Setup Remove All Elements If Exist ${SERVICE_NODES_URI}
8 Library OperatingSystem
9 Library RequestsLibrary
10 Resource ../../../variables/sfc/Variables.robot
11 Resource ../../../libraries/Utils.robot
12 Resource ../../../libraries/TemplatedRequests.robot
16 [Documentation] Add Service Nodes from JSON file
17 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
18 ${body} OperatingSystem.Get File ${SERVICE_NODES_FILE}
19 ${jsonbody} To Json ${body}
20 ${nodes} Get From Dictionary ${jsonbody} service-nodes
21 ${resp} RequestsLibrary.Get Request session ${SERVICE_NODES_URI}
22 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
23 ${result} To JSON ${resp.content}
24 ${node} Get From Dictionary ${result} service-nodes
25 Lists Should be Equal ${node} ${nodes}
27 Delete All Service Nodes
28 [Documentation] Delete all Service Nodes
29 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
30 ${resp} RequestsLibrary.Get Request session ${SERVICE_NODES_URI}
31 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
32 Remove All Elements At URI ${SERVICE_NODES_URI}
33 ${resp} RequestsLibrary.Get Request session ${SERVICE_NODES_URI}
34 Should Be Equal As Strings ${resp.status_code} 404
37 [Documentation] Get one Service Node
38 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
39 ${elements}= Create List node-101 firewall-101-2 10.3.1.101
40 Check For Elements At URI ${SERVICE_NODES_URI}service-node/node-101 ${elements}
42 Get A Non-existing Service Node
43 [Documentation] Get A Non-existing Service Node
44 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
45 ${resp} RequestsLibrary.Get Request session ${SERVICE_NODES_URI}service-node/non-existing-sf
46 Should Be Equal As Strings ${resp.status_code} 404
49 [Documentation] Delete A Service Node
50 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
51 Remove All Elements At URI ${SERVICE_NODES_URI}service-node/node-101
52 ${resp} RequestsLibrary.Get Request session ${SERVICE_NODES_URI}
53 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
54 Should Not Contain ${resp.content} node-101
56 Delete A Non-existing Service Node
57 [Documentation] Delete A Non existing Service Node
58 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
59 ${body} OperatingSystem.Get File ${SERVICE_NODES_FILE}
60 ${jsonbody} To Json ${body}
61 ${nodes} Get From Dictionary ${jsonbody} service-nodes
62 ${resp} RequestsLibrary.Delete Request session ${SERVICE_NODES_URI}service-node/non-existing-sn
63 Should Be Equal As Strings ${resp.status_code} 404
64 ${resp} RequestsLibrary.Get Request session ${SERVICE_NODES_URI}
65 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
66 ${result} To JSON ${resp.content}
67 ${node} Get From Dictionary ${result} service-nodes
68 Lists Should be Equal ${node} ${nodes}
71 [Documentation] Put one Service Node
72 Add Elements To URI From File ${SN_NODE100_URI} ${SN_NODE100_FILE}
73 ${elements}= Create List node-100 10.3.1.100 dpi-100-1 firewall-102-1
74 Check For Elements At URI ${SN_NODE100_URI} ${elements}
75 Check For Elements At URI ${SERVICE_NODES_URI} ${elements}
79 [Documentation] Initialize session and ODL version specific variables
80 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
82 Set Suite Variable ${VERSION_DIR} master
83 Set Suite Variable ${SERVICE_NODES_URI} /restconf/config/service-node:service-nodes/
84 Set Suite Variable ${SERVICE_NODES_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-nodes.json
85 Set Suite Variable ${SN_NODE100_URI} /restconf/config/service-node:service-nodes/service-node/node-100
86 Set Suite Variable ${SN_NODE100_FILE} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/sn_node_100.json