blob: 289d1d7ce75f241b4710cb5ceb08b1f2a8c3ac5a [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
4Library UUID
5Library 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
22 Should Be Equal As Strings ${resp.json()['output']['response-code']} 200
23
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}
47
48Create 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
56 [Return] ${resp}