X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=solution%2Fintegration%2Fnetwork%2Fconfig.py;fp=solution%2Fintegration%2Fnetwork%2Fconfig.py;h=0000000000000000000000000000000000000000;hb=990de7205645f827a36429006f7e5529b5fb6866;hp=30c4a39f6029b1766b42b6714131cef31cd25063;hpb=a3be9ade3bec5ca8cd5b41032704872f87d8c065;p=oam.git diff --git a/solution/integration/network/config.py b/solution/integration/network/config.py deleted file mode 100644 index 30c4a39..0000000 --- a/solution/integration/network/config.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -################################################################################ -# Copyright 2021 highstreet technologies GmbH -# -# Licensed under the Apache License, Version 2.0 (the 'License'); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an 'AS IS' BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# importing the sys, json, requests library -import os -import sys -import json -import requests -import subprocess - -dockerFilter = subprocess.check_output("docker ps --format '{{.Names}}'", shell=True) -containers = dockerFilter.splitlines() - -mapping = dict({"ntsim-ng-o-ru": "O-RU", "ntsim-ng-o-du": "O-DU"}) -# base = 'https://sdnc-web:8453' -base = 'https://localhost:8453' -username = 'admin' -password = 'Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U' - -# REST to set event settings -def configEventSettings(nfName, nfType): - file = os.path.dirname(os.path.abspath(__file__)) + '/' + nfType + '/event-settings.json' - with open(file) as json_file: - body = json.load(json_file) - url = base + '/rests/data/network-topology:network-topology/topology=topology-netconf/node=' + nfName + '/yang-ext:mount/nts-network-function:simulation/network-function' - headers = { - 'content-type': 'application/yang-data+json', - 'accept': 'application/yang-data+json' - } - try: - response = requests.put(url, verify=False, auth=(username, password), json=body, headers=headers) - except requests.exceptions.Timeout: - sys.exit('HTTP request failed, please check you internet connection.') - except requests.exceptions.TooManyRedirects: - sys.exit('HTTP request failed, please check your proxy settings.') - except requests.exceptions.RequestException as e: - # catastrophic error. bail. - raise SystemExit(e) - - return response.status_code >= 200 and response.status_code < 300 - -# main -for container in containers: - name = container.decode("utf-8") - if "ntsim-ng" in name: - if "ntsim-ng-o-ru" in name: - nfName = mapping["ntsim-ng-o-ru"] + name[name.rindex("-"):] - print("Set", nfName, configEventSettings(nfName, "ntsim-ng-o-ru")) - if "ntsim-ng-o-du" in name: - nfName = mapping["ntsim-ng-o-du"] + name[name.rindex("-"):] - print("Set", nfName, configEventSettings(nfName, "ntsim-ng-o-du"))