feat(configurations): now VNF/VDU/KDU configurations are in the same place, compatibl... 10/10310/3
authorbravof <fbravo@whitestack.com>
Fri, 12 Feb 2021 19:17:54 +0000 (16:17 -0300)
committerguzman <jmguzman@whitestack.com>
Tue, 16 Feb 2021 14:34:26 +0000 (15:34 +0100)
Change-Id: Ia2d03e26987b7c319373005d7afed7d42ec54e3a
Signed-off-by: bravof <fbravo@whitestack.com>
models/augments/configuration.yang [deleted file]
models/augments/day1-2.yang
models/augments/kdu.yang
models/augments/scaling.yang
osm_im/im_translation.py
tests/examples/hackfest_charmed_vnfd_sol006.yaml
tests/examples/vepc_sol006.yaml

diff --git a/models/augments/configuration.yang b/models/augments/configuration.yang
deleted file mode 100644 (file)
index 8120c5a..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-  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.
-*/
-
-module configuration {
-    yang-version 1.1;
-    namespace "urn:etsi:osm:yang:configuration";
-    prefix "configuration";
-
-    import etsi-nfv-vnfd {
-        prefix vnfd;
-    }
-
-    import day1-2 {
-        prefix day1-2;
-    }
-
-    grouping extended-vnf-configuration {
-        leaf vnf-configuration-id {
-            description
-              "Reference for the VNF configuration to use in this DF";
-            type leafref {
-                path "/vnfd:vnfd/day1-2:vnf-configuration/day1-2:id";
-            }
-        }
-    }
-
-    grouping extended-vdu-configuration {
-        leaf vdu-configuration-id {
-            description
-              "Reference for the VDU configuration to use in this DF";
-            type leafref {
-                path "/vnfd:vnfd/day1-2:vdu-configuration/day1-2:id";
-            }
-        }
-    }
-
-    augment "/vnfd:vnfd/vnfd:df" {
-        uses extended-vnf-configuration;
-    }
-
-    augment "/vnfd:vnfd/vnfd:df/vnfd:vdu-profile" {
-        uses extended-vdu-configuration;
-    }
-}
index e66ce16..cf3b841 100644 (file)
@@ -29,37 +29,31 @@ module day1-2 {
     }
 
     grouping extended-vnf-configuration {
-        list vnf-configuration {
+        list day1-2 {
             key "id";
             leaf id {
                 description
-                  "Internal identifier for the VNF configuration";
+                  "Internal identifier for the VNF/VDU/KNF/KDU configuration";
                 type string;
             }
             uses common:vnfc-configuration;
             uses common:vnfc-relations;
             uses common:vdu-config-access;
-        }
-    }
 
-    grouping extended-vdu-configuration {
-        list vdu-configuration {
-            key "id";
-            leaf id {
+            leaf-list blacklist-config-primitive {
                 description
-                  "Internal identifier for the VDU configuration";
-                type string;
+                  "List of blacklisted config primitives from the list of
+                   default kdu config primitives";
+
+                type enumeration {
+                    enum upgrade;
+                    enum rollback;
+                }
             }
-            uses common:vnfc-configuration;
-            uses common:vdu-config-access;
         }
     }
 
-    augment "/vnfd:vnfd" {
+    augment "/vnfd:vnfd/vnfd:df/vnfd:lcm-operations-configuration/vnfd:operate-vnf-op-config" {
         uses extended-vnf-configuration;
     }
-
-    augment "/vnfd:vnfd" {
-        uses extended-vdu-configuration;
-    }
 }
\ No newline at end of file
index 3f7d2e7..bd8b8fb 100644 (file)
@@ -24,10 +24,6 @@ module kdu {
         prefix vnfd;
     }
 
-    import common-augments {
-        prefix common;
-    }
-
     grouping extended-ext-cpd {
         leaf k8s-cluster-net {
             description
@@ -40,24 +36,6 @@ module kdu {
         }
     }
 
-    grouping extended-kdu-configuration {
-        container kdu-configuration {
-            uses common:vnfc-configuration;
-            uses common:vdu-config-access;
-
-            leaf-list blacklist-config-primitive {
-                description
-                  "List of blacklisted config primitives from the list of
-                   default kdu config primitives";
-
-                type enumeration {
-                    enum upgrade;
-                    enum rollback;
-                }
-            }
-        }
-    }
-
     grouping extended-kdu {
         list kdu {
             description
@@ -116,9 +94,6 @@ module kdu {
                     }
                 }
             }
-
-            uses extended-kdu-configuration;
-
         }
 
         container k8s-cluster {
index 647edf1..69ff163 100644 (file)
@@ -156,7 +156,7 @@ module scaling {
                 description
                   "Reference to the VNF config primitive";
                 type leafref {
-                    path "/vnfd:vnfd/day1-2:vnf-configuration/day1-2:config-primitive/day1-2:name";
+                    path "/vnfd:vnfd/vnfd:df/vnfd:lcm-operations-configuration/vnfd:operate-vnf-op-config/day1-2:day1-2/day1-2:config-primitive/day1-2:name";
                 }
             }
         }
index 9216f45..78a2931 100644 (file)
@@ -286,7 +286,7 @@ def _add_im_vdus_to_sol006_vnfd(im_vnfd, sol006_vnfd):
         vdu_level = _get_instantiation_level_vdu_level_from_im_vdu(vdu)
         if vdu.get("vdu-configuration"):
             vdu_configuration = vdu["vdu-configuration"]
-            vdu_configuration["id"] = "{}-vdu-configuration".format(vdu["id"])
+            vdu_configuration["id"] = vdu["id"]
             vdu_configurations.append(vdu_configuration)
         df["vdu-profile"].append(vdu_profile)
         df["instantiation-level"][0]["vdu-level"].append(vdu_level)
@@ -299,7 +299,8 @@ def _add_im_vdus_to_sol006_vnfd(im_vnfd, sol006_vnfd):
     if len(ext_cpds) > 0:
         sol006_vnfd["ext-cpd"] = ext_cpds
     if len(vdu_configurations) > 0:
-        sol006_vnfd["vdu-configuration"] = vdu_configurations
+        _prepare_dict_entries_for_configurations(sol006_vnfd)
+        sol006_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"].extend(vdu_configurations)
 
 
 def _add_im_vdu_images_to_sol006_vdu(im_vdu, sol006_vdu):
@@ -365,8 +366,6 @@ def _get_vdu_profile_from_im_vdu(im_vdu, im_vnfd):
                 sgd_min_instances = int(scaling_group_descriptor.get("min-instance-count", 0))
                 vdu_profile["min-number-of-instances"] = sgd_min_instances + initial_instances
                 vdu_profile["max-number-of-instances"] = sgd_max_instances + initial_instances
-    if im_vdu.get("vdu-configuration"):
-        vdu_profile["vdu-configuration-id"] = "{}-vdu-configuration".format(im_vdu["id"])
     return vdu_profile
 
 
@@ -409,14 +408,22 @@ def _add_im_internal_vld_connection_point_refs_to_sol006_vnfd(ivld, im_vnfd, sol
                 if int_cpd["id"] == sol006_int_cpd_id:
                     int_cpd["int-virtual-link-desc"] = ivld["id"]
 
+def _prepare_dict_entries_for_configurations(sol006_vnfd):
+    sol006_vnfd["df"] = sol006_vnfd.get("df", [{}])
+    if not sol006_vnfd["df"][0].get("lcm-operations-configuration"):
+        sol006_vnfd["df"][0]["lcm-operations-configuration"] = {
+            "operate-vnf-op-config": {
+                "day1-2": []
+            }
+        }
 
 def _add_im_vnf_configuration_to_sol006_vnfd(im_vnfd, sol006_vnfd):
     vnf_configuration = im_vnfd.get("vnf-configuration")
     if not vnf_configuration:
         return
-    vnf_configuration["id"] = "default-vnf-configuration"
-    sol006_vnfd["vnf-configuration"] = [vnf_configuration]
-    sol006_vnfd["df"][0]["vnf-configuration-id"] = vnf_configuration["id"]
+    vnf_configuration["id"] = im_vnfd.get("id")
+    _prepare_dict_entries_for_configurations(sol006_vnfd)
+    sol006_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"].append(vnf_configuration)
 
 
 def _add_im_ip_profiles_to_sol006_vnfd(im_vnfd, sol006_vnfd):
@@ -513,8 +520,18 @@ def _add_im_scaling_group_descriptors_to_sol006_vnfd(im_vnfd, sol006_vnfd):
 def _add_im_kdus_to_sol006_vnfd(im_vnfd, sol006_vnfd):
     if im_vnfd.get("kdu"):
         sol006_vnfd["kdu"] = im_vnfd["kdu"]
+        kdu_configs = []
+        for a_kdu in sol006_vnfd["kdu"]:
+            if "kdu-configuration" in a_kdu:
+                kdu_config = a_kdu.pop("kdu-configuration")
+                kdu_config["id"] = a_kdu["name"]
+                kdu_configs.append(kdu_config)
         if len(sol006_vnfd.get("df", ())) == 0:
             sol006_vnfd["df"] = [{"id": "default-df"}]
+        if len(kdu_configs) > 0:
+            _prepare_dict_entries_for_configurations(sol006_vnfd)
+            sol006_vnfd["df"][0]["lcm-operations-configuration"]["operate-vnf-op-config"]["day1-2"].extend(kdu_configs)
+
 
 
 def _add_im_k8s_clusters_to_sol006_vnfd(im_vnfd, sol006_vnfd):
index 069198b..ab55af8 100644 (file)
@@ -107,7 +107,6 @@ vnfd:
 
   df:
     - id: default-df
-      vnf-configuration-id: default-vnf-configuration
       vdu-profile:
         - id: mgmtVM
           min-number-of-instances: 1
@@ -149,29 +148,30 @@ vnfd:
               vnf-config-primitive-name-ref: touch
             - trigger: pre-scale-in
               vnf-config-primitive-name-ref: touch
-
-  vnf-configuration:
-    - id: default-vnf-configuration
-      initial-config-primitive:
-        - seq: "1"
-          name: config
-          parameter:
-            - name: ssh-hostname
-              value: <rw_mgmt_ip>
-            - name: ssh-username
-              value: ubuntu
-            - name: ssh-password
-              value: osm4u
-        - seq: "2"
-          name: touch
-          parameter:
-            - name: filename
-              value: <touch_filename>
-      config-primitive:
-        - name: touch
-          parameter:
-            - data-type: STRING
-              default-value: <touch_filename2>
-              name: filename
-      juju:
-        charm: simple
+      lcm-operations-configuration:
+        operate-vnf-op-config:
+          day1-2:
+          - id: hackfest3charmed-vnf
+            initial-config-primitive:
+              - seq: "1"
+                name: config
+                parameter:
+                  - name: ssh-hostname
+                    value: <rw_mgmt_ip>
+                  - name: ssh-username
+                    value: ubuntu
+                  - name: ssh-password
+                    value: osm4u
+              - seq: "2"
+                name: touch
+                parameter:
+                  - name: filename
+                    value: <touch_filename>
+            config-primitive:
+              - name: touch
+                parameter:
+                  - data-type: STRING
+                    default-value: <touch_filename2>
+                    name: filename
+            juju:
+              charm: simple
\ No newline at end of file
index e5863e7..f248efd 100644 (file)
@@ -104,13 +104,11 @@ vnfd:
                 type: PARAVIRT
   df:
     - id: default-df
-      vnf-configuration-id: default-vnf-configuration
       vdu-profile:
         - id: spgwmme
           min-number-of-instances: 1
         - id: hss
           min-number-of-instances: 1
-          vdu-configuration-id: hss-vdu-configuration
       instantiation-level:
         - id: default-instantiation-level
           vdu-level:
@@ -128,65 +126,66 @@ vnfd:
               ip-version: ipv4
               cidr: 10.0.6.0/24
               dhcp-enabled: true
-  vdu-configuration:
-    - id: hss-vdu-configuration
-      initial-config-primitive:
-        - seq: "1"
-          name: config
-          parameter:
-            - name: ssh-hostname
-              value: <rw_mgmt_ip>
-            - name: ssh-username
-              value: ubuntu
-            - name: ssh-password
-              value: <password>
-        - seq: "2"
-          name: configure-hss
-          parameter:
-            - name: spgw-ip
-              data-type: STRING
-              value: <spgw_ip>
-            - name: hss-ip
-              data-type: STRING
-              value: <hss_ip>
-        - seq: "3"
-          name: restart-hss
-      juju:
-        charm: hsscharm
-  vnf-configuration:
-    - id: default-vnf-configuration
-      initial-config-primitive:
-        - seq: "1"
-          name: config
-          parameter:
-            - name: ssh-hostname
-              value: <rw_mgmt_ip>
-            - name: ssh-username
-              value: ubuntu
-            - name: ssh-password
-              value: <password>
-        - seq: "2"
-          name: configure-spgw
-          parameter:
-            - name: spgw-ip
-              data-type: STRING
-              value: <spgw_ip>
-            - name: hss-ip
-              data-type: STRING
-              value: <hss_ip>
-        - seq: "3"
-          name: restart-spgw
-      config-primitive:
-        - name: add-route
-          parameter:
-            - name: external-prefix
-              data-type: STRING
-              default-value: "8.8.8.8/32"
-            - name: next-hop
-              data-type: STRING
-              default-value: "192.168.2.1"
-      juju:
-        charm: spgwcharm
+      lcm-operations-configuration:
+        operate-vnf-op-config:
+          day1-2:
+          - id: vEPC_vnfd
+            initial-config-primitive:
+              - seq: "1"
+                name: config
+                parameter:
+                  - name: ssh-hostname
+                    value: <rw_mgmt_ip>
+                  - name: ssh-username
+                    value: ubuntu
+                  - name: ssh-password
+                    value: <password>
+              - seq: "2"
+                name: configure-spgw
+                parameter:
+                  - name: spgw-ip
+                    data-type: STRING
+                    value: <spgw_ip>
+                  - name: hss-ip
+                    data-type: STRING
+                    value: <hss_ip>
+              - seq: "3"
+                name: restart-spgw
+            config-primitive:
+              - name: add-route
+                parameter:
+                  - name: external-prefix
+                    data-type: STRING
+                    default-value: "8.8.8.8/32"
+                  - name: next-hop
+                    data-type: STRING
+                    default-value: "192.168.2.1"
+            juju:
+              charm: spgwcharm
+          - id: hss
+            initial-config-primitive:
+              - seq: "1"
+                name: config
+                parameter:
+                  - name: ssh-hostname
+                    value: <rw_mgmt_ip>
+                  - name: ssh-username
+                    value: ubuntu
+                  - name: ssh-password
+                    value: <password>
+              - seq: "2"
+                name: configure-hss
+                parameter:
+                  - name: spgw-ip
+                    data-type: STRING
+                    value: <spgw_ip>
+                  - name: hss-ip
+                    data-type: STRING
+                    value: <hss_ip>
+              - seq: "3"
+                name: restart-hss
+            juju:
+              charm: hsscharm    
   int-virtual-link-desc:
     - id: s6a
   ext-cpd: