- ${data_path}= Set Variable ${APPMGR_BASE_PATH}${xapp_name}
- ${resp}= Run Keyword Run AppMgr Get Request ${data_path}
- Should Be Equal As Strings ${resp.status_code} 200
-
-Run Create Xapp
- [documentation] Create Xapp
- [Arguments] ${xapp_name} ${xapp_id}
- ${data_path}= Set Variable ${APPMGR_BASE_PATH}
- ${dict}= Create Dictionary xapp_name=${xapp_name} xapp_id=${xapp_id}
- ${data}= Fill JSON Template File ${APPMGR_CREATE_XAPP_TEMPLATE} ${dict}
- ${auth}= Create List ${GLOBAL_INJECTED_APPMGR_USER} ${GLOBAL_INJECTED_APPMGR_PASSWORD}
- ${session}= Create Session appmgr ${APPMGR_ENDPOINT} auth=${auth}
- ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- ${resp}= Post Request appmgr ${data_path} data=${data} headers=${headers}
- Log Received response from AppMgr ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
- [Return] ${resp}
-
-
-Run AppMgr Get Request
- [Documentation] Runs AppMgr Get request
- [Arguments] ${data_path}
- ${auth}= Create List ${GLOBAL_INJECTED_APPMGR_USER} ${GLOBAL_INJECTED_APPMGR_PASSWORD}
- ${session}= Create Session appmgr ${APPMGR_ENDPOINT} auth=${auth}
- ${uuid}= Generate UUID
- ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- ${resp}= Get Request appmgr ${data_path} headers=${headers}
- Log Received response from AppMgr ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
- [Return] ${resp}
-
-Run AppMgr Delete Request
- [documentation] Delete Xapp data by XappId
- [Arguments] ${xapp_id}
- ${data_path}= Set Variable ${APPMGR_BASE_PATH}/${xapp_id}
- ${auth}= Create List ${GLOBAL_INJECTED_APPMGR_USER} ${GLOBAL_INJECTED_APPMGR_PASSWORD}
- ${session}= Create Session appmgr ${APPMGR_ENDPOINT} auth=${auth}
- ${uuid}= Generate UUID
- ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- ${resp}= Delete Request appmgr ${data_path} headers=${headers}
- Log Received response from AppMgr ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
+ &{dict} = Create Dictionary name=${xapp_name}
+ ${data} = Evaluate json.dumps(&{dict}) json
+ ${resp} = Run AppMgr POST Request ${EMPTY} ${data}
+ Should Be True ${resp}
+ [Return] ${resp}
+
+Deploy XApps
+ [Documentation] Create one or more XApps
+ [Arguments] @{xapp_names}
+ :FOR ${xapp} IN @{xapp_names}
+ \ Deploy XApp ${xapp}
+
+Undeploy XApp
+ [Documentation] Remove a deployed XApp
+ [Arguments] ${xapp_name}
+ ${resp} = Run AppMgr DELETE Request /${xapp_name}
+ Should Be True ${resp}
+ [Return] ${resp}
+
+Undeploy XApps
+ [Documentation] Remove one or more deployed XApps
+ [Arguments] @{xapp_names}
+ :FOR ${xapp} IN @{xapp_names}
+ \ Undeploy XApp ${xapp}
+
+Deploy All Available XApps
+ [Documentation] Attempt to deploy any not-currently-deployed XApp
+ @{d} = Get Deployed XApps
+ @{deployed} = Pluck name ${d}
+ @{available} = Get Deployable XApps
+ @{toDeploy} = Subtract From List ${available} ${deployed}
+ Deploy XApps @{toDeploy}
+
+Undeploy All Running XApps
+ [Documentation] Undeploy any deployed XApps
+ @{d} = Get Deployed XApps
+ @{deployed} = Pluck name ${d}
+ Run Keyword If ${deployed} Undeploy XApps @{deployed}
+
+Run AppMgr GET Request
+ [Documentation] Make an HTTP GET request against the XApp manager
+ [Arguments] ${path}=${EMPTY}
+ ${session} = Create Session roboAppmgrGet ${APPMGR_ENDPOINT}
+ ${headers} = Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp} = Get Request roboAppmgrGet ${APPMGR_BASE_PATH}${path} headers=${headers}
+ [Return] ${resp}
+
+Run AppMgr POST Request
+ [Documentation] Make an HTTP POST request against the XApp manager
+ [Arguments] ${path}=${EMPTY} ${body}=${EMPTY}
+ ${session} = Create Session roboAppmgrPost ${APPMGR_ENDPOINT}
+ ${headers} = Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp} = Post Request roboAppmgrPost ${APPMGR_BASE_PATH}${path} headers=${headers} data=${body}
+ [Return] ${resp}
+
+Run AppMgr DELETE Request
+ [Documentation] Make an HTTP DELETE request against the XApp manager
+ [Arguments] ${path}
+ ${session} = Create Session roboAppmgrDelete ${APPMGR_ENDPOINT}
+ ${headers} = Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp} = Delete Request roboAppmgrDelete ${APPMGR_BASE_PATH}${path} headers=${headers}
+ [Return] ${resp}