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
17 [Documentation] Runs an APPC healthcheck
18 ${resp}= Run APPC Post Request ${APPC_INDEX PATH}${APPC_HEALTHCHECK_OPERATION_PATH} ${None}
19 Should Be Equal As Strings ${resp.status_code} 200
20 Should Be Equal As Strings ${resp.json()['output']['response-code']} 200
23 [Documentation] Runs an APPC post request
24 [Arguments] ${data_path} ${data} ${content}=json
25 ${auth}= Create List ${GLOBAL_APPC_USERNAME} ${GLOBAL_APPC_PASSWORD}
26 Log Creating session ${GLOBAL_APPC_SERVER}
27 ${session}= Create Session appc ${GLOBAL_APPC_SERVER} auth=${auth}
28 ${uuid}= Generate UUID
29 ${headers}= Create Dictionary Accept=application/${content} Content-Type=application/${content} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
30 ${resp}= Post Request appc ${data_path} data=${data} headers=${headers}
31 Log Received response from appc ${resp.text}
35 [Documentation] Runs an APPC post request
36 [Arguments] ${data_path} ${data} ${content}=xml
37 ${auth}= Create List ${GLOBAL_APPC_USERNAME} ${GLOBAL_APPC_PASSWORD}
38 Log Creating session ${GLOBAL_APPC_SERVER}
39 ${session}= Create Session appc ${GLOBAL_APPC_SERVER} auth=${auth}
40 ${uuid}= Generate UUID
41 ${headers}= Create Dictionary Accept=application/${content} Content-Type=application/${content} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
42 ${resp}= Put Request appc ${data_path} data=${data} headers=${headers}
43 Log Received response from appc ${resp.text}
46 Create Mount Point In APPC
47 [Documentation] Go tell APPC about the PGN we just spun up...
48 [Arguments] ${nodeid} ${host} ${port}=${GLOBAL_PGN_PORT} ${username}=admin ${password}=admin
49 ${dict}= Create Dictionary nodeid=${nodeid} host=${host} port=${port} username=${username} password=${password}
50 ${template}= OperatingSystem.Get File ${APPC_MOUNT_XML}
51 ${data}= Template String ${template} ${dict}
52 ${resp}= Run APPC Put Request ${APPC_INDEX PATH}${APPC_CREATE_MOUNTPOINT_PATH}${nodeid} ${data}
53 Should Be Equal As Strings ${resp.status_code} 200