aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker-compose/docker-compose.yml11
-rw-r--r--docker-compose/preload-templates/Dockerfile7
-rw-r--r--docker-compose/preload-templates/cpspreload.py26
-rw-r--r--docker-compose/preload-templates/samplepreload.json16
4 files changed, 59 insertions, 1 deletions
diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml
index 961cec6..1868c89 100644
--- a/docker-compose/docker-compose.yml
+++ b/docker-compose/docker-compose.yml
@@ -50,4 +50,13 @@ services:
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
+
diff --git a/docker-compose/preload-templates/Dockerfile b/docker-compose/preload-templates/Dockerfile
new file mode 100644
index 0000000..c668ed9
--- /dev/null
+++ b/docker-compose/preload-templates/Dockerfile
@@ -0,0 +1,7 @@
+FROM python:3
+WORKDIR /usr/src/app
+COPY cpspreload.py .
+COPY samplepreload.json .
+RUN pip install requests
+CMD ["cpspreload.py"]
+ENTRYPOINT ["python3"]
diff --git a/docker-compose/preload-templates/cpspreload.py b/docker-compose/preload-templates/cpspreload.py
new file mode 100644
index 0000000..25fd568
--- /dev/null
+++ b/docker-compose/preload-templates/cpspreload.py
@@ -0,0 +1,26 @@
+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)
+
+
diff --git a/docker-compose/preload-templates/samplepreload.json b/docker-compose/preload-templates/samplepreload.json
new file mode 100644
index 0000000..d96488d
--- /dev/null
+++ b/docker-compose/preload-templates/samplepreload.json
@@ -0,0 +1,16 @@
+[
+ {
+ "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}}']"
+ }
+]