Bug 1830 fixed: maps completed operations to original operation types
[osm/NBI.git] / osm_nbi / tests / test_pkg_descriptors.py
index fd8cac9..d77b79f 100644 (file)
 __author__ = "Pedro de la Cruz Ramos, pedro.delacruzramos@altran.com"
 __date__ = "2019-11-20"
 
+
+# Exploit exists in the key kdu.helm-chart
+vnfd_exploit_text = """
+  _id: 00000000-0000-0000-0000-000000000000
+  id: n2vc-rce_vnfd
+  df:
+  - id: default-df
+  kdu:
+  - name: exploit
+    helm-chart: "local/exploit --post-renderer /bin/bash"
+    helm-version: v3
+"""
+
+# Exploit in kdu.helm-chart is fixed
+vnfd_exploit_fixed_text = """
+  id: n2vc-rce_vnfd
+  df:
+  - id: default-df
+  kdu:
+  - name: exploit
+    helm-chart: "local/exploit"
+    helm-version: v3
+"""
+
 db_vnfds_text = """
 ---
 -   _admin:
@@ -49,7 +73,7 @@ db_vnfds_text = """
     product-name: hackfest3charmed-vnf
     version: '1.0'
     mgmt-cp: vnf-mgmt-ext
-  
+
     virtual-compute-desc:
       - id: mgmt-compute
         virtual-cpu:
@@ -61,17 +85,17 @@ db_vnfds_text = """
           num-virtual-cpu: 2
         virtual-memory:
           size: '2'
-  
+
     virtual-storage-desc:
       - id: mgmt-storage
         size-of-storage: '20'
       - id: data-storage
         size-of-storage: '20'
-  
+
     sw-image-desc:
       - id: hackfest3-mgmt
         name: hackfest3-mgmt
-  
+
     vdu:
       - id: mgmtVM
         name: mgmtVM
@@ -118,10 +142,10 @@ db_vnfds_text = """
           - id: dataVM_cpu_util
             name: dataVM_cpu_util
             performance-metric: cpu_utilization
-  
+
     int-virtual-link-desc:
       - id: internal
-  
+
     ext-cpd:
       - id: vnf-mgmt-ext
         int-cpd: # Connection to int-cpd
@@ -131,7 +155,7 @@ db_vnfds_text = """
         int-cpd: # Connection to int-cpd
           vdu-id: dataVM
           cpd: vnf-data
-  
+
     df:
       - id: hackfest_default
         vdu-profile:
@@ -179,8 +203,13 @@ db_vnfds_text = """
           operate-vnf-op-config:
             day1-2:
             - id: hackfest3charmed-vnf
+              execution-environment-list:
+                - id: simple-ee
+                  juju:
+                    charm: simple
               initial-config-primitive:
                 - seq: "1"
+                  execution-environment-ref: simple-ee
                   name: config
                   parameter:
                     - name: ssh-hostname
@@ -190,18 +219,18 @@ db_vnfds_text = """
                     - name: ssh-password
                       value: osm4u
                 - seq: "2"
+                  execution-environment-ref: simple-ee
                   name: touch
                   parameter:
                     - name: filename
                       value: <touch_filename>
               config-primitive:
                 - name: touch
+                  execution-environment-ref: simple-ee
                   parameter:
                     - data-type: STRING
                       default-value: <touch_filename2>
                       name: filename
-              juju:
-                charm: simple
 """
 
 db_nsds_text = """
@@ -266,3 +295,77 @@ db_nsds_text = """
                   - constituent-base-element-id: hackfest_vnf2
                     constituent-cpd-id: vnf-data-ext
 """
+
+db_sfc_nsds_text = """
+- _admin:
+    userDefinedData: {}
+    revision: 1
+    created: 1683713524.2696395
+    modified: 1683713524.3553684
+    projects_read:
+      - 93601899-b310-4a56-a765-91539d5f675d
+    projects_write:
+      - 93601899-b310-4a56-a765-91539d5f675d
+    onboardingState: ONBOARDED
+    operationalState: ENABLED
+    usageState: NOT_IN_USE
+    storage:
+      fs: mongo
+      path: /app/storage/
+      folder: '2eb45633-03e3-4909-a87d-a564f5943948:1'
+      pkg-dir: cirros_vnffg_ns
+      descriptor: cirros_vnffg_ns/cirros_vnffg_nsd.yaml
+      zipfile: package.tar.gz
+  _id: 2eb45633-03e3-4909-a87d-a564f5943948
+  id: cirros_vnffg-ns
+  designer: OSM
+  version: '1.0'
+  name: cirros_vnffg-ns
+
+  vnfd-id:
+    - cirros_vnffg-vnf
+
+  virtual-link-desc:
+    - id: osm-ext
+      mgmt-network: true
+
+  vnffgd:
+    - id: vnffg1
+      vnf-profile-id:
+        - Mid-vnf1
+      nfpd:
+        - id: forwardingpath1
+          position-desc-id:
+            - id: position1
+              cp-profile-id:
+                - id: cpprofile2
+                  constituent-profile-elements:
+                    - id: vnf1
+                      order: 0
+                      constituent-base-element-id: Mid-vnf1
+                      ingress-constituent-cpd-id: vnf-cp0-ext
+                      egress-constituent-cpd-id: vnf-cp0-ext
+              match-attributes:
+                - id: rule1_80
+                  ip-proto: 6
+                  source-ip-address: 20.20.1.2
+                  destination-ip-address: 20.20.3.5
+                  source-port: 0
+                  destination-port: 80
+              nfp-position-element-id:
+                - test
+      nfp-position-element:
+        - id: test
+
+  df:
+    - id: default-df
+      vnf-profile:
+        - id: '1'
+          virtual-link-connectivity:
+            - constituent-cpd-id:
+                - constituent-base-element-id: '1'
+                  constituent-cpd-id: eth0-ext
+              virtual-link-profile-id: osm-ext
+          vnfd-id: cirros_vnffg-vnf
+  description: Simple NS example with vnffgd
+"""