aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Geissler <andreas-geissler@telekom.de>2022-10-24 14:26:35 +0200
committerLukasz Rajewski <lukasz.rajewski@t-mobile.pl>2023-02-15 22:27:49 +0100
commitcb795c01df747f872f5985ba318eefdddea57507 (patch)
tree378750d7a62ba272decdac166dc4d305b6918206
parentf4bfac20ab2aaed86846da037db986d3d1dcb6f2 (diff)
[OSDF] Enable OSDF in ServiceMesh deployment
In case AAF is disabled the secret loading via AAF-SMS should not be called Issue-ID: OPTFRA-1099 Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de> Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> Change-Id: Ifca03215a36705b1c160b2cbf708389bd2162301
-rwxr-xr-xconfig/opteng_config.yaml2
-rwxr-xr-xcsit/scripts/simulator_script.sh12
-rw-r--r--osdf/adapters/aaf/sms.py104
-rw-r--r--pom.xml2
-rw-r--r--requirements-opteng.txt2
-rw-r--r--requirements-sim.txt18
-rwxr-xr-xtest/functest/simulators/build_sim_image.sh6
-rwxr-xr-xtest/functest/simulators/simulated-config/opteng_config.yaml2
-rwxr-xr-xtest/functest/simulators/start_sim.sh2
-rw-r--r--version.properties2
10 files changed, 100 insertions, 52 deletions
diff --git a/config/opteng_config.yaml b/config/opteng_config.yaml
index d6be7ed..6b61eb0 100755
--- a/config/opteng_config.yaml
+++ b/config/opteng_config.yaml
@@ -22,4 +22,4 @@ osdfDatabasePassword: osdf
osdfDatabasePort: 3306
#key
-appkey: os35@rrtky400fdntc#001t5 \ No newline at end of file
+appkey: os35@rrtky400fdntc#001t5
diff --git a/csit/scripts/simulator_script.sh b/csit/scripts/simulator_script.sh
index e146cb9..f6daab6 100755
--- a/csit/scripts/simulator_script.sh
+++ b/csit/scripts/simulator_script.sh
@@ -44,9 +44,20 @@ chmod +x ./build_sim_image.sh
# run osdf_sim
docker run -d --name osdf_sim -p "5000:5000" osdf_sim:latest;
+#wait for docker setup a while
+sleep 10
+
+docker ps -a
+
+echo "logs of the osdf_sim"
+sudo cat `docker inspect -f '{{.LogPath}}' osdf_sim`
+
+
OSDF_SIM_IP=`${WORKSPACE}/scripts/get-instance-ip.sh osdf_sim`
echo "OSDF_SIM_IP=${OSDF_SIM_IP}"
+docker inspect osdf_sim
+
${WORKSPACE}/scripts/wait_for_port.sh ${OSDF_SIM_IP} 5000
@@ -54,5 +65,4 @@ ${WORKSPACE}/scripts/wait_for_port.sh ${OSDF_SIM_IP} 5000
sleep 2
echo "inspect docker things for tracing purpose"
-docker inspect osdf_sim
diff --git a/osdf/adapters/aaf/sms.py b/osdf/adapters/aaf/sms.py
index bcc449c..031fee4 100644
--- a/osdf/adapters/aaf/sms.py
+++ b/osdf/adapters/aaf/sms.py
@@ -23,9 +23,9 @@
from onapsmsclient import Client
import osdf.config.base as cfg_base
+from osdf.config.base import osdf_config
import osdf.config.credentials as creds
import osdf.config.loader as config_loader
-from osdf.config.base import osdf_config
from osdf.logging.osdf_logging import debug_log
from osdf.utils import cipherUtils
@@ -35,9 +35,12 @@ config_spec = {
def preload_secrets():
- """ This is intended to load the secrets required for testing Application
- Actual deployment will have a preload script. Make sure the config is
- in sync"""
+ """preload_secrets()
+
+ This is intended to load the secrets required for testing Application
+ Actual deployment will have a preload script. Make sure the config is
+ in sync
+ """
preload_config = config_loader.load_config_file(
config_spec.get("preload_secrets"))
domain = preload_config.get("domain")
@@ -45,6 +48,9 @@ def preload_secrets():
sms_url = config["aaf_sms_url"]
timeout = config["aaf_sms_timeout"]
cacert = config["aaf_ca_certs"]
+ if not sms_url:
+ debug_log.debug("SMS Disabled")
+ return
sms_client = Client(url=sms_url, timeout=timeout, cacert=cacert)
domain_uuid = sms_client.createDomain(domain)
debug_log.debug(
@@ -64,46 +70,50 @@ def retrieve_secrets():
timeout = config["aaf_sms_timeout"]
cacert = config["aaf_ca_certs"]
domain = config["secret_domain"]
- sms_client = Client(url=sms_url, timeout=timeout, cacert=cacert)
- secrets = sms_client.getSecretNames(domain)
- for secret in secrets:
- values = sms_client.getSecret(domain, secret)
- secret_dict[secret] = values
- debug_log.debug("Secret Dictionary Retrieval Success")
+ if sms_url:
+ sms_client = Client(url=sms_url, timeout=timeout, cacert=cacert)
+ secrets = sms_client.getSecretNames(domain)
+ for secret in secrets:
+ values = sms_client.getSecret(domain, secret)
+ secret_dict[secret] = values
+ debug_log.debug("Secret Dictionary Retrieval Success")
+ else:
+ debug_log.debug("SMS Disabled. Secrets not loaded")
return secret_dict
def load_secrets():
config = osdf_config.deployment
secret_dict = retrieve_secrets()
- config['soUsername'] = secret_dict['so']['UserName']
- config['soPassword'] = decrypt_pass(secret_dict['so']['Password'])
- config['conductorUsername'] = secret_dict['conductor']['UserName']
- config['conductorPassword'] = decrypt_pass(secret_dict['conductor']['Password'])
- config['policyPlatformUsername'] = secret_dict['policyPlatform']['UserName']
- config['policyPlatformPassword'] = decrypt_pass(secret_dict['policyPlatform']['Password'])
- config['policyClientUsername'] = secret_dict['policyPlatform']['UserName']
- config['policyClientPassword'] = decrypt_pass(secret_dict['policyPlatform']['Password'])
- config['messageReaderAafUserId'] = secret_dict['dmaap']['UserName']
- config['messageReaderAafPassword'] = decrypt_pass(secret_dict['dmaap']['Password'])
- config['sdcUsername'] = secret_dict['sdc']['UserName']
- config['sdcPassword'] = decrypt_pass(secret_dict['sdc']['Password'])
- config['osdfPlacementUsername'] = secret_dict['osdfPlacement']['UserName']
- config['osdfPlacementPassword'] = decrypt_pass(secret_dict['osdfPlacement']['Password'])
- config['osdfPlacementSOUsername'] = secret_dict['osdfPlacementSO']['UserName']
- config['osdfPlacementSOPassword'] = decrypt_pass(secret_dict['osdfPlacementSO']['Password'])
- config['osdfPlacementVFCUsername'] = secret_dict['osdfPlacementVFC']['UserName']
- config['osdfPlacementVFCPassword'] = decrypt_pass(secret_dict['osdfPlacementVFC']['Password'])
- config['osdfCMSchedulerUsername'] = secret_dict['osdfCMScheduler']['UserName']
- config['osdfCMSchedulerPassword'] = decrypt_pass(secret_dict['osdfCMScheduler']['Password'])
- config['configDbUserName'] = secret_dict['configDb']['UserName']
- config['configDbPassword'] = decrypt_pass(secret_dict['configDb']['Password'])
- config['pciHMSUsername'] = secret_dict['pciHMS']['UserName']
- config['pciHMSPassword'] = decrypt_pass(secret_dict['pciHMS']['Password'])
- config['osdfPCIOptUsername'] = secret_dict['osdfPCIOpt']['UserName']
- config['osdfPCIOptPassword'] = decrypt_pass(secret_dict['osdfPCIOpt']['Password'])
- config['osdfOptEngineUsername'] = secret_dict['osdfOptEngine']['UserName']
- config['osdfOptEnginePassword'] = decrypt_pass(secret_dict['osdfOptEngine']['Password'])
+ if secret_dict:
+ config['soUsername'] = secret_dict['so']['UserName']
+ config['soPassword'] = decrypt_pass(secret_dict['so']['Password'])
+ config['conductorUsername'] = secret_dict['conductor']['UserName']
+ config['conductorPassword'] = decrypt_pass(secret_dict['conductor']['Password'])
+ config['policyPlatformUsername'] = secret_dict['policyPlatform']['UserName']
+ config['policyPlatformPassword'] = decrypt_pass(secret_dict['policyPlatform']['Password'])
+ config['policyClientUsername'] = secret_dict['policyPlatform']['UserName']
+ config['policyClientPassword'] = decrypt_pass(secret_dict['policyPlatform']['Password'])
+ config['messageReaderAafUserId'] = secret_dict['dmaap']['UserName']
+ config['messageReaderAafPassword'] = decrypt_pass(secret_dict['dmaap']['Password'])
+ config['sdcUsername'] = secret_dict['sdc']['UserName']
+ config['sdcPassword'] = decrypt_pass(secret_dict['sdc']['Password'])
+ config['osdfPlacementUsername'] = secret_dict['osdfPlacement']['UserName']
+ config['osdfPlacementPassword'] = decrypt_pass(secret_dict['osdfPlacement']['Password'])
+ config['osdfPlacementSOUsername'] = secret_dict['osdfPlacementSO']['UserName']
+ config['osdfPlacementSOPassword'] = decrypt_pass(secret_dict['osdfPlacementSO']['Password'])
+ config['osdfPlacementVFCUsername'] = secret_dict['osdfPlacementVFC']['UserName']
+ config['osdfPlacementVFCPassword'] = decrypt_pass(secret_dict['osdfPlacementVFC']['Password'])
+ config['osdfCMSchedulerUsername'] = secret_dict['osdfCMScheduler']['UserName']
+ config['osdfCMSchedulerPassword'] = decrypt_pass(secret_dict['osdfCMScheduler']['Password'])
+ config['configDbUserName'] = secret_dict['configDb']['UserName']
+ config['configDbPassword'] = decrypt_pass(secret_dict['configDb']['Password'])
+ config['pciHMSUsername'] = secret_dict['pciHMS']['UserName']
+ config['pciHMSPassword'] = decrypt_pass(secret_dict['pciHMS']['Password'])
+ config['osdfPCIOptUsername'] = secret_dict['osdfPCIOpt']['UserName']
+ config['osdfPCIOptPassword'] = decrypt_pass(secret_dict['osdfPCIOpt']['Password'])
+ config['osdfOptEngineUsername'] = secret_dict['osdfOptEngine']['UserName']
+ config['osdfOptEnginePassword'] = decrypt_pass(secret_dict['osdfOptEngine']['Password'])
cfg_base.http_basic_auth_credentials = creds.load_credentials(osdf_config)
cfg_base.dmaap_creds = creds.dmaap_creds()
@@ -117,17 +127,23 @@ def decrypt_pass(passwd):
def delete_secrets():
- """ This is intended to delete the secrets for a clean initialization for
- testing Application. Actual deployment will have a preload script.
- Make sure the config is in sync"""
+ """delete_secrets()
+
+ This is intended to delete the secrets for a clean initialization for
+ testing Application. Actual deployment will have a preload script.
+ Make sure the config is in sync
+ """
config = osdf_config.deployment
sms_url = config["aaf_sms_url"]
timeout = config["aaf_sms_timeout"]
cacert = config["aaf_ca_certs"]
domain = config["secret_domain"]
- sms_client = Client(url=sms_url, timeout=timeout, cacert=cacert)
- ret_val = sms_client.deleteDomain(domain)
- debug_log.debug("Clean up complete")
+ if sms_url:
+ sms_client = Client(url=sms_url, timeout=timeout, cacert=cacert)
+ ret_val = sms_client.deleteDomain(domain)
+ debug_log.debug("Clean up complete")
+ else:
+ debug_log.debug("SMS Disabled. Secrets delete skipped")
return ret_val
diff --git a/pom.xml b/pom.xml
index de87383..bd31f85 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@ http://maven.apache.org/POM/4.0.0 ">
<groupId>org.onap.optf.osdf</groupId>
<artifactId>optf-osdf</artifactId>
<name>optf-osdf</name>
- <version>3.0.7-SNAPSHOT</version>
+ <version>3.0.8-SNAPSHOT</version>
<description>Optimization Service Design Framework</description>
<properties>
diff --git a/requirements-opteng.txt b/requirements-opteng.txt
index 6d0b524..a20435b 100644
--- a/requirements-opteng.txt
+++ b/requirements-opteng.txt
@@ -1 +1 @@
-mysql-connector-python>=8.0.12 \ No newline at end of file
+mysql-connector-python==8.0.31
diff --git a/requirements-sim.txt b/requirements-sim.txt
new file mode 100644
index 0000000..56a8931
--- /dev/null
+++ b/requirements-sim.txt
@@ -0,0 +1,18 @@
+cryptography==3.3.2
+docutils>=0.12
+docopt>=0.6.2
+Flask>=0.11.1
+Flask-HTTPAuth>=3.2.2
+jsonschema>=2.5.1
+lxml>=3.6.4
+python-dateutil>=2.5.3
+PyYAML==5.4.1
+requests>=2.14.2
+schematics>=2.0.0
+onapsmsclient>=0.0.4
+pymzn>=0.18.3
+onappylog>=1.0.9
+pathtools>=0.1.2
+pycryptodome>=3.9.6
+python-consul>=1.1.0
+tornado>=6.1
diff --git a/test/functest/simulators/build_sim_image.sh b/test/functest/simulators/build_sim_image.sh
index 6a71d3c..561db19 100755
--- a/test/functest/simulators/build_sim_image.sh
+++ b/test/functest/simulators/build_sim_image.sh
@@ -31,6 +31,10 @@ SIMULATORS_DIR=$FUNC_TEST_DIR/simulators
OSDF_DIR=$(dirname $TEST_DIR)
DOCKER_DIR=$SIMULATORS_DIR/tmp_docker
+echo "Before Docker Build"
+cat $OSDF_DIR/requirements-sim.txt
+echo $OSDF_DIR
+
mkdir -p $DOCKER_DIR/sim/osdf/policy/response-payloads/pdp-has-vcpe-good
cp $SIMULATORS_DIR/Dockerfile $DOCKER_DIR/.
@@ -47,7 +51,7 @@ cp -r $SIMULATORS_DIR/aai $DOCKER_DIR/sim
cp $TEST_DIR/policy-local-files/*.json $DOCKER_DIR/sim/policy/response-payloads/pdp-has-vcpe-good
cp $TEST_DIR/placement-tests/policy_response.json $DOCKER_DIR/sim/policy/response-payloads/
cp $SIMULATORS_DIR/oof_dependencies_simulators.py $DOCKER_DIR/sim/oof_dependencies_simulators.py
-cp $OSDF_DIR/requirements.txt $DOCKER_DIR
+cp $OSDF_DIR/requirements-sim.txt $DOCKER_DIR/requirements.txt
cp -r $SIMULATORS_DIR/start_sim.sh $DOCKER_DIR/
cd $DOCKER_DIR
diff --git a/test/functest/simulators/simulated-config/opteng_config.yaml b/test/functest/simulators/simulated-config/opteng_config.yaml
index 4a7e57d..0dfb536 100755
--- a/test/functest/simulators/simulated-config/opteng_config.yaml
+++ b/test/functest/simulators/simulated-config/opteng_config.yaml
@@ -22,4 +22,4 @@ osdfDatabasePassword: osdf
osdfDatabasePort: 3306
#key
-appkey: os35@rrtky400fdntc#001t5 \ No newline at end of file
+appkey: os35@rrtky400fdntc#001t5
diff --git a/test/functest/simulators/start_sim.sh b/test/functest/simulators/start_sim.sh
index 1d17d65..f5935da 100755
--- a/test/functest/simulators/start_sim.sh
+++ b/test/functest/simulators/start_sim.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
cd /sim
-python oof_dependencies_simulators.py > simulator-logs 2>&1 \ No newline at end of file
+python oof_dependencies_simulators.py
diff --git a/version.properties b/version.properties
index 8abfb34..18c199b 100644
--- a/version.properties
+++ b/version.properties
@@ -19,7 +19,7 @@
major=3
minor=0
-patch=7
+patch=8
base_version=${major}.${minor}.${patch}