diff options
author | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2024-02-22 10:20:27 +0100 |
---|---|---|
committer | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2024-02-22 10:24:08 +0100 |
commit | 99569a495242d681c16bd2e014c7554bbfa3d34c (patch) | |
tree | 71ba380d1268732d12fc788a678f94b30c3415ee | |
parent | e065c3bb1b148371a991d8f0245357b1b2910f7f (diff) |
Remove readthedocs configuration file and docs/ directory
Documentation is not generated anymore so can be removed
Issue-ID: TEST-404
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Change-Id: Iadaaf95231626cc5f47b804a11941e178ed6cb83
49 files changed, 0 insertions, 4607 deletions
diff --git a/.readthedocs.yaml b/.readthedocs.yaml deleted file mode 100644 index f56b3b7..0000000 --- a/.readthedocs.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -# .readthedocs.yml -# Read the Docs configuration file -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details -# Required - -version: 2 -build: - os: ubuntu-20.04 - tools: - python: "3.8" - -python: - install: - - requirements: docs/requirements-docs.txt - -sphinx: - configuration: docs/conf.py diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 733775b..0000000 --- a/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# SPDX-License-Identifier: Apache-2.0 -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/_static/css/ribbon.css b/docs/_static/css/ribbon.css deleted file mode 100644 index 7949130..0000000 --- a/docs/_static/css/ribbon.css +++ /dev/null @@ -1,63 +0,0 @@ -.ribbon { - z-index: 1000; - background-color: #a00; - overflow: hidden; - white-space: nowrap; - position: fixed; - top: 25px; - right: -50px; - -webkit-transform: rotate(45deg); - -moz-transform: rotate(45deg); - -ms-transform: rotate(45deg); - -o-transform: rotate(45deg); - transform: rotate(45deg); - -webkit-box-shadow: 0 0 10px #888; - -moz-box-shadow: 0 0 10px #888; - box-shadow: 0 0 10px #888; - -} - -.ribbon a { - border: 1px solid #faa; - color: #fff; - display: block; - font: bold 81.25% 'Helvetica Neue', Helvetica, Arial, sans-serif; - margin: 1px 0; - padding: 10px 50px; - text-align: center; - text-decoration: none; - text-shadow: 0 0 5px #444; - transition: 0.5s; -} - -.ribbon a:hover { - background: #c11; - color: #fff; -} - - -/* override table width restrictions */ -@media screen and (min-width: 767px) { - - .wy-table-responsive table td, .wy-table-responsive table th { - /* !important prevents the common CSS stylesheets from overriding - this as on RTD they are loaded after this stylesheet */ - white-space: normal !important; - } - - .wy-table-responsive { - overflow: visible !important; - } -} - -@media screen and (max-width: 767px) { - .wy-table-responsive table td { - white-space: nowrap; - } -} - -/* fix width of the screen */ - -.wy-nav-content { - max-width: 800px; -} diff --git a/docs/architecture.rst b/docs/architecture.rst deleted file mode 100644 index ece5cb2..0000000 --- a/docs/architecture.rst +++ /dev/null @@ -1,2 +0,0 @@ -Architecture -############ diff --git a/docs/conf.py b/docs/conf.py deleted file mode 100644 index ab8d09e..0000000 --- a/docs/conf.py +++ /dev/null @@ -1,75 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# http://www.sphinx-doc.org/en/master/config - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -import os -import sys -sys.path.insert(0, os.path.abspath('../src')) - - -# -- Project information ----------------------------------------------------- - -project = 'ONAP SDK' -copyright = '2019, Orange. 2019, DT' -author = 'ONAP Integration team' - -# The full version, including alpha/beta/rc tags -package_version = {} -with open("../src/onapsdk/version.py") as fp: - exec(fp.read(), package_version) -release = package_version['__version__'] - - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.intersphinx', - 'sphinx.ext.napoleon', - 'sphinx_autodoc_typehints' -] - -intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} - -# These folders are copied to the documentation's HTML output -html_static_path = ['_static'] - -# These paths are either relative to html_static_path -# or fully qualified paths (eg. https://...) -html_css_files = [ - 'css/custom.css', -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.tox'] - - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'sphinx_rtd_theme' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] -master_doc = 'index' diff --git a/docs/description.rst b/docs/description.rst deleted file mode 100644 index 39cf761..0000000 --- a/docs/description.rst +++ /dev/null @@ -1,13 +0,0 @@ -Description -########### - -ONAP SDK is a client library written in Python for building applications to -work with ONAP. The project aims to provide a consistent and complete set of -interactions with ONAP’s many services, along with complete documentation, -examples, and tools. - -Using few python commands, you should be able to onboard, distribute models and -instantiate xNFs. - -First beta release deals with ONAP "Legacy" APIs but new -APIs, CDS and policy integration is planned for next releases. diff --git a/docs/development.rst b/docs/development.rst deleted file mode 100644 index 7140ef6..0000000 --- a/docs/development.rst +++ /dev/null @@ -1,122 +0,0 @@ -Development -############ - - - -Setting up development environment ----------------------------------- -Before you start, ensure you have Python installation in version 3.7 or higher. -Please see the official Python documentation_ in case you have to upgrade or install -certain Python version. - -.. _documentation: https://docs.python.org/3/using/index.html - -Clone the project. Inside the project folder create a new virtual environment and activate -it: - -.. code:: shell - - $ python -m venv env - $ source env/bin/activate - -On Windows, activate by executing the following: - -.. code:: powershell - - $ .\env\Scripts\activate - -When your virtual environment is ready, install required dependencies: - -.. code:: shell - - $ pip install -r requirements.txt - -Developing ----------- - -To use library functions directly from the source code, execute the following -to point to the source folder in *PYTHONPATH* variable and run the interpreter: - - -.. code:: shell - - $ PYTHONPATH=$PYTHONPATH:src/ python - - -On Windows: - -.. code:: powershell - - $ $env:PYTHONPATH='src\';python - -Verify that packages are accessible: - -.. code:: python - - >>> import onapsdk - -You can then start working with library functions as needed. - -New ONAP component package --------------------------- - -When you create a new ONAP component package and wants to use Jinja templates you need to create `templates` directory -to store them in a newly created package. Furthermore you need to add a `PackageLoader` in `utils.jinja` module. - -Testing -------- - -Install tox: - -.. code:: shell - - $ pip install tox - -To run all unit test, lint and docstyle checks, inside the project folder simply -execute *tox*: - -.. code:: shell - - $ tox - -Please note that the above runs unit tests on all major versions of Python available on your -OS (3.8, 3.9). To limit execution to only specific version of Python Interpreter, -use the following example: - -.. code:: shell - - $ tox -e py38 - -Integration testing -------------------- - -It is possible to run integration tests using mock-servers_ project. - -.. _mock-servers: https://gitlab.com/Orange-OpenSource/lfn/onap/mock_servers - -Make sure Docker Compose is available on your system. Install required dependencies: - -.. code:: shell - - $ pip install pytest mock - -Go to *integration_tests/* directory and execute: - -.. code:: shell - - $ docker-compose up - -Please note that *docker-compose* attempts to create subnet 172.20.0.0/24, so it can not be run if the scope is already allocated. -Also, containers are not reachable by their IP addresses on Windows host since -Docker for Windows does not support bridged network interface for Linux containers. -For reference, please see Docker docs_. - -.. _docs: https://docs.docker.com/desktop/networking/#known-limitations-for-all-platforms - -Once containers are running, execute the following in the project's directory: - -.. code:: shell - - $ PYTHONPATH=$PYTHONPATH:integration_tests/:src/ ONAP_PYTHON_SDK_SETTINGS="local_urls" pytest -c /dev/null --verbose --junitxml=pytest-integration.xml integration_tests - -Please make sure all the test are passing before creating merge request.
\ No newline at end of file diff --git a/docs/examples/e2e_artifact_upload.rst b/docs/examples/e2e_artifact_upload.rst deleted file mode 100644 index aea4d21..0000000 --- a/docs/examples/e2e_artifact_upload.rst +++ /dev/null @@ -1,58 +0,0 @@ -E2E Upload of an artifact -##################################### - - -.. code:: Python - - import os - import logging - - from onapsdk.sdc.vsp import Vsp - from onapsdk.sdc.vf import Vf - from onapsdk.sdc.service import Service - - logger = logging.getLogger("") - logger.setLevel(logging.INFO) - fh = logging.StreamHandler() - fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s') - fh.setFormatter(fh_formatter) - logger.addHandler(fh) - - - - # Create required A&AI resources - VF_NAME = "my_VF" - SERVICENAME = "artifact_SERVICE" - - ARTIFACT_NAME = "clampnode" - ARTIFACT_TYPE = "DCAE_INVENTORY_BLUEPRINT" - ARTIFACT_FILE_PATH = "{os.path.dirname(os.path.abspath(__file__))}/my_ArtifactFile.yaml" - - - logger.info("*******************************") - logger.info("******** SERVICE DESIGN *******") - logger.info("*******************************") - - logger.info("******** Get VF *******") - vf = Vf(VF_NAME) - vf.onboard() - - logger.info("******** Create Service *******") - svc = Service(name=SERVICENAME) - svc.create() - svc.add_resource(vf) - - logger.info("******** Extract Artifact Data *******") - data = open(ARTIFACT_FILE_PATH,'rb').read() - - logger.info("******** Upload Artifact *******") - svc.add_artifact_to_vf(vnf_name=VF_NAME, - artifact_type=ARTIFACT_TYPE, - artifact_name=ARTIFACT_NAME, - artifact=data) - - logger.info("******** Distribute Service *******") - svc.checkin() - svc.certify() - svc.distribute() - diff --git a/docs/examples/e2e_basicvm_nomulticloud_instantiation.rst b/docs/examples/e2e_basicvm_nomulticloud_instantiation.rst deleted file mode 100644 index 37f3c31..0000000 --- a/docs/examples/e2e_basicvm_nomulticloud_instantiation.rst +++ /dev/null @@ -1,414 +0,0 @@ -E2E Instantiation of a simple VM without muticloud -################################################## - - -.. code:: Python - - import logging - import time - from uuid import uuid4 - from onapsdk.aai.aai_element import AaiElement - from onapsdk.aai.cloud_infrastructure import ( - CloudRegion, - Complex, - Tenant - ) - from onapsdk.aai.service_design_and_creation import ( - Service as AaiService - ) - from onapsdk.aai.business import ( - ServiceInstance, - VnfInstance, - VfModuleInstance, - ServiceSubscription, - Customer, - OwningEntity as AaiOwningEntity - ) - from onapsdk.so.instantiation import ( - ServiceInstantiation, - VnfInstantiation, - VnfParameter - ) - from onapsdk.sdc import SDC - from onapsdk.sdc.vendor import Vendor - from onapsdk.sdc.vsp import Vsp - from onapsdk.sdc.vf import Vf - from onapsdk.sdc.service import Service - import onapsdk.constants as const - import os - from onapsdk.vid import LineOfBusiness, OwningEntity, Platform, Project - - logger = logging.getLogger("") - logger.setLevel(logging.DEBUG) - fh = logging.StreamHandler() - fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s') - fh.setFormatter(fh_formatter) - logger.addHandler(fh) - - # Required A&AI resources - VSPNAME = "ubuntu16_VSP" - VFNAME = "ubuntu16_VF" - SERVICENAME = "ubuntu16_SERVICE" - - # FULLY CUSTOMIZABLE VALUES - # ************************* - VENDOR = "" # FILL ME - GLOBAL_CUSTOMER_ID = "" # FILL ME - SERVICE_DELETION = True # True|False - - COMPLEX_PHYSICAL_LOCATION_ID = "" # FILL ME - COMPLEX_DATA_CENTER_CODE = "" # FILL ME - - CLOUD_OWNER = "" # FILL ME - - OWNING_ENTITY = "" # FILL ME - PROJECT = "" # FILL ME - PLATFORM = "" # FILL ME - LINE_OF_BUSINESS = "" # FILL ME - - SERVICE_INSTANCE_NAME = "" # FILL ME - - AVAILABILITY_ZONE_NAME = "" # FILL ME - AVAILABILITY_ZONE_HYPERVISOR_TYPE = "" # FILL ME - - - # FILL ME with your INFRA values - # ****************************** - # ubuntu16.zip file path including the heat and env files - VSPFILE_PATH = "" # FILL ME - - VIM_USERNAME = "" # FILL ME - VIM_PASSWORD = "" # FILL ME - VIM_SERVICE_URL = "" # FILL ME - - TENANT_NAME = "" # FILL ME - TENANT_ID = "" # FILL ME - - CLOUD_REGION = "" # Shall be defined in Openstack - - - # ************************************************************************************************* - logger.info("*******************************") - logger.info("******** SERVICE DESIGN *******") - logger.info("*******************************") - - logger.info("******** Onboard Vendor *******") - vendor = Vendor(name=VENDOR) - vendor.onboard() - - logger.info("******** Onboard VSP *******") - vsp = Vsp(name=VSPNAME, vendor=vendor, package=open(VSPFILE_PATH, 'rb')) - vsp.onboard() - - logger.info("******** Onboard VF *******") - vf = Vf(name=VFNAME) - vf.vsp = vsp - vf.onboard() - - logger.info("******** Onboard Service *******") - svc = Service(name=SERVICENAME, resources=[vf]) - svc.onboard() - - logger.info("******** Check Service Distribution *******") - distribution_completed = False - nb_try = 0 - nb_try_max = 10 - while distribution_completed is False and nb_try < nb_try_max: - distribution_completed = svc.distributed - if distribution_completed is True: - logger.info("Service Distribution for %s is sucessfully finished",svc.name) - break - logger.info("Service Distribution for %s ongoing, Wait for 60 s",svc.name) - time.sleep(60) - nb_try += 1 - - if distribution_completed is False: - logger.error("Service Distribution for %s failed !!",svc.name) - exit(1) - - logger.info("*******************************") - logger.info("***** RUNTIME PREPARATION *****") - logger.info("*******************************") - - logger.info("******** Create Complex *******") - cmplx = Complex.create( - physical_location_id=COMPLEX_PHYSICAL_LOCATION_ID, - data_center_code=COMPLEX_DATA_CENTER_CODE, - name=COMPLEX_PHYSICAL_LOCATION_ID - ) - - logger.info("******** Create CloudRegion *******") - # Note for non multicloud instanciation, cloud_region_version shall be set to openstack - # versus - cloud_region = CloudRegion.create( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION, - orchestration_disabled=False, - in_maint=False, - cloud_type="openstack", - cloud_region_version="openstack", - cloud_zone="z1", - complex_name=COMPLEX_PHYSICAL_LOCATION_ID - ) - - logger.info("******** Link Complex to CloudRegion *******") - cloud_region.link_to_complex(cmplx) - - logger.info("******** Add ESR Info to CloudRegion *******") - cloud_region.add_esr_system_info( - esr_system_info_id=str(uuid4()), - user_name=VIM_USERNAME, - password=VIM_PASSWORD, - system_type="VIM", - service_url=VIM_SERVICE_URL, - cloud_domain="Default", - ssl_insecure=False, - system_status="active", - default_tenant=TENANT_NAME - ) - - logger.info("*******************************") - logger.info("**** SERVICE INSTANTIATION ****") - logger.info("*******************************") - - logger.info("******** Create Customer *******") - customer = None - for found_customer in list(Customer.get_all()): - logger.debug("Customer %s found", found_customer.subscriber_name) - if found_customer.subscriber_name == GLOBAL_CUSTOMER_ID: - logger.info("Customer %s found", found_customer.subscriber_name) - customer = found_customer - break - if not customer: - customer = Customer.create(GLOBAL_CUSTOMER_ID,GLOBAL_CUSTOMER_ID, "INFRA") - - logger.info("******** Find Service in SDC *******") - service = None - services = Service.get_all() - for found_service in services: - logger.debug("Service %s is found, distribution %s",found_service.name, found_service.distribution_status) - if found_service.name == SERVICENAME: - logger.info("Found Service %s in SDC",found_service.name) - service = found_service - break - - if not service: - logger.error("Service %s not found in SDC",SERVICENAME) - exit(1) - - logger.info("******** Check Service Subscription *******") - service_subscription = None - for service_sub in customer.service_subscriptions: - logger.debug("Service subscription %s is found",service_sub.service_type) - if service_sub.service_type == SERVICENAME: - logger.info("Service %s subscribed",SERVICENAME) - service_subscription = service_sub - break - - if not service_subscription: - logger.info("******** Subscribe Service *******") - customer.subscribe_service(SERVICENAME) - - logger.info("******** Get Tenant *******") - cloud_region = CloudRegion(cloud_owner=CLOUD_OWNER, cloud_region_id=CLOUD_REGION, - orchestration_disabled=True, in_maint=False) - try: - tenant: Tenant = cloud_region.get_tenant(settings.TENANT_ID) - except ValueError: - logger.warning("Impossible to retrieve the Specificed Tenant") - logger.debug("If no multicloud selected, add the tenant") - cloud_region.add_tenant( - tenant_id=settings.TENANT_ID, - tenant_name=settings.TENANT_NAME) - - # be sure that an availability zone has been created - # if not, create it - try: - cloud_region.get_availability_zone_by_name( - settings.AVAILABILITY_ZONE_NAME) - except ValueError: - cloud_region.add_availability_zone( - settings.AVAILABILITY_ZONE_NAME, - settings.AVAILABILITY_ZONE_HYPERVISOR_TYPE) - - logger.info("******** Connect Service to Tenant *******") - service_subscription = None - for service_sub in customer.service_subscriptions: - logger.debug("Service subscription %s is found",service_sub.service_type) - if service_sub.service_type == SERVICENAME: - logger.info("Service %s subscribed",SERVICENAME) - service_subscription = service_sub - break - - if not service_subscription: - logger.error("Service subscription %s is not found",SERVICENAME) - exit(1) - - service_subscription.link_to_cloud_region_and_tenant(cloud_region, tenant) - - logger.info("******** Add Business Objects (OE, P, Pl, LoB) in VID *******") - vid_owning_entity = OwningEntity.create(OWNING_ENTITY) - vid_project = Project.create(PROJECT) - vid_platform = Platform.create(PLATFORM) - vid_line_of_business = LineOfBusiness.create(LINE_OF_BUSINESS) - - logger.info("******** Add Owning Entity in AAI *******") - owning_entity = None - for oe in AaiOwningEntity.get_all(): - if oe.name == vid_owning_entity.name: - owning_entity = oe - break - if not owning_entity: - logger.info("******** Owning Entity not existing: create *******") - owning_entity = AaiOwningEntity.create(vid_owning_entity.name, str(uuid4())) - - logger.info("******** Instantiate Service *******") - service_instance = None - service_instantiation = None - for se in service_subscription.service_instances: - if se.instance_name == SERVICE_INSTANCE_NAME: - service_instance = se - break - if not service_instance: - logger.info("******** Service Instance not existing: Instantiate *******") - # Instantiate service - service_instantiation = ServiceInstantiation.instantiate_so_ala_carte( - service, - cloud_region, - tenant, - customer, - owning_entity, - vid_project, - service_instance_name=SERVICE_INSTANCE_NAME - ) - time.sleep(60) - else: - logger.info("******** Service Instance already existing *******") - - service_instance = None - for se in service_subscription.service_instances: - if se.instance_name == SERVICE_INSTANCE_NAME: - service_instance = se - break - if not service_instance: - logger.error("******** Service %s instantiation failed",SERVICE_INSTANCE_NAME) - exit(1) - - nb_try = 0 - nb_try_max = 10 - service_active = False - while service_active is False and nb_try < nb_try_max: - if service_instance.orchestration_status == "Active": - logger.info("******** Service Instance %s is active *******",service_instance.name) - service_active = True - break - logger.info("Service %s instantiation not complete,Status:%s, wait 10s",service_instance.name,service_instance.orchestration_status) - time.sleep(10) - nb_try += 1 - - if service_active is False: - logger.error("Service %s instantiation failed",service_instance.name) - exit(1) - - - logger.info("******** Get VNFs in Service Model *******") - vnfs = service_instance.service_subscription.sdc_service.vnfs - - logger.info("******** Create VNFs *******") - for vnf in vnfs: - logger.debug("Check if VNF instance of class %s exist", vnf.name) - vnf_found = False - for vnf_instance in service_instance.vnf_instances: - logger.debug("VNF instance %s found in Service Instance ",vnf_instance.name) - vnf_found = True - if vnf_found is False: - vnf_instantiation = service_instance.add_vnf(vnf, vid_line_of_business, vid_platform) - while not vnf_instantiation.finished: - print("Wait for VNF %s instantiation",vnf.name) - time.sleep(10) - - - for vnf_instance in service_instance.vnf_instances: - logger.debug("VNF instance %s found in Service Instance ",vnf_instance.name) - logger.info("******** Get VfModules in VNF Model *******") - logger.info("******** Check VF Modules *******") - vf_module = vnf_instance.vnf.vf_module - - logger.info("******** Create VF Module %s *******",vf_module.name) - - for vf_module in vnf_instance.vnf.vf_modules: - vf_module_instantiation = vnf_instance.add_vf_module( - vf_module, - cloud_region,tenant, - SERVICE_INSTANCE_NAME, - vnf_parameters=[]) - nb_try = 0 - nb_try_max = 30 - while not vf_module_instantiation.finished and nb_try < nb_try_max: - logger.info("Wait for vf module instantiation") - nb_try += 1 - time.sleep(10) - if vf_module_instantiation.finished: - logger.info("VfModule %s instantiated",vf_module.name) - else: - logger.error("VfModule instantiation %s failed",vf_module.name) - - if SERVICE_DELETION is False: - logger.info("*****************************************") - logger.info("**** No Deletion requested, finished ****") - logger.info("*****************************************") - exit(0) - - logger.info("*******************************") - logger.info("**** SERVICE DELETION *********") - logger.info("*******************************") - time.sleep(30) - - for vnf_instance in service_instance.vnf_instances: - logger.debug("VNF instance %s found in Service Instance ",vnf_instance.name) - logger.info("******** Get VF Modules *******") - for vf_module in vnf_instance.vf_modules: - logger.info("******** Delete VF Module %s *******",vf_module.name) - vf_module_deletion = vf_module.delete() - - nb_try = 0 - nb_try_max = 30 - while not vf_module_deletion.finished and nb_try < nb_try_max: - logger.info("Wait for vf module deletion") - nb_try += 1 - time.sleep(10) - if vf_module_deletion.finished: - logger.info("VfModule %s deleted",vf_module.name) - else: - logger.error("VfModule deletion %s failed",vf_module.name) - exit(1) - - logger.info("******** Delete VNF %s *******",vnf_instance.name) - vnf_deletion = vnf_instance.delete() - - nb_try = 0 - nb_try_max = 30 - while not vnf_deletion.finished and nb_try < nb_try_max: - logger.info("Wait for vnf deletion") - nb_try += 1 - time.sleep(10) - if vnf_deletion.finished: - logger.info("VNF %s deleted",vnf_instance.name) - else: - logger.error("VNF deletion %s failed",vnf_instance.name) - exit(1) - - logger.info("******** Delete Service %s *******",service_instance.name) - service_deletion = service_instance.delete() - - nb_try = 0 - nb_try_max = 30 - while not service_deletion.finished and nb_try < nb_try_max: - logger.info("Wait for Service deletion") - nb_try += 1 - time.sleep(10) - if service_deletion.finished: - logger.info("Service %s deleted",service_instance.name) - else: - logger.error("Service deletion %s failed",service_instance.name) - exit(1) diff --git a/docs/examples/e2e_closed_loop_instantiation.rst b/docs/examples/e2e_closed_loop_instantiation.rst deleted file mode 100644 index a263a66..0000000 --- a/docs/examples/e2e_closed_loop_instantiation.rst +++ /dev/null @@ -1,108 +0,0 @@ -E2E Instantiation of a Closed Loop -########################################## - - -.. code:: Python - - #Service already created in this case - - logger = logging.getLogger("") - logger.setLevel(logging.INFO) - fh = logging.StreamHandler() - fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s') - fh.setFormatter(fh_formatter) - logger.addHandler(fh) - - - #Constants - SERVICE_NAME = "Test_SDK" - POLICY_NAME = ["MinMax", "FrequencyLimiter"] - LOOP_INSTANCE_NAME = "instance01" - CERT = (PEM, KEY) # you must add clamp cert for AUTHENTIFICATION - - Clamp.set_proxy({ 'http': 'socks5h://127.0.0.1:8080', 'https': 'socks5h://127.0.0.1:8080'}) - Service.set_proxy({ 'http': 'socks5h://127.0.0.1:8080', 'https': 'socks5h://127.0.0.1:8080'}) - - logger.info("*******************************") - logger.info("******** SERVICE FETCH *******") - logger.info("*******************************") - - svc = Service(name=SERVICE_NAME) - - logger.info("***************************************") - logger.info("******** CLAMP AUTHENTIFICATION *******") - logger.info("***************************************") - - Clamp(cert=CERT) - - logger.info("*************************************") - logger.info("******** LOOP TEMPLATES CHECK *******") - logger.info("*************************************") - - loop_template = Clamp.check_loop_template(service=svc) - if not loop_template: - logger.error("Loop template for the service %s not found", svc.name) - exit(1) - - logger.info("*******************************") - logger.info("******** POLICIES CHECK *******") - logger.info("*******************************") - - minmax_exists = Clamp.check_policies(policy_name=POLICY_NAME[0], - req_policies=30) - frequency_exists = Clamp.check_policies(policy_name=POLICY_NAME[1], - req_policies=30) - policy_exists = (minmax_exists and frequency_exists) - if not policy_exists: - logger.error("Couldn't load the policy %s", POLICY_NAME) - exit(1) - - logger.info("***********************************") - logger.info("******** LOOP INSTANTIATION *******") - logger.info("***********************************") - - loop = LoopInstance(template=loop_template, name=LOOP_INSTANCE_NAME, details={}, cert=CERT) - loop.create() - if loop.details: - logger.info("Loop instance %s successfully created !!", LOOP_INSTANCE_NAME) - else: - logger.error("An error occured while creating the loop instance") - - logger.info("******** UPDATE MICROSERVICE POLICY *******") - loop._update_loop_details() - loop.update_microservice_policy() - - logger.info("******** ADD OPERATIONAL POLICY MINMAX *******") - added = loop.add_operational_policy(policy_type="onap.policies.controlloop.guard.common.MinMax", - policy_version="1.0.0") - - logger.info("******** CONFIGURE OPERATIONAL POLICY MINMAX *******") - loop.add_op_policy_config(loop.add_minmax_config) - - logger.info("******** ADD FREQUENCY POLICY *******") - added = loop.add_operational_policy(policy_type="onap.policies.controlloop.guard.common.FrequencyLimiter", - policy_version="1.0.0") - - logger.info("******** CONFIGURE FREQUENCY POLICY *******") - loop.add_op_policy_config(loop.add_frequency_limiter) - - logger.info("******** SUBMIT POLICIES TO PE *******") - submit = loop.act_on_loop_policy(loop.submit) - - logger.info("******** CHECK POLICIES SUBMITION *******") - if submit : - logger.info("Policies successfully submited to PE") - else: - logger.error("An error occured while submitting the loop instance") - exit(1) - - logger.info("******** DEPLOY LOOP INSTANCE *******") - deploy = loop.deploy_microservice_to_dcae() - if deploy: - logger.info("Loop instance %s successfully deployed on DCAE !!", LOOP_INSTANCE_NAME) - else: - logger.error("An error occured while deploying the loop instance") - exit(2) - - logger.info("******** DELETE LOOP INSTANCE *******") - loop.delete() diff --git a/docs/examples/e2e_net_instantiation.rst b/docs/examples/e2e_net_instantiation.rst deleted file mode 100644 index bfa4346..0000000 --- a/docs/examples/e2e_net_instantiation.rst +++ /dev/null @@ -1,332 +0,0 @@ -E2E Instantiation of a simple Network -##################################### - - -.. code:: Python - - import logging - import time - from uuid import uuid4 - from onapsdk.aai.aai_element import AaiElement - from onapsdk.aai.cloud_infrastructure import ( - CloudRegion, - Complex, - Tenant - ) - from onapsdk.aai.service_design_and_creation import ( - Service as AaiService - ) - from onapsdk.aai.business import ( - ServiceInstance, - ServiceSubscription, - Customer, - OwningEntity as AaiOwningEntity - ) - from onapsdk.so.instantiation import ( - ServiceInstantiation, - Subnet - ) - from onapsdk.sdc.service import Service - from onapsdk.sdc.vl import Vl - import onapsdk.constants as const - import os - from onapsdk.vid import LineOfBusiness, OwningEntity, Platform, Project - - logger = logging.getLogger("") - logger.setLevel(logging.INFO) - fh = logging.StreamHandler() - fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s') - fh.setFormatter(fh_formatter) - logger.addHandler(fh) - - - - # Create required A&AI resources - VL_NAME = "Generic NeutronNet" - SERVICENAME = "net_SERVICE" - - GLOBAL_CUSTOMER_ID = "" # FILL ME - COMPLEX_PHYSICAL_LOCATION_ID = "" # FILL ME - COMPLEX_DATA_CENTER_CODE = "" # FILL ME - - CLOUD_OWNER = "" # FILL ME - CLOUD_REGION = "" # FILL ME - - VIM_USERNAME = "" # FILL ME - VIM_PASSWORD = "" # FILL ME - VIM_SERVICE_URL = "" # FILL ME - - TENANT_NAME = "" # FILL ME - OWNING_ENTITY = "" # FILL ME - PROJECT = "" # FILL ME - PLATFORM = "" # FILL ME - LINE_OF_BUSINESS = "" # FILL ME - - SERVICE_INSTANCE_NAME = "net-Instance" - SERVICE_DELETION = True - - logger.info("*******************************") - logger.info("******** SERVICE DESIGN *******") - logger.info("*******************************") - - logger.info("******** Get VL *******") - vl = Vl(VL_NAME) - - logger.info("******** Onboard Service *******") - svc = Service(name=SERVICENAME, resources=[vl]) - svc.onboard() - - logger.info("******** Check Service Distribution *******") - distribution_completed = False - nb_try = 0 - nb_try_max = 10 - while distribution_completed is False and nb_try < nb_try_max: - distribution_completed = svc.distributed - if distribution_completed is True: - logger.info("Service Distribution for %s is sucessfully finished",svc.name) - break - logger.info("Service Distribution for %s ongoing, Wait for 60 s",svc.name) - time.sleep(60) - nb_try += 1 - - if distribution_completed is False: - logger.error("Service Distribution for %s failed !!",svc.name) - exit(1) - - logger.info("*******************************") - logger.info("***** RUNTIME PREPARATION *****") - logger.info("*******************************") - - logger.info("******** Create Complex *******") - cmplx = Complex.create( - physical_location_id=COMPLEX_PHYSICAL_LOCATION_ID, - data_center_code=COMPLEX_DATA_CENTER_CODE, - name=COMPLEX_PHYSICAL_LOCATION_ID - ) - - logger.info("******** Create CloudRegion *******") - cloud_region = CloudRegion.create( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION, - orchestration_disabled=False, - in_maint=False, - cloud_type="openstack", - cloud_region_version="titanium_cloud", - cloud_zone="z1", - complex_name=COMPLEX_PHYSICAL_LOCATION_ID - ) - - logger.info("******** Link Complex to CloudRegion *******") - cloud_region.link_to_complex(cmplx) - - logger.info("******** Add ESR Info to CloudRegion *******") - cloud_region.add_esr_system_info( - esr_system_info_id=str(uuid4()), - user_name=VIM_USERNAME, - password=VIM_PASSWORD, - system_type="VIM", - service_url=VIM_SERVICE_URL, - cloud_domain="Default", - ssl_insecure=False, - system_status="active", - default_tenant=TENANT_NAME - ) - - logger.info("******** Register CloudRegion to MultiCloud *******") - cloud_region.register_to_multicloud() - - logger.info("******** Check MultiCloud Registration *******") - time.sleep(60) - registration_completed = False - nb_try = 0 - nb_try_max = 10 - while registration_completed is False and nb_try < nb_try_max: - for tenant in cloud_region.tenants: - logger.debug("Tenant %s found in %s_%s",tenant.name,cloud_region.cloud_owner,cloud_region.cloud_region_id) - registration_completed = True - if registration_completed is False: - time.sleep(60) - nb_try += 1 - - if registration_completed is False: - logger.error("Registration of Cloud %s_%s failed !!",cloud_region.cloud_owner,cloud_region.cloud_region_id) - exit(1) - else: - logger.info("Registration of Cloud %s_%s successful !!",cloud_region.cloud_owner,cloud_region.cloud_region_id) - - logger.info("*******************************") - logger.info("**** SERVICE INSTANTIATION ****") - logger.info("*******************************") - - logger.info("******** Create Customer *******") - customer = None - for found_customer in list(Customer.get_all()): - logger.debug("Customer %s found", found_customer.subscriber_name) - if found_customer.subscriber_name == GLOBAL_CUSTOMER_ID: - logger.info("Customer %s found", found_customer.subscriber_name) - customer = found_customer - break - if not customer: - customer = Customer.create(GLOBAL_CUSTOMER_ID,GLOBAL_CUSTOMER_ID, "INFRA") - - logger.info("******** Find Service in SDC *******") - service = None - services = Service.get_all() - for found_service in services: - logger.debug("Service %s is found, distribution %s",found_service.name, found_service.distribution_status) - if found_service.name == SERVICENAME: - logger.info("Found Service %s in SDC",found_service.name) - service = found_service - break - - if not service: - logger.error("Service %s not found in SDC",SERVICENAME) - exit(1) - - logger.info("******** Check Service Subscription *******") - service_subscription = None - for service_sub in customer.service_subscriptions: - logger.debug("Service subscription %s is found",service_sub.service_type) - if service_sub.service_type == SERVICENAME: - logger.info("Service %s subscribed",SERVICENAME) - service_subscription = service_sub - break - - if not service_subscription: - logger.info("******** Subscribe Service *******") - customer.subscribe_service(SERVICENAME) - - logger.info("******** Get Tenant *******") - cloud_region = CloudRegion(cloud_owner=CLOUD_OWNER, cloud_region_id=CLOUD_REGION, - orchestration_disabled=True, in_maint=False) - tenant = None - for found_tenant in cloud_region.tenants: - logger.debug("Tenant %s found in %s_%s",found_tenant.name,cloud_region.cloud_owner,cloud_region.cloud_region_id) - if found_tenant.name == TENANT_NAME: - logger.info("Found my Tenant %s",found_tenant.name) - tenant = found_tenant - break - - if not tenant: - logger.error("tenant %s not found",TENANT_NAME) - exit(1) - - logger.info("******** Connect Service to Tenant *******") - service_subscription = None - for service_sub in customer.service_subscriptions: - logger.debug("Service subscription %s is found",service_sub.service_type) - if service_sub.service_type == SERVICENAME: - logger.info("Service %s subscribed",SERVICENAME) - service_subscription = service_sub - break - - if not service_subscription: - logger.error("Service subscription %s is not found",SERVICENAME) - exit(1) - - service_subscription.link_to_cloud_region_and_tenant(cloud_region, tenant) - - logger.info("******** Add Business Objects (OE, P, Pl, LoB) in VID *******") - vid_owning_entity = OwningEntity.create(OWNING_ENTITY) - vid_project = Project.create(PROJECT) - vid_platform = Platform.create(PLATFORM) - vid_line_of_business = LineOfBusiness.create(LINE_OF_BUSINESS) - - logger.info("******** Add Owning Entity in AAI *******") - owning_entity = None - for oe in AaiOwningEntity.get_all(): - if oe.name == vid_owning_entity.name: - owning_entity = oe - break - if not owning_entity: - logger.info("******** Owning Entity not existing: create *******") - owning_entity = AaiOwningEntity.create(vid_owning_entity.name, str(uuid4())) - - logger.info("******** Instantiate Service *******") - service_instance = None - service_instantiation = None - for se in service_subscription.service_instances: - if se.instance_name == SERVICE_INSTANCE_NAME: - service_instance = se - break - if not service_instance: - logger.info("******** Service Instance not existing: Instantiate *******") - # Instantiate service - service_instantiation = ServiceInstantiation.instantiate_so_ala_carte( - service, - cloud_region, - tenant, - customer, - owning_entity, - vid_project, - service_instance_name=SERVICE_INSTANCE_NAME - ) - time.sleep(60) - else: - logger.info("******** Service Instance already existing *******") - - service_instance = None - for se in service_subscription.service_instances: - if se.instance_name == SERVICE_INSTANCE_NAME: - service_instance = se - break - if not service_instance: - logger.error("******** Service %s instantiation failed",SERVICE_INSTANCE_NAME) - exit(1) - - nb_try = 0 - nb_try_max = 10 - service_active = False - while service_active is False and nb_try < nb_try_max: - if service_instance.orchestration_status == "Active": - logger.info("******** Service Instance %s is active *******",service_instance.name) - service_active = True - break - logger.info("Service %s instantiation not complete,Status:%s, wait 10s",service_instance.name,service_instance.orchestration_status) - time.sleep(10) - nb_try += 1 - - if service_active is False: - logger.error("Service %s instantiation failed",service_instance.name) - exit(1) - - - logger.info("******** Get Networks in Service Model *******") - networks = service_instance.service_subscription.sdc_service.networks - - logger.info("******** Create Network *******") - sn=Subnet(name="test", start_address="127.0.0.0", gateway_address="127.0.0.1") - for network in networks: - logger.debug("Check if Network instance of class %s exist", network.name) - network_found = False - for network_instance in service_instance.network_instances: - logger.debug("Network instance %s found in Service Instance ",network_intance.name) - network_found = True - if network_found is False: - network_instantiation = service_instance.add_network(network, vid_line_of_business, vid_platform, subnets=[sn]) - network_instantiation.wait_for_finish() - - - if SERVICE_DELETION is False: - logger.info("*****************************************") - logger.info("**** No Deletion requested, finished ****") - logger.info("*****************************************") - exit(0) - - logger.info("*******************************") - logger.info("**** SERVICE DELETION *********") - logger.info("*******************************") - time.sleep(30) - - for network_instance in service_instance.network_instances: - logger.debug("Network instance %s found in Service Instance ",network_instance.name) - - logger.info("******** Delete Network %s *******",network_instance.name) - network_deletion = network_instance.delete() - network_deletion.wait_for_finish() - - logger.info("******** Delete Service %s *******",service_instance.name) - service_deletion = service_instance.delete() - service_deletion.wait_for_finish() - - diff --git a/docs/examples/e2e_vfw_instantiation.rst b/docs/examples/e2e_vfw_instantiation.rst deleted file mode 100644 index 5455d7d..0000000 --- a/docs/examples/e2e_vfw_instantiation.rst +++ /dev/null @@ -1,429 +0,0 @@ -E2E Instantiation of vFW (a'la carte) -##################################### - - -.. code:: Python - - import logging - import time - from uuid import uuid4 - from onapsdk.aai.aai_element import AaiElement - from onapsdk.aai.cloud_infrastructure import ( - CloudRegion, - Complex, - Tenant - ) - from onapsdk.aai.service_design_and_creation import ( - Service as AaiService - ) - from onapsdk.aai.business import ( - ServiceInstance, - VnfInstance, - VfModuleInstance, - ServiceSubscription, - Customer, - OwningEntity as AaiOwningEntity - ) - from onapsdk.so.instantiation import ( - ServiceInstantiation, - VnfInstantiation, - VnfParameter - ) - from onapsdk.sdc import SDC - from onapsdk.sdc.vendor import Vendor - from onapsdk.sdc.vsp import Vsp - from onapsdk.sdc.vf import Vf - from onapsdk.sdc.service import Service - import onapsdk.constants as const - import os - from onapsdk.vid import LineOfBusiness, OwningEntity, Platform, Project - - logger = logging.getLogger("") - logger.setLevel(logging.INFO) - fh = logging.StreamHandler() - fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s') - fh.setFormatter(fh_formatter) - logger.addHandler(fh) - - - - # Create required A&AI resources - VENDOR = "VNFVendor" - VSPFILE = "vsp/vfw.zip" - VSPNAME = "vfw_VSP" - VFNAME = "vfw_VF" - SERVICENAME = "vfw_SERVICE" - - GLOBAL_CUSTOMER_ID = "" # FILL ME - COMPLEX_PHYSICAL_LOCATION_ID = "" # FILL ME - COMPLEX_DATA_CENTER_CODE = "" # FILL ME - - CLOUD_OWNER = "" # FILL ME - CLOUD_REGION = "" # FILL ME - - VIM_USERNAME = "" # FILL ME - VIM_PASSWORD = "" # FILL ME - VIM_SERVICE_URL = "" # FILL ME - - TENANT_NAME = "" # FILL ME - OWNING_ENTITY = "" # FILL ME - PROJECT = "" # FILL ME - PLATFORM = "" # FILL ME - LINE_OF_BUSINESS = "" # FILL ME - - SERVICE_INSTANCE_NAME = "vFW-Instance" - SERVICE_DELETION = True - - logger.info("*******************************") - logger.info("******** SERVICE DESIGN *******") - logger.info("*******************************") - - logger.info("******** Onboard Vendor *******") - vendor = Vendor(name=VENDOR) - vendor.onboard() - - logger.info("******** Onboard VSP *******") - mypath = os.path.dirname(os.path.realpath(__file__)) - myvspfile = os.path.join(mypath, VSPFILE) - vsp = Vsp(name=VSPNAME, vendor=vendor, package=open(myvspfile, 'rb')) - vsp.onboard() - - logger.info("******** Onboard VF *******") - vf = Vf(name=VFNAME) - vf.vsp = vsp - vf.onboard() - - logger.info("******** Onboard Service *******") - svc = Service(name=SERVICENAME, resources=[vf]) - svc.onboard() - - logger.info("******** Check Service Distribution *******") - distribution_completed = False - nb_try = 0 - nb_try_max = 10 - while distribution_completed is False and nb_try < nb_try_max: - distribution_completed = svc.distributed - if distribution_completed is True: - logger.info("Service Distribution for %s is sucessfully finished",svc.name) - break - logger.info("Service Distribution for %s ongoing, Wait for 60 s",svc.name) - time.sleep(60) - nb_try += 1 - - if distribution_completed is False: - logger.error("Service Distribution for %s failed !!",svc.name) - exit(1) - - logger.info("*******************************") - logger.info("***** RUNTIME PREPARATION *****") - logger.info("*******************************") - - logger.info("******** Create Complex *******") - cmplx = Complex.create( - physical_location_id=COMPLEX_PHYSICAL_LOCATION_ID, - data_center_code=COMPLEX_DATA_CENTER_CODE, - name=COMPLEX_PHYSICAL_LOCATION_ID - ) - - logger.info("******** Create CloudRegion *******") - cloud_region = CloudRegion.create( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION, - orchestration_disabled=False, - in_maint=False, - cloud_type="openstack", - cloud_region_version="titanium_cloud", - cloud_zone="z1", - complex_name=COMPLEX_PHYSICAL_LOCATION_ID - ) - - logger.info("******** Link Complex to CloudRegion *******") - cloud_region.link_to_complex(cmplx) - - logger.info("******** Add ESR Info to CloudRegion *******") - cloud_region.add_esr_system_info( - esr_system_info_id=str(uuid4()), - user_name=VIM_USERNAME, - password=VIM_PASSWORD, - system_type="VIM", - service_url=VIM_SERVICE_URL, - cloud_domain="Default", - ssl_insecure=False, - system_status="active", - default_tenant=TENANT_NAME - ) - - logger.info("******** Register CloudRegion to MultiCloud *******") - cloud_region.register_to_multicloud() - - logger.info("******** Check MultiCloud Registration *******") - time.sleep(60) - registration_completed = False - nb_try = 0 - nb_try_max = 10 - while registration_completed is False and nb_try < nb_try_max: - for tenant in cloud_region.tenants: - logger.debug("Tenant %s found in %s_%s",tenant.name,cloud_region.cloud_owner,cloud_region.cloud_region_id) - registration_completed = True - if registration_completed is False: - time.sleep(60) - nb_try += 1 - - if registration_completed is False: - logger.error("Registration of Cloud %s_%s failed !!",cloud_region.cloud_owner,cloud_region.cloud_region_id) - exit(1) - else: - logger.info("Registration of Cloud %s_%s successful !!",cloud_region.cloud_owner,cloud_region.cloud_region_id) - - logger.info("*******************************") - logger.info("**** SERVICE INSTANTIATION ****") - logger.info("*******************************") - - logger.info("******** Create Customer *******") - customer = None - for found_customer in list(Customer.get_all()): - logger.debug("Customer %s found", found_customer.subscriber_name) - if found_customer.subscriber_name == GLOBAL_CUSTOMER_ID: - logger.info("Customer %s found", found_customer.subscriber_name) - customer = found_customer - break - if not customer: - customer = Customer.create(GLOBAL_CUSTOMER_ID,GLOBAL_CUSTOMER_ID, "INFRA") - - logger.info("******** Find Service in SDC *******") - service = None - services = Service.get_all() - for found_service in services: - logger.debug("Service %s is found, distribution %s",found_service.name, found_service.distribution_status) - if found_service.name == SERVICENAME: - logger.info("Found Service %s in SDC",found_service.name) - service = found_service - break - - if not service: - logger.error("Service %s not found in SDC",SERVICENAME) - exit(1) - - logger.info("******** Check Service Subscription *******") - service_subscription = None - for service_sub in customer.service_subscriptions: - logger.debug("Service subscription %s is found",service_sub.service_type) - if service_sub.service_type == SERVICENAME: - logger.info("Service %s subscribed",SERVICENAME) - service_subscription = service_sub - break - - if not service_subscription: - logger.info("******** Subscribe Service *******") - customer.subscribe_service(SERVICENAME) - - logger.info("******** Get Tenant *******") - cloud_region = CloudRegion(cloud_owner=CLOUD_OWNER, cloud_region_id=CLOUD_REGION, - orchestration_disabled=True, in_maint=False) - tenant = None - for found_tenant in cloud_region.tenants: - logger.debug("Tenant %s found in %s_%s",found_tenant.name,cloud_region.cloud_owner,cloud_region.cloud_region_id) - if found_tenant.name == TENANT_NAME: - logger.info("Found my Tenant %s",found_tenant.name) - tenant = found_tenant - break - - if not tenant: - logger.error("tenant %s not found",TENANT_NAME) - exit(1) - - logger.info("******** Connect Service to Tenant *******") - service_subscription = None - for service_sub in customer.service_subscriptions: - logger.debug("Service subscription %s is found",service_sub.service_type) - if service_sub.service_type == SERVICENAME: - logger.info("Service %s subscribed",SERVICENAME) - service_subscription = service_sub - break - - if not service_subscription: - logger.error("Service subscription %s is not found",SERVICENAME) - exit(1) - - service_subscription.link_to_cloud_region_and_tenant(cloud_region, tenant) - - logger.info("******** Add Business Objects (OE, P, Pl, LoB) in VID *******") - vid_owning_entity = OwningEntity.create(OWNING_ENTITY) - vid_project = Project.create(PROJECT) - vid_platform = Platform.create(PLATFORM) - vid_line_of_business = LineOfBusiness.create(LINE_OF_BUSINESS) - - logger.info("******** Add Owning Entity in AAI *******") - owning_entity = None - for oe in AaiOwningEntity.get_all(): - if oe.name == vid_owning_entity.name: - owning_entity = oe - break - if not owning_entity: - logger.info("******** Owning Entity not existing: create *******") - owning_entity = AaiOwningEntity.create(vid_owning_entity.name, str(uuid4())) - - logger.info("******** Instantiate Service *******") - service_instance = None - service_instantiation = None - for se in service_subscription.service_instances: - if se.instance_name == SERVICE_INSTANCE_NAME: - service_instance = se - break - if not service_instance: - logger.info("******** Service Instance not existing: Instantiate *******") - # Instantiate service - service_instantiation = ServiceInstantiation.instantiate_so_ala_carte( - service, - cloud_region, - tenant, - customer, - owning_entity, - vid_project, - service_instance_name=SERVICE_INSTANCE_NAME - ) - time.sleep(60) - else: - logger.info("******** Service Instance already existing *******") - - service_instance = None - for se in service_subscription.service_instances: - if se.instance_name == SERVICE_INSTANCE_NAME: - service_instance = se - break - if not service_instance: - logger.error("******** Service %s instantiation failed",SERVICE_INSTANCE_NAME) - exit(1) - - nb_try = 0 - nb_try_max = 10 - service_active = False - while service_active is False and nb_try < nb_try_max: - if service_instance.orchestration_status == "Active": - logger.info("******** Service Instance %s is active *******",service_instance.name) - service_active = True - break - logger.info("Service %s instantiation not complete,Status:%s, wait 10s",service_instance.name,service_instance.orchestration_status) - time.sleep(10) - nb_try += 1 - - if service_active is False: - logger.error("Service %s instantiation failed",service_instance.name) - exit(1) - - - logger.info("******** Get VNFs in Service Model *******") - vnfs = service_instance.service_subscription.sdc_service.vnfs - - logger.info("******** Create VNFs *******") - for vnf in vnfs: - logger.debug("Check if VNF instance of class %s exist", vnf.name) - vnf_found = False - for vnf_instance in service_instance.vnf_instances: - logger.debug("VNF instance %s found in Service Instance ",vnf_instance.name) - vnf_found = True - if vnf_found is False: - vnf_instantiation = service_instance.add_vnf(vnf, vid_line_of_business, vid_platform) - while not vnf_instantiation.finished: - print("Wait for VNF %s instantiation",vnf.name) - time.sleep(10) - - - for vnf_instance in service_instance.vnf_instances: - logger.debug("VNF instance %s found in Service Instance ",vnf_instance.name) - logger.info("******** Get VfModules in VNF Model *******") - logger.info("******** Check VF Modules *******") - vf_module = vnf_instance.vnf.vf_module - - logger.info("******** Create VF Module %s *******",vf_module.name) - - vf_module_instantiation = vnf_instance.add_vf_module( - vf_module, - vnf_parameters=[ - VnfParameter(name="vfw_image_name", value="Ubuntu_1404"), - VnfParameter(name="vpg_image_name", value="Ubuntu_1404"), - VnfParameter(name="vsn_image_name", value="Ubuntu_1404"), - VnfParameter(name="vfw_flavor_name", value="m1.small"), - VnfParameter(name="vpg_flavor_name", value="m1.small"), - VnfParameter(name="vsn_flavor_name", value="m1.small"), - VnfParameter(name="public_net_id", value="admin"), - VnfParameter(name="onap_private_net_id", value="admin"), - VnfParameter(name="onap_private_subnet_id", value="admin-subnet"), - VnfParameter(name="onap_private_net_cidr", value="10.41.1.0/24"), - VnfParameter(name="vfw_onap_private_ip_0", value="10.41.1.10"), - VnfParameter(name="vpg_onap_private_ip_0", value="10.41.1.11"), - VnfParameter(name="vsn_onap_private_ip_0", value="10.41.1.12"), - VnfParameter(name="sec_group", value="ci-onap-master-vnfs-onap") - ] - ) - nb_try = 0 - nb_try_max = 30 - while not vf_module_instantiation.finished and nb_try < nb_try_max: - logger.info("Wait for vf module instantiation") - nb_try += 1 - time.sleep(10) - if vf_module_instantiation.finished: - logger.info("VfModule %s instantiated",vf_module.name) - else: - logger.error("VfModule instantiation %s failed",vf_module.name) - - if SERVICE_DELETION is False: - logger.info("*****************************************") - logger.info("**** No Deletion requested, finished ****") - logger.info("*****************************************") - exit(0) - - logger.info("*******************************") - logger.info("**** SERVICE DELETION *********") - logger.info("*******************************") - time.sleep(30) - - for vnf_instance in service_instance.vnf_instances: - logger.debug("VNF instance %s found in Service Instance ",vnf_instance.name) - logger.info("******** Get VF Modules *******") - for vf_module in vnf_instance.vf_modules: - logger.info("******** Delete VF Module %s *******",vf_module.name) - vf_module_deletion = vf_module.delete() - - nb_try = 0 - nb_try_max = 30 - while not vf_module_deletion.finished and nb_try < nb_try_max: - logger.info("Wait for vf module deletion") - nb_try += 1 - time.sleep(10) - if vf_module_deletion.finished: - logger.info("VfModule %s deleted",vf_module.name) - else: - logger.error("VfModule deletion %s failed",vf_module.name) - exit(1) - - logger.info("******** Delete VNF %s *******",vnf_instance.name) - vnf_deletion = vnf_instance.delete() - - nb_try = 0 - nb_try_max = 30 - while not vnf_deletion.finished and nb_try < nb_try_max: - logger.info("Wait for vnf deletion") - nb_try += 1 - time.sleep(10) - if vnf_deletion.finished: - logger.info("VNF %s deleted",vnf_instance.name) - else: - logger.error("VNF deletion %s failed",vnf_instance.name) - exit(1) - - logger.info("******** Delete Service %s *******",service_instance.name) - service_deletion = service_instance.delete() - - nb_try = 0 - nb_try_max = 30 - while not service_deletion.finished and nb_try < nb_try_max: - logger.info("Wait for Service deletion") - nb_try += 1 - time.sleep(10) - if service_deletion.finished: - logger.info("Service %s deleted",service_instance.name) - else: - logger.error("Service deletion %s failed",service_instance.name) - exit(1) - diff --git a/docs/examples/e2e_vfw_macro_instantiation.rst b/docs/examples/e2e_vfw_macro_instantiation.rst deleted file mode 100644 index 72f8167..0000000 --- a/docs/examples/e2e_vfw_macro_instantiation.rst +++ /dev/null @@ -1,493 +0,0 @@ -E2E Instantiation of vFW (macro) -################################ - - -.. code:: Python - - import logging - import time - import json - from uuid import uuid4 - from onapsdk.aai.aai_element import AaiElement - from onapsdk.aai.cloud_infrastructure import ( - CloudRegion, - Complex, - Tenant - ) - from onapsdk.aai.service_design_and_creation import ( - Service as AaiService - ) - from onapsdk.aai.business import ( - ServiceInstance, - VnfInstance, - VfModuleInstance, - ServiceSubscription, - Customer, - OwningEntity as AaiOwningEntity - ) - from onapsdk.so.instantiation import ( - ServiceInstantiation, - VnfInstantiation, - InstantiationParameter, - VnfParameters, - VfmoduleParameters - ) - from onapsdk.sdc.properties import Property - from onapsdk.sdc import SDC - from onapsdk.sdc.vendor import Vendor - from onapsdk.sdc.vsp import Vsp - from onapsdk.sdc.vf import Vf - from onapsdk.sdc.service import Service, ServiceInstantiationType - import onapsdk.constants as const - import os - from onapsdk.vid import LineOfBusiness, OwningEntity, Platform, Project - - from onapsdk.cds.blueprint import Blueprint - from onapsdk.cds.data_dictionary import DataDictionary, DataDictionarySet - - logger = logging.getLogger("") - logger.setLevel(logging.INFO) - logname = "./vfwcds.debug.log" - fh = logging.FileHandler(logname) - fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s') - fh.setFormatter(fh_formatter) - logger.addHandler(fh) - - ########################################################################### - ######## CDS Design settings ############################################## - ######## vFW CDS Example ############################################## - ########################################################################### - # DDF Settings (dd files located in following location) - DDDIR = "resources/starter-dictionary" - DDFILE = "resources/my_dd.json" - - # CBA resources (location of base CBA file) - CBAFILE = "resources/vFWCDS/CBA/CBA.zip" - ARTIFACT_LABEL = "vnfcds" - ARTIFACT_NAME = "CBA_enriched.zip" - ARTIFACT_TYPE = "CONTROLLER_BLUEPRINT_ARCHIVE" - ARTIFACT_FILE_PATH = "resources/vFWCDS/CBA/CBA_enriched.zip" - SDNC_TEMPLATE_NAME = "vFW-CDS" - SDNC_TEMPLATE_VERSION = "1.0.0" - SDNC_ARTIFACT_NAME = "vnf" - - ########################################################################### - ######## Service Design settings ########################################## - ########################################################################### - VENDOR = "VNFVendor" - - # HEAT resources (location of zipped HEAT file) - VSPFILE = "resources/vFWCDS/HEAT/vFW/vFW.zip" - VSPNAME = "vfwcds_VS" - VFNAME = "vfwcds_VF" - SERVICENAME = "vfwcds_SERVICE" - - ########################################################################### - ######## Runtime preparation settings ##################################### - ########################################################################### - # Default Cloud - CLOUD_OWNER = "CloudOwner" - CLOUD_REGION = "RegionOne" - - GLOBAL_CUSTOMER_ID = "generic" - CLOUD_TYPE = "openstack" - CLOUD_VERSION = "pike" - VIM_USERNAME = <user> # FILL ME - VIM_PASSWORD = <password> # FILL ME - VIM_SERVICE_URL = "http://<vim-url>/v3" # FILL ME - TENANT_NAME = <tenant> # FILL ME - TENANT_SEC_GROUP = <sec-group> # FILL ME - COMPLEX_PHYSICAL_LOCATION_ID = "location" - COMPLEX_DATA_CENTER_CODE = "1234" - - - # common - OWNING_ENTITY = "Test-OE" - PROJECT = "Test-Project" - PLATFORM = "Test-Platform" - LINE_OF_BUSINESS = "Test-BusinessLine" - - SERVICE_DELETION = False - - ########################################################################### - ######## Service Instance attributes ###################################### - ########################################################################### - SERVICE_INSTANCE_NAME = "vFWCDS-Instance-1" - ONAP_PRIVATE_NET = "onap-oam" # FILL ME - ONAP_PRIVATE_SUBNET = "onap-oam-subnet" # FILL ME - PUBLIC_NET = "admin" # FILL ME - IMAGE_NAME = "Ubuntu_1604" # FILL ME - FLAVOR_NAME = "m1.small" # FILL ME - - logger.info("*******************************") - logger.info("********* CBA Creation ********") - logger.info("*******************************") - - logger.info("******** Load Data Dictionary *******") - mypath = os.path.dirname(os.path.realpath(__file__)) - myddpath = os.path.join(mypath, DDDIR) - myddfile = os.path.join(mypath, DDFILE) - - logger.info("path: %s", myddpath) - dd_set = DataDictionarySet() - for file in os.listdir(myddpath): - logger.info("file: %s", file) - if file.endswith(".json"): - with open(os.path.join(myddpath, file), "r") as dd_file: # type file - dd_json: dict = json.loads(dd_file.read()) - logger.info("DD: %s", dd_json) - dd_set.add(DataDictionary(dd_json)) - logger.info("DD Length: %d", dd_set.length) - dd_set.upload() - - logger.info("******** Open Blueprint *******") - cbafile = os.path.join(mypath, CBAFILE) - artifactfile = os.path.join(mypath, ARTIFACT_FILE_PATH) - - blueprint = Blueprint.load_from_file(cbafile) - enriched_blueprint = blueprint.enrich() # returns enriched blueprint object - enriched_blueprint.save(artifactfile) - - - logger.info("*******************************") - logger.info("******** SERVICE DESIGN *******") - logger.info("*******************************") - - logger.info("******** Onboard Vendor *******") - vendor = Vendor(name=VENDOR) - vendor.onboard() - - logger.info("******** Onboard VSP *******") - vspfile = os.path.join(mypath, VSPFILE) - vsp = Vsp(name=VSPNAME, vendor=vendor, package=open(vspfile, 'rb')) - vsp.onboard() - - - logger.info("******** Onboard VF *******") - vf = Vf(name=VFNAME) - vf.vsp = vsp - vf.create() - - if vf.status == const.DRAFT: - - logger.info("******** Extract Artifact Data *******") - data = open(artifactfile, 'rb').read() - - logger.info("******** Upload Artifact *******") - vf.add_deployment_artifact(artifact_type=ARTIFACT_TYPE, - artifact_name=ARTIFACT_NAME, - artifact_label=ARTIFACT_LABEL, - artifact=artifactfile) - - vf.onboard() - - svc = Service(name=SERVICENAME,instantiation_type=ServiceInstantiationType.MACRO) - svc.create() - - if svc.status == const.DRAFT: - svc.add_resource(vf) - - logger.info("******** Set SDNC properties for VF ********") - component = svc.get_component(vf) - prop = component.get_property("sdnc_model_version") - prop.value = SDNC_TEMPLATE_VERSION - prop = component.get_property("sdnc_artifact_name") - prop.value = SDNC_ARTIFACT_NAME - prop = component.get_property("sdnc_model_name") - prop.value = SDNC_TEMPLATE_NAME - prop = component.get_property("controller_actor") - prop.value = "CDS" - prop = component.get_property("skip_post_instantiation_configuration") - prop.value = False - - logger.info("******** Onboard Service *******") - svc.checkin() - svc.onboard() - - logger.info("******** Check Service Distribution *******") - distribution_completed = False - nb_try = 0 - nb_try_max = 10 - while distribution_completed is False and nb_try < nb_try_max: - distribution_completed = svc.distributed - if distribution_completed is True: - logger.info("Service Distribution for %s is sucessfully finished",svc.name) - break - logger.info("Service Distribution for %s ongoing, Wait for 60 s",svc.name) - time.sleep(60) - nb_try += 1 - - if distribution_completed is False: - logger.error("Service Distribution for %s failed !!",svc.name) - exit(1) - - logger.info("*******************************") - logger.info("***** RUNTIME PREPARATION *****") - logger.info("*******************************") - - logger.info("******** Create Complex *******") - cmplx = Complex.create( - physical_location_id=COMPLEX_PHYSICAL_LOCATION_ID, - data_center_code=COMPLEX_DATA_CENTER_CODE, - name=COMPLEX_PHYSICAL_LOCATION_ID - ) - - logger.info("******** Create CloudRegion *******") - cloud_region = CloudRegion.create( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION, - orchestration_disabled=False, - in_maint=False, - cloud_type=CLOUD_TYPE, - cloud_zone="z1", - complex_name=COMPLEX_PHYSICAL_LOCATION_ID, - sriov_automation=False, - owner_defined_type="t1", - cloud_region_version=CLOUD_VERSION - ) - - logger.info("******** Link Complex to CloudRegion *******") - cloud_region.link_to_complex(cmplx) - - logger.info("******** Add ESR Info to CloudRegion *******") - cloud_region.add_esr_system_info( - esr_system_info_id=str(uuid4()), - user_name=VIM_USERNAME, - password=VIM_PASSWORD, - system_type="VIM", - service_url=VIM_SERVICE_URL, - cloud_domain="Default", - ssl_insecure=False, - system_status="active", - default_tenant=TENANT_NAME - ) - - logger.info("******** Register CloudRegion to MultiCloud *******") - cloud_region.register_to_multicloud() - - logger.info("******** Check MultiCloud Registration *******") - time.sleep(60) - tenant_found = False - availability_zone_found = False - registration_completed = False - nb_try = 0 - nb_try_max = 10 - while registration_completed is False and nb_try < nb_try_max: - for tenant in cloud_region.tenants: - logger.debug("Tenant %s found in %s_%s",tenant.name,cloud_region.cloud_owner,cloud_region.cloud_region_id) - tenant_found = True - for az in cloud_region.availability_zones: - logger.debug("A-Zone %s found",az.name) - availability_zone_found = True - if availability_zone_found and tenant_found: - registration_completed = True - if registration_completed is False: - time.sleep(60) - nb_try += 1 - - if registration_completed is False: - logger.error("Registration of Cloud %s_%s failed !!",cloud_region.cloud_owner,cloud_region.cloud_region_id) - exit(1) - else: - logger.info("Registration of Cloud %s_%s successful !!",cloud_region.cloud_owner,cloud_region.cloud_region_id) - - logger.info("*******************************") - logger.info("**** SERVICE INSTANTIATION ****") - logger.info("*******************************") - - logger.info("******** Create Customer *******") - customer = None - for found_customer in list(Customer.get_all()): - logger.debug("Customer %s found", found_customer.subscriber_name) - if found_customer.subscriber_name == GLOBAL_CUSTOMER_ID: - logger.info("Customer %s found", found_customer.subscriber_name) - customer = found_customer - break - if not customer: - customer = Customer.create(GLOBAL_CUSTOMER_ID,GLOBAL_CUSTOMER_ID, "INFRA") - - logger.info("******** Find Service in SDC *******") - service = None - services = Service.get_all() - for found_service in services: - logger.debug("Service %s is found, distribution %s",found_service.name, found_service.distribution_status) - if found_service.name == SERVICENAME: - logger.info("Found Service %s in SDC",found_service.name) - service = found_service - break - - if not service: - logger.error("Service %s not found in SDC",SERVICENAME) - exit(1) - - logger.info("******** Check Service Subscription *******") - service_subscription = None - for service_sub in customer.service_subscriptions: - logger.debug("Service subscription %s is found",service_sub.service_type) - if service_sub.service_type == SERVICENAME: - logger.info("Service %s subscribed",SERVICENAME) - service_subscription = service_sub - break - - if not service_subscription: - logger.info("******** Subscribe Service *******") - customer.subscribe_service(SERVICENAME) - - logger.info("******** Get Tenant *******") - cloud_region = CloudRegion(cloud_owner=CLOUD_OWNER, cloud_region_id=CLOUD_REGION, - orchestration_disabled=True, in_maint=False) - tenant = None - for found_tenant in cloud_region.tenants: - logger.debug("Tenant %s found in %s_%s",found_tenant.name,cloud_region.cloud_owner,cloud_region.cloud_region_id) - if found_tenant.name == TENANT_NAME: - logger.info("Found my Tenant %s",found_tenant.name) - tenant = found_tenant - break - - if not tenant: - logger.error("tenant %s not found",TENANT_NAME) - exit(1) - - logger.info("******** Connect Service to Tenant *******") - service_subscription = None - for service_sub in customer.service_subscriptions: - logger.debug("Service subscription %s is found",service_sub.service_type) - if service_sub.service_type == SERVICENAME: - logger.info("Service %s subscribed",SERVICENAME) - service_subscription = service_sub - break - - if not service_subscription: - logger.error("Service subscription %s is not found",SERVICENAME) - exit(1) - - service_subscription.link_to_cloud_region_and_tenant(cloud_region, tenant) - - logger.info("******** Add Business Objects (OE, P, Pl, LoB) in VID *******") - vid_owning_entity = OwningEntity.create(OWNING_ENTITY) - vid_project = Project.create(PROJECT) - vid_platform = Platform.create(PLATFORM) - vid_line_of_business = LineOfBusiness.create(LINE_OF_BUSINESS) - - logger.info("******** Add Owning Entity in AAI *******") - owning_entity = None - for oe in AaiOwningEntity.get_all(): - if oe.name == vid_owning_entity.name: - owning_entity = oe - break - if not owning_entity: - logger.info("******** Owning Entity not existing: create *******") - owning_entity = AaiOwningEntity.create(vid_owning_entity.name, str(uuid4())) - - ########################################################################### - ######## VFModule parameters ############################################## - ########################################################################### - vfm_base=[ - InstantiationParameter(name="sec_group", value=TENANT_SEC_GROUP), - InstantiationParameter(name="public_net_id", value=PUBLIC_NET) - ] - - vfm_vsn=[ - InstantiationParameter(name="sec_group", value=TENANT_SEC_GROUP), - InstantiationParameter(name="public_net_id", value=PUBLIC_NET) - ] - - vfm_vfw=[ - InstantiationParameter(name="sec_group", value=TENANT_SEC_GROUP), - InstantiationParameter(name="public_net_id", value=PUBLIC_NET) - ] - - vfm_vpkg=[ - InstantiationParameter(name="sec_group", value=TENANT_SEC_GROUP), - InstantiationParameter(name="public_net_id", value=PUBLIC_NET) - ] - - base_paras=VfmoduleParameters("base_template",vfm_base) - vpkg_paras=VfmoduleParameters("vpkg",vfm_vpkg) - vsn_paras=VfmoduleParameters("vsn",vfm_vsn) - vfw_paras=VfmoduleParameters("vfw",vfm_vfw) - - ########################################################################### - ######## VNF parameters ################################################### - ########################################################################### - - vnf_vfw=[ - InstantiationParameter(name="onap_private_net_id", value=ONAP_PRIVATE_NET), - InstantiationParameter(name="onap_private_subnet_id", value=ONAP_PRIVATE_SUBNET), - InstantiationParameter(name="pub_key", value="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFBOB1Ea2yej68aqIQw10kEsVf+rNoxT39qrV8JvvTK2yhkniQka1t2oD9h6DlXOLM3HJ6nBegWjOasJmIbminKZ6wvmxZrDVFJXp9Sn1gni0vtEnlDgH14shRUrFDYO0PYjXRHoj7QXZMYxtAdFSbzGuCsaTLcV/xchLBQmqZ4AGhMIiYMfJJF+Ygy0lbgcVmT+8DH7kUUt8SAdh2rRsYFwpKANnQJyPV1dBNuTcD0OW1hEOhXnwqH28tjfb7uHJzTyGZlTmwTs544teTNz5B9L4yT3XiCAlMcaLOBMfBTKRIse+NkiTb+tc60JNnEYR6MqZoqTea/w+YBQaIMcil"), - InstantiationParameter(name="image_name", value=IMAGE_NAME), - InstantiationParameter(name="flavor_name", value=FLAVOR_NAME), - InstantiationParameter(name="sec_group", value=TENANT_SEC_GROUP), - InstantiationParameter(name="install_script_version", value="1.4.0-SNAPSHOT"), - InstantiationParameter(name="demo_artifacts_version", value="1.4.0-SNAPSHOT"), - InstantiationParameter(name="cloud_env", value=CLOUD_TYPE), - InstantiationParameter(name="public_net_id", value=PUBLIC_NET), - InstantiationParameter(name="aic-cloud-region", value=CLOUD_REGION) - ] - - vnf_paras=VnfParameters("vfwcds_VF", vnf_vfw, - [base_paras, vpkg_paras, vsn_paras, vfw_paras]) - - # You must define for each VNF and its vFModule the parameters, - # otherwise they stay empty. - # The matching critera are: - # - VnfParameters.name must match VNF ModelInstanceName - # (see above "vfwcds_VF") - # - VfmoduleParameters.name must match substring in vfModule "instanceName" - # (e.g. "vfwcds_vf0..VfwcdsVf..vsn..module-1") - logger.info("******** Instantiate Service *******") - - service_instantiation = ServiceInstantiation.instantiate_macro( - service, - cloud_region, - tenant, - customer, - owning_entity, - vid_project, - vid_line_of_business, - vid_platform, - service_instance_name=SERVICE_INSTANCE_NAME, - vnf_parameters=[vnf_paras] - ) - - if service_instantiation.wait_for_finish(): - logger.info("Success") - else: - logger.error("Instantiation failed, check logs") - exit(1) - - service_instance = None - for se in service_subscription.service_instances: - if se.instance_name == SERVICE_INSTANCE_NAME: - service_instance = se - break - if not service_instance: - logger.error("******** Service %s instantiation failed",SERVICE_INSTANCE_NAME) - exit(1) - - if SERVICE_DELETION is False: - logger.info("*****************************************") - logger.info("**** No Deletion requested, finished ****") - logger.info("*****************************************") - exit(0) - - logger.info("*******************************") - logger.info("**** SERVICE DELETION *********") - logger.info("*******************************") - time.sleep(30) - - logger.info("******** Delete Service %s *******",service_instance.name) - service_deletion = service_instance.delete() - - nb_try = 0 - nb_try_max = 30 - while not service_deletion.finished and nb_try < nb_try_max: - logger.info("Wait for Service deletion") - nb_try += 1 - time.sleep(10) - if service_deletion.finished: - logger.info("Service %s deleted",service_instance.name) - else: - logger.error("Service deletion %s failed",service_instance.name) - exit(1) - diff --git a/docs/examples/examples.rst b/docs/examples/examples.rst deleted file mode 100644 index f6a43e3..0000000 --- a/docs/examples/examples.rst +++ /dev/null @@ -1,13 +0,0 @@ -Real life script examples -######################### - -.. toctree:: - :maxdepth: 4 - - e2e_vfw_instantiation - e2e_closed_loop_instantiation - e2e_vfw_macro_instantiation - e2e_net_instantiation - e2e_artifact_upload - e2e_basicvm_nomulticloud_instantiation - k8s_plugin_usage diff --git a/docs/examples/k8s_plugin_usage.rst b/docs/examples/k8s_plugin_usage.rst deleted file mode 100644 index 562dd92..0000000 --- a/docs/examples/k8s_plugin_usage.rst +++ /dev/null @@ -1,94 +0,0 @@ -E2E msb k8s plugin usage -######################## - - -.. code:: Python - - import logging - import os - - from onapsdk.msb.k8s import ( - Definition, - Instance, - ConnectivityInfo) - - logger = logging.getLogger("") - logger.setLevel(logging.DEBUG) - fh = logging.StreamHandler() - fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s') - fh.setFormatter(fh_formatter) - logger.addHandler(fh) - - RB_NAME = "test_definition" - RB_VERSION = "ver_1" - DEFINITION_ARTIFACT_PATH = "artifacts\\vault-consul-dev.tar.gz" # FILL ME - PROFILE_NAME = "test-profile" - PROFILE_NAMESPACE = "test" - PROFILE_K8S_VERSION = "1.0" - PROFILE_ARTIFACT_PATH = "artifacts\\profile.tar.gz" # FILL ME - CLOUD_REGION_ID = "k8s_region_test" # FILL ME - CLOUD_OWNER = "CloudOwner" - KUBECONFIG_PATH = "artifacts\\kubeconfig" # FILL ME - MYPATH = os.path.dirname(os.path.realpath(__file__)) - - ######## Create new Definition ############################################ - definition = Definition.create(RB_NAME, RB_VERSION) - - ######## Upload artifact for created definition ########################### - definition_artifact_file = os.path.join(MYPATH, DEFINITION_ARTIFACT_PATH) - definition.upload_artifact(open(definition_artifact_file, 'rb').read()) - - ######## Get one Definition ############################################### - check_definition = Definition.get_definition_by_name_version(RB_NAME, - RB_VERSION) - - ######## Get all Definitions ############################################## - definitions = list(Definition.get_all()) - - ######## Create profile for Definition #################################### - profile = definition.create_profile(PROFILE_NAME, - PROFILE_NAMESPACE, - PROFILE_K8S_VERSION) - - ######## Upload artifact for created profile ############################## - profile_artifact_file = os.path.join(MYPATH, PROFILE_ARTIFACT_PATH) - profile.upload_artifact(open(profile_artifact_file, 'rb').read()) - - ######## Get one Profile ################################################## - check_profile = definition.get_profile_by_name(PROFILE_NAME) - - ######## Get all Profiles ################################################# - profiles = list(definition.get_all_profiles()) - - ######## Create Connectivity Info ######################################### - kubeconfig_file = os.path.join(MYPATH, KUBECONFIG_PATH) - conninfo = ConnectivityInfo.create(CLOUD_REGION_ID, - CLOUD_OWNER, - open(kubeconfig_file, 'rb').read()) - - ######## Instantiate Profile ############################################## - instance = Instance.create(CLOUD_REGION_ID, - profile.profile_name, - definition.rb_name, - definition.rb_version) - - ######## Get Instance by ID ############################################### - check_instance = Instance.get_by_id(instance.instance_id) - - ######## Get all Instances ################################################ - instances = list(Instance.get_all()) - - ######## Delete Instance ################################################## - instance.delete() - - ######## Check instance deletion ########################################## - instances = list(Instance.get_all()) - - ######## Delete Connectivity Info ######################################### - conninfo.delete() - - ######## Delete Profile ################################################### - profile.delete() - - ######## Delete Definition ################################################ - definition.delete()
\ No newline at end of file diff --git a/docs/glossary.rst b/docs/glossary.rst deleted file mode 100644 index 2c95539..0000000 --- a/docs/glossary.rst +++ /dev/null @@ -1,20 +0,0 @@ -.. _glossary: - -Glossary -======== - -.. glossary:: - - Vendor - a vendor is the entity that provides the network function. - - VSP (Vendor Software Product) - a VSP is the package of the network function seen from ONAP Designer - - VF (Virtual Function) - a VF is the virtual function using the VSP. The VF will be used by - services. - - Service - a service is the model that can be instantiated. it's composed of one (or - several) Functions (VF or PNF). diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index a878cb8..0000000 --- a/docs/index.rst +++ /dev/null @@ -1,34 +0,0 @@ -.. _contents: - -ONAP SDK Documentation contents -=============================== - -.. toctree:: - :maxdepth: 2 - - description - usage/intro - usage/installation - usage/usage - examples/examples - development - - architecture - modules/modules - -.. include:: description.rst - -Indices and tables -================== - -.. only:: builder_html - - * :ref:`genindex` - * :ref:`modindex` - * :ref:`search` - * :ref:`glossary` - -.. only:: not builder_html - - * :ref:`modindex` - * :ref:`glossary` diff --git a/docs/modules/modules.rst b/docs/modules/modules.rst deleted file mode 100644 index e66ce77..0000000 --- a/docs/modules/modules.rst +++ /dev/null @@ -1,7 +0,0 @@ -onapsdk -======= - -.. toctree:: - :maxdepth: 4 - - onapsdk diff --git a/docs/modules/onapsdk.aai.business.rst b/docs/modules/onapsdk.aai.business.rst deleted file mode 100644 index 1bec9ac..0000000 --- a/docs/modules/onapsdk.aai.business.rst +++ /dev/null @@ -1,109 +0,0 @@ -onapsdk.aai.business package -============================ - -Submodules ----------- - -onapsdk.aai.business.customer module ------------------------------------- - -.. automodule:: onapsdk.aai.business.customer - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.business.instance module ------------------------------------- - -.. automodule:: onapsdk.aai.business.instance - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.business.line\_of\_business module ----------------------------------------------- - -.. automodule:: onapsdk.aai.business.line_of_business - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.business.network module ------------------------------------ - -.. automodule:: onapsdk.aai.business.network - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.business.owning\_entity module ------------------------------------------- - -.. automodule:: onapsdk.aai.business.owning_entity - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.business.platform module ------------------------------------- - -.. automodule:: onapsdk.aai.business.platform - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.business.pnf module -------------------------------- - -.. automodule:: onapsdk.aai.business.pnf - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.business.project module ------------------------------------ - -.. automodule:: onapsdk.aai.business.project - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.business.service module ------------------------------------ - -.. automodule:: onapsdk.aai.business.service - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.business.sp\_partner module ---------------------------------------- - -.. automodule:: onapsdk.aai.business.sp_partner - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.business.vf\_module module --------------------------------------- - -.. automodule:: onapsdk.aai.business.vf_module - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.business.vnf module -------------------------------- - -.. automodule:: onapsdk.aai.business.vnf - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.aai.business - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.aai.cloud_infrastructure.rst b/docs/modules/onapsdk.aai.cloud_infrastructure.rst deleted file mode 100644 index 307676b..0000000 --- a/docs/modules/onapsdk.aai.cloud_infrastructure.rst +++ /dev/null @@ -1,37 +0,0 @@ -onapsdk.aai.cloud\_infrastructure package -========================================= - -Submodules ----------- - -onapsdk.aai.cloud\_infrastructure.cloud\_region module ------------------------------------------------------- - -.. automodule:: onapsdk.aai.cloud_infrastructure.cloud_region - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.cloud\_infrastructure.complex module ------------------------------------------------- - -.. automodule:: onapsdk.aai.cloud_infrastructure.complex - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.cloud\_infrastructure.tenant module ------------------------------------------------ - -.. automodule:: onapsdk.aai.cloud_infrastructure.tenant - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.aai.cloud_infrastructure - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.aai.rst b/docs/modules/onapsdk.aai.rst deleted file mode 100644 index 161e291..0000000 --- a/docs/modules/onapsdk.aai.rst +++ /dev/null @@ -1,46 +0,0 @@ -onapsdk.aai package -=================== - -Subpackages ------------ - -.. toctree:: - :maxdepth: 4 - - onapsdk.aai.business - onapsdk.aai.cloud_infrastructure - -Submodules ----------- - -onapsdk.aai.aai\_element module -------------------------------- - -.. automodule:: onapsdk.aai.aai_element - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.bulk module ------------------------ - -.. automodule:: onapsdk.aai.bulk - :members: - :undoc-members: - :show-inheritance: - -onapsdk.aai.service\_design\_and\_creation module -------------------------------------------------- - -.. automodule:: onapsdk.aai.service_design_and_creation - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.aai - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.cds.rst b/docs/modules/onapsdk.cds.rst deleted file mode 100644 index c0b8d51..0000000 --- a/docs/modules/onapsdk.cds.rst +++ /dev/null @@ -1,53 +0,0 @@ -onapsdk.cds package -=================== - -Submodules ----------- - -onapsdk.cds.blueprint module ----------------------------- - -.. automodule:: onapsdk.cds.blueprint - :members: - :undoc-members: - :show-inheritance: - -onapsdk.cds.blueprint\_model module ------------------------------------ - -.. automodule:: onapsdk.cds.blueprint_model - :members: - :undoc-members: - :show-inheritance: - -onapsdk.cds.blueprint\_processor module ---------------------------------------- - -.. automodule:: onapsdk.cds.blueprint_processor - :members: - :undoc-members: - :show-inheritance: - -onapsdk.cds.cds\_element module -------------------------------- - -.. automodule:: onapsdk.cds.cds_element - :members: - :undoc-members: - :show-inheritance: - -onapsdk.cds.data\_dictionary module ------------------------------------ - -.. automodule:: onapsdk.cds.data_dictionary - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.cds - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.clamp.rst b/docs/modules/onapsdk.clamp.rst deleted file mode 100644 index 65d9888..0000000 --- a/docs/modules/onapsdk.clamp.rst +++ /dev/null @@ -1,29 +0,0 @@ -onapsdk.clamp package -===================== - -Submodules ----------- - -onapsdk.clamp.clamp\_element module ------------------------------------ - -.. automodule:: onapsdk.clamp.clamp_element - :members: - :undoc-members: - :show-inheritance: - -onapsdk.clamp.loop\_instance module ------------------------------------ - -.. automodule:: onapsdk.clamp.loop_instance - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.clamp - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.configuration.rst b/docs/modules/onapsdk.configuration.rst deleted file mode 100644 index 4833ad3..0000000 --- a/docs/modules/onapsdk.configuration.rst +++ /dev/null @@ -1,29 +0,0 @@ -onapsdk.configuration package -============================= - -Submodules ----------- - -onapsdk.configuration.global\_settings module ---------------------------------------------- - -.. automodule:: onapsdk.configuration.global_settings - :members: - :undoc-members: - :show-inheritance: - -onapsdk.configuration.loader module ------------------------------------ - -.. automodule:: onapsdk.configuration.loader - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.configuration - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.cps.rst b/docs/modules/onapsdk.cps.rst deleted file mode 100644 index a65d0d4..0000000 --- a/docs/modules/onapsdk.cps.rst +++ /dev/null @@ -1,45 +0,0 @@ -onapsdk.cps package -=================== - -Submodules ----------- - -onapsdk.cps.anchor module -------------------------- - -.. automodule:: onapsdk.cps.anchor - :members: - :undoc-members: - :show-inheritance: - -onapsdk.cps.cps\_element module -------------------------------- - -.. automodule:: onapsdk.cps.cps_element - :members: - :undoc-members: - :show-inheritance: - -onapsdk.cps.dataspace module ----------------------------- - -.. automodule:: onapsdk.cps.dataspace - :members: - :undoc-members: - :show-inheritance: - -onapsdk.cps.schemaset module ----------------------------- - -.. automodule:: onapsdk.cps.schemaset - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.cps - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.dmaap.rst b/docs/modules/onapsdk.dmaap.rst deleted file mode 100644 index dc17d2e..0000000 --- a/docs/modules/onapsdk.dmaap.rst +++ /dev/null @@ -1,29 +0,0 @@ -onapsdk.dmaap package -===================== - -Submodules ----------- - -onapsdk.dmaap.dmaap module --------------------------- - -.. automodule:: onapsdk.dmaap.dmaap - :members: - :undoc-members: - :show-inheritance: - -onapsdk.dmaap.dmaap\_service module ------------------------------------ - -.. automodule:: onapsdk.dmaap.dmaap_service - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.dmaap - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.msb.k8s.rst b/docs/modules/onapsdk.msb.k8s.rst deleted file mode 100644 index aaba76a..0000000 --- a/docs/modules/onapsdk.msb.k8s.rst +++ /dev/null @@ -1,37 +0,0 @@ -onapsdk.msb.k8s package -======================= - -Submodules ----------- - -onapsdk.msb.k8s.connectivity\_info module ------------------------------------------ - -.. automodule:: onapsdk.msb.k8s.connectivity_info - :members: - :undoc-members: - :show-inheritance: - -onapsdk.msb.k8s.definition module ---------------------------------- - -.. automodule:: onapsdk.msb.k8s.definition - :members: - :undoc-members: - :show-inheritance: - -onapsdk.msb.k8s.instance module -------------------------------- - -.. automodule:: onapsdk.msb.k8s.instance - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.msb.k8s - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.msb.rst b/docs/modules/onapsdk.msb.rst deleted file mode 100644 index eeea5b7..0000000 --- a/docs/modules/onapsdk.msb.rst +++ /dev/null @@ -1,45 +0,0 @@ -onapsdk.msb package -=================== - -Subpackages ------------ - -.. toctree:: - :maxdepth: 4 - - onapsdk.msb.k8s - -Submodules ----------- - -onapsdk.msb.esr module ----------------------- - -.. automodule:: onapsdk.msb.esr - :members: - :undoc-members: - :show-inheritance: - -onapsdk.msb.msb\_service module -------------------------------- - -.. automodule:: onapsdk.msb.msb_service - :members: - :undoc-members: - :show-inheritance: - -onapsdk.msb.multicloud module ------------------------------ - -.. automodule:: onapsdk.msb.multicloud - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.msb - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.nbi.rst b/docs/modules/onapsdk.nbi.rst deleted file mode 100644 index b0a68b5..0000000 --- a/docs/modules/onapsdk.nbi.rst +++ /dev/null @@ -1,21 +0,0 @@ -onapsdk.nbi package -=================== - -Submodules ----------- - -onapsdk.nbi.nbi module ----------------------- - -.. automodule:: onapsdk.nbi.nbi - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.nbi - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.rst b/docs/modules/onapsdk.rst deleted file mode 100644 index 77e5575..0000000 --- a/docs/modules/onapsdk.rst +++ /dev/null @@ -1,65 +0,0 @@ -onapsdk package -=============== - -Subpackages ------------ - -.. toctree:: - :maxdepth: 4 - - onapsdk.aai - onapsdk.cds - onapsdk.clamp - onapsdk.configuration - onapsdk.dmaap - onapsdk.msb - onapsdk.nbi - onapsdk.sdc - onapsdk.sdnc - onapsdk.so - onapsdk.utils - onapsdk.ves - onapsdk.vid - -Submodules ----------- - -onapsdk.constants module ------------------------- - -.. automodule:: onapsdk.constants - :members: - :undoc-members: - :show-inheritance: - -onapsdk.exceptions module -------------------------- - -.. automodule:: onapsdk.exceptions - :members: - :undoc-members: - :show-inheritance: - -onapsdk.onap\_service module ----------------------------- - -.. automodule:: onapsdk.onap_service - :members: - :undoc-members: - :show-inheritance: - -onapsdk.version module ----------------------- - -.. automodule:: onapsdk.version - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.sdc.rst b/docs/modules/onapsdk.sdc.rst deleted file mode 100644 index 5ba5ec3..0000000 --- a/docs/modules/onapsdk.sdc.rst +++ /dev/null @@ -1,101 +0,0 @@ -onapsdk.sdc package -=================== - -Submodules ----------- - -onapsdk.sdc.category\_management module ---------------------------------------- - -.. automodule:: onapsdk.sdc.category_management - :members: - :undoc-members: - :show-inheritance: - -onapsdk.sdc.component module ----------------------------- - -.. automodule:: onapsdk.sdc.component - :members: - :undoc-members: - :show-inheritance: - -onapsdk.sdc.pnf module ----------------------- - -.. automodule:: onapsdk.sdc.pnf - :members: - :undoc-members: - :show-inheritance: - -onapsdk.sdc.properties module ------------------------------ - -.. automodule:: onapsdk.sdc.properties - :members: - :undoc-members: - :show-inheritance: - -onapsdk.sdc.sdc\_element module -------------------------------- - -.. automodule:: onapsdk.sdc.sdc_element - :members: - :undoc-members: - :show-inheritance: - -onapsdk.sdc.sdc\_resource module --------------------------------- - -.. automodule:: onapsdk.sdc.sdc_resource - :members: - :undoc-members: - :show-inheritance: - -onapsdk.sdc.service module --------------------------- - -.. automodule:: onapsdk.sdc.service - :members: - :undoc-members: - :show-inheritance: - -onapsdk.sdc.vendor module -------------------------- - -.. automodule:: onapsdk.sdc.vendor - :members: - :undoc-members: - :show-inheritance: - -onapsdk.sdc.vf module ---------------------- - -.. automodule:: onapsdk.sdc.vf - :members: - :undoc-members: - :show-inheritance: - -onapsdk.sdc.vl module ---------------------- - -.. automodule:: onapsdk.sdc.vl - :members: - :undoc-members: - :show-inheritance: - -onapsdk.sdc.vsp module ----------------------- - -.. automodule:: onapsdk.sdc.vsp - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.sdc - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.sdnc.rst b/docs/modules/onapsdk.sdnc.rst deleted file mode 100644 index 2a87163..0000000 --- a/docs/modules/onapsdk.sdnc.rst +++ /dev/null @@ -1,29 +0,0 @@ -onapsdk.sdnc package -==================== - -Submodules ----------- - -onapsdk.sdnc.preload module ---------------------------- - -.. automodule:: onapsdk.sdnc.preload - :members: - :undoc-members: - :show-inheritance: - -onapsdk.sdnc.sdnc\_element module ---------------------------------- - -.. automodule:: onapsdk.sdnc.sdnc_element - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.sdnc - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.so.rst b/docs/modules/onapsdk.so.rst deleted file mode 100644 index eae1eda..0000000 --- a/docs/modules/onapsdk.so.rst +++ /dev/null @@ -1,45 +0,0 @@ -onapsdk.so package -================== - -Submodules ----------- - -onapsdk.so.deletion module --------------------------- - -.. automodule:: onapsdk.so.deletion - :members: - :undoc-members: - :show-inheritance: - -onapsdk.so.instantiation module -------------------------------- - -.. automodule:: onapsdk.so.instantiation - :members: - :undoc-members: - :show-inheritance: - -onapsdk.so.so\_db\_adapter module ---------------------------------- - -.. automodule:: onapsdk.so.so_db_adapter - :members: - :undoc-members: - :show-inheritance: - -onapsdk.so.so\_element module ------------------------------ - -.. automodule:: onapsdk.so.so_element - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.so - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.utils.rst b/docs/modules/onapsdk.utils.rst deleted file mode 100644 index cbb4c73..0000000 --- a/docs/modules/onapsdk.utils.rst +++ /dev/null @@ -1,53 +0,0 @@ -onapsdk.utils package -===================== - -Submodules ----------- - -onapsdk.utils.configuration module ----------------------------------- - -.. automodule:: onapsdk.utils.configuration - :members: - :undoc-members: - :show-inheritance: - -onapsdk.utils.headers\_creator module -------------------------------------- - -.. automodule:: onapsdk.utils.headers_creator - :members: - :undoc-members: - :show-inheritance: - -onapsdk.utils.jinja module --------------------------- - -.. automodule:: onapsdk.utils.jinja - :members: - :undoc-members: - :show-inheritance: - -onapsdk.utils.mixins module ---------------------------- - -.. automodule:: onapsdk.utils.mixins - :members: - :undoc-members: - :show-inheritance: - -onapsdk.utils.tosca\_file\_handler module ------------------------------------------ - -.. automodule:: onapsdk.utils.tosca_file_handler - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.utils - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.ves.rst b/docs/modules/onapsdk.ves.rst deleted file mode 100644 index 51a4c6b..0000000 --- a/docs/modules/onapsdk.ves.rst +++ /dev/null @@ -1,29 +0,0 @@ -onapsdk.ves package -=================== - -Submodules ----------- - -onapsdk.ves.ves module ----------------------- - -.. automodule:: onapsdk.ves.ves - :members: - :undoc-members: - :show-inheritance: - -onapsdk.ves.ves\_service module -------------------------------- - -.. automodule:: onapsdk.ves.ves_service - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.ves - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/modules/onapsdk.vid.rst b/docs/modules/onapsdk.vid.rst deleted file mode 100644 index 36a6705..0000000 --- a/docs/modules/onapsdk.vid.rst +++ /dev/null @@ -1,21 +0,0 @@ -onapsdk.vid package -=================== - -Submodules ----------- - -onapsdk.vid.vid module ----------------------- - -.. automodule:: onapsdk.vid.vid - :members: - :undoc-members: - :show-inheritance: - -Module contents ---------------- - -.. automodule:: onapsdk.vid - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt deleted file mode 100644 index a064d33..0000000 --- a/docs/requirements-docs.txt +++ /dev/null @@ -1,8 +0,0 @@ -sphinx>=4.2.0 # BSD -sphinx-rtd-theme>=1.0.0 # MIT -sphinxcontrib-blockdiag # BSD -sphinxcontrib-seqdiag # BSD -sphinxcontrib-swaggerdoc -sphinxcontrib-spelling -sphinxcontrib-plantuml -sphinx-autodoc-typehints diff --git a/docs/tox.ini b/docs/tox.ini deleted file mode 100644 index 57ae89a..0000000 --- a/docs/tox.ini +++ /dev/null @@ -1,31 +0,0 @@ -[tox] -minversion = 1.6 -envlist = docs,docs-linkcheck,docs-spellcheck -skipsdist = true - -[testenv:docs] -basepython = python3.8 -deps = - -r{toxinidir}/requirements-docs.txt - -r{toxinidir}/../requirements.txt - -chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt?h=master -commands = - sphinx-build -q -b html -n -d {envtmpdir}/doctrees {toxinidir} {toxinidir}/_build/html - -[testenv:docs-linkcheck] -basepython = python3.8 -deps = - -r{toxinidir}/requirements-docs.txt - -r{toxinidir}/../requirements.txt - -chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt?h=master -commands = - sphinx-build -q -b linkcheck -d {envtmpdir}/doctrees {toxinidir} {toxinidir}/_build/linkcheck - -[testenv:docs-spellcheck] -basepython = python3.8 -deps = - -r{toxinidir}/requirements-docs.txt - -r{toxinidir}/../requirements.txt - -chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt?h=master -commands = - sphinx-build -q -b spelling -d {envtmpdir}/doctrees {toxinidir} {toxinidir}/_build/spellcheck diff --git a/docs/usage/installation.rst b/docs/usage/installation.rst deleted file mode 100644 index c324c96..0000000 --- a/docs/usage/installation.rst +++ /dev/null @@ -1,32 +0,0 @@ -Installation -############ - - - -Installing with pip --------------------- - -.. code:: shell - - $ pip install onapsdk - - -Customize the configuration ---------------------------- - -You can customize the global settings of onapsdk by creating an environment -variable ONAP_PYTHON_SDK_SETTINGS and a file my_settings.py. - -By default the global settings are retrieved from the file located in -src/onapsdk/configuration/global_settings.py. You can create your own customized -configuration file and reference it through the environement variable. -You can thus copy/paste the existing global_settings.py file, rename it as -my_settings.py, adapt it with your favorite editor and export the environnement -variable accordingly. - -It can be useful to move from a nodeport to an an ingress based configuration -or test different API versions. - - .. code:: shell - - $ export ONAP_PYTHON_SDK_SETTINGS="onapsdk.configuration.my_settings" diff --git a/docs/usage/intro.rst b/docs/usage/intro.rst deleted file mode 100644 index 7031c13..0000000 --- a/docs/usage/intro.rst +++ /dev/null @@ -1,16 +0,0 @@ -Introduction -############ - -It *should* be simple to use. -Once you have installed the Python module, few lines of code are needed to -onboard a Service: - -.. code:: Python - - from onapsdk.vf import Vf - from onapsdk.service import Service - - # We assume here that the VF has been already onboarded - vf = VF(name="myVF") - service = Service(name="myService", resources=[vf]) - service.onboard() diff --git a/docs/usage/usage.rst b/docs/usage/usage.rst deleted file mode 100644 index 4a1dc9d..0000000 --- a/docs/usage/usage.rst +++ /dev/null @@ -1,14 +0,0 @@ -Usage -##### - -A minimum knowledge of ONAP is needed, especially on the onboarding part. - -.. toctree:: - :maxdepth: 2 - - usage/cloud_configuration - usage/design_time - usage/instantiation - usage/deletion - usage/cds - usage/cps diff --git a/docs/usage/usage/cds.rst b/docs/usage/usage/cds.rst deleted file mode 100644 index 6128e60..0000000 --- a/docs/usage/usage/cds.rst +++ /dev/null @@ -1,173 +0,0 @@ -CDS -### - -Preparation for CDS tests -------------------------- - -To enable CDS Enrichment in an ONAP Frankfurt environment the NodePort 30449 -for the CDS Blueprint Processor API service needs to be opened - -#. Check existing CDS Services: - - .. code-block:: sh - - ubuntu@control01:~$ kubectl get service -n onap|grep cds-blueprints-processor-http - cds-blueprints-processor-http ClusterIP 10.43.101.198 <none> 8080/TCP - -#. Change NodePort to CDS cds-blueprints-processor-http - - Add the "nodePort" under "ports" section - and change "type" from "ClusterIP" to "NodePort" - - .. code-block:: sh - - ubuntu@control01:~$ kubectl edit service cds-blueprints-processor-http -n onap - - apiVersion: v1 - kind: Service - metadata: - creationTimestamp: "2020-07-23T02:57:36Z" - labels: - app: cds-blueprints-processor - chart: cds-blueprints-processor-6.0.0 - heritage: Tiller - release: onap - name: cds-blueprints-processor-http - namespace: onap - resourceVersion: "10256" - selfLink: /api/v1/namespaces/onap/services/cds-blueprints-processor-http - uid: 6f065c03-4563-4d64-b6f5-a8892226c909 - spec: - clusterIP: 10.43.101.198 - ports: - - name: blueprints-processor-http - nodePort: 30449 -> add line - port: 8080 - protocol: TCP - targetPort: 8080 - selector: - app: cds-blueprints-processor - release: onap - sessionAffinity: None - type: ClusterIP -> change to NodePort - status: - loadBalancer: {} - -#. Verify NodePort to CDS cds-blueprints-processor-http - - .. code-block:: sh - - ubuntu@control01:~$ kubectl get service -n onap|grep cds-blueprints-processor-http - cds-blueprints-processor-http NodePort 10.43.101.198 <none> 8080:30449/TCP - -#. Load ModelType via Bootstrap - - .. code-block:: sh - - curl --location --request POST 'http://<k8s-host>:30449/api/v1/blueprint-model/bootstrap' \ - --header 'Content-Type: application/json' \ - --header 'Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==' \ - --data-raw '{ - "loadModelType" : true, - "loadResourceDictionary" : false, - "loadCBA" : false - }' - - -Load blueprint from file ------------------------- - -.. code:: Python - - from onapsdk.cds import Blueprint - blueprint = Blueprint.load_from_file("<< path to CBA file >>") - -Enrich blueprint and save -------------------------- - -.. code:: Python - - enriched_blueprint = blueprint.enrich() - enriched_blueprint.save("<< path to dest file >>") - -Publish blueprint ------------------ - -.. code:: Python - - enriched_blueprint.publish() - -Generate data dictionary from blueprint ---------------------------------------- - -The method to generate data dictionaries based on the blueprint mappings. As the result it returns a data dictionaries set -with valid structure, but some additional actions may be needed. Data dictionary input has to be filled by the user -if the type is neither "source-input" nor "source-default". Things, which are needed to be filled are marked by `<< FILL >>` mark. -If the blueprint you are using has only "source-input" or "source-default" input types, the generated data dictionary set is -ready to upload to CDS. - -.. code:: Python - - generated_dd: DataDictionarySet = blueprint.get_data_dictionaries() - generated_dd.save_to_file("<< path to dest file >>") - -Load data dictionary set from file ----------------------------------- - -.. code:: Python - - from onapsdk.cds import DataDictionarySet - dd_set = DataDictionarySet.load_from_file("<< path to dd file >>") - -Upload data dictionary set --------------------------- - -.. code:: Python - - dd_set.upload() - -Retrieve Blueprint Models from CDS ----------------------------------- - -#. All - -.. code:: Python - - from onapsdk.cds import BlueprintModel - all_blueprint_models = BlueprintModel.get_all() - -#. Selected by id of Blueprint Model - -.. code:: Python - - blueprint_model = BlueprintModel.get_by_id(blueprint_model_id='11111111-1111-1111-1111-111111111111') - -#. Selected by name and version of Blueprint Model - -.. code:: Python - - blueprint_model = BlueprintModel.get_by_name_and_version(blueprint_name='test_name', blueprint_version='1.0.0') - -Delete Blueprint Model ----------------------- - -.. code:: Python - - blueprint_model.delete() - -Download Blueprint Model ------------------------- - -.. code:: Python - - blueprint_model.save(dst_file_path='/tmp/blueprint.zip') - - -Get Blueprint object for Blueprint Model ----------------------------------------- - -After that, all operation for blueprint object, like execute blueprint workflow etc. can be executed. - -.. code:: Python - - blueprint = blueprint_model.get_blueprint() diff --git a/docs/usage/usage/cloud_configuration.rst b/docs/usage/usage/cloud_configuration.rst deleted file mode 100644 index b048c0a..0000000 --- a/docs/usage/usage/cloud_configuration.rst +++ /dev/null @@ -1,210 +0,0 @@ -Cloud configuration -################### - -Create a complex ----------------- - -.. code:: Python - - from onapsdk.aai.cloud_infrastructure import Complex - cmplx = Complex.create( - physical_location_id=COMPLEX_PHYSICAL_LOCATION_ID, - data_center_code=COMPLEX_DATA_CENTER_CODE, - name=COMPLEX_PHYSICAL_LOCATION_ID - ) - -Create cloud region -------------------- - -.. code:: Python - - from onapsdk.aai.cloud_infrastructure import CloudRegion - cloud_region = CloudRegion.create( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION, - orchestration_disabled=False, - in_maint=False, - cloud_type=CLOUD_TYPE, - cloud_region_version=CLOUD_REGION_VERSION - ) - -Link cloud region to complex ----------------------------- - -.. code:: Python - - from onapsdk.aai.cloud_infrastructure import CloudRegion, Complex - # We assume that complex has been already created - cmplx = Complex( - physical_location_id=COMPLEX_PHYSICAL_LOCATION_ID, - name=COMPLEX_PHYSICAL_LOCATION_ID - ) - cloud_region = CloudRegion.create( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION, - orchestration_disabled=False, - in_maint=False, - cloud_type=CLOUD_TYPE, - cloud_region_version=CLOUD_REGION_VERSION - ) - cloud_region.link_to_complex(cmplx) - -Add ESR Info to cloud region ----------------------------- - -.. code:: Python - - from uuid import uuid4 - from onapsdk.aai.cloud_infrastructure import CloudRegion - # We assume that cloud region has been already created - cloud_region = CloudRegion.get_by_id( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION - ) - cloud_region.add_esr_system_info( - esr_system_info_id=str(uuid4()), - user_name=VIM_USERNAME, - password=VIM_PASSWORD, - system_type=CLOUD_TYPE, - service_url=VIM_SERVICE_URL, - cloud_domain=CLOUD_DOMAIN - ) - -Register cloud to MultiCloud ----------------------------- - -.. code:: Python - - from uuid import uuid4 - from onapsdk.aai.cloud_infrastructure import CloudRegion - # We assume that cloud region has been already created - cloud_region = CloudRegion.get_by_id( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION - ) - cloud_region.add_esr_system_info( - esr_system_info_id=str(uuid4()), - user_name=VIM_USERNAME, - password=VIM_PASSWORD, - system_type=CLOUD_TYPE, - service_url=VIM_SERVICE_URL, - cloud_domain=CLOUD_DOMAIN - ) - cloud_region.register_to_multicloud() - -Get cloud region tenant ------------------------ - -.. code:: Python - - # We assume that cloud region has been already created - # and connected to multicloud - from onapsdk.aai.cloud_infrastructure import CloudRegion - cloud_region = CloudRegion.get_by_id( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION - ) - try: - tenant = next(cloud_region.tenant) - except StopIteration - # No Tenant found in cloud region - -Create customer ---------------- - -.. code:: Python - - from onapsdk.aai.business import Customer - customer = Customer.create(GLOBAL_CUSTOMER_ID, GLOBAL_CUSTOMER_ID, "INFRA") - -Create customer service subscription ------------------------------------- - -.. code:: Python - - # We assume here that the service has been already onboarded - # and customer created - from onapsdk.aai.business import Customer - - customer = Customer.get_by_global_customer_id(GLOBAL_CUSTOMER_ID) - customer.subscribe_service("service_type") - - # Service subscriptions can be also created during Customer - # creation - from onapsdk.aai.business import Customer - - customer = Customer.create(GLOBAL_CUSTOMER_ID, GLOBAL_CUSTOMER_ID, "INFRA", service_subscriptions=["service_type"]) - -Connect service subscription to cloud region and tenant -------------------------------------------------------- - -.. code:: Python - - # We assume here that the service subscription has been already created - # and cloud region has a tenant - from onapsdk.aai.business import Customer - from onapsdk.aai.cloud_infrastructure import CloudRegion, Tenant - - customer = Customer.get_by_global_customer_id(GLOBAL_CUSTOMER_ID) - service_subscription = next(customer.service_subscriptions) - cloud_region = CloudRegion.get_by_id( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION - ) - tenant = next(cloud_region.tenants) - service_subscription.link_to_cloud_region_and_tenant(cloud_region, tenant) - -Add Cloud SIte entry to SO Catalog DB -------------------------------------------------------- - -.. code:: Python - - from onapsdk.so.so_db_adapter import IdentityService, SoDbAdapter - - identity_service = IdentityService(identity_id="mc_test_identity_1_KEYSTONE", - url="http://test:5000/v3", - mso_id="test_user", - mso_pass="test_password_encrypted", - roject_domain_name="Default", - user_domain_name="Default", - identity_server_type="KEYSTONE_V3") - response = SoDbAdapter.add_cloud_site(cloud_region_id="test_region_1", - complex_id="test_clli_1", - identity_service=identity_service, - orchestrator="NULL") - -Use A&AI bulk API (experimental) --------------------------------- - -.. code:: Python - - from onapsdk.aai.bulk import AaiBulk, AaiBulkRequest - from onapsdk.aai.cloud_infrastructure.cloud_region import CloudRegion - from onapsdk.utils.jinja import jinja_env - - - for resp in AaiBulk.single_transaction( - [ - AaiBulkRequest( - action="put", - uri=f"/cloud-infrastructure/cloud-regions/cloud-region/aai_bulk_test_cloud_owner_1/aai_bulk_test_cloud_region_id_1", - body=jinja_env().get_template("cloud_region_create.json.j2").render(cloud_region=CloudRegion( - cloud_owner="aai_bulk_test_cloud_owner_1", - cloud_region_id="aai_bulk_test_cloud_region_id_1", - orchestration_disabled=False, - in_maint=False - )) - ), - AaiBulkRequest( - action="put", - uri=f"/cloud-infrastructure/cloud-regions/cloud-region/aai_bulk_test_cloud_owner_2/aai_bulk_test_cloud_region_id_2", - body=jinja_env().get_template("cloud_region_create.json.j2").render(cloud_region=CloudRegion( - cloud_owner="aai_bulk_test_cloud_owner_2", - cloud_region_id="aai_bulk_test_cloud_region_id_2", - orchestration_disabled=False, - in_maint=False - )) - ) - ] - ): - print(resp) diff --git a/docs/usage/usage/cps.rst b/docs/usage/usage/cps.rst deleted file mode 100644 index 3124bcf..0000000 --- a/docs/usage/usage/cps.rst +++ /dev/null @@ -1,32 +0,0 @@ -CPS -### - -Create dataspace ----------------- - -.. code:: Python - - from onapsdk.cps import Dataspace - dataspace: Dataspace = Dataspace.create(dataspace_name="test_dataspace") - - -Create schema set ------------------ - -.. code:: Python - - from onapsdk.cps import Dataspace, SchemaSet - dataspace: Dataspace = Dataspace(name="test_dataspace") - with Path("schema_set_zip_file.zip").open("rb") as zip_file: - schema_set: SchemaSet = dataspace.create_schema_set("test_schemaset", zip_file) - - -Create anchor -------------- - -.. code:: Python - - from onapsdk.cps import Anchor, Dataspace, SchemaSet - dataspace: Dataspace = Dataspace(name="test_dataspace") - schema_set: SchemaSet = dataspace.get_schema_set("test_schemaset") - anchor: Anchor = dataspace.create_anchor(schema_set, "test_anchor") diff --git a/docs/usage/usage/deletion.rst b/docs/usage/usage/deletion.rst deleted file mode 100644 index c5e5025..0000000 --- a/docs/usage/usage/deletion.rst +++ /dev/null @@ -1,28 +0,0 @@ -Instantiated resources deletion -############################### - -Service, vnf and vf module deletion ------------------------------------ - -.. code:: Python - - from onapsdk.aai.business import Customer - - customer = Customer.get_by_global_customer_id(GLOBAL_CUSTOMER_ID) - service_subscription = next(customer.service_subscriptions) - service_instance = service_subscription.get_service_instance_by_name(SERVICE_INSTANCE_NAME) - for vnf_instance in service_instance.vnf_instances: - for vf_module_instance in vnf_instance.vf_modules: - vf_module_deletion_request = vf_module_instance.delete() - while not vf_module_deletion.finished: - time.sleep(10) - - vnf_instance_deletion_request = vnf_instance.delete() - while not vnf_instance_deletion_request.finished: - time.sleep(10) - - service_instance_deletion_request = service_instance.delete() - if service_instance_deletion_request.wait_for_finish(): - print("Service instance deleted") - else: - print("Service deletion failed, check logs" diff --git a/docs/usage/usage/design_time.rst b/docs/usage/usage/design_time.rst deleted file mode 100644 index 5990258..0000000 --- a/docs/usage/usage/design_time.rst +++ /dev/null @@ -1,351 +0,0 @@ -Design time -########### - -Onboard a Vendor ----------------- - -.. code:: Python - - from onapsdk.vendor import Vendor - vendor = Vendor(name="myVendor") - vendor.onboard() - -Onboard a VSP -------------- - -You will need the package of the VSP to onboard. - -.. code:: Python - - from onapsdk.sdc.vendor import Vendor - from onapsdk.sdc.vsp import Vsp - - # We assume here that the Vendor has been already onboarded - vendor = Vendor(name="myVendor") - vendor.onboard() - vsp = Vsp(name="myVSP", vendor=vendor, package=open(PATH_TO_PACKAGE, 'rb')) - vsp.onboard() - -Create new VSP version ----------------------- - -You will need the package of the VSP to update. - -.. code:: Python - - from onapsdk.sdc.vendor import Vendor - from onapsdk.sdc.vsp import Vsp - - # We assume here that the Vendor has been already onboarded - vsp = Vsp(name="myVSP") - vsp.create_new_version() - vsp.update_package(open(PATH_TO_PACKAGE, 'rb')) - vsp.onboard() - -Onboard a VF ------------- - -.. code:: Python - - from onapsdk.sdc.vsp import Vsp - from onapsdk.sdc.vf import Vf - - # We assume here that the VSP has been already onboarded - vsp = Vsp(name="myVSP") - vf = Vf(name="myVF", vsp=vsp) - vf.onboard() - -Onboard a VF with properties assignement ----------------------------------------- - -.. code:: Python - - from onapsdk.sdc.properties import Property - from onapsdk.sdc.vsp import Vsp - from onapsdk.sdc.vf import Vf - - # We assume here that the VSP has been already onboarded - vsp = Vsp(name="myVSP") - property_1 = Property( - name="prop1", - property_type="string", - value="test" - ) - property_2 = Property( - name="prop2", - property_type="integer" - ) - vf = Vf(name="myVF", - vsp=vsp, - properties=[ - property_1, - property_2 - ], - inputs=[property_1]) - vf.onboard() - -Onboard a VF with Deployment Artifact -------------------------------------- - -.. code:: Python - - from onapsdk.sdc.properties import Property - from onapsdk.sdc.vsp import Vsp - from onapsdk.sdc.vf import Vf - - logger.info("******** Onboard Vendor *******") - vendor = Vendor(name="my_Vendor") - vendor.onboard() - - # We assume here that the VSP has been already onboarded - vsp = Vsp(name="myVSP") - - logger.info("******** Onboard VF *******") - vf = Vf(name="myVF") - vf.vsp = vsp - vf.create() - - logger.info("******** Upload Artifact *******") - vf.add_deployment_artifact(artifact_type="CONTROLLER_BLUEPRINT_ARCHIVE", - artifact_name="CBA.zip", - artifact_label="vfwcds", - artifact="dir/CBA_enriched.zip") - - vf.onboard() - -Onboard a VF with it's component's property input -------------------------------------------------- - -.. code:: Python - - from onapsdk.sdc.properties import ComponentProperty - from onapsdk.sdc.vsp import Vsp - from onapsdk.sdc.vf import Vf - from onapsdk.sdc.vfc import Vfc - - # We assume here that the VSP has been already onboarded - vsp = Vsp(name="myVSP") - - vfc = Vfc(name="AllottedResource") - - logger.info("******** Onboard VF *******") - vf = Vf(name="myVF") - vf.vsp = vsp - vf.create() - vf.add_resource(vfc) - vfc_comp = vf.get_component(vfc) - comp_prop = vfc_comp.get_property("min_instances") - comp_prop.value = 11 - vf.declare_input(comp_prop) - - vf.onboard() - -Onboard a PNF with VSP ----------------------- -.. code:: Python - - from onapsdk.sdc.pnf import Pnf - from onapsdk.sdc.vendor import Vendor - - logger.info("******** Onboard Vendor *******") - vendor = Vendor(name="my_Vendor") - vendor.onboard() - - # We assume here that the VSP has been already onboarded - vsp = Vsp(name="myVSP") - - logger.info("******** Onboard PNF *******") - pnf = PNF(name="myPNF") - pnf.vsp = vsp - pnf.onboard() - -Onboard a PNF with Deployment Artifact (without VSP) ----------------------------------------------------- -.. code:: Python - - from onapsdk.sdc.vendor import Vendor - from onapsdk.sdc.pnf import Pnf - - logger.info("******** Onboard Vendor *******") - vendor = Vendor(name="my_Vendor") - vendor.onboard() - - logger.info("******** Onboard PNF *******") - pnf = Pnf(name=PNF, vendor=vendor) - pnf.create() - - logger.info("******** Upload Artifact *******") - pnf.add_deployment_artifact(artifact_type=ARTIFACT_TYPE, - artifact_name=ARTIFACT_NAME, - artifact_label=ARTIFACT_LABEL, - artifact=ARTIFACT_FILE_PATH) - pnf.onboard() - -Onboard a Service ------------------ - -.. code:: Python - - from onapsdk.sdc.vf import Vf - from onapsdk.sdc.service import Service - - # We assume here that the VF has been already onboarded - vf = Vf(name="myVF") - service = Service(name="myService", resources=[vf]) - service.onboard() - -Onboard a Service with properties assignement ---------------------------------------------- - -.. code:: Python - - from onapsdk.sdc.properties import Property - from onapsdk.sdc.vf import Vf - from onapsdk.sdc.service import Service - - # We assume here that the VF has been already onboarded - vf = Vf(name="myVF") - property_1 = Property( - name="prop1", - property_type="string", - value="test" - ) - property_2 = Property( - name="prop2", - property_type="integer", - declare_input=True - ) - service = Service(name="myService", - resources=[vf], - properties=[ - property_1, - property_2 - ], - inputs=[property_1]) - service.onboard() - -Onboard a Service with Nested inputs ------------------------------------- - -.. code:: Python - - from onapsdk.sdc.properties import NestedInput - from onapsdk.sdc.vf import Vf - from onapsdk.sdc.service import Service - - # We assume here that the VF has been already onboarded - vf = Vf(name="myVF") - inp = vf.get_input("input_name_we_want_to_declare_in_service") - service = Service(name="myService", - resources=[vf], - inputs=[NestedInput(vf, inp)]) - service.onboard() - -Onboard a Service with VL -------------------------- - -.. code:: Python - - from onapsdk.sdc.vl import VL - from onapsdk.sdc.service import Service - - # No VF needed, but you need to be sure that Vl with given - # name exists in SDC - vl = Vl(name="Generic NeutronNet") - service = Service(name="myServiceWithVl", resources=[vl]) - service.onboard() - -Onboard a Service with custom category --------------------------------------- - -.. code:: Python - - from onapsdk.sdc.category_management import ServiceCategory - from onapsdk.sdc.vf import Vf - from onapsdk.sdc.service import Service - - # Let's create a custom category - CATEGORY_NAME = "Python ONAP SDK category" - ServiceCategory.create(name=CATEGORY_NAME) - - # We assume here that the VF has been already onboarded - # Create a service with category we created few lines above - vf = Vf(name="myVF") - service = Service(name="myService", resources=[vf], category=CATEGORY_NAME) - service.onboard() - -Onboard an Artifact for an embedded VF --------------------------------------- - -All SDC artifact types are supported - -.. code:: Python - - from onapsdk.service import Service - - # We assume here that the Service has been already onboarded - # with a Vnf - service = Service(name="myService") - # We load artifact data - data = open("{}/myArtifact.yaml".format(os.path.dirname(os.path.abspath(__file__))), 'rb').read() - # We add the artifact to the service Vnf - # - svc.add_artifact_to_vf(vnf_name="myVnf", - artifact_type="DCAE_INVENTORY_BLUEPRINT", - artifact_name="myArtifact.yaml", - artifact=data) - -Onboard a Service with Deployment Artifact ------------------------------------------- - -.. code:: Python - - from onapsdk.sdc.service import Service - - svc = Service(name="myService") - - logger.info("******** Upload Artifact *******") - svc.add_deployment_artifact(artifact_type="OTHER", - artifact_name="eMBB.zip", - artifact_label="embbcn", - artifact="dir/eMBB.zip") - - svc.onboard() - -Onboard a Service with a CBA blueprint for Macro Instantiation --------------------------------------------------------------- - -.. code:: Python - - from onapsdk.sdc.service import Service, ServiceInstantiationType - - # Set CBA variables and artifact level - # Must match to values in the CBA TOSCA.meta file - SDNC_TEMPLATE_NAME = "vFW-CDS" - SDNC_TEMPLATE_VERSION = "1.0.0" - SDNC_ARTIFACT_NAME = "vnf" - - svc = Service(name="myService", - instantiation_type=ServiceInstantiationType.MACRO) - - svc.create() - - logger.info("*** add a VF, which includes a CBA blueprint ***") - svc.add_resource(vf) - - logger.info("******** Set SDNC properties for VF ********") - component = svc.get_component(vf) - prop = component.get_property("sdnc_model_version") - prop.value = SDNC_TEMPLATE_NAME - prop = component.get_property("sdnc_artifact_name") - prop.value = SDNC_ARTIFACT_NAME - prop = component.get_property("sdnc_model_name") - prop.value = SDNC_TEMPLATE_NAME - prop = component.get_property("controller_actor") - prop.value = "CDS" - prop = component.get_property("skip_post_instantiation_configuration") - prop.value = False - - logger.info("******** Onboard Service *******") - svc.checkin() - svc.onboard() diff --git a/docs/usage/usage/dmaap.rst b/docs/usage/usage/dmaap.rst deleted file mode 100644 index 2154bf4..0000000 --- a/docs/usage/usage/dmaap.rst +++ /dev/null @@ -1,47 +0,0 @@ -VES -### - -Preparation for DMAAP tests ---------------------------- - -#. Check existing DMaap Services: - - .. code-block:: sh - - kubectl get service -n onap| grep mess - message-router NodePort 10.43.30.205 <none> 3905:31163/TCP,3904:32404/TCP - -#. If the port of Ves Service is different than 3904 you can change it corresponding to the installation instruction. - - -Remove all events from DMaap ----------------------------- - -.. code:: Python - - from onapsdk.dmaap.dmaap import Dmaap - response = Dmaap.reset_events() - -Get all events from DMaap -------------------------- - -.. code:: Python - - from onapsdk.dmaap.dmaap import Dmaap - response = Dmaap.get_all_events() - -Get events from specific topic from DMaap ------------------------------------------ - -.. code:: Python - - from onapsdk.dmaap.dmaap import Dmaap - response = Dmaap.get_events_for_topic("fault") - -Get all topics from DMaap -------------------------- - -.. code:: Python - - from onapsdk.dmaap.dmaap import Dmaap - response = Dmaap.get_all_topics()
\ No newline at end of file diff --git a/docs/usage/usage/instantiation.rst b/docs/usage/usage/instantiation.rst deleted file mode 100644 index dac0500..0000000 --- a/docs/usage/usage/instantiation.rst +++ /dev/null @@ -1,485 +0,0 @@ -Instantiation -############# - -Create business objects ------------------------ - -.. code:: Python - - from onapsdk.vid import LineOfBusiness, OwningEntity, Platform, Project - - vid_owning_entity = OwningEntity.create(OWNING_ENTITY) - vid_project = Project.create(PROJECT) - vid_platform = Platform.create(PLATFORM) - vid_line_of_business = LineOfBusiness.create(LINE_OF_BUSINESS) - -Instantiate a service (ALaCarte) --------------------------------- - -.. code:: Python - - import time - from onapsdk.aai.cloud_infrastructure import CloudRegion, Tenant - from onapsdk.aai.business import Customer - from onapsdk.service import Service - from onapsdk.vid import LineOfBusiness, OwningEntity, Platform, Project - from onapsdk.so.instantiation import ServiceInstantiation - - # We assume that: - # - service is onboarded, - # - cloud region, customer, owning_entity and project have been already created, - # - cloud region has at least one tenant - # - customer has service subscription - # - service subscription is connected with cloud region and tenant - SERVICE_INSTANCE_NAME = "vFW-AlaCarte-1" - - service = Service(name="myService") - customer = Customer.get_by_global_customer_id(GLOBAL_CUSTOMER_ID) - cloud_region = CloudRegion.get_by_id( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION - ) - tenant = next(cloud_region.tenants) - vid_owning_entity = OwningEntity(OWNING_ENTITY) - owning_entity = AaiOwningEntity.get_by_owning_entity_name(OWNING_ENTITY) - vid_project = Project(PROJECT) - - service_instantiation = ServiceInstantiation.instantiate_so_ala_carte( - service, - cloud_region, - tenant, - customer, - owning_entity, - vid_project, - service_instance_name=SERVICE_INSTANCE_NAME - ) - service_instantiation.wait_for_finish(): - print("Success") - else: - print("Instantiation failed, check logs") - -Instantiate a service (Macro) ------------------------------ - -.. code:: Python - - import time - from onapsdk.aai.cloud_infrastructure import CloudRegion, Tenant - from onapsdk.aai.business import Customer - from onapsdk.service import Service - from onapsdk.vid import LineOfBusiness, OwningEntity, Platform, Project - from onapsdk.so.instantiation import ( - ServiceInstantiation, - VnfInstantiation, - InstantiationParameter, - VnfParameters, - VfmoduleParameters - ) - - ... - VSPNAME = "vfwcds_VS" - VFNAME = "vfwcds_VF" - ... - vf = Vf(name=VFNAME) - ... - - # We assume that: - # - service is onboarded, - # - cloud region, customer, owning_entity and project have been already created, - # - cloud region has at least one tenant - # - customer has service subscription - # - service subscription is connected with cloud region and tenant - SERVICE_INSTANCE_NAME = "vFW-Macro-1" - - service = Service(name="myMacroService") - customer = Customer.get_by_global_customer_id(GLOBAL_CUSTOMER_ID) - cloud_region = CloudRegion.get_by_id( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION - ) - tenant = next(cloud_region.tenants) - vid_owning_entity = OwningEntity(OWNING_ENTITY) - owning_entity = AaiOwningEntity.get_by_owning_entity_name(OWNING_ENTITY) - vid_project = Project(PROJECT) - - ########################################################################### - ######## VFModule parameters ############################################## - ########################################################################### - vfm_base=[ - InstantiationParameter(name="sec_group", value=TENANT_SEC_GROUP), - InstantiationParameter(name="public_net_id", value=PUBLIC_NET) - ] - - vfm_vsn=[ - InstantiationParameter(name="sec_group", value=TENANT_SEC_GROUP), - InstantiationParameter(name="public_net_id", value=PUBLIC_NET) - ] - - vfm_vfw=[ - InstantiationParameter(name="sec_group", value=TENANT_SEC_GROUP), - InstantiationParameter(name="public_net_id", value=PUBLIC_NET) - ] - - vfm_vpkg=[ - InstantiationParameter(name="sec_group", value=TENANT_SEC_GROUP), - InstantiationParameter(name="public_net_id", value=PUBLIC_NET) - ] - - base_paras=VfmoduleParameters("base_template",vfm_base) - vpkg_paras=VfmoduleParameters("vpkg",vfm_vpkg) - vsn_paras=VfmoduleParameters("vsn",vfm_vsn) - vfw_paras=VfmoduleParameters("vfw",vfm_vfw) - - ########################################################################### - ######## VNF parameters ################################################### - ########################################################################### - - vnf_vfw=[ - InstantiationParameter(name="onap_private_net_id", value=ONAP_PRIVATE_NET), - InstantiationParameter(name="onap_private_subnet_id", value=ONAP_PRIVATE_SUBNET), - InstantiationParameter(name="pub_key", value="ssh-rsa AAAAB3NzaC1yc2EAA\ - AADAQABAAABAQDFBOB1Ea2yej68aqIQw10kEsVf+rNoxT39qrV8JvvTK2yhkniQka1t2oD9h6DlXOL\ - M3HJ6nBegWjOasJmIbminKZ6wvmxZrDVFJXp9Sn1gni0vtEnlDgH14shRUrFDYO0PYjXRHoj7QXZMY\ - xtAdFSbzGuCsaTLcV/xchLBQmqZ4AGhMIiYMfJJF+Ygy0lbgcVmT+8DH7kUUt8SAdh2rRsYFwpKANn\ - QJyPV1dBNuTcD0OW1hEOhXnwqH28tjfb7uHJzTyGZlTmwTs544teTNz5B9L4yT3XiCAlMcaLOBMfBT\ - KRIse+NkiTb+tc60JNnEYR6MqZoqTea/w+YBQaIMcil"), - InstantiationParameter(name="image_name", value=IMAGE_NAME), - InstantiationParameter(name="flavor_name", value=FLAVOR_NAME), - InstantiationParameter(name="sec_group", value=TENANT_SEC_GROUP), - InstantiationParameter(name="install_script_version", value="1.4.0-SNAPSHOT"), - InstantiationParameter(name="demo_artifacts_version", value="1.4.0-SNAPSHOT"), - InstantiationParameter(name="cloud_env", value=CLOUD_TYPE), - InstantiationParameter(name="public_net_id", value=PUBLIC_NET), - InstantiationParameter(name="aic-cloud-region", value=CLOUD_REGION) - ] - - vnf_paras=VnfParameters("vfwcds_VF", vnf_vfw, - [base_paras, vpkg_paras, vsn_paras, vfw_paras]) - - # You must define for each VNF and its vFModule the parameters, - # otherwise they stay empty. - # The matching critera are: - # - VnfParameters.name must match VNF ModelInstanceName - # (see above "vfwcds_VF") - # - VfmoduleParameters.name must match substring in vfModule "instanceName" - # (e.g. "vfwcds_vf0..VfwcdsVf..vsn..module-1") - - service_instantiation = ServiceInstantiation.instantiate_macro( - service, - cloud_region, - tenant, - customer, - owning_entity, - vid_project, - vid_line_of_business, - vid_platform, - service_instance_name=SERVICE_INSTANCE_NAME, - vnf_parameters=[vnf_paras] - ) - - service_instantiation.wait_for_finish(): - print("Success") - else: - print("Instantiation failed, check logs") - -Instantiate a service using SO service template (Macro) -------------------------------------------------------- - -To provide more control on the SO macro instantiation, you can define your service as follows: - -.. code:: Yaml - - myservice: - subscription_service_type: myservice - vnfs: - - model_name: myvfmodel - instance_name: myfirstvnf - parameters: - param1: value1 - processing_priority: 1 - vf_modules: - - instance_name: mysecondvfm - model_name: base - processing_priority: 2 - parameters: - param-vfm1: value-vfm1 - - instance_name: myfirstvfm - model_name: base - processing_priority: 1 - parameters: - param-vfm1: value-vfm1 - - model_name: myvfmodel - instance_name: mysecondvnf - parameters: - param1: value1 - processing_priority: 2 - vf_modules: - - instance_name: myfirstvfm - model_name: base - processing_priority: 1 - parameters: - param-vfm1: value-vfm1 - - instance_name: mysecondvfm - model_name: base - processing_priority: 2 - parameters: - param-vfm1: value-vfm1 - -.. code:: Python - - from onapsdk.aai.business import Customer, OwningEntity, Project, LineOfBusiness, Platform - from onapsdk.aai.cloud_infrastructure import CloudRegion - from onapsdk.sdc.service import Service - from onapsdk.so.instantiation import ServiceInstantiation - from yaml import load - - so_yaml_service = "/path/to/yaml/service" - with open(so_yaml_service, "r") as yaml_template: - so_service_data = load(yaml_template) - - # We assume that: - # - service is onboarded, - # - cloud region, customer, owning_entity and project have been already created, - # - cloud region has at least one tenant - # - customer has service subscription - # - service subscription is connected with cloud region and tenant - - service = Service(next(iter(so_service_data.keys()))) - so_service = SoService.load(so_service_data[service.name]) - SERVICE_INSTANCE_NAME = "my_svc_instance_name" - - customer = Customer.get_by_global_customer_id(GLOBAL_CUSTOMER_ID) - cloud_region = CloudRegion.get_by_id( - cloud_owner=CLOUD_OWNER, - cloud_region_id=CLOUD_REGION - ) - tenant = next(cloud_region.tenants) - owning_entity = OwningEntity(OWNING_ENTITY) - project = Project(PROJECT) - line_of_business = LineOfBusiness(LINE_OF_BUSINESS) - platform = Platform(PLATFORM) - - service_instantiation = ServiceInstantiation.instantiate_macro( - sdc_service=service, - customer=customer, - owning_entity=owning_entity, - project=project, - line_of_business=line_of_business, - platform=platform, - cloud_region=cloud_region, - tenant=tenant, - service_instance_name=SERVICE_INSTANCE_NAME, - so_service=so_service - ) - - -Instantiate VNF (Macro) ------------------------ - -Since ONAP Istanbul the creation or deletion of VNFs in macro mode is supported. Examples below: - -.. code:: Python - - import time - from onapsdk.aai.business import Customer - from onapsdk.vid import LineOfBusiness, Platform - - # We assume that - # - service has been already instantiated, - # - line of business and platform are created - - SERVICE_INSTANCE_NAME = "service_instance_demo" - VNF_INSTANCE_NAME = "new_vnf_instance" - - customer = Customer.get_by_global_customer_id(GLOBAL_CUSTOMER_ID) - service_subscription = next(customer.service_subscriptions) - service_instance = service_subscription.get_service_instance_by_name(SERVICE_INSTANCE_NAME) - vnf = service_subscription.sdc_service.vnfs[0] - vid_line_of_business = LineOfBusiness.create(LINE_OF_BUSINESS) - vid_platform = Platform.create(PLATFORM) - - ########################################################################### - ######## VFModule parameters ############################################## - ########################################################################### - - myfirstvfm_params = [ - InstantiationParameter(name="param-vfm1", value="value-vfm1") - ] - - vf1_params = VfmoduleParameters("myfirstvfm", myfirstvfm_params) - - ########################################################################### - ######## VNF parameters ################################################### - ########################################################################### - - vnf_param_list = [ - InstantiationParameter(name="param1", value="value1") - ] - - vnf_paras = VnfParameters("myvfmodel", vnf_param_list, [vf1_params]) - - vnf_instantiation = service_instance.add_vnf( - vnf=vnf, - line_of_business=vid_line_of_business, - platform=vid_platform, - vnf_instance_name=VNF_INSTANCE_NAME, - vnf_parameters=[vnf_paras], - a_la_carte=False - ) - - vnf_instantiation.wait_for_finish(): - print("Success") - else: - print("Instantiation failed, check logs") - - -Instantiate VNF using SO service template (Macro) -------------------------------------------------- - -To provide more control on the SO macro instantiation for new vnf, you can define your vnf as follows: - -.. code:: Yaml - - model_name: myvfmodel - instance_name: mynewvnf - parameters: - param1: value1 - vf_modules: - - instance_name: mysecondvfm - model_name: base - processing_priority: 2 - parameters: - param-vfm1: value-vfm1 - - instance_name: myfirstvfm - model_name: base - processing_priority: 1 - parameters: - param-vfm1: value-vfm1 - -.. code:: Python - - import time - from onapsdk.aai.business import Customer - from onapsdk.vid import LineOfBusiness, Platform - - SERVICE_INSTANCE_NAME = "service_instance_demo" - VNF_INSTANCE_NAME = "new_vnf_instance" - - # We assume that - # - service has been already instantiated, - # - line of business and platform are created - - customer = Customer.get_by_global_customer_id(GLOBAL_CUSTOMER_ID) - service_subscription = next(customer.service_subscriptions) - service_instance = service_subscription.get_service_instance_by_name(SERVICE_INSTANCE_NAME) - vnf = service_subscription.sdc_service.vnfs[0] - vid_line_of_business = LineOfBusiness.create(LINE_OF_BUSINESS) - vid_platform = Platform.create(PLATFORM) - - so_yaml_vnf = "/path/to/yaml/vnf" - with open(so_yaml_vnf, "r") as yaml_template: - so_vnf_data = load(yaml_template) - - so_vnf = SoServiceVnf.load(so_vnf_data) - - vnf_instantiation = service_instance.add_vnf( - vnf=vnf, - line_of_business=vid_line_of_business, - platform=vid_platform, - vnf_instance_name=VNF_INSTANCE_NAME, - so_vnfs=so_vnfs, - a_la_carte=False - ) - - vnf_instantiation.wait_for_finish(): - print("Success") - else: - print("Instantiation failed, check logs") - - -Instantiate VNF (ALaCarte) --------------------------- - -.. code:: Python - - import time - from onapsdk.aai.business import Customer - from onapsdk.vid import LineOfBusiness, Platform - - # We assume that - # - service has been already instantiated, - # - line of business and platform are created - - customer = Customer.get_by_global_customer_id(GLOBAL_CUSTOMER_ID) - service_subscription = next(customer.service_subscriptions) - service_instance = service_subscription.get_service_instance_by_name(SERVICE_INSTANCE_NAME) - vnf = service_subscription.sdc_service.vnfs[0] - vid_line_of_business = LineOfBusiness.create(LINE_OF_BUSINESS) - vid_platform = Platform.create(PLATFORM) - vnf_instantiation = service_instance.add_vnf(vnf, vid_line_of_business, vid_platform) - vnf_instantiation.wait_for_finish(): - print("Success") - else: - print("Instantiation failed, check logs") - -Instantiate Vf module (ALaCarte) --------------------------------- - -.. code:: Python - - import time - from onapsdk.aai.business import Customer - - customer = Customer.get_by_global_customer_id(GLOBAL_CUSTOMER_ID) - service_subscription = next(customer.service_subscriptions) - service_instance = service_subscription.get_service_instance_by_name(SERVICE_INSTANCE_NAME) - vnf_instance = next(service_instance.vnf_instances) - vf_module = vnf_instance.vnf.vf_module - vf_module_instantiation = vnf_instance.add_vf_module( - vf_module, - vnf_parameters=[ - VnfParameter(name="parameter1", value="parameter1_value"), - VnfParameter(name="parameter2", value="parameter2_value - ] - ) - vf_module_instantiation.wait_for_finish(): - print("Success") - else: - print("Instantiation failed, check logs") - -Instantiate Vl module (ALaCarte) --------------------------------- - -.. code:: Python - - import time - from onapsdk.aai.business import Customer - from onapsdk.vid import LineOfBusiness, Platform - - # We assume that - # - service has been already instantiated, - # - line of business and platform are created - - customer = Customer.get_by_global_customer_id(GLOBAL_CUSTOMER_ID) - service_subscription = next(customer.service_subscriptions) - service_instance = service_subscription.get_service_instance_by_name(SERVICE_INSTANCE_NAME) - - logger.info("******** Get 1st Network in Service Model *******") - network = service_subscription.sdc_service.networks[0] - - logger.info("******** Create Network *******") - sn=Subnet(name="my_subnet", - start_address="10.0.0.1", - cidr_mask="24", - gateway_address="10.0.0.1) - - vid_line_of_business = LineOfBusiness.create(LINE_OF_BUSINESS) - vid_platform = Platform.create(PLATFORM) - - network_instantiation = service_instance.add_network(network, vid_line_of_business, - vid_platform, network_instance_name="my_net", subnets=[sn]) - - if network_instantiation.wait_for_finish(): - print("Success") - else: - print("Instantiation failed, check logs") diff --git a/docs/usage/usage/ves.rst b/docs/usage/usage/ves.rst deleted file mode 100644 index 8171a7d..0000000 --- a/docs/usage/usage/ves.rst +++ /dev/null @@ -1,42 +0,0 @@ -VES -### - -Preparation for VES tests -------------------------- - -To enable CDS Enrichment in an ONAP Frankfurt environment the NodePort 30449 -for the CDS Blueprint Processor API service needs to be opened - -#. Check existing VES Services: - - .. code-block:: sh - - kubectl get service -n onap|grep ves - xdcae-ves-collector NodePort 10.43.48.246 <none> 8443:30417/TCP - -#. If the port of Ves Service is different than 30417 you can change it corresponding to the installation instruction. - - -Send event to Ves Collector ---------------------------- - -.. code:: Python - - from onapsdk.ves.ves import Ves - response = Ves.send_event( - basic_auth={'username': 'sample1', 'password': 'sample1'}, - json_event=event, - version="v7" - ) - -Send event batch to Ves Collector ---------------------------------- - -.. code:: Python - - from onapsdk.ves.ves import Ves - response = Ves.send_batch_event( - basic_auth={'username': 'sample1', 'password': 'sample1'}, - json_event=event, - version="v7" - ) |