2 Documentation Keywords for interacting with the XApp Manager, including listing, deploying, and undeploying XApps
4 Library RequestsLibrary
6 Resource ../global_properties.robot
8 Resource ../ric/ric_utils.robot
11 ${APPMGR_BASE_PATH} /ric/v1/xapps
12 ${APPMGR_ENDPOINT} ${GLOBAL_APPMGR_SERVER_PROTOCOL}://${GLOBAL_INJECTED_APPMGR_IP_ADDR}:${GLOBAL_APPMGR_SERVER_PORT}
15 Run AppMgr Health Check
16 [Documentation] Runs AppMgr Health check
17 Run Keyword Get Deployed XApps
20 [Documentation] Obtain the list of deployed XApps from the Appmgr
21 ${resp} = Run AppMgr GET Request
22 [Return] ${resp.json()}
25 [Documentation] Obtain the list of deployed XApps from the Appmgr
26 ${resp} = Run AppMgr GET Request /search/
27 Should Be True ${resp}
28 [Return] ${resp.json()}
31 [Documentation] Get installed XApp from Appmgr given name
32 [Arguments] ${xapp_name}
33 ${resp} = Run AppMgr GET Request /${xapp_name}
34 Should Be True ${resp}
35 [Return] ${resp.json()}
37 Get XApp By Name and ID
38 [Documentation] Get installed XApp from Appmgr by name and ID
39 [Arguments] ${xapp_name} ${xapp_id}
40 ${resp}= Run AppMgr GET Request /${xapp_name}/${xapp_id}/
41 Should Be True ${resp}
42 [Return] ${resp.json()}
45 [Documentation] Create Xapp
46 [Arguments] ${xapp_name}
47 &{dict} = Create Dictionary name=${xapp_name}
48 ${data} = Evaluate json.dumps(&{dict}) json
49 ${resp} = Run AppMgr POST Request ${EMPTY} ${data}
50 Should Be True ${resp}
54 [Documentation] Create one or more XApps
55 [Arguments] @{xapp_names}
56 :FOR ${xapp} IN @{xapp_names}
60 [Documentation] Remove a deployed XApp
61 [Arguments] ${xapp_name}
62 ${resp} = Run AppMgr DELETE Request /${xapp_name}
63 Should Be True ${resp}
67 [Documentation] Remove one or more deployed XApps
68 [Arguments] @{xapp_names}
69 :FOR ${xapp} IN @{xapp_names}
70 \ Undeploy XApp ${xapp}
72 Deploy All Available XApps
73 [Documentation] Attempt to deploy any not-currently-deployed XApp
74 @{d} = Get Deployed XApps
75 @{deployed} = Pluck name ${d}
76 @{available} = Get Deployable XApps
77 @{toDeploy} = Subtract From List ${available} ${deployed}
78 Deploy XApps @{toDeploy}
80 Undeploy All Running XApps
81 [Documentation] Undeploy any deployed XApps
82 @{d} = Get Deployed XApps
83 @{deployed} = Pluck name ${d}
84 Run Keyword If ${deployed} Undeploy XApps @{deployed}
86 Run AppMgr GET Request
87 [Documentation] Make an HTTP GET request against the XApp manager
88 [Arguments] ${path}=${EMPTY}
89 ${session} = Create Session roboAppmgrGet ${APPMGR_ENDPOINT}
90 ${headers} = Create Dictionary Accept=application/json Content-Type=application/json
91 ${resp} = Get Request roboAppmgrGet ${APPMGR_BASE_PATH}${path} headers=${headers}
94 Run AppMgr POST Request
95 [Documentation] Make an HTTP POST request against the XApp manager
96 [Arguments] ${path}=${EMPTY} ${body}=${EMPTY}
97 ${session} = Create Session roboAppmgrPost ${APPMGR_ENDPOINT}
98 ${headers} = Create Dictionary Accept=application/json Content-Type=application/json
99 ${resp} = Post Request roboAppmgrPost ${APPMGR_BASE_PATH}${path} headers=${headers} data=${body}
102 Run AppMgr DELETE Request
103 [Documentation] Make an HTTP DELETE request against the XApp manager
105 ${session} = Create Session roboAppmgrDelete ${APPMGR_ENDPOINT}
106 ${headers} = Create Dictionary Accept=application/json Content-Type=application/json
107 ${resp} = Delete Request roboAppmgrDelete ${APPMGR_BASE_PATH}${path} headers=${headers}