From 27db04b176e4f9657603528c06e1febb04b5dd4d Mon Sep 17 00:00:00 2001 From: andreasgeissler Date: Wed, 2 Sep 2020 16:09:17 +0200 Subject: [PATCH] Updated onboarding steps and customer creation and added HEAT files Updated README to comply styleguide - hopefully now Issue-ID: TEST-260 Signed-off-by: andreasgeissler Change-Id: I29b9709452ab7cccc1bca54e8e3f8a187c560d14 --- README.md | 61 +++++++++++++++++++++ run.py | 5 +- .../cloud/customer_service_subscription_create.py | 1 + src/onaptests/steps/onboard/service.py | 2 +- src/onaptests/steps/onboard/vf.py | 2 +- src/onaptests/steps/onboard/vsp.py | 2 +- templates/heat_files/ubuntu16/ubuntu16.zip | Bin 0 -> 1641 bytes templates/vnf-services/ubuntu16test-service.yaml | 2 +- 8 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 README.md create mode 100644 templates/heat_files/ubuntu16/ubuntu16.zip diff --git a/README.md b/README.md new file mode 100644 index 0000000..f275115 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# pythonsdk-tests + +This project is a wrapper to use onapsdk toolkit to onboard and +instantiate services on ONAP + +## Temporary help section + +A basic example is implemented in the python file + +- run.py + +The global datas defined in these files (see input_datas) shall be +adapted to your environment. + +In addition you must define your service in directory templates/vnf-services +and create zip file for heat template templates/heat_files. +See ubuntu16test as example + +### Prepare your environment and run tests + +- Clone the project (using instantiation branch) + ```shell + git clone https://gerrit.onap.org/r/testsuite/pythonsdk-tests.git + ``` + +- Create a virtual environment and clone the python-onapsdk + ```shell + virtualenv my_test + source my_test/bin/activate + git clone git@gitlab.com:Orange-OpenSource/lfn/onap/python-onapsdk. + git -b develop + cd python-onapsdk + pip install -e . + cd .. + pip install -e . + ``` + +- Set global settings configuration files with all required input datas + including the dynamic forwarding port for ssh tunnel in + src/onaptests/configuration/settings.py + +- Export the setting file in a environment variable + ```shell + export ONAP_PYTHON_SDK_SETTINGS="onaptests.configuration.settings" + ``` + +- (optional) Open ssh tunnel towards your openlab setting a dynamic + port forward (by default 1080): + ```shell + ssh user@onap.pod4.opnfv.fr -D 1080 + ``` + +- Once the different input datas are updated in run\_\*.py files and + that the templates files for your service are defined, start to run + the different steps: + ```shell + python run.py + ``` + +- By default, all the logs are stored in the file pythonsdk.debug.log. + The file name and location can be set in the settings.py diff --git a/run.py b/run.py index 144edde..22bdb25 100644 --- a/run.py +++ b/run.py @@ -1,6 +1,6 @@ import logging.config from onapsdk.configuration import settings -from onaptests.steps.instantiate.service_ala_carte import ServiceAlaCarteInstantiateStep +from onaptests.steps.instantiate.service_ala_carte import YamlTemplateServiceAlaCarteInstantiateStep @@ -9,5 +9,6 @@ if __name__ == "__main__": # Correction requested in onapsdk to avoid having this duplicate code logging.config.dictConfig(settings.LOG_CONFIG) - service_inst = ServiceAlaCarteInstantiateStep() + service_inst = YamlTemplateServiceAlaCarteInstantiateStep() + #service_inst = ServiceAlaCarteInstantiateStep() service_inst.execute() diff --git a/src/onaptests/steps/cloud/customer_service_subscription_create.py b/src/onaptests/steps/cloud/customer_service_subscription_create.py index c797d56..ebe478f 100644 --- a/src/onaptests/steps/cloud/customer_service_subscription_create.py +++ b/src/onaptests/steps/cloud/customer_service_subscription_create.py @@ -25,6 +25,7 @@ class CustomerServiceSubscriptionCreateStep(BaseStep): - GLOBAL_CUSTOMER_ID, - SERVICE_NAME. """ + super().execute() service = Service(name=settings.SERVICE_NAME) customer = Customer.get_by_global_customer_id(settings.GLOBAL_CUSTOMER_ID) customer.subscribe_service(service) diff --git a/src/onaptests/steps/onboard/service.py b/src/onaptests/steps/onboard/service.py index 0143908..42a1db4 100644 --- a/src/onaptests/steps/onboard/service.py +++ b/src/onaptests/steps/onboard/service.py @@ -84,5 +84,5 @@ class YamlTemplateServiceOnboardStep(YamlTemplateBaseStep): super().execute() service: Service = Service(name=self.service_name, resources=[Vf(name=vnf["vnf_name"]) \ - for vnf in self.yaml_template[self.name]["vnfs"]]) + for vnf in self.yaml_template[self.service_name]["vnfs"]]) service.onboard() diff --git a/src/onaptests/steps/onboard/vf.py b/src/onaptests/steps/onboard/vf.py index 6d19b9a..2cda931 100644 --- a/src/onaptests/steps/onboard/vf.py +++ b/src/onaptests/steps/onboard/vf.py @@ -54,7 +54,7 @@ class YamlTemplateVfOnboardStep(YamlTemplateBaseStep): dict: YAML template """ - return self.parent.yaml_template[self.parent.name] + return self.parent.yaml_template[self.parent.service_name] def execute(self): """Onboard Vfs from YAML template.""" diff --git a/src/onaptests/steps/onboard/vsp.py b/src/onaptests/steps/onboard/vsp.py index f1eec1f..75055de 100644 --- a/src/onaptests/steps/onboard/vsp.py +++ b/src/onaptests/steps/onboard/vsp.py @@ -33,7 +33,7 @@ class VspOnboardStep(BaseStep): vsp.onboard() -class YamlTemplateVspOnboardStep(VspOnboardStep, YamlTemplateBaseStep): +class YamlTemplateVspOnboardStep(YamlTemplateBaseStep): """Vsp onboard using YAML template step.""" @property diff --git a/templates/heat_files/ubuntu16/ubuntu16.zip b/templates/heat_files/ubuntu16/ubuntu16.zip new file mode 100644 index 0000000000000000000000000000000000000000..9a98baad6608ec63e45f23577ded7f05182cfa82 GIT binary patch literal 1641 zcmZ`)doGJh@|Zm5x*C=kHB5?XmgKo%lx7=w3!9G0qp8eYNQ%m9 zqZ~4f%!o=zkGbZmpSNHcFhvN1~$}7rAB3%V6IYj8ofFjUjnBAO$*gB^_p{EJ{d; zRHqGpszYQj;A)X)F#hFWPrTU0+7j_m?YQ1bMu9v|;%5?4v1+9sg{iRNqWtO3465}q zzZzR`YkjmRCe*SOQXur3-ldy1(Rt{ny=gChKMB2CDCkTz?FPs!2z&gADB-4@MzL;% zx3z-J0$U!@mG|4{1J_l;W4!B3u{_9CzysC!%(y(Rm>rC|4P z3}^~pZyPcO!xcZa@MuYf8a(`BHp1ix?q4!d+`US+9+4;fTF=uPx6t5nM*^!Vlt2Y7 zLLUQ3Rl*@3of+OSIT8sbkf(TwSEoEE{UHl%ry62D+_TKr=M;|_qD|uM>-3wX!nplU zPkiw}H^~jSMc3S!>uJ-6>jXm_Q&9c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)G84hOVt^F0CZL8ul`5UcfKXtEGaIf2oSGB#L2^hEp82;7ziukF^0{R^ zKi#N_$L)H(JO=f%D{(wxRF>HwQyVa1?ze3KKy_9&g<;TA(kh_;PxTE`{#oq!@9;y$ n|C9b-hW?8T0PJ{&jaTt+`geO{&@!^$Z=^RmZUg&dzE6Ju-b?d` literal 0 HcmV?d00001 diff --git a/templates/vnf-services/ubuntu16test-service.yaml b/templates/vnf-services/ubuntu16test-service.yaml index bc09df8..c088313 100644 --- a/templates/vnf-services/ubuntu16test-service.yaml +++ b/templates/vnf-services/ubuntu16test-service.yaml @@ -5,7 +5,7 @@ ubuntu16test: subscription_type: "ubuntu16test" vnfs: - vnf_name: ubuntu16test - heat_files_to_upload: ubuntu16/ubuntu16.zip + heat_files_to_upload: templates/heat_files/ubuntu16/ubuntu16.zip vnf_parameters: [ {"name": "ubuntu16_image_name", "value": "ubuntu-16.04-daily" -- 2.16.6