blob: 5c3d86361c6225bdbf14415193f247d24dffedd2 [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
2Documentation The main interface for interacting with APP-C. It handles low level stuff like managing the http request library and APP-C required fields
3Library RequestsLibrary
Jerry Flood81d33fb2017-11-21 16:21:21 -05004Library UUID
DR695Hccff30b2017-02-17 18:44:24 -05005Library OperatingSystem
6Library StringTemplater
7Resource global_properties.robot
8
9*** Variables ***
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
DR695Hbf5a3a32017-06-30 13:09:57 -040014${APPC_ENDPOINT} ${GLOBAL_APPC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_APPC_IP_ADDR}:${GLOBAL_APPC_SERVER_PORT}
15
DR695Hccff30b2017-02-17 18:44:24 -050016
17*** Keywords ***
18Run APPC Health Check
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
Jerry Flood81d33fb2017-11-21 16:21:21 -050022 Should Be Equal As Strings ${resp.json()['output']['response-code']} 200
DR695Hccff30b2017-02-17 18:44:24 -050023
24Run APPC Post Request
25 [Documentation] Runs an APPC post request
26 [Arguments] ${data_path} ${data} ${content}=json
27 ${auth}= Create List ${GLOBAL_APPC_USERNAME} ${GLOBAL_APPC_PASSWORD}
DR695Hbf5a3a32017-06-30 13:09:57 -040028 Log Creating session ${APPC_ENDPOINT}
29 ${session}= Create Session appc ${APPC_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -050030 ${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}
34 [Return] ${resp}
35
36Run APPC Put Request
37 [Documentation] Runs an APPC post request
38 [Arguments] ${data_path} ${data} ${content}=xml
39 ${auth}= Create List ${GLOBAL_APPC_USERNAME} ${GLOBAL_APPC_PASSWORD}
DR695Hbf5a3a32017-06-30 13:09:57 -040040 Log Creating session ${APPC_ENDPOINT}
41 ${session}= Create Session appc ${APPC_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -050042 ${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}
46 [Return] ${resp}
Jerry Flood81d33fb2017-11-21 16:21:21 -050047
DR695Hccff30b2017-02-17 18:44:24 -050048Create 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}
Jerry Flood81d33fb2017-11-21 16:21:21 -050053 ${data}= Template String ${template} ${dict}
DR695Hccff30b2017-02-17 18:44:24 -050054 ${resp}= Run APPC Put Request ${APPC_INDEX PATH}${APPC_CREATE_MOUNTPOINT_PATH}${nodeid} ${data}
DR695Hb034c282018-02-23 18:33:19 -050055 Should Be True 200 <= ${resp.status_code} < 300
Tal Karbachinskyb97d9302018-02-08 10:58:26 +020056 [Return] ${resp}