diff options
Diffstat (limited to 'scripts')
14 files changed, 268 insertions, 23 deletions
diff --git a/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-kill.sh b/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-kill.sh index 205a6009..b3074b3a 100755 --- a/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-kill.sh +++ b/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-kill.sh @@ -2,3 +2,4 @@ docker exec -i dfc_app0 cat /var/log/ONAP/application.log docker kill dfc_app0 +docker rm dfc_app0 diff --git a/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-start.sh b/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-start.sh index 808b0b17..38b78f2d 100755 --- a/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-start.sh +++ b/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-start.sh @@ -1,12 +1,30 @@ #!/bin/bash +#function to load sftp servers keys to dfc app depending on KNOWN_HOSTS environment variable +# when KNOWN_HOSTS == "all_hosts_keys" or is not set, public keys of all sftp servers are loaded +# when KNOWN_HOSTS == "known_hosts_empty", empty known hosts file is created +# for other strings known hosts file is not created +function load-sftp-servers-keys() { + if [ -z "$KNOWN_HOSTS" ] || [ "$KNOWN_HOSTS" == "all_hosts_keys" ]; then + SFTP_SERVERS="$(docker ps -q --filter='name=dfc_sftp')" + + for SFTP_SERVER in $SFTP_SERVERS; do + HOST_NAMES=$(docker inspect -f '{{ join .NetworkSettings.Networks.dfcnet.Aliases ","}}' $SFTP_SERVER) + KEY_ENTRY=$(echo $HOST_NAMES "$(docker exec $SFTP_SERVER cat /etc/ssh/ssh_host_rsa_key.pub)" | + sed -e 's/\w*@\w*$//') + docker exec -u root dfc_app0 sh -c "echo $KEY_ENTRY >> /home/datafile/.ssh/known_hosts" + done + elif [ "$KNOWN_HOSTS" == "known_hosts_empty" ]; then + docker exec -u root dfc_app0 sh -c "touch /home/datafile/.ssh/known_hosts" + fi +} + set -x #Start DFC app - DOCKER_SIM_NWNAME="dfcnet" echo "Creating docker network $DOCKER_SIM_NWNAME, if needed" -docker network ls| grep $DOCKER_SIM_NWNAME > /dev/null || docker network create $DOCKER_SIM_NWNAME +docker network ls | grep $DOCKER_SIM_NWNAME >/dev/null || docker network create $DOCKER_SIM_NWNAME docker-compose up -d @@ -14,21 +32,23 @@ DFC_APP="$(docker ps -q --filter='name=dfc_app0')" #Wait for initialization of docker containers for dfc app and all simulators for i in {1..10}; do - if [ $(docker inspect --format '{{ .State.Running }}' $DFC_APP) ] - then - echo "DFC app Running" - # enable TRACE logging of DFC - docker exec $DFC_APP /bin/sh -c " sed -i 's/org.onap.dcaegen2.collectors.datafile: WARN/org.onap.dcaegen2.collectors.datafile: TRACE/g' /opt/app/datafile/config/application.yaml" - - #enable TRACE logging of spring-framework - docker exec $DFC_APP /bin/sh -c " sed -i 's/org.springframework.data: ERROR/org.springframework.data: TRACE/g' /opt/app/datafile/config/application.yaml" - - docker restart $DFC_APP - sleep 10 - - break - else - echo sleep $i - sleep $i + if [ $(docker inspect --format '{{ .State.Running }}' $DFC_APP) ]; then + echo "DFC app Running" + + load-sftp-servers-keys + + # enable TRACE logging of DFC + docker exec $DFC_APP /bin/sh -c " sed -i 's/org.onap.dcaegen2.collectors.datafile: WARN/org.onap.dcaegen2.collectors.datafile: TRACE/g' /opt/app/datafile/config/application.yaml" + + #enable TRACE logging of spring-framework + docker exec $DFC_APP /bin/sh -c " sed -i 's/org.springframework.data: ERROR/org.springframework.data: TRACE/g' /opt/app/datafile/config/application.yaml" + + docker restart $DFC_APP + sleep 10 + + break + else + echo sleep $i + sleep $i fi done diff --git a/scripts/dcaegen2-collectors-datafile/dfc-management/docker-compose.yml b/scripts/dcaegen2-collectors-datafile/dfc-management/docker-compose.yml index 9e15ccf0..2ea2882b 100644 --- a/scripts/dcaegen2-collectors-datafile/dfc-management/docker-compose.yml +++ b/scripts/dcaegen2-collectors-datafile/dfc-management/docker-compose.yml @@ -15,8 +15,13 @@ services: - "8433:8433" networks: dfcnet: null + volumes: + - $SIMGROUP_ROOT/tls/:/opt/app/datafile/etc/cert/ environment: CONSUL_HOST: "consul-server" CONSUL_PORT: 8500 CONFIG_BINDING_SERVICE: "config-binding-service" + CONFIG_BINDING_SERVICE_SERVICE_PORT: 10000 HOSTNAME: "dfc_app0" + KNOWN_HOSTS_FILE_PATH: "/home/datafile/.ssh/known_hosts" + diff --git a/scripts/dcaegen2-services-son-handler/sonhandler/Dockerfile b/scripts/dcaegen2-services-son-handler/sonhandler/Dockerfile new file mode 100644 index 00000000..688a2fe0 --- /dev/null +++ b/scripts/dcaegen2-services-son-handler/sonhandler/Dockerfile @@ -0,0 +1,15 @@ +FROM python:alpine3.7 + +ADD configdb-oof-sim.py / + +ADD ./sim-data / + +RUN pip install Flask + +RUN pip install requests + +EXPOSE 5000 + +CMD ["flask", "run", "--host", "0.0.0.0"] + +CMD [ "python", "./configdb-oof-sim.py" ] diff --git a/scripts/dcaegen2-services-son-handler/sonhandler/configdb-oof-sim.py b/scripts/dcaegen2-services-son-handler/sonhandler/configdb-oof-sim.py new file mode 100644 index 00000000..7a51c951 --- /dev/null +++ b/scripts/dcaegen2-services-son-handler/sonhandler/configdb-oof-sim.py @@ -0,0 +1,98 @@ +import flask +import json +from flask import request +import requests +import threading +import time + +app = flask.Flask(__name__) +app.config["DEBUG"] = True + + +def get_neighbour_cell_list_for_cell_id(): + with open('cell_list.json') as cell_list: + data = json.load(cell_list) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + +def get_pci_for_cell_id(): + with open('pci_value.json') as pci_value: + data = json.load(pci_value) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + +def get_cell_data_for_cell_id(): + with open('cell_data.json') as cell_data: + data = json.load(cell_data) + if not data: + return {"Error": "Unable to read file"}, 503 + return data, None + +def get_oof_sync_response(): + with open('oof_syn_response.json') as syncRes: + data = json.load(syncRes) + if not data: + return {"Error": "Unale to read file"}, 503 + return data, None + +def get_oof_async_response(callback_url, transaction_id): + time.sleep(10) + with open('oof_async_response.json') as asyncRes: + data = json.load(asyncRes) + data['transactionId'] = transaction_id + if not data: + return {"Error": "Unable to read file"}, 503 + res = requests.post(callback_url, json=data) + print('response from server:',res.text) + return res + +@app.route("/api/sdnc-config-db/v3/getNbrList/<cell_id>/<ts>", methods=["GET"]) +def get_neighbour_list(cell_id, ts): + data, status = get_neighbour_cell_list_for_cell_id() + if not status: + return data + return data, 503 + +@app.route("/api/sdnc-config-db/v3/getPCI/<cell_id>/<ts>", methods=["GET"]) +def get_pci(cell_id, ts): + data, status = get_pci_for_cell_id() + if not status: + return data + return data, 503 +@app.route("/api/sdnc-config-db/v3/getPnfId/<cell_id>/<ts>", methods=["GET"]) +def get_pnf_id(cell_id, ts): + data, status = get_pci_for_cell_id() + data['value'] = 'ncserver5' + if not status: + return data + return data, 503 + +@app.route("/api/sdnc-config-db/v3/getCell/<cell_id>", methods=["GET"]) +def get_cell_data(cell_id): + data, status = get_cell_data_for_cell_id() + if not status: + return data + return data, 503 + +@app.route("/api/oof/v1/pci",methods=["POST"]) +def oof_optimizatio_result(): + content = request.get_json() + callback_url = content['requestInfo']['callbackUrl'] + transaction_id = content['requestInfo']['transactionId'] + try: + task = threading.Thread(target=get_oof_async_response, args=(callback_url,transaction_id,)) + task.daemon = True + task.start() + except: + print("Error: Unable to start thread") + + data, status = get_oof_sync_response() + + if not status: + return data, 202 + return data, 503 + + +app.run(host='0.0.0.0') diff --git a/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/cell_data.json b/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/cell_data.json new file mode 100644 index 00000000..0e4e73f4 --- /dev/null +++ b/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/cell_data.json @@ -0,0 +1,13 @@ +{ + "neighbor": ["Chn0066", "Chn0067", "Chn0068", "Chn0069", "Chn0070", "Chn0072", "Chn0073", "Chn0074", "Chn0075", "Chn0076", "Chn0077", "Chn0078", "Chn0079", "Chn0080"], + "Cell": { + "networkId": "ran-1", + "nodeId": "Chn0071", + "physicalCellId": 1, + "pnfId": "ncserver5", + "sectorNumber": null, + "latitude": "27.55626304907802", + "longitude": "-58.48690415723466", + "notes": "NA" + } +}
\ No newline at end of file diff --git a/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/cell_list.json b/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/cell_list.json new file mode 100644 index 00000000..4f961ae2 --- /dev/null +++ b/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/cell_list.json @@ -0,0 +1,60 @@ +{ + "cellId": "Chn0071", + "nbrList": [{ + "targetCellId": "Chn0066", + "pciValue": 0, + "ho": true + }, { + "targetCellId": "Chn0067", + "pciValue": 1, + "ho": true + }, { + "targetCellId": "Chn0068", + "pciValue": 2, + "ho": true + }, { + "targetCellId": "Chn0069", + "pciValue": 3, + "ho": true + }, { + "targetCellId": "Chn0070", + "pciValue": 4, + "ho": true + }, { + "targetCellId": "Chn0072", + "pciValue": 6, + "ho": true + }, { + "targetCellId": "Chn0073", + "pciValue": 7, + "ho": true + }, { + "targetCellId": "Chn0074", + "pciValue": 8, + "ho": true + }, { + "targetCellId": "Chn0075", + "pciValue": 9, + "ho": true + }, { + "targetCellId": "Chn0076", + "pciValue": 10, + "ho": true + }, { + "targetCellId": "Chn0077", + "pciValue": 11, + "ho": true + }, { + "targetCellId": "Chn0078", + "pciValue": 12, + "ho": true + }, { + "targetCellId": "Chn0079", + "pciValue": 13, + "ho": true + }, { + "targetCellId": "Chn0080", + "pciValue": 14, + "ho": true + }] +}
\ No newline at end of file diff --git a/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/oof_async_response.json b/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/oof_async_response.json new file mode 100644 index 00000000..99f54cb4 --- /dev/null +++ b/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/oof_async_response.json @@ -0,0 +1,14 @@ +{ + "transactionId": "fff33db3-8fc9-4e29-89ff-7419c85900bd", + "requestId": "742b9e6a-aa55-487e-9d71-a4a5e05b3981", + "requestStatus": "completed", + "statusMessage": "success", + "solutions": { + "networkId": "ran-1", + "pciSolutions": [{ + "cellId": "Chn0071", + "pci": "5" + }], + "anrSolutions": [] + } +}
\ No newline at end of file diff --git a/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/oof_syn_response.json b/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/oof_syn_response.json new file mode 100644 index 00000000..c9260bbc --- /dev/null +++ b/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/oof_syn_response.json @@ -0,0 +1,6 @@ +{ + "requestId": "742b9e6a-aa55-487e-9d71-a4a5e05b3981", + "transactionId": "fff33db3-8fc9-4e29-89ff-7419c85900bd", + "requestStatus": "accepted", + "statusMessage": "" +}
\ No newline at end of file diff --git a/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/pci_value.json b/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/pci_value.json new file mode 100644 index 00000000..6b6d4475 --- /dev/null +++ b/scripts/dcaegen2-services-son-handler/sonhandler/sim-data/pci_value.json @@ -0,0 +1,4 @@ +{ + "attributeName": "PCIvalue", + "value": "5" +}
\ No newline at end of file diff --git a/scripts/policy/docker-compose-drools.yml b/scripts/policy/docker-compose-drools.yml index 974b465f..5fc6ef67 100644 --- a/scripts/policy/docker-compose-drools.yml +++ b/scripts/policy/docker-compose-drools.yml @@ -32,9 +32,8 @@ services: - 8081 drools: image: nexus3.onap.org:10001/onap/policy-drools:${POLICY_DROOLS_VERSION} - user: 1000:1000 container_name: drools - depends_on: + depends_on: - mariadb - nexus hostname: drools diff --git a/scripts/policy/docker-compose-pap.yml b/scripts/policy/docker-compose-pap.yml index 5438557b..934e1739 100644 --- a/scripts/policy/docker-compose-pap.yml +++ b/scripts/policy/docker-compose-pap.yml @@ -23,6 +23,12 @@ services: - ./config/db:/docker-entrypoint-initdb.d expose: - 3306 + message-router: + image: dmaap/simulator + container_name: dmaap-simulator + hostname: dmaap-simulator + expose: + - 3904 pap: image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION} container_name: policy-pap @@ -46,8 +52,11 @@ services: container_name: policy-wait depends_on: - mariadb + - message-router hostname: policy-wait - command: mariadb:3306 + command: + mariadb:3306 + message-router:3904 start_all: image: dadarek/wait-for-dependencies environment: @@ -60,5 +69,6 @@ services: hostname: policy-wait-all command: mariadb:3306 + message-router:3904 pap:6969 api:6969 diff --git a/scripts/policy/drools-apps/custom/papDefaultConfig.json b/scripts/policy/drools-apps/custom/papDefaultConfig.json index 2575d8a5..1e47c7e7 100644 --- a/scripts/policy/drools-apps/custom/papDefaultConfig.json +++ b/scripts/policy/drools-apps/custom/papDefaultConfig.json @@ -25,7 +25,7 @@ "databaseDriver": "org.mariadb.jdbc.Driver", "databaseUrl": "jdbc:mariadb://mariadb:3306/policyadmin", "databaseUser": "policy_user", - "databasePassword": "cG9saWN5X3VzZXI=", + "databasePassword": "policy_user", "persistenceUnit": "PolicyMariaDb" }, "topicParameterGroup": { diff --git a/scripts/sdnc/netconf-pnp-simulator/docker-compose.yml b/scripts/sdnc/netconf-pnp-simulator/docker-compose.yml index 67a75c94..d8e723ba 100755 --- a/scripts/sdnc/netconf-pnp-simulator/docker-compose.yml +++ b/scripts/sdnc/netconf-pnp-simulator/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: netconf-pnp-simulator: - image: nexus3.onap.org:10001/onap/integration/simulators/netconf-pnp-simulator:2.8.5 + image: nexus3.onap.org:10001/onap/integration/simulators/netconf-pnp-simulator:2.8.6 container_name: netconf-simulator restart: always ports: |