2 Documentation Test suite for SFC Service Nodes, Operates Nodes from Restconf APIs.
6 Library OperatingSystem
7 Library RequestsLibrary
8 Resource ../../../variables/sfc/Variables.robot
9 Resource ../../../libraries/Utils.robot
10 Resource ../../../libraries/TemplatedRequests.robot
12 Suite Setup Init Suite
13 Suite Teardown Delete All Sessions
14 Test Setup Remove All Elements If Exist ${SERVICE_NODES_URI}
19 [Documentation] Add Service Nodes from JSON file
20 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
21 ${body} OperatingSystem.Get File ${SERVICE_NODES_FILE}
22 ${jsonbody} To Json ${body}
23 ${nodes} Get From Dictionary ${jsonbody} service-nodes
24 ${resp} RequestsLibrary.Get Request session ${SERVICE_NODES_URI}
25 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
26 ${result} To JSON ${resp.content}
27 ${node} Get From Dictionary ${result} service-nodes
28 Lists Should be Equal ${node} ${nodes}
30 Delete All Service Nodes
31 [Documentation] Delete all Service Nodes
32 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
33 ${resp} RequestsLibrary.Get Request session ${SERVICE_NODES_URI}
34 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
35 Remove All Elements At URI ${SERVICE_NODES_URI}
36 ${resp} RequestsLibrary.Get Request session ${SERVICE_NODES_URI}
37 Should Be Equal As Strings ${resp.status_code} 404
40 [Documentation] Get one Service Node
41 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
42 ${elements} Create List node-101 firewall-101-2 10.3.1.101
43 Check For Elements At URI ${SERVICE_NODE_URI}/node-101 ${elements}
45 Get A Non-existing Service Node
46 [Documentation] Get A Non-existing Service Node
47 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
48 ${resp} RequestsLibrary.Get Request session ${SERVICE_NODE_URI}/non-existing-sf
49 Should Be Equal As Strings ${resp.status_code} 404
52 [Documentation] Delete A Service Node
53 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
54 Remove All Elements At URI ${SERVICE_NODE_URI}/node-101
55 ${resp} RequestsLibrary.Get Request session ${SERVICE_NODES_URI}
56 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
57 Should Not Contain ${resp.text} node-101
59 Delete A Non-existing Service Node
60 [Documentation] Delete A Non existing Service Node
61 Add Elements To URI From File ${SERVICE_NODES_URI} ${SERVICE_NODES_FILE}
62 ${body} OperatingSystem.Get File ${SERVICE_NODES_FILE}
63 ${jsonbody} To Json ${body}
64 ${nodes} Get From Dictionary ${jsonbody} service-nodes
65 ${resp} RequestsLibrary.Delete Request session ${SERVICE_NODE_URI}/non-existing-sn
66 Should Be Equal As Strings ${resp.status_code} 404
67 ${resp} RequestsLibrary.Get Request session ${SERVICE_NODES_URI}
68 Should Contain ${ALLOWED_STATUS_CODES} ${resp.status_code}
69 ${result} To JSON ${resp.content}
70 ${node} Get From Dictionary ${result} service-nodes
71 Lists Should be Equal ${node} ${nodes}
74 [Documentation] Put one Service Node
75 Add Elements To URI From File ${SN_NODE100_URI} ${SN_NODE100_FILE}
76 ${elements} Create List node-100 10.3.1.100 dpi-100-1 firewall-102-1
77 Check For Elements At URI ${SN_NODE100_URI} ${elements}
78 Check For Elements At URI ${SERVICE_NODES_URI} ${elements}
83 [Documentation] Initialize session and ODL version specific variables
84 Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
86 Set Suite Variable ${VERSION_DIR} master
87 Set Suite Variable ${TEST_DIR} ${CURDIR}/../../../variables/sfc/${VERSION_DIR}
88 Set Suite Variable ${SERVICE_NODES_FILE} ${TEST_DIR}/service-nodes.json
89 Set Suite Variable ${SN_NODE100_URI} ${SERVICE_NODE_URI}/node-100
90 Set Suite Variable ${SN_NODE100_FILE} ${TEST_DIR}/sn_node_100.json