2 Documentation Keywords for interacting with the A1 interface, including policy creation, instantiaton, and deletion
4 Library RequestsLibrary
6 Resource /robot/resources/global_properties.robot
8 Resource /robot/resources/ric/ric_utils.robot
11 ${A1MEDIATOR_BASE_PATH} /a1-p/policytypes
12 ${A1MEDIATOR_ENDPOINT} ${GLOBAL_A1MEDIATOR_SERVER_PROTOCOL}://${GLOBAL_INJECTED_A1MEDIATOR_IP_ADDR}:${GLOBAL_A1MEDIATOR_SERVER_PORT}
16 Run A1Mediator Health Check
17 [Documentation] Runs A1Mediator Health check
18 Log To Console Entering a1mediator
19 ${resp} = Run A1mediator GET Request
20 Log To Console ${resp}
23 [Documentation] Create a new policy via the A1 Mediator.
24 [Arguments] ${type} ${name} ${description} ${properties} ${required}=@{EMPTY}
25 ${typeID} = Convert To Integer ${type}
26 Should Be True ${type} > 0 Policy type must be an integer > 0
27 ${createSchema} = Create Dictionary
28 ... $schema=http://json-schema.org/draft-07/schema#
30 ... properties=${properties}
31 ... required=@{required}
32 ${createBody} = Create Dictionary
34 ... policy_type_id=${typeID}
35 ... description=${description}
36 ... create_schema=${createSchema}
37 ${createJSON} = Evaluate json.dumps(&{createBody}) json,uuid
38 ${resp} = Run A1Mediator PUT Request /${type} body=${createJSON}
42 [Documentation] Create a new instance of an A1 policy
43 [Arguments] ${type} ${instance} ${properties}=${EMPTY}
44 ${typeID} = Convert To Integer ${type}
45 Should Be True ${type} > 0 Policy type must be an integer > 0
46 ${instanceJSON} = Evaluate json.dumps(&{properties}) json,uuid
47 ${resp} = Run A1Mediator PUT Request /${type}/policies/${instance} body=${instanceJSON}
51 [Documentation] Remove an A1 policy instance
52 [Arguments] ${type} ${instance}
53 ${typeID} = Convert To Integer ${type}
54 Should Be True ${type} > 0 Policy type must be an integer > 0
55 ${resp} = Run A1Mediator DELETE Request /${type}/policies/${instance}
59 [Documentation] Remove an A1 policy type
61 ${typeID} = Convert To Integer ${type}
62 Should Be True ${type} > 0 Policy type must be an integer > 0
63 ${resp} = Run A1Mediator DELETE Request /${type}
67 [Documentation] Get a defined policy from A1
69 ${typeID} = Convert To Integer ${type}
70 Should Be True ${type} > 0 Policy type must be an integer > 0
71 ${resp} = Run A1Mediator GET Request /${type}
75 [Documentation] Get a defined policy from A1. If no instance is specified, retrieve all instances.
76 [Arguments] ${type} ${instance}=${EMPTY}
77 ${typeID} = Convert To Integer ${type}
78 Should Be True ${type} > 0 Policy type must be an integer > 0
79 ${resp} = Run Keyword If "${instance}" != "${EMPTY}"
80 ... Run A1Mediator GET Request /${type}/policies/${instance}
82 ... Run A1Mediator GET Request /${type}/policies
85 Retrieve A1 Instance Status
86 [Documentation] Get policy instance status
87 [Arguments] ${type} ${instance}=${EMPTY}
88 ${typeID} = Convert To Integer ${type}
89 Should Be True ${type} > 0 Policy type must be an integer > 0
90 ${resp} = Run A1Mediator GET Request /${type}/policies/${instance}/status
93 Run A1mediator GET Request
94 [Documentation] Make an HTTP GET request against the XApp manager
95 [Arguments] ${path}=${EMPTY}
96 ${session} = Create Session roboA1mediatorGet ${A1MEDIATOR_ENDPOINT}
97 ${headers} = Create Dictionary Accept=application/json Content-Type=application/json
98 ${resp} = Get Request roboA1mediatorGet ${A1MEDIATOR_BASE_PATH}${path} headers=${headers}
101 Run A1mediator PUT Request
102 [Documentation] Make an HTTP PUT request against the XApp manager
103 [Arguments] ${path}=${EMPTY} ${body}=${EMPTY}
104 ${session} = Create Session roboA1mediatorPut ${A1MEDIATOR_ENDPOINT}
105 ${headers} = Create Dictionary Accept=application/json Content-Type=application/json
106 ${resp} = PUT Request roboA1mediatorPut ${A1MEDIATOR_BASE_PATH}${path}
107 ... headers=${headers}
111 Run A1mediator POST Request
112 [Documentation] Make an HTTP POST request against the XApp manager
113 [Arguments] ${path}=${EMPTY} ${body}=${EMPTY}
114 ${session} = Create Session roboA1mediatorPost ${A1MEDIATOR_ENDPOINT}
115 ${headers} = Create Dictionary Accept=application/json Content-Type=application/json
116 ${resp} = POST Request roboA1mediatorPost ${A1MEDIATOR_BASE_PATH}${path}
117 ... headers=${headers}
121 Run A1mediator DELETE Request
122 [Documentation] Make an HTTP DELETE request against the XApp manager
124 ${session} = Create Session roboA1mediatorDelete ${A1MEDIATOR_ENDPOINT}
125 ${headers} = Create Dictionary Accept=application/json Content-Type=application/json
126 ${resp} = Delete Request roboA1mediatorDelete ${A1MEDIATOR_BASE_PATH}${path} headers=${headers}