2 Documentation The main interface for interacting with APP-C. It handles low level stuff like managing the http request library and APP-C required fields
3 Library RequestsLibrary
5 Library OperatingSystem
6 Library StringTemplater
7 Resource global_properties.robot
10 ${APPC_INDEX_PATH} /restconf
11 ${APPC_HEALTHCHECK_OPERATION_PATH} /operations/SLI-API:healthcheck
12 ${APPC_CREATE_MOUNTPOINT_PATH} /config/network-topology:network-topology/topology/topology-netconf/node/
13 ${APPC_MOUNT_XML} robot/assets/templates/appc/vnf_mount.template
14 ${APPC_ENDPOINT} ${GLOBAL_APPC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_APPC_IP_ADDR}:${GLOBAL_APPC_SERVER_PORT}
19 [Documentation] Runs an APPC healthcheck
20 ${resp}= Run APPC Post Request ${APPC_INDEX PATH}${APPC_HEALTHCHECK_OPERATION_PATH} ${None}
21 Should Be Equal As Strings ${resp.status_code} 200
22 Should Be Equal As Strings ${resp.json()['output']['response-code']} 200
25 [Documentation] Runs an APPC post request
26 [Arguments] ${data_path} ${data} ${content}=json
27 ${auth}= Create List ${GLOBAL_APPC_USERNAME} ${GLOBAL_APPC_PASSWORD}
28 Log Creating session ${APPC_ENDPOINT}
29 ${session}= Create Session appc ${APPC_ENDPOINT} auth=${auth}
30 ${uuid}= Generate UUID
31 ${headers}= Create Dictionary Accept=application/${content} Content-Type=application/${content} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
32 ${resp}= Post Request appc ${data_path} data=${data} headers=${headers}
33 Log Received response from appc ${resp.text}
37 [Documentation] Runs an APPC post request
38 [Arguments] ${data_path} ${data} ${content}=xml
39 ${auth}= Create List ${GLOBAL_APPC_USERNAME} ${GLOBAL_APPC_PASSWORD}
40 Log Creating session ${APPC_ENDPOINT}
41 ${session}= Create Session appc ${APPC_ENDPOINT} auth=${auth}
42 ${uuid}= Generate UUID
43 ${headers}= Create Dictionary Accept=application/${content} Content-Type=application/${content} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
44 ${resp}= Put Request appc ${data_path} data=${data} headers=${headers}
45 Log Received response from appc ${resp.text}
48 Create Mount Point In APPC
49 [Documentation] Go tell APPC about the PGN we just spun up...
50 [Arguments] ${nodeid} ${host} ${port}=${GLOBAL_PGN_PORT} ${username}=admin ${password}=admin
51 ${dict}= Create Dictionary nodeid=${nodeid} host=${host} port=${port} username=${username} password=${password}
52 ${template}= OperatingSystem.Get File ${APPC_MOUNT_XML}
53 ${data}= Template String ${template} ${dict}
54 ${resp}= Run APPC Put Request ${APPC_INDEX PATH}${APPC_CREATE_MOUNTPOINT_PATH}${nodeid} ${data}
55 Should Be Equal As Strings ${resp.status_code} 200