Fix Bug1659 package-create update with sol006 templates 77/11177/3
authorgomezchavez <guillermo.gomez.external@atos.net>
Tue, 14 Sep 2021 09:18:47 +0000 (11:18 +0200)
committerbeierlm <mark.beierl@canonical.com>
Mon, 27 Sep 2021 17:24:06 +0000 (19:24 +0200)
Change-Id: I9ad8cad6932e46caa855da7e7fe87feacdb840e8
Signed-off-by: gomezchavez <guillermo.gomez.external@atos.net>
osmclient/common/package_tool.py
osmclient/scripts/osm.py
osmclient/templates/nsd.yaml.j2
osmclient/templates/nsd_old.yaml.j2 [new file with mode: 0644]
osmclient/templates/vnfd.yaml.j2
osmclient/templates/vnfd_old.yaml.j2 [new file with mode: 0644]

index 186d486..658b8e0 100644 (file)
@@ -54,6 +54,7 @@ class PackageTool(object):
         detailed,
         netslice_subnets,
         netslice_vlds,
+        old,
     ):
         """
         **Create a package descriptor**
@@ -71,6 +72,7 @@ class PackageTool(object):
             - detailed: include all possible values for NSD, VNFD, NST
             - netslice_subnets: number of netslice_subnets for the NST
             - netslice_vlds: number of virtual link descriptors for the NST
+            - old: flag to create a package using the IM of OSM<9
 
         :return: status
         """
@@ -79,7 +81,7 @@ class PackageTool(object):
         file_loader = PackageLoader("osmclient")
         env = Environment(loader=file_loader)
         if package_type == "ns":
-            template = env.get_template("nsd.yaml.j2")
+            template = env.get_template("nsd.yaml.j2" if not old else "nsd_old.yaml.j2")
             content = {
                 "name": package_name,
                 "vendor": vendor,
@@ -89,7 +91,7 @@ class PackageTool(object):
                 "detailed": detailed,
             }
         elif package_type == "vnf":
-            template = env.get_template("vnfd.yaml.j2")
+            template = env.get_template("vnfd.yaml.j2" if not old else "vnfd_old.yaml.j2")
             content = {
                 "name": package_name,
                 "vendor": vendor,
@@ -103,6 +105,7 @@ class PackageTool(object):
                 "detailed": detailed,
             }
         elif package_type == "nst":
+            # TODO: repo-index did not support nst in OSM<9, no changes in template
             template = env.get_template("nst.yaml.j2")
             content = {
                 "name": package_name,
@@ -117,9 +120,9 @@ class PackageTool(object):
                 "Wrong descriptor type {}. Options: ns, vnf, nst".format(package_type)
             )
 
-        # print("To be rendered: {}".format(content))
+        self._logger.debug("To be rendered: {}".format(content))
         output = template.render(content)
-        # print(output)
+        self._logger.debug(output)
 
         structure = self.discover_folder_structure(
             base_directory, package_name, override
@@ -156,6 +159,7 @@ class PackageTool(object):
                 descriptor_data = descriptor_file.read()
             desc_type = "-"
             try:
+                # TODO: refactor validation_im.yaml_validation to @staticmethod
                 desc_type, descriptor_data = validation_im.yaml_validation(
                     self, descriptor_data
                 )
@@ -179,6 +183,7 @@ class PackageTool(object):
                     {"type": desc_type, "path": desc_path, "valid": "OK", "error": "-"}
                 )
             except Exception as e:
+                self._logger.error(f"Validation error: {e}", exc_info=True)
                 table.append(
                     {
                         "type": desc_type,
index df638a0..507df02 100755 (executable)
@@ -5772,6 +5772,9 @@ def role_show(ctx, name):
 @click.option(
     "--netslice-vlds", default=1, help="(NST) Number of netslice vlds. Default 1"
 )
+@click.option(
+    "--old", default=False, is_flag=True, help="Support flag for old versions of the OSM IM (OSM<9)"
+)
 @click.pass_context
 def package_create(
     ctx,
@@ -5789,6 +5792,7 @@ def package_create(
     detailed,
     netslice_subnets,
     netslice_vlds,
+    old,
 ):
     """
     Creates an OSM NS, VNF, NST package
@@ -5821,6 +5825,7 @@ def package_create(
         detailed=detailed,
         netslice_subnets=netslice_subnets,
         netslice_vlds=netslice_vlds,
+        old=old,
     )
     print(resp)
     # except ClientException as inst:
index 0e0c7a3..8feeacb 100644 (file)
 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 #    License for the specific language governing permissions and limitations
 #    under the License.
-
-nsd-catalog:
-    schema-version: "v3.0"
-    nsd:
-    -   id: {{ name }}_nsd
-        name: {{ name }}_nsd
-        short-name: {{ name }}_nsd
-        vendor: {{ vendor }}
-        description: Generated by OSM package generator
-        version: '1.0'
-        {%- if detailed is sameas true %}
-
-        # Place the logo as png in icons directory and provide the name here
-        # logo: <update, optional> Example: icons/logo.png
-        {%- endif %}
-
-        # Specify the VNFDs that are part of this NSD
-        constituent-vnfd:
-        # The member-vnf-index needs to be unique, starting from 1
-        # vnfd-id-ref is the id of the VNFD
-        # Multiple constituent VNFDs can be specified
-        -   member-vnf-index: "1"
-            vnfd-id-ref: {{ name }}_vnfd
+nsd:
+  nsd:
+  - id: {{ name }}_nsd
+    name: {{ name }}_nsd
+    designer: {{ vendor }}
+    description: Generated by OSM package generator
+    version: '1.0'
+    vnfd-id:
+    - {{ name }}_vnfd
+    df:
+    - id: default-df
+      vnf-profile:
+      - id: "1"
+        vnfd-id: {{ name }}_vnfd
+        virtual-link-connectivity:
+        - virtual-link-profile-id: {{ name }}_nsd_vld0
+          constituent-cpd-id:
+          - constituent-base-element-id: "1"
+            constituent-cpd-id: vnf-cp0-ext
             {%- if detailed is sameas true %}
-            # start-by-default: True
-            {%- endif %}
-
-        # Networks for the VNFs
-        vld:
-        -   id: {{ name }}_nsd_vld0
-            name: mgmt
-            short-name: mgmt
-            type: ELAN
-            mgmt-network: true
-            {%- if detailed is sameas true %}
-            # description: <update>
-            # vim-network-name: <update> Name of network in VIM account
-            # ip-profile-ref: <update> Name of reference of IP profile object
-            # provider-network:
-            #     physical-network: <update> Name of the physical network on which provider network is built
-            #     segmentation_id: <update> ID of segregated virtual network
-            {%- endif %}
-
-            # Specify the constituent VNFs
-            # member-vnf-index-ref - entry from constituent vnf
-            # vnfd-id-ref - VNFD id
-            # vnfd-connection-point-ref - connection point name in the VNFD
-            vnfd-connection-point-ref:
-            -   member-vnf-index-ref: "1"
-                vnfd-id-ref: {{ name }}_vnfd
-                # NOTE: Validate the entry below
-                vnfd-connection-point-ref: vnf-cp0
-                {%- if detailed is sameas true %}
-                # ip-address: <update> IP address of the connection point
-                {%- endif %}
-
-            {%- for x in range(1, interfaces + 1 ) %}
-            -   member-vnf-index-ref: "1"
-                vnfd-id-ref: {{ name }}_vnfd
-                # NOTE: Validate the entry below
-                vnfd-connection-point-ref: vnf-cp{{ x }}
-                {%- if detailed is sameas true %}
-                # ip-address: <update> IP address of the connection point
-                {%- endif %}
-            {%- endfor %}
-
-            {%- if detailed is sameas true %}
-            # List of IP Profiles.
-            # IP Profile describes the IP characteristics for the Virtual-Link
-            #ip-profiles
-            #-   name: <update>
-            #    description: <update>
-            #    ip-profile-params:
-            #    -   ip-version:
-            #        subnet-address: <update>
-            #        gateway-address: <update>
-            #        security-group: <update>
-            #        subnet-prefix-pool: <update>
-            #        dns-server:
-            #        -   address: <update>
-            #        dhcp-params:
-            #        -   enabled: <update>
-            #            start-address: <update>
-            #            count: <update>
-
-            # Information about NS configuration
-            #ns-configuration:
-            #    juju:
-            #        charm: <update>
-            #        proxy: <update>
-            #        vca-relationships:
-            #            relation:
-            #            -   requires: <update>
-            #                provides: <update>
-
-            #    # List of config primitives supported by the
-            #    # configuration agent for this NS.
-            #    config-primitive:
-            #    -   name: <update>
-            #        parameter:
-            #        -   name: <update>
-            #            data-type: <update>
-            #            mandatory: <update>
-            #            default-value: <update>
-            #            parameter-pool: <update>
-            #            read-only: <update>
-            #            hidden: <update>
-
-            #    # Initial set of configuration primitives.
-            #    initial-config-primitive:
-            #    -   seq: <update>
-            #        name: <update>
-            #        parameter:
-            #        -   name: <update>
-            #            data-type: <update>
-            #            value: <update>
-
-            #    # Terminate set of configuration primitives.
-            #    terminate-config-primitive:
-            #    -   seq: <update>
-            #        name: <update>
-            #        parameter:
-            #        -   name: <update>
-            #            data-type: <update>
-            #            value: <update>
-
-            #    # List of VCA related metric
-            #    metrics:
-            #    -   name: <update>
-
-            # Used to configure the list of public keys to be injected as part
-            # of ns instantiation
-            #key-pair:
-            #-   name: <update>
-            #    key: <update>
-
-            # List of users to be added through cloud-config
-            #user:
-            #-   name: <update>
-            #    user-info: <update>
-            #    key-pair:
-            #    -   name: <update>
-            #        key: <update>
-
-            # List of VNF Forwarding Graph Descriptors (VNFFGD)
-            #vnffgd:
-            #-   id: <update>
-            #    name: <update>
-            #    short-name: <update>
-            #    vendor: <update>
-            #    description: <update>
-            #    version: <update>
-            #    # List of Rendered Service Paths
-            #    rsp:
-            #    -   id: <update>
-            #        name: <update>
-            #        vnfd-connection-point-ref:
-            #        -   member-vnf-index-ref: <update>
-            #            order: <update>
-            #            vnfd-id-ref: <update>
-            #            vnfd-ingress-connection-point-ref: <update>
-            #            vnfd-egress-connection-point-ref: <update>
-            #    # List of classifier rules
-            #    classifier:
-            #    -   id: <update>
-            #        name: <update>
-            #        rsp-id-ref: <update>
-            #        member-vnf-index-ref: <update>
-            #        vnfd-id-ref: <update>
-            #        vnfd-connection-point-ref: <update>
-            #        match-attributes:
-            #        -   id: <update>
-            #            ip-proto: <update>
-            #            source-ip-address: <update>
-            #            destination-ip-address: <update>
-            #            source-port: <update>
-            #            destination-port: <update>
+            # ip-address: <update> IP address of the connection point
             {%- endif %}
+    virtual-link-desc:
+    - id: {{ name }}_nsd_vld0
+      mgmt-network: true
+      {%- if detailed is sameas true %}
+      #vim-network-name: <update> Name of network in VIM account
+      {%- endif %}
+    {%- if detailed is sameas true %}
+    #ns-configuration:
+      #relation:
+      #- name: relation
+      #  entities:
+      #  - id: "1"
+      #    endpoint: interface
+    {%- endif %}
\ No newline at end of file
diff --git a/osmclient/templates/nsd_old.yaml.j2 b/osmclient/templates/nsd_old.yaml.j2
new file mode 100644 (file)
index 0000000..796cd34
--- /dev/null
@@ -0,0 +1,193 @@
+# Copyright 2021 ETSI OSM
+#
+# All Rights Reserved.
+#
+#    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.
+
+nsd-catalog:
+    schema-version: "v3.0"
+    nsd:
+    -   id: {{ name }}_nsd
+        name: {{ name }}_nsd
+        short-name: {{ name }}_nsd
+        vendor: {{ vendor }}
+        description: Generated by OSM package generator
+        version: '1.0'
+        {%- if detailed is sameas true %}
+
+        # Place the logo as png in icons directory and provide the name here
+        # logo: <update, optional> Example: icons/logo.png
+        {%- endif %}
+
+        # Specify the VNFDs that are part of this NSD
+        constituent-vnfd:
+        # The member-vnf-index needs to be unique, starting from 1
+        # vnfd-id-ref is the id of the VNFD
+        # Multiple constituent VNFDs can be specified
+        -   member-vnf-index: "1"
+            vnfd-id-ref: {{ name }}_vnfd
+            {%- if detailed is sameas true %}
+            # start-by-default: True
+            {%- endif %}
+
+        # Networks for the VNFs
+        vld:
+        -   id: {{ name }}_nsd_vld0
+            name: mgmt
+            short-name: mgmt
+            type: ELAN
+            mgmt-network: true
+            {%- if detailed is sameas true %}
+            # description: <update>
+            # vim-network-name: <update> Name of network in VIM account
+            # ip-profile-ref: <update> Name of reference of IP profile object
+            # provider-network:
+            #     physical-network: <update> Name of the physical network on which provider network is built
+            #     segmentation_id: <update> ID of segregated virtual network
+            {%- endif %}
+
+            # Specify the constituent VNFs
+            # member-vnf-index-ref - entry from constituent vnf
+            # vnfd-id-ref - VNFD id
+            # vnfd-connection-point-ref - connection point name in the VNFD
+            vnfd-connection-point-ref:
+            -   member-vnf-index-ref: "1"
+                vnfd-id-ref: {{ name }}_vnfd
+                # NOTE: Validate the entry below
+                vnfd-connection-point-ref: vnf-cp0
+                {%- if detailed is sameas true %}
+                # ip-address: <update> IP address of the connection point
+                {%- endif %}
+
+            {%- for x in range(1, interfaces + 1 ) %}
+            -   member-vnf-index-ref: "1"
+                vnfd-id-ref: {{ name }}_vnfd
+                # NOTE: Validate the entry below
+                vnfd-connection-point-ref: vnf-cp{{ x }}
+                {%- if detailed is sameas true %}
+                # ip-address: <update> IP address of the connection point
+                {%- endif %}
+            {%- endfor %}
+
+            {%- if detailed is sameas true %}
+            # List of IP Profiles.
+            # IP Profile describes the IP characteristics for the Virtual-Link
+            #ip-profiles
+            #-   name: <update>
+            #    description: <update>
+            #    ip-profile-params:
+            #    -   ip-version:
+            #        subnet-address: <update>
+            #        gateway-address: <update>
+            #        security-group: <update>
+            #        subnet-prefix-pool: <update>
+            #        dns-server:
+            #        -   address: <update>
+            #        dhcp-params:
+            #        -   enabled: <update>
+            #            start-address: <update>
+            #            count: <update>
+
+            # Information about NS configuration
+            #ns-configuration:
+            #    juju:
+            #        charm: <update>
+            #        proxy: <update>
+            #        vca-relationships:
+            #            relation:
+            #            -   requires: <update>
+            #                provides: <update>
+
+            #    # List of config primitives supported by the
+            #    # configuration agent for this NS.
+            #    config-primitive:
+            #    -   name: <update>
+            #        parameter:
+            #        -   name: <update>
+            #            data-type: <update>
+            #            mandatory: <update>
+            #            default-value: <update>
+            #            parameter-pool: <update>
+            #            read-only: <update>
+            #            hidden: <update>
+
+            #    # Initial set of configuration primitives.
+            #    initial-config-primitive:
+            #    -   seq: <update>
+            #        name: <update>
+            #        parameter:
+            #        -   name: <update>
+            #            data-type: <update>
+            #            value: <update>
+
+            #    # Terminate set of configuration primitives.
+            #    terminate-config-primitive:
+            #    -   seq: <update>
+            #        name: <update>
+            #        parameter:
+            #        -   name: <update>
+            #            data-type: <update>
+            #            value: <update>
+
+            #    # List of VCA related metric
+            #    metrics:
+            #    -   name: <update>
+
+            # Used to configure the list of public keys to be injected as part
+            # of ns instantiation
+            #key-pair:
+            #-   name: <update>
+            #    key: <update>
+
+            # List of users to be added through cloud-config
+            #user:
+            #-   name: <update>
+            #    user-info: <update>
+            #    key-pair:
+            #    -   name: <update>
+            #        key: <update>
+
+            # List of VNF Forwarding Graph Descriptors (VNFFGD)
+            #vnffgd:
+            #-   id: <update>
+            #    name: <update>
+            #    short-name: <update>
+            #    vendor: <update>
+            #    description: <update>
+            #    version: <update>
+            #    # List of Rendered Service Paths
+            #    rsp:
+            #    -   id: <update>
+            #        name: <update>
+            #        vnfd-connection-point-ref:
+            #        -   member-vnf-index-ref: <update>
+            #            order: <update>
+            #            vnfd-id-ref: <update>
+            #            vnfd-ingress-connection-point-ref: <update>
+            #            vnfd-egress-connection-point-ref: <update>
+            #    # List of classifier rules
+            #    classifier:
+            #    -   id: <update>
+            #        name: <update>
+            #        rsp-id-ref: <update>
+            #        member-vnf-index-ref: <update>
+            #        vnfd-id-ref: <update>
+            #        vnfd-connection-point-ref: <update>
+            #        match-attributes:
+            #        -   id: <update>
+            #            ip-proto: <update>
+            #            source-ip-address: <update>
+            #            destination-ip-address: <update>
+            #            source-port: <update>
+            #            destination-port: <update>
+            {%- endif %}
\ No newline at end of file
index 0dfc1f2..b0a6c48 100644 (file)
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-vnfd-catalog:
-    schema-version: "v3.0"
-    vnfd:
-    -   id: {{ name }}_vnfd
-        name: {{ name }}_vnfd
-        short-name: {{ name }}_vnfd
-        description: Generated by OSM package generator
-        vendor: OSM
-        version: '1.0'
-
-        {%- if detailed is sameas true %}
-        #Place the logo as png in icons directory and provide the name here
-        #logo: <update, optional>
-
-        {%- endif %}
-
-        # Management interface
-        mgmt-interface:
-            cp: vnf-cp0
-
-        # At least one VDU need to be specified
-        vdu:
-        # Additional VDUs can be created by copying the
-        # VDU descriptor below
-        -   id: {{ name }}_vnfd-VM
-            name: {{ name }}_vnfd-VM
-            description: {{ name }}_vnfd-VM
-            count: 1
-            {%- if detailed is sameas true %}
-            #pdu-type: <update, optional>
-            #mgmt-vpci: <update, optional>
-            {%- endif %}
-
-            # Flavour of the VM to be instantiated for the VDU
-            vm-flavor:
-                vcpu-count: {{ vcpu }}
-                memory-mb: {{ memory }}
-                storage-gb: {{ storage }}
-
-            # Image including the full path
-            image: "{{ image }}"
-            {%- if detailed is sameas true %}
-            #image-checksum: <update, optional>
-            {%- endif %}
-
-            interface:
-            # Specify the external interfaces
-            # There can be multiple interfaces defined
-            -   name: eth0
-                type: EXTERNAL
-                virtual-interface:
-                    type: PARAVIRT
-                    {%- if detailed is sameas true %}
-                    #vpci: <update, optional>
-                    #bandwidth: <update, optional>
-                    {%- endif %}
-                external-connection-point-ref: vnf-cp0
-                {%- if detailed is sameas true %}
-                #internal-connection-point-ref: <update, optional>
-                #mac-address <update, optional>
-                #mgmt-interface: <update, optional>
-                {%- endif %}
-
-            {%- for x in range(1, interfaces + 1 ) %}
-            -   name: eth{{ x }}
-                type: EXTERNAL
-                virtual-interface:
-                    type: PARAVIRT
-                    {%- if detailed is sameas true %}
-                    #vpci: <update, optional>
-                    #bandwidth: <update, optional>
-                    {%- endif %}
-                external-connection-point-ref: vnf-cp{{ x }}
-                {%- if detailed is sameas true %}
-                #internal-connection-point-ref: <update, optional>
-                #mac-address <update, optional>
-                #mgmt-interface: <update, optional>
-                {%- endif %}
-            {%- endfor %}
-
-            {%- if detailed is sameas true %}
-            #guest-epa:
-            #    mempage-size: <update, optional>
-            #    # Choice cpu-pinning / cpu-quota
-            #    cpu-pinning-policy: <update, optional> [DEDICATED, SHARED, ANY]
-            #    cpu-thread-pinning-policy: <update, optional> [AVOID, SEPARATED, ISOLATE, PREFER]
-            #    cpu-quota:
-            #       limit: <update, optional>
-            #       reserve: <update, optional>
-            #       shares: <update, optional>
-            #    mem-quota:
-            #       limit: <update, optional>
-            #       reserve: <update, optional>
-            #       shares: <update, optional>
-            #    disk-io-quota:
-            #       limit: <update, optional>
-            #       reserve: <update, optional>
-            #       shares: <update, optional>
-            #    vif-quota:
-            #       limit: <update, optional>
-            #       reserve: <update, optional>
-            #       shares: <update, optional>
-
-            #alarm:
-            #-   alarm-id: <update>
-            #    vnf-monitoring-param-ref: <update, optional>
-            #    operation: <update, optional>
-            #    value: <update, optional>
-            #    actions:
-            #        ok:
-            #        -   url: <update>
-            #        insufficient-data:
-            #        -   url: <update>
-            #        alarm:
-            #        -   url: <update>
-            #
-            #alternative-images:
-            #-   vim-type: <update>
-            #    image: <update, optional>
-            #    image-checksum: <update, optional>
-            #
-            #vdu-configuration:
-            #    # Configure the VNF or VDU through Juju.
-            #    juju:
-            #        charm: <update, optional>
-            #        proxy: <update, optional>
-            #        vca-relationships:
-            #            relation:
-            #            -   requires: <update>
-            #                provides: <update>
-            #    config-primitive:
-            #    -   name: <update>
-            #        parameter:
-            #        -   name: <update>
-            #            data-type: <update, optional>
-            #            mandatory: <update, optional>
-            #            default-value: <update, optional>
-            #            parameter-pool: <update, optional>
-            #            read-only: <update, optional>
-            #            hidden: <update, optional>
-            #    initial-config-primitive:
-            #    -   seq: <update>
-            #        name: <update, optional>
-            #        parameter:
-            #        -   name: <update>
-            #            data-type: <update, optional>
-            #            value: <update, optional>
-            #    terminate-config-primitive:
-            #    -   seq: <update>
-            #        name: <update, optional>
-            #        parameter:
-            #        -   name: <update>
-            #            data-type: <update, optional>
-            #            value: <update, optional>
-            #    metrics:
-            #    -   name: <update>
-            #    config-access:
-            #        ssh-access:
-            #            required: <update, optional>
-            #            default-user: <update, optional>
-            #
-            #monitoring-param:
-            #-   id: <update>
-            #    nfvi-metric: <update, optional>
-            #    interface-name-ref: <update, optional>
-            #
-            ## Choice cloud-init / cloud-init-file
-            #cloud-init: <update, optional>
-            #cloud-init-file: <update, optional>
-            #supplemental-boot-data:
-            #    boot-data-drive: <update, optional>
-            #
-            #internal-connection-point:
-            #-   id: <update>
-            #    name: <update, optional>
-            #    short-name: <update, optional>
-            #    type: <update, optional>
-            #    port-security-enabled: <update, optional>
-            #    internal-vld-ref: <update, optional>
-            #
-            #interface:
-            #-   name: <update>
-            #    position: <update, optional>
-            #    mgmt-interface: <update, optional>
-            #    type: <update, optional>
-            #    mac-address: <update, optional>
-            #    # Choice: connection-point-type | internal-connection-point-ref / external-connection-point-ref
-            #    internal-connection-point-ref: <update, optional>
-            #    external-connection-point-ref: <update, optional>
-            #    virtual-interface:
-            #        type: <update, optional> # PARAVIRT,OM-MGMT,PCI-PASSTHROUGH,SR-IOV,VIRTIO,E1000,RTL8139,PCNET
-            #        vpci: <update, optional>
-            #        bandwidth: <update, optional>
-            #
-            #volumes:
-            #-   name: <update>
-            #    description: <update, optional>
-            #    size: <update, optional>
-            #    device-bus: <update, optional> # ide, usb, virtio, iscsi
-            #    device-type: <update, optional> # disk, cdrom, floopy, lun
-            #    # Choice volume-source | ephemeral / image
-            #    ephemeral: <update, optional>
-            #    image: <update, optional>
-            #    image-checksum: <update, optional>
-
-        #scaling-group-descriptor:
-        #-   name: <update>
-        #    min-instance-count: <update, optional>
-        #    max-instance-count: <update, optional>
-        #    scaling-policy:
-        #    -   name: <update>
-        #        scaling-type: <update, optional>
-        #        enabled: <update, optional>
-        #        scale-in-operator-type: <update, optional>
-        #        scale-out-operator-type: <update, optional>
-        #        threshold-time: <update, optional>
-        #        cooldown-time: <update, optional>
-        #        scaling-criteria: <update, optional>
-        #        -   name: <update>
-        #            scale-in-threshold: <update, optional>
-        #            scale-in-relational-operation: <update, optional>
-        #            scale-out-threshold: <update, optional>
-        #            scale-out-relational-operation: <update, optional>
-        #            vnf-monitoring-param-ref: <update, optional>
-        #    vdu:
-        #    -   vdu-id-ref: <update>
-        #        count: <update, optional>
-        #    scaling-config-action:
-        #    -   trigger: <update>
-        #        vnf-config-primitive-name-ref: <update, optional>
-
-        # List of monitoring params at NS level
-        #monitoring-param:
-        #-   id: <update>
-        #    name: <update, optional>
-        #    aggregation-type: <update, optional>
-        #    # Choice monitoring-type | vdu-monitoring-param / vnf-metric / vdu-metric
-        #    vdu-monitoring-param:
-        #        vdu-ref: <update, optional>
-        #        vdu-monitoring-param-ref: <update, optional>
-        #    vnf-metric:
-        #        vnfm-metric-name-ref: <update, optional>
-        #    vdu-metric:
-        #        vdu-ref: <update, optional>
-        #        vdu-metric-name-ref: <update, optional>
-        #
-        # Placement groups at VNF Level
-        #placement-groups:
-        #-   name: <update>
-        #    requirement: <update, optional>
-        #    strategy: <update, optional> # COLOCATION, ISOLATION
-        #    member-vdus:
-        #    -   member-vdu-ref: <update>
-        {%- endif %}
-        {%- if vdus > 1 %}
-        {% for y in range(1, vdus ) %}
-        -   id: {{ name }}_vnfd{{y}}-VM
-            name: {{ name }}_vnfd{{y}}-VM
-            description: {{ name }}_vnfd{{y}}-VM
-            count: 1
-            {%- if detailed is sameas true %}
-            #pdu-type: <update, optional>
-            #mgmt-vpci: <update, optional>
-            {%- endif %}
-
-            # Flavour of the VM to be instantiated for the VDU
-            vm-flavor:
-                vcpu-count: {{ vcpu }}
-                memory-mb: {{ memory }}
-                storage-gb: {{ storage }}
-
-            # Image including the full path
-            image: "{{ image }}"
-            {%- if detailed is sameas true %}
-            #image-checksum: <update, optional>
-            {%- endif %}
-
-            interface:
-            # Specify the external interfaces
-            # There can be multiple interfaces defined
-            -   name: eth0
-                type: EXTERNAL
-                virtual-interface:
-                    type: PARAVIRT
-                    {%- if detailed is sameas true %}
-                    #vpci: <update, optional>
-                    #bandwidth: <update, optional>
-                    {%- endif %}
-                external-connection-point-ref: vnf-cp0
-                {%- if detailed is sameas true %}
-                #internal-connection-point-ref: <update, optional>
-                #mac-address <update, optional>
-                #mgmt-interface: <update, optional>
-                {%- endif %}
-
-            {%- for z in range(1, interfaces + 1 ) %}
-            -   name: eth{{ z }}
-                type: EXTERNAL
-                virtual-interface:
-                    type: PARAVIRT
-                    {%- if detailed is sameas true %}
-                    #vpci: <update, optional>
-                    #bandwidth: <update, optional>
-                    {%- endif %}
-                external-connection-point-ref: vnf-cp{{ z }}
-                {%- if detailed is sameas true %}
-                #internal-connection-point-ref: <update, optional>
-                #mac-address <update, optional>
-                #mgmt-interface: <update, optional>
-                {%- endif %}
-            {%- endfor %}
-        {%- endfor %}
-        {%- endif %}
-        connection-point:
-        -   name: vnf-cp0
-        {%- for x in range(1, interfaces + 1 ) %}
-        -   name: vnf-cp{{ x }}
-        {%- endfor %}
\ No newline at end of file
+vnfd:
+  id: {{ name }}_vnfd
+  product-name: {{ name }}_vnfd
+  description: Generated by OSM package generator
+  provider: OSM
+  version: '1.0'
+  mgmt-cp: vnf-cp0-ext
+  virtual-storage-desc:
+  - id: {{ name }}_vnfd-VM-storage
+    size-of-storage: {{ storage }}
+    {%- if detailed is sameas true %}
+    #disk-io-quota:
+    #  limit: <update, optional>
+    #  reserve: <update, optional>
+    #  shares: <update, optional>
+    {%- endif %}
+  virtual-compute-desc:
+  - id: {{ name }}_vnfd-VM-compute
+    virtual-cpu:
+      num-virtual-cpu: {{ vcpu }}
+      {%- if detailed is sameas true %}
+      #pinning:
+      #  # Choice cpu-pinning / cpu-quota
+      #  policy: <update, optional> [dynamic, static]
+      #  thread-policy: <update, optional> [AVOID, SEPARATED, ISOLATE, PREFER]
+      #  cpu-quota:
+      #    limit: <update, optional>
+      #    reserve: <update, optional>
+      #    shares: <update, optional>
+      {%- endif %}
+    virtual-memory:
+      size: {{ memory }}
+      {%- if detailed is sameas true %}
+      #guest-epa:
+      #  mempage-size: <update, optional>
+      #  mem-quota:
+      #    limit: <update, optional>
+      #    reserve: <update, optional>
+      #    shares: <update, optional>
+      {%- endif %}
+  sw-image-desc:
+  - id: "{{ image }}"
+    name: "{{ image }}"
+    image: "{{ image }}"
+  {%- if detailed is sameas true %}
+  #-  id: <update>
+  #   name: <update, optional>
+  #   image: <update, optional>
+  #   vim-type: <update>
+  {%- endif %}
+  df:
+  - id: default-df
+    instantiation-level:
+    - id: default-instantiation-level
+      vdu-level:
+      - vdu-id: {{ name }}_vnfd-VM
+        number-of-instances: 1
+    vdu-profile:
+    - id: {{ name }}_vnfd-VM
+      min-number-of-instances: 1
+      max-number-of-instances: 1
+    {%- if detailed is sameas true %}
+    #lcm-operations-configuration:
+    #  operate-vnf-op-config:
+    #    day1-2:
+    #    - id: {{ name }}_vnfd-VM
+    #      # Configure the VNF or VDU through Juju.
+    #      juju:
+    #        charm: <update, optional>
+    #        proxy: <update, optional>
+    #        vca-relationships:
+    #          relation:
+    #          - requires: <update>
+    #            provides: <update>
+    #      config-primitive:
+    #      - name: <update>
+    #        parameter:
+    #        - name: <update>
+    #          data-type: <update, optional>
+    #          mandatory: <update, optional>
+    #          default-value: <update, optional>
+    #          parameter-pool: <update, optional>
+    #          read-only: <update, optional>
+    #          hidden: <update, optional>
+    #      initial-config-primitive:
+    #      - seq: <update>
+    #        name: <update, optional>
+    #        parameter:
+    #        - name: <update>
+    #          data-type: <update, optional>
+    #          value: <update, optional>
+    #      terminate-config-primitive:
+    #      - seq: <update>
+    #        name: <update, optional>
+    #        parameter:
+    #        - name: <update>
+    #          data-type: <update, optional>
+    #          value: <update, optional>
+    #      metrics:
+    #      - name: <update>
+    #      config-access:
+    #        ssh-access:
+    #          required: <update, optional>
+    #          default-user: <update, optional>
+    #scaling-aspect:
+    #- id: <update>
+    #  name: <update>
+    #  max-scale-level: <update, optional>
+    #  scaling-policy:
+    #  - name: <update>
+    #    scaling-type: <update, optional>
+    #    enabled: <update, optional>
+    #    scale-in-operator-type: <update, optional>
+    #    scale-out-operator-type: <update, optional>
+    #    threshold-time: <update, optional>
+    #    cooldown-time: <update, optional>
+    #    scaling-criteria: <update, optional>
+    #    - name: <update>
+    #      scale-in-threshold: <update, optional>
+    #      scale-in-relational-operation: <update, optional>
+    #      scale-out-threshold: <update, optional>
+    #      scale-out-relational-operation: <update, optional>
+    #      vnf-monitoring-param-ref: <update, optional>
+    #  scaling-config-action:
+    #  - trigger: <update>
+    #    vnf-config-primitive-name-ref: <update, optional>
+    #  aspect-delta-details:
+    #    id: <update>-delta
+    #    vdu-delta:
+    #    - number-of-instances: 1
+    #      id: {{ name }}_vnfd-VM
+    {%- endif %}
+    {%- if detailed is sameas true %}
+    ## Placement groups at VNF Level
+    #placement-groups:
+    #- name: <update>
+    #  requirement: <update, optional>
+    #  strategy: <update, optional> # COLOCATION, ISOLATION
+    #  member-vdus:
+    #  - member-vdu-ref: <update>
+    {%- endif %}
+    # At least one VDU need to be specified
+    # Additional VDUs can be created by copying the
+    # VDU descriptor below
+  vdu:
+  - id: {{ name }}_vnfd-VM
+    name: {{ name }}_vnfd-VM
+    description: {{ name }}_vnfd-VM
+    sw-image-desc: "{{ image }}"
+    {%- if detailed is sameas true %}
+    ## Choice cloud-init / cloud-init-file
+    #cloud-init: <update, optional>
+    #cloud-init-file: <update, optional>
+    #supplemental-boot-data:
+    #    boot-data-drive: <update, optional>
+    #alarm:
+    #- alarm-id: <update>
+    #  vnf-monitoring-param-ref: <update, optional>
+    #  operation: <update, optional>
+    #  value: <update, optional>
+    #  actions:
+    #    ok:
+    #    - url: <update>
+    #    insufficient-data:
+    #    - url: <update>
+    #    alarm:
+    #    - url: <update>
+    #pdu-type: <update, optional>
+    #alternative-sw-image-desc:
+    #- id: <update>
+    #  name: <update, optional>
+    #  image: <update, optional>
+    #  vim-type: <update>
+    {%- endif %}
+    virtual-storage-desc:
+    - {{ name }}_vnfd-VM-storage
+    virtual-compute-desc: {{ name }}_vnfd-VM-compute
+    {%- if detailed is sameas true %}
+    #monitoring-parameter:
+    #- id: <update>
+    #  name: <update, optional>
+    #  performance-metric: <update>
+    {%- endif %}
+    int-cpd:
+    - id: eth0-int
+      virtual-network-interface-requirement:
+      - name: eth0
+        virtual-interface:
+          type: PARAVIRT
+          {%- if detailed is sameas true %}
+          #vpci: <update, optional>
+          #bandwidth: <update, optional>
+          {%- endif %}
+  ext-cpd:
+  - id: vnf-cp0-ext
+    int-cpd:
+      vdu-id: {{ name }}_vnfd-VM
+      cpd: eth0-int
+      {%- if detailed is sameas true %}
+      #port-security-enabled: <update, optional>
+      #port-security-disable-strategy: <update, optional>
+      {%- endif %}
\ No newline at end of file
diff --git a/osmclient/templates/vnfd_old.yaml.j2 b/osmclient/templates/vnfd_old.yaml.j2
new file mode 100644 (file)
index 0000000..7da4086
--- /dev/null
@@ -0,0 +1,334 @@
+# Copyright 2021 ETSI OSM
+#
+# All Rights Reserved.
+#
+#    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-catalog:
+    schema-version: "v3.0"
+    vnfd:
+    -   id: {{ name }}_vnfd
+        name: {{ name }}_vnfd
+        short-name: {{ name }}_vnfd
+        description: Generated by OSM package generator
+        vendor: OSM
+        version: '1.0'
+
+        {%- if detailed is sameas true %}
+        #Place the logo as png in icons directory and provide the name here
+        #logo: <update, optional>
+
+        {%- endif %}
+
+        # Management interface
+        mgmt-interface:
+            cp: vnf-cp0
+
+        # At least one VDU need to be specified
+        vdu:
+        # Additional VDUs can be created by copying the
+        # VDU descriptor below
+        -   id: {{ name }}_vnfd-VM
+            name: {{ name }}_vnfd-VM
+            description: {{ name }}_vnfd-VM
+            count: 1
+            {%- if detailed is sameas true %}
+            #pdu-type: <update, optional>
+            #mgmt-vpci: <update, optional>
+            {%- endif %}
+
+            # Flavour of the VM to be instantiated for the VDU
+            vm-flavor:
+                vcpu-count: {{ vcpu }}
+                memory-mb: {{ memory }}
+                storage-gb: {{ storage }}
+
+            # Image including the full path
+            image: "{{ image }}"
+            {%- if detailed is sameas true %}
+            #image-checksum: <update, optional>
+            {%- endif %}
+
+            interface:
+            # Specify the external interfaces
+            # There can be multiple interfaces defined
+            -   name: eth0
+                type: EXTERNAL
+                virtual-interface:
+                    type: PARAVIRT
+                    {%- if detailed is sameas true %}
+                    #vpci: <update, optional>
+                    #bandwidth: <update, optional>
+                    {%- endif %}
+                external-connection-point-ref: vnf-cp0
+                {%- if detailed is sameas true %}
+                #internal-connection-point-ref: <update, optional>
+                #mac-address <update, optional>
+                #mgmt-interface: <update, optional>
+                {%- endif %}
+
+            {%- for x in range(1, interfaces + 1 ) %}
+            -   name: eth{{ x }}
+                type: EXTERNAL
+                virtual-interface:
+                    type: PARAVIRT
+                    {%- if detailed is sameas true %}
+                    #vpci: <update, optional>
+                    #bandwidth: <update, optional>
+                    {%- endif %}
+                external-connection-point-ref: vnf-cp{{ x }}
+                {%- if detailed is sameas true %}
+                #internal-connection-point-ref: <update, optional>
+                #mac-address <update, optional>
+                #mgmt-interface: <update, optional>
+                {%- endif %}
+            {%- endfor %}
+
+            {%- if detailed is sameas true %}
+            #guest-epa:
+            #    mempage-size: <update, optional>
+            #    # Choice cpu-pinning / cpu-quota
+            #    cpu-pinning-policy: <update, optional> [DEDICATED, SHARED, ANY]
+            #    cpu-thread-pinning-policy: <update, optional> [AVOID, SEPARATED, ISOLATE, PREFER]
+            #    cpu-quota:
+            #       limit: <update, optional>
+            #       reserve: <update, optional>
+            #       shares: <update, optional>
+            #    mem-quota:
+            #       limit: <update, optional>
+            #       reserve: <update, optional>
+            #       shares: <update, optional>
+            #    disk-io-quota:
+            #       limit: <update, optional>
+            #       reserve: <update, optional>
+            #       shares: <update, optional>
+            #    vif-quota:
+            #       limit: <update, optional>
+            #       reserve: <update, optional>
+            #       shares: <update, optional>
+
+            #alarm:
+            #-   alarm-id: <update>
+            #    vnf-monitoring-param-ref: <update, optional>
+            #    operation: <update, optional>
+            #    value: <update, optional>
+            #    actions:
+            #        ok:
+            #        -   url: <update>
+            #        insufficient-data:
+            #        -   url: <update>
+            #        alarm:
+            #        -   url: <update>
+            #
+            #alternative-images:
+            #-   vim-type: <update>
+            #    image: <update, optional>
+            #    image-checksum: <update, optional>
+            #
+            #vdu-configuration:
+            #    # Configure the VNF or VDU through Juju.
+            #    juju:
+            #        charm: <update, optional>
+            #        proxy: <update, optional>
+            #        vca-relationships:
+            #            relation:
+            #            -   requires: <update>
+            #                provides: <update>
+            #    config-primitive:
+            #    -   name: <update>
+            #        parameter:
+            #        -   name: <update>
+            #            data-type: <update, optional>
+            #            mandatory: <update, optional>
+            #            default-value: <update, optional>
+            #            parameter-pool: <update, optional>
+            #            read-only: <update, optional>
+            #            hidden: <update, optional>
+            #    initial-config-primitive:
+            #    -   seq: <update>
+            #        name: <update, optional>
+            #        parameter:
+            #        -   name: <update>
+            #            data-type: <update, optional>
+            #            value: <update, optional>
+            #    terminate-config-primitive:
+            #    -   seq: <update>
+            #        name: <update, optional>
+            #        parameter:
+            #        -   name: <update>
+            #            data-type: <update, optional>
+            #            value: <update, optional>
+            #    metrics:
+            #    -   name: <update>
+            #    config-access:
+            #        ssh-access:
+            #            required: <update, optional>
+            #            default-user: <update, optional>
+            #
+            #monitoring-param:
+            #-   id: <update>
+            #    nfvi-metric: <update, optional>
+            #    interface-name-ref: <update, optional>
+            #
+            ## Choice cloud-init / cloud-init-file
+            #cloud-init: <update, optional>
+            #cloud-init-file: <update, optional>
+            #supplemental-boot-data:
+            #    boot-data-drive: <update, optional>
+            #
+            #internal-connection-point:
+            #-   id: <update>
+            #    name: <update, optional>
+            #    short-name: <update, optional>
+            #    type: <update, optional>
+            #    port-security-enabled: <update, optional>
+            #    internal-vld-ref: <update, optional>
+            #
+            #interface:
+            #-   name: <update>
+            #    position: <update, optional>
+            #    mgmt-interface: <update, optional>
+            #    type: <update, optional>
+            #    mac-address: <update, optional>
+            #    # Choice: connection-point-type | internal-connection-point-ref / external-connection-point-ref
+            #    internal-connection-point-ref: <update, optional>
+            #    external-connection-point-ref: <update, optional>
+            #    virtual-interface:
+            #        type: <update, optional> # PARAVIRT,OM-MGMT,PCI-PASSTHROUGH,SR-IOV,VIRTIO,E1000,RTL8139,PCNET
+            #        vpci: <update, optional>
+            #        bandwidth: <update, optional>
+            #
+            #volumes:
+            #-   name: <update>
+            #    description: <update, optional>
+            #    size: <update, optional>
+            #    device-bus: <update, optional> # ide, usb, virtio, iscsi
+            #    device-type: <update, optional> # disk, cdrom, floopy, lun
+            #    # Choice volume-source | ephemeral / image
+            #    ephemeral: <update, optional>
+            #    image: <update, optional>
+            #    image-checksum: <update, optional>
+
+        #scaling-group-descriptor:
+        #-   name: <update>
+        #    min-instance-count: <update, optional>
+        #    max-instance-count: <update, optional>
+        #    scaling-policy:
+        #    -   name: <update>
+        #        scaling-type: <update, optional>
+        #        enabled: <update, optional>
+        #        scale-in-operator-type: <update, optional>
+        #        scale-out-operator-type: <update, optional>
+        #        threshold-time: <update, optional>
+        #        cooldown-time: <update, optional>
+        #        scaling-criteria: <update, optional>
+        #        -   name: <update>
+        #            scale-in-threshold: <update, optional>
+        #            scale-in-relational-operation: <update, optional>
+        #            scale-out-threshold: <update, optional>
+        #            scale-out-relational-operation: <update, optional>
+        #            vnf-monitoring-param-ref: <update, optional>
+        #    vdu:
+        #    -   vdu-id-ref: <update>
+        #        count: <update, optional>
+        #    scaling-config-action:
+        #    -   trigger: <update>
+        #        vnf-config-primitive-name-ref: <update, optional>
+
+        # List of monitoring params at NS level
+        #monitoring-param:
+        #-   id: <update>
+        #    name: <update, optional>
+        #    aggregation-type: <update, optional>
+        #    # Choice monitoring-type | vdu-monitoring-param / vnf-metric / vdu-metric
+        #    vdu-monitoring-param:
+        #        vdu-ref: <update, optional>
+        #        vdu-monitoring-param-ref: <update, optional>
+        #    vnf-metric:
+        #        vnfm-metric-name-ref: <update, optional>
+        #    vdu-metric:
+        #        vdu-ref: <update, optional>
+        #        vdu-metric-name-ref: <update, optional>
+        #
+        # Placement groups at VNF Level
+        #placement-groups:
+        #-   name: <update>
+        #    requirement: <update, optional>
+        #    strategy: <update, optional> # COLOCATION, ISOLATION
+        #    member-vdus:
+        #    -   member-vdu-ref: <update>
+        {%- endif %}
+        {%- if vdus > 1 %}
+        {% for y in range(1, vdus ) %}
+        -   id: {{ name }}_vnfd{{y}}-VM
+            name: {{ name }}_vnfd{{y}}-VM
+            description: {{ name }}_vnfd{{y}}-VM
+            count: 1
+            {%- if detailed is sameas true %}
+            #pdu-type: <update, optional>
+            #mgmt-vpci: <update, optional>
+            {%- endif %}
+
+            # Flavour of the VM to be instantiated for the VDU
+            vm-flavor:
+                vcpu-count: {{ vcpu }}
+                memory-mb: {{ memory }}
+                storage-gb: {{ storage }}
+
+            # Image including the full path
+            image: "{{ image }}"
+            {%- if detailed is sameas true %}
+            #image-checksum: <update, optional>
+            {%- endif %}
+
+            interface:
+            # Specify the external interfaces
+            # There can be multiple interfaces defined
+            -   name: eth0
+                type: EXTERNAL
+                virtual-interface:
+                    type: PARAVIRT
+                    {%- if detailed is sameas true %}
+                    #vpci: <update, optional>
+                    #bandwidth: <update, optional>
+                    {%- endif %}
+                external-connection-point-ref: vnf-cp0
+                {%- if detailed is sameas true %}
+                #internal-connection-point-ref: <update, optional>
+                #mac-address <update, optional>
+                #mgmt-interface: <update, optional>
+                {%- endif %}
+
+            {%- for z in range(1, interfaces + 1 ) %}
+            -   name: eth{{ z }}
+                type: EXTERNAL
+                virtual-interface:
+                    type: PARAVIRT
+                    {%- if detailed is sameas true %}
+                    #vpci: <update, optional>
+                    #bandwidth: <update, optional>
+                    {%- endif %}
+                external-connection-point-ref: vnf-cp{{ z }}
+                {%- if detailed is sameas true %}
+                #internal-connection-point-ref: <update, optional>
+                #mac-address <update, optional>
+                #mgmt-interface: <update, optional>
+                {%- endif %}
+            {%- endfor %}
+        {%- endfor %}
+        {%- endif %}
+        connection-point:
+        -   name: vnf-cp0
+        {%- for x in range(1, interfaces + 1 ) %}
+        -   name: vnf-cp{{ x }}
+        {%- endfor %}
\ No newline at end of file