Feature 10509: Add support for scaling KDUs 74/10874/1 v10.0.0 v10.0.1
authorDavid Garcia <david.garcia@canonical.com>
Mon, 12 Apr 2021 15:26:20 +0000 (17:26 +0200)
committerguzman <jmguzman@whitestack.com>
Fri, 21 May 2021 22:41:07 +0000 (00:41 +0200)
- Add kdu-resource-profile: Profile that references to a particular
resource of a KDU (i.e. deployment/statefulset/etc. of a KDU).
- Add kdu-resource-delta: Delta list for the scaling-in and -out of a
KDU.
- Add vnfd_sol006_k8s_scale.yaml under tests/examples: Descriptor
example.

Change-Id: I6b159341216a54776049da4f6145f0c3e030ff12
Signed-off-by: David Garcia <david.garcia@canonical.com>
(cherry picked from commit b8c5953995f7c3e68602dae2f4770efc3b674dd2)

models/augments/scaling.yang
tests/examples/vnfd_sol006_k8s_scale.yaml [new file with mode: 0644]
tests/test_validation.py

index 69ff163..6194d4a 100644 (file)
@@ -32,6 +32,10 @@ module scaling {
         prefix day1-2;
     }
 
         prefix day1-2;
     }
 
+    import kdu {
+        prefix kdu;
+    }
+
     grouping extended-scaling {
         list scaling-policy {
 
     grouping extended-scaling {
         list scaling-policy {
 
@@ -162,7 +166,83 @@ module scaling {
         }
     }
 
         }
     }
 
+    grouping extended-kdu-resource-profile {
+      list kdu-resource-profile {
+        key "id";
+        description
+          "The Kdu resource profile describes additional instantiation data for
+           a given KDU used in a deployment flavour.";
+
+        leaf id {
+          type string;
+        }
+
+        leaf min-number-of-instances {
+          type uint16;
+          default 1;
+          description
+            "Minimum number of instances of the KNFC based on this
+             KDU resource that is permitted to exist for this flavour.";
+        }
+
+        leaf max-number-of-instances {
+          type uint16;
+          default 1;
+          must ". >= ../min-number-of-instances";
+        }
+
+        leaf resource-name {
+          type string;
+          description
+            "Name of the application of KDU";
+        }
+
+        leaf kdu-name {
+          type leafref {
+            path "/vnfd:vnfd/kdu:kdu/kdu:name";
+          }
+          description
+            "Name of the KDU";
+        }
+      }
+    }
+
+    grouping extended-deltas {
+      list kdu-resource-delta {
+        key "id";
+        description
+          "The number of KNFC instances based on particular
+            KDUs to be created or removed.";
+
+        leaf id {
+          type leafref {
+            path "../../../../../kdu-resource-profile/id";
+          }
+          description
+            "Uniquely identifies a KDU profile.";
+        }
+
+        leaf number-of-instances {
+          type uint32 {
+            range "0..max";
+          }
+          description
+            "Number of instances of KNFC based on this KDU to
+              deploy for an instantiation level or for a
+              scaling delta. Shall be zero or greater.";
+        }
+      }
+    }
+
+    augment "/vnfd:vnfd/vnfd:df" {
+        uses extended-kdu-resource-profile;
+    }
+
     augment "/vnfd:vnfd/vnfd:df/vnfd:scaling-aspect" {
         uses extended-scaling;
     }
     augment "/vnfd:vnfd/vnfd:df/vnfd:scaling-aspect" {
         uses extended-scaling;
     }
-}
+
+    augment "/vnfd:vnfd/vnfd:df/vnfd:scaling-aspect/vnfd:aspect-delta-details/vnfd:deltas" {
+        uses extended-deltas;
+    }
+}
\ No newline at end of file
diff --git a/tests/examples/vnfd_sol006_k8s_scale.yaml b/tests/examples/vnfd_sol006_k8s_scale.yaml
new file mode 100644 (file)
index 0000000..c643207
--- /dev/null
@@ -0,0 +1,72 @@
+#  Copyright 2020 Whitestack LLC
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+#  implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+vnfd:
+  id: native_k8s_charm-vnf
+  product-name: native_k8s_charm-vnf
+  version: "1.0"
+  mgmt-cp: mgmt-ext
+
+  kdu:
+    - name: wordpress-kdu
+      juju-bundle: bundle.yaml
+
+  df:
+    - id: default-df
+      kdu-resource-profile:
+        - id: mysql-scale
+          kdu-name: wordpress-kdu
+          resource-name: mysql
+          min-number-of-instances: 1
+        - id: nginx-scale
+          kdu-name: wordpress-kdu
+          resource-name: nginx
+          min-number-of-instances: 1
+          max-number-of-instances: 11
+      scaling-aspect:
+        - id: scale_wordpresskdu
+          name: scale_wordpresskdu
+          max-scale-level: 10
+          aspect-delta-details:
+            deltas:
+              - id: wordpress-kdu
+                kdu-resource-delta:
+                  - id: mysql-scale
+                    number-of-instances: 2
+                  - id: nginx-scale
+                    number-of-instances: 1
+      lcm-operations-configuration:
+        operate-vnf-op-config:
+          day1-2:
+            - id: wordpress-kdu
+              config-primitive:
+                - name: changecontent
+                  parameter:
+                    - data-type: STRING
+                      default-value: nginx
+                      name: application-name
+                    - data-type: STRING
+                      default-value: ""
+                      name: customtitle
+              initial-config-primitive:
+                - name: changecontent
+                  parameter:
+                    - data-type: STRING
+                      name: application-name
+                      value: nginx
+                    - data-type: STRING
+                      name: customtitle
+                      value: Initial Config Primitive
+                  seq: 1
index a9dc8a4..02b9efb 100644 (file)
@@ -27,7 +27,8 @@ VNFD_FILES = [
     'hackfest_charmed_vnfd_sol006.yaml',
     'magma_knf_sol006.yaml',
     'vepc_sol006.yaml',
     'hackfest_charmed_vnfd_sol006.yaml',
     'magma_knf_sol006.yaml',
     'vepc_sol006.yaml',
-    'vnfd_sol006.yaml'
+    'vnfd_sol006.yaml',
+    'vnfd_sol006_k8s_scale.yaml',
 ]
 
 NSD_FILES = [
 ]
 
 NSD_FILES = [