depends_on:
- postgres
networks:
- - cps-tbdmt-default
\ No newline at end of file
+ - cps-tbdmt-default
+ preload-templates:
+ build: ../preload-templates
+ depends_on:
+ - cps-tbdmt
+ networks:
+ - cps-tbdmt-default
+ volumes:
+ - ../preload-templates/$FILENAME:/usr/src/app/samplepreload.json
+
--- /dev/null
+FROM python:3
+WORKDIR /usr/src/app
+COPY cpspreload.py .
+COPY samplepreload.json .
+RUN pip install requests
+CMD ["cpspreload.py"]
+ENTRYPOINT ["python3"]
--- /dev/null
+import json
+import time
+import requests
+
+CPS_HEADERS = {
+ "Accept": "application/json",
+ "Content-Type": "application/json",
+ }
+tbdmt_url="http://cps-tbdmt:8080/templates"
+
+
+
+with open('samplepreload.json') as template_file:
+ templates_json = template_file.read()
+templates=json.loads(templates_json)
+
+
+for template in templates:
+ print(type(template))
+ print("send rest req")
+ print("waiting before sent req")
+ time.sleep(2)
+ response=requests.post(tbdmt_url, json=template, headers=CPS_HEADERS)
+ print("res",response.reason)
+
+
--- /dev/null
+[
+ {
+ "includeDescendants": true,
+ "model": "ran-network",
+ "requestType": "get",
+ "templateId": "dummy-template-7",
+ "xpathTemplate": "/ran-network/NearRTRIC[@idNearRTRIC='{{idNearRTRIC}}']/GNBCUUPFunction[@idGNBCUUPFunction='{{idGNBCUUPFunction}}']/attributes/pLMNInfoList[@mcc='{{mcc}}' and @mnc='{{mnc}}']/sNSSAIList[@sNssai='{{sNSSAIList}}']"
+ },
+ {
+ "includeDescendants": true,
+ "model": "ran-network",
+ "requestType": "get",
+ "templateId": "dummy-template-8",
+ "xpathTemplate": "/ran-network/NearRTRIC[@idNearRTRIC='{{idNearRTRIC}}']/GNBCUUPFunction[@idGNBCUUPFunction='{{idGNBCUUPFunction}}']/attributes/RRMPolicyRatio[@id='{{id}}']/attributes/rRMPolicyMemberList[@idx='{{idx}}']"
+ }
+]