2 Documentation The main interface for interacting with 5G Bulkpm.
3 Library RequestsLibrary
4 Library OperatingSystem
6 Library ONAPLibrary.Templating WITH NAME Templating
7 Resource ../global_properties.robot
11 ${INVENTORY_SERVER} ${GLOBAL_INVENTORY_SERVER_PROTOCOL}://${GLOBAL_INVENTORY_SERVER_NAME}:${GLOBAL_INVENTORY_SERVER_PORT}
12 ${INVENTORY_ENDPOINT} /dcae-service-types
13 ${BLUEPRINT_TEMPLATE} ${EXECDIR}/robot/assets/cmpv2/blueprintTemplate.json
16 Load Blueprint To Inventory
17 [Arguments] ${blueprint_path} ${typeName}
19 ${blueprint}= OperatingSystem.Get File ${blueprint_path}
20 ${templatejson}= Load JSON From File ${BLUEPRINT_TEMPLATE}
21 ${templatejson}= Update Value To Json ${templatejson} blueprintTemplate ${blueprint}
22 ${templatejson}= Update Value To Json ${templatejson} typeName ${typeName}
23 ${data} Convert JSON To String ${templatejson}
24 ${headers}= Create Dictionary content-type=application/json
25 ${session}= Create Session inventory_session ${INVENTORY_SERVER}
26 ${resp}= Post Request inventory_session ${INVENTORY_ENDPOINT} data=${data} headers=${headers}
27 ${serviceTypeId}= Set Variable ${resp.json().get('typeId')}
28 [Return] ${serviceTypeId}
30 Delete Blueprint From Inventory
31 [Arguments] ${serviceTypeId}
33 ${session}= Create Session inventory_session ${INVENTORY_SERVER}
34 ${resp}= Delete Request inventory_session ${INVENTORY_ENDPOINT}/${serviceTypeId}
37 Get Blueprint From Inventory
38 [Arguments] ${typeName}
40 ${headers}= Create Dictionary content-type=application/json
41 ${session}= Create Session inventory_session ${INVENTORY_SERVER}
42 ${resp}= Get Request inventory_session ${INVENTORY_ENDPOINT}?typeName=${typeName} headers=${headers}
43 Should Not Be Equal As Integers ${resp.json().get('totalCount')} 0 msg=Blueprint ${typeName} does not exist in inventory!