Feature 10908: LCM process NS update request
[osm/LCM.git] / osm_lcm / tests / test_db_descriptors.py
index 34491a7..457ea30 100644 (file)
@@ -120,6 +120,38 @@ db_nsds_text = """
 
 db_nslcmops_text = """
 ---
+-   _admin:
+        created: 1651100375.77829
+        modified: 1651100481.36625
+        projects_read:
+        - 7f563445c74147f78e29b193a6da42bb
+        projects_write:
+        - 7f563445c74147f78e29b193a6da42bb
+        worker: a5adf5972b63
+    detailed-status: success
+    _id: 6bd4362f-da74-4bd8-a825-fd00e610c644
+    id: 6bd4362f-da74-4bd8-a825-fd00e610c644
+    operationState: COMPLETED
+    queuePosition: 0
+    stage: ''
+    errorMessage: ''
+    detailedStatus:
+    statusEnteredTime: 1651100481.36625
+    nsInstanceId: 7e3ad9ce-39b8-4636-a661-7870f25bf800
+    lcmOperationType: update
+    startTime: 1651100375.77823
+    isAutomaticInvocation: false
+    operationParams:
+        updateType: CHANGE_VNFPKG
+        changeVnfPackageData:
+            vnfInstanceId: 6421c7c9-d865-4fb4-9a13-d4275d243e01
+            vnfdId: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
+        lcmOperationType: update
+        nsInstanceId: f48163a6-c807-47bc-9682-f72caef5af85
+    isCancelPending: false
+    links:
+        self: "/osm/nslcm/v1/ns_lcm_op_occs/6bd4362f-da74-4bd8-a825-fd00e610c644"
+        nsInstance: "/osm/nslcm/v1/ns_instances/f48163a6-c807-47bc-9682-f72caef5af85"       
 -   _admin:
         created: 1566823354.4148262
         modified: 1566823354.4148262
@@ -315,6 +347,7 @@ db_nsrs_text = """
                 vdu_count_index: null
                 vdu_id: null
                 vdu_name: null
+                type: lxc_proxy_charm
                 vnfd_id: hackfest3charmed-vnf
             -   application: alf-c-ab
                 ee_id: f48163a6-c807-47bc-9682-f72caef5af85.alf-c-ab
@@ -329,6 +362,7 @@ db_nsrs_text = """
                 vdu_count_index: null
                 vdu_id: null
                 vdu_name: null
+                type: lxc_proxy_charm
                 vnfd_id: hackfest3charmed-vnf
             VCA-model-name: f48163a6-c807-47bc-9682-f72caef5af85
         modified: 1566823354.3716335
@@ -861,9 +895,10 @@ db_nsrs_text = """
     nsd-name-ref: hackfest3charmed-ns
     nsd-ref: hackfest3charmed-ns
     operational-events: []
-    operational-status: failed
+    operational-status: running
     orchestration-progress: {}
     resource-orchestrator: osmopenmano
+    nsState: INSTANTIATED
     short-name: ALF
     ssh-authorized-key: null
     flavor : [{"vcpu-count":1,"memory-mb":1024,"storage-gb":"10","vim_info":[],"name":"mgmtVM-flv","id":"0"}]
@@ -1412,6 +1447,196 @@ db_k8sclusters_text = """
     vim_account: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
 """
 
+db_vnfds_revisions_text = """
+---
+-   _admin:
+      created: 1566823352.7154346
+      modified: 1566823353.9295402
+      onboardingState: ONBOARDED
+      operationalState: ENABLED
+      projects_read:
+      - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
+      projects_write:
+      - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
+      storage:
+          descriptor: hackfest_3charmed_vnfd/hackfest_3charmed_vnfd.yaml
+          folder: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
+          fs: local
+          path: /app/storage/
+          pkg-dir: hackfest_3charmed_vnfd
+          zipfile: package.tar.gz
+      type: vnfd
+      usageState: NOT_IN_USE
+      userDefinedData: {}
+    _id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77:1
+    id: hackfest3charmed-vnf
+    description: >-
+      A VNF consisting of 2 VDUs connected to an internal VL, and one VDU
+      with cloud-init
+    product-name: hackfest3charmed-vnf
+    version: '1.0'
+    mgmt-cp: vnf-mgmt-ext
+    virtual-compute-desc:
+      - id: mgmt-compute
+        virtual-cpu:
+          num-virtual-cpu: 1
+        virtual-memory:
+          size: 1
+      - id: data-compute
+        virtual-cpu:
+          num-virtual-cpu: 1
+        virtual-memory:
+          size: 1
+    kdu:
+    - juju-bundle: stable/native-kdu
+      name: native-kdu
+    virtual-storage-desc:
+      - id: mgmt-storage
+        block-storage-data:
+          size-of-storage: 10
+      - id: data-storage
+        block-storage-data:
+          size-of-storage: 10
+
+    sw-image-desc:
+      - id: hackfest3-mgmt
+        name: hackfest3-mgmt
+
+    vdu:
+      - id: mgmtVM
+        name: mgmtVM
+        cloud-init-file: cloud-config.txt
+        sw-image-desc: hackfest3-mgmt
+        virtual-compute-desc: mgmt-compute
+        virtual-storage-desc: mgmt-storage
+        int-cpd:
+          - id: vnf-mgmt
+            order: 1
+            virtual-network-interface-requirement:
+              - name: mgmtVM-eth0
+                virtual-interface:
+                  type: VIRTIO
+          - id: mgmtVM-internal
+            int-virtual-link-desc: internal
+            order: 2
+            virtual-network-interface-requirement:
+              - name: mgmtVM-eth1
+                virtual-interface:
+                  type: VIRTIO
+      - id: dataVM
+        name: dataVM
+        sw-image-desc: hackfest3-mgmt
+        virtual-compute-desc: data-compute
+        virtual-storage-desc: data-storage
+        int-cpd:
+          - id: dataVM-internal
+            int-virtual-link-desc: internal
+            order: 1
+            virtual-network-interface-requirement:
+              - name: dataVM-eth1
+                virtual-interface:
+                  type: VIRTIO
+          - id: vnf-data
+            order: 2
+            virtual-network-interface-requirement:
+              - name: dataVM-eth0
+                virtual-interface:
+                  type: VIRTIO
+        monitoring-parameter:
+          - 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
+          vdu-id: mgmtVM
+          cpd: vnf-mgmt
+      - id: vnf-data-ext
+        int-cpd: # Connection to int-cpd
+          vdu-id: dataVM
+          cpd: vnf-data
+
+    df:
+      - id: hackfest_default
+        vdu-profile:
+          - id: mgmtVM
+            min-number-of-instances: 1
+          - id: dataVM
+            min-number-of-instances: 1
+            max-number-of-instances: 10
+        instantiation-level:
+          - id: default
+            vdu-level:
+              - vdu-id: mgmtVM
+                number-of-instances: 1
+              - vdu-id: dataVM
+                number-of-instances: 1
+        scaling-aspect:
+          - id: scale_dataVM
+            name: scale_dataVM
+            max-scale-level: 10
+            aspect-delta-details:
+              deltas:
+              - id: delta1
+                vdu-delta:
+                - id: vdudelta1
+                  number-of-instances: 1
+            scaling-policy:
+              - name: auto_cpu_util_above_threshold
+                scaling-type: automatic
+                enabled: true
+                threshold-time: 0
+                cooldown-time: 60
+                scaling-criteria:
+                  - name: cpu_util_above_threshold
+                    scale-in-relational-operation: LE
+                    scale-in-threshold: '15.0000000000'
+                    scale-out-relational-operation: GE
+                    scale-out-threshold: '60.0000000000'
+                    vnf-monitoring-param-ref: dataVM_cpu_util
+            scaling-config-action:
+              - trigger: post-scale-out
+                vnf-config-primitive-name-ref: touch
+              - trigger: pre-scale-in
+                vnf-config-primitive-name-ref: touch
+        lcm-operations-configuration:
+          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
+                      value: <rw_mgmt_ip>
+                    - name: ssh-username
+                      value: ubuntu
+                    - 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
+"""
+
 db_vnfds_text = """
 ---
 -   _admin:
@@ -1810,6 +2035,89 @@ db_vnfrs_text = """
         vim-id: ff181e6d-2597-4244-b40b-bb0174bdfeb6
     vnfd-id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
     vnfd-ref: hackfest3charmed-vnf
+-   _admin:
+        created: 1566823354.3668208
+        modified: 1566823354.3668208
+        nsState: NOT_INSTANTIATED
+        projects_read:
+        - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
+        projects_write:
+        - 25b5aebf-3da1-49ed-99de-1d2b4a86d6e4
+    _id: 6421c7c9-d865-4fb4-9a13-d4275d243e01
+    additionalParamsForVnf:
+        touch_filename: /home/ubuntu/first-touch-1
+        touch_filename2: /home/ubuntu/second-touch-1
+    connection-point:
+    -   connection-point-id: vnf-mgmt
+        id: vnf-mgmt
+        name: vnf-mgmt
+    -   connection-point-id: vnf-data
+        id: vnf-data
+        name: vnf-data
+    created-time: 1566823354.36234
+    id: 6421c7c9-d865-4fb4-9a13-d4275d243e01
+    ip-address: 10.205.1.46
+    member-vnf-index-ref: '1'
+    nsr-id-ref: f48163a6-c807-47bc-9682-f72caef5af85
+    vdur:
+    -   _id: f0e7d7ce-2443-4dcb-ad0b-5ab9f3b13d37
+        count-index: 0
+        interfaces:
+        -   ip-address: 10.205.1.46
+            mac-address: fa:16:3e:b4:3e:b1
+            mgmt-vnf: true
+            name: mgmtVM-eth0
+            ns-vld-id: mgmt
+        -   ip-address: 192.168.54.2
+            mac-address: fa:16:3e:6e:7e:78
+            name: mgmtVM-eth1
+            vnf-vld-id: internal
+        internal-connection-point:
+        -   connection-point-id: mgmtVM-internal
+            id: mgmtVM-internal
+            name: mgmtVM-internal
+        ip-address: 10.205.1.46
+        name: ALF-1-mgmtVM-1
+        status: ACTIVE
+        status-detailed: null
+        vdu-id-ref: mgmtVM
+        vim-id: c2538499-4c30-41c0-acd5-80cb92f48061
+        ns-image-id: 0
+        ns-flavor-id: 0
+        affinity-or-anti-affinity-group-id : []
+    -   _id: ab453219-2d9a-45c2-864d-2c0788385028
+        count-index: 0
+        interfaces:
+        -   ip-address: 192.168.54.3
+            mac-address: fa:16:3e:d9:7a:5d
+            name: dataVM-eth0
+            vnf-vld-id: internal
+        -   ip-address: 192.168.24.3
+            mac-address: fa:16:3e:d1:6c:0d
+            name: dataVM-xe0
+            ns-vld-id: datanet
+        internal-connection-point:
+        -   connection-point-id: dataVM-internal
+            id: dataVM-internal
+            name: dataVM-internal
+        ip-address: null
+        name: ALF-1-dataVM-1
+        status: ACTIVE
+        status-detailed: null
+        vdu-id-ref: dataVM
+        vim-id: 87973c3f-365d-4227-95c2-7a8abc74349c
+        ns-image-id: 0
+        ns-flavor-id: 0
+        affinity-or-anti-affinity-group-id : []
+    vim-account-id: ea958ba5-4e58-4405-bf42-6e3be15d4c3a
+    vld:
+    -   id: internal
+        name: ALF-internal
+        status: ACTIVE
+        status-detailed: null
+        vim-id: ff181e6d-2597-4244-b40b-bb0174bdfeb6
+    vnfd-id: 7637bcf8-cf14-42dc-ad70-c66fcf1e6e77
+    vnfd-ref: hackfest3charmed-vnf
 -   _admin:
         created: 1566823354.3703845
         modified: 1566823354.3703845
@@ -2038,6 +2346,7 @@ test_ids = {
         "ns": "f48163a6-c807-47bc-9682-f72caef5af85",
         "instantiate": "a639fac7-e0bb-4225-8ecb-c1f8efcc125e",
         "terminate": "a639fac7-e0bb-4225-ffff-c1f8efcc125e",
+        "update": "6bd4362f-da74-4bd8-a825-fd00e610c644",
     },
     "TEST-KDU": {
         "ns": "0bcb701c-ee4d-41ab-8ee6-f4156f7f114d",