aboutsummaryrefslogtreecommitdiffstats
path: root/docs/examples/e2e_artifact_upload.rst
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2022-10-17 12:46:49 +0000
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2022-10-17 14:05:09 +0000
commitf2adf542e878c96895210f97ebf1ebb763b2f465 (patch)
tree91fc0faeb3436e723d07aed1f38ce59a6e7cc7c5 /docs/examples/e2e_artifact_upload.rst
parent49071a0d0425ef67fa552dbf14c81e5a11cc49e7 (diff)
Release ONAP SDKv10.2
Issue-ID: INT-2150 Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl> Change-Id: I650047c599a5aae6de7c6b42d38e34aea88578e2
Diffstat (limited to 'docs/examples/e2e_artifact_upload.rst')
-rw-r--r--docs/examples/e2e_artifact_upload.rst58
1 files changed, 58 insertions, 0 deletions
diff --git a/docs/examples/e2e_artifact_upload.rst b/docs/examples/e2e_artifact_upload.rst
new file mode 100644
index 0000000..aea4d21
--- /dev/null
+++ b/docs/examples/e2e_artifact_upload.rst
@@ -0,0 +1,58 @@
+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()
+