From: gomezchavez Date: Mon, 28 Jun 2021 15:59:31 +0000 (-0400) Subject: Fixes bug 1658 package-create update with sol006 templates X-Git-Tag: v9.1.4 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=08095b54c086c3276601c9e9c4d7c285a483b425;p=osm%2Fosmclient.git Fixes bug 1658 package-create update with sol006 templates Change-Id: I88c1ed42a2340aa91c6bbfc0bf09b2b90450db99 Signed-off-by: gomezchavez --- diff --git a/osmclient/common/package_tool.py b/osmclient/common/package_tool.py index e792ce9..aa31ed8 100644 --- a/osmclient/common/package_tool.py +++ b/osmclient/common/package_tool.py @@ -39,7 +39,7 @@ class PackageTool(object): self._validator = validation_im() def create(self, package_type, base_directory, package_name, override, image, vdus, vcpu, memory, storage, - interfaces, vendor, detailed, netslice_subnets, netslice_vlds): + interfaces, vendor, detailed, netslice_subnets, netslice_vlds, old): """ **Create a package descriptor** @@ -56,6 +56,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 """ @@ -64,11 +65,11 @@ 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, "vdus": vdus, "clean": False, "interfaces": interfaces, "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, "vdus": vdus, "clean": False, "interfaces": interfaces, "image": image, "vcpu": vcpu, "memory": memory, "storage": storage, "detailed": detailed} elif package_type == 'nst': diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index d9136f3..54f902b 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -4265,6 +4265,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, package_type, @@ -4280,7 +4283,8 @@ def package_create(ctx, vendor, detailed, netslice_subnets, - netslice_vlds): + netslice_vlds, + old,): """ Creates an OSM NS, VNF, NST package @@ -4306,7 +4310,8 @@ def package_create(ctx, vendor=vendor, detailed=detailed, netslice_subnets=netslice_subnets, - netslice_vlds=netslice_vlds) + netslice_vlds=netslice_vlds, + old=old,) print(resp) # except ClientException as inst: # print("ERROR: {}".format(inst)) diff --git a/osmclient/templates/nsd.yaml.j2 b/osmclient/templates/nsd.yaml.j2 index 0e0c7a3..8feeacb 100644 --- a/osmclient/templates/nsd.yaml.j2 +++ b/osmclient/templates/nsd.yaml.j2 @@ -13,181 +13,39 @@ # 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: 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: - # vim-network-name: Name of network in VIM account - # ip-profile-ref: Name of reference of IP profile object - # provider-network: - # physical-network: Name of the physical network on which provider network is built - # segmentation_id: 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: 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: 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: - # description: - # ip-profile-params: - # - ip-version: - # subnet-address: - # gateway-address: - # security-group: - # subnet-prefix-pool: - # dns-server: - # - address: - # dhcp-params: - # - enabled: - # start-address: - # count: - - # Information about NS configuration - #ns-configuration: - # juju: - # charm: - # proxy: - # vca-relationships: - # relation: - # - requires: - # provides: - - # # List of config primitives supported by the - # # configuration agent for this NS. - # config-primitive: - # - name: - # parameter: - # - name: - # data-type: - # mandatory: - # default-value: - # parameter-pool: - # read-only: - # hidden: - - # # Initial set of configuration primitives. - # initial-config-primitive: - # - seq: - # name: - # parameter: - # - name: - # data-type: - # value: - - # # Terminate set of configuration primitives. - # terminate-config-primitive: - # - seq: - # name: - # parameter: - # - name: - # data-type: - # value: - - # # List of VCA related metric - # metrics: - # - name: - - # Used to configure the list of public keys to be injected as part - # of ns instantiation - #key-pair: - #- name: - # key: - - # List of users to be added through cloud-config - #user: - #- name: - # user-info: - # key-pair: - # - name: - # key: - - # List of VNF Forwarding Graph Descriptors (VNFFGD) - #vnffgd: - #- id: - # name: - # short-name: - # vendor: - # description: - # version: - # # List of Rendered Service Paths - # rsp: - # - id: - # name: - # vnfd-connection-point-ref: - # - member-vnf-index-ref: - # order: - # vnfd-id-ref: - # vnfd-ingress-connection-point-ref: - # vnfd-egress-connection-point-ref: - # # List of classifier rules - # classifier: - # - id: - # name: - # rsp-id-ref: - # member-vnf-index-ref: - # vnfd-id-ref: - # vnfd-connection-point-ref: - # match-attributes: - # - id: - # ip-proto: - # source-ip-address: - # destination-ip-address: - # source-port: - # destination-port: + # ip-address: 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: 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 index 0000000..796cd34 --- /dev/null +++ b/osmclient/templates/nsd_old.yaml.j2 @@ -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: 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: + # vim-network-name: Name of network in VIM account + # ip-profile-ref: Name of reference of IP profile object + # provider-network: + # physical-network: Name of the physical network on which provider network is built + # segmentation_id: 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: 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: 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: + # description: + # ip-profile-params: + # - ip-version: + # subnet-address: + # gateway-address: + # security-group: + # subnet-prefix-pool: + # dns-server: + # - address: + # dhcp-params: + # - enabled: + # start-address: + # count: + + # Information about NS configuration + #ns-configuration: + # juju: + # charm: + # proxy: + # vca-relationships: + # relation: + # - requires: + # provides: + + # # List of config primitives supported by the + # # configuration agent for this NS. + # config-primitive: + # - name: + # parameter: + # - name: + # data-type: + # mandatory: + # default-value: + # parameter-pool: + # read-only: + # hidden: + + # # Initial set of configuration primitives. + # initial-config-primitive: + # - seq: + # name: + # parameter: + # - name: + # data-type: + # value: + + # # Terminate set of configuration primitives. + # terminate-config-primitive: + # - seq: + # name: + # parameter: + # - name: + # data-type: + # value: + + # # List of VCA related metric + # metrics: + # - name: + + # Used to configure the list of public keys to be injected as part + # of ns instantiation + #key-pair: + #- name: + # key: + + # List of users to be added through cloud-config + #user: + #- name: + # user-info: + # key-pair: + # - name: + # key: + + # List of VNF Forwarding Graph Descriptors (VNFFGD) + #vnffgd: + #- id: + # name: + # short-name: + # vendor: + # description: + # version: + # # List of Rendered Service Paths + # rsp: + # - id: + # name: + # vnfd-connection-point-ref: + # - member-vnf-index-ref: + # order: + # vnfd-id-ref: + # vnfd-ingress-connection-point-ref: + # vnfd-egress-connection-point-ref: + # # List of classifier rules + # classifier: + # - id: + # name: + # rsp-id-ref: + # member-vnf-index-ref: + # vnfd-id-ref: + # vnfd-connection-point-ref: + # match-attributes: + # - id: + # ip-proto: + # source-ip-address: + # destination-ip-address: + # source-port: + # destination-port: + {%- endif %} \ No newline at end of file diff --git a/osmclient/templates/vnfd.yaml.j2 b/osmclient/templates/vnfd.yaml.j2 index 0dfc1f2..b0a6c48 100644 --- a/osmclient/templates/vnfd.yaml.j2 +++ b/osmclient/templates/vnfd.yaml.j2 @@ -14,321 +14,205 @@ # 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: - - {%- 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: - #mgmt-vpci: - {%- 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: - {%- 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: - #bandwidth: - {%- endif %} - external-connection-point-ref: vnf-cp0 - {%- if detailed is sameas true %} - #internal-connection-point-ref: - #mac-address - #mgmt-interface: - {%- endif %} - - {%- for x in range(1, interfaces + 1 ) %} - - name: eth{{ x }} - type: EXTERNAL - virtual-interface: - type: PARAVIRT - {%- if detailed is sameas true %} - #vpci: - #bandwidth: - {%- endif %} - external-connection-point-ref: vnf-cp{{ x }} - {%- if detailed is sameas true %} - #internal-connection-point-ref: - #mac-address - #mgmt-interface: - {%- endif %} - {%- endfor %} - - {%- if detailed is sameas true %} - #guest-epa: - # mempage-size: - # # Choice cpu-pinning / cpu-quota - # cpu-pinning-policy: [DEDICATED, SHARED, ANY] - # cpu-thread-pinning-policy: [AVOID, SEPARATED, ISOLATE, PREFER] - # cpu-quota: - # limit: - # reserve: - # shares: - # mem-quota: - # limit: - # reserve: - # shares: - # disk-io-quota: - # limit: - # reserve: - # shares: - # vif-quota: - # limit: - # reserve: - # shares: - - #alarm: - #- alarm-id: - # vnf-monitoring-param-ref: - # operation: - # value: - # actions: - # ok: - # - url: - # insufficient-data: - # - url: - # alarm: - # - url: - # - #alternative-images: - #- vim-type: - # image: - # image-checksum: - # - #vdu-configuration: - # # Configure the VNF or VDU through Juju. - # juju: - # charm: - # proxy: - # vca-relationships: - # relation: - # - requires: - # provides: - # config-primitive: - # - name: - # parameter: - # - name: - # data-type: - # mandatory: - # default-value: - # parameter-pool: - # read-only: - # hidden: - # initial-config-primitive: - # - seq: - # name: - # parameter: - # - name: - # data-type: - # value: - # terminate-config-primitive: - # - seq: - # name: - # parameter: - # - name: - # data-type: - # value: - # metrics: - # - name: - # config-access: - # ssh-access: - # required: - # default-user: - # - #monitoring-param: - #- id: - # nfvi-metric: - # interface-name-ref: - # - ## Choice cloud-init / cloud-init-file - #cloud-init: - #cloud-init-file: - #supplemental-boot-data: - # boot-data-drive: - # - #internal-connection-point: - #- id: - # name: - # short-name: - # type: - # port-security-enabled: - # internal-vld-ref: - # - #interface: - #- name: - # position: - # mgmt-interface: - # type: - # mac-address: - # # Choice: connection-point-type | internal-connection-point-ref / external-connection-point-ref - # internal-connection-point-ref: - # external-connection-point-ref: - # virtual-interface: - # type: # PARAVIRT,OM-MGMT,PCI-PASSTHROUGH,SR-IOV,VIRTIO,E1000,RTL8139,PCNET - # vpci: - # bandwidth: - # - #volumes: - #- name: - # description: - # size: - # device-bus: # ide, usb, virtio, iscsi - # device-type: # disk, cdrom, floopy, lun - # # Choice volume-source | ephemeral / image - # ephemeral: - # image: - # image-checksum: - - #scaling-group-descriptor: - #- name: - # min-instance-count: - # max-instance-count: - # scaling-policy: - # - name: - # scaling-type: - # enabled: - # scale-in-operator-type: - # scale-out-operator-type: - # threshold-time: - # cooldown-time: - # scaling-criteria: - # - name: - # scale-in-threshold: - # scale-in-relational-operation: - # scale-out-threshold: - # scale-out-relational-operation: - # vnf-monitoring-param-ref: - # vdu: - # - vdu-id-ref: - # count: - # scaling-config-action: - # - trigger: - # vnf-config-primitive-name-ref: - - # List of monitoring params at NS level - #monitoring-param: - #- id: - # name: - # aggregation-type: - # # Choice monitoring-type | vdu-monitoring-param / vnf-metric / vdu-metric - # vdu-monitoring-param: - # vdu-ref: - # vdu-monitoring-param-ref: - # vnf-metric: - # vnfm-metric-name-ref: - # vdu-metric: - # vdu-ref: - # vdu-metric-name-ref: - # - # Placement groups at VNF Level - #placement-groups: - #- name: - # requirement: - # strategy: # COLOCATION, ISOLATION - # member-vdus: - # - member-vdu-ref: - {%- 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: - #mgmt-vpci: - {%- 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: - {%- 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: - #bandwidth: - {%- endif %} - external-connection-point-ref: vnf-cp0 - {%- if detailed is sameas true %} - #internal-connection-point-ref: - #mac-address - #mgmt-interface: - {%- endif %} - - {%- for z in range(1, interfaces + 1 ) %} - - name: eth{{ z }} - type: EXTERNAL - virtual-interface: - type: PARAVIRT - {%- if detailed is sameas true %} - #vpci: - #bandwidth: - {%- endif %} - external-connection-point-ref: vnf-cp{{ z }} - {%- if detailed is sameas true %} - #internal-connection-point-ref: - #mac-address - #mgmt-interface: - {%- 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: + # reserve: + # shares: + {%- 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: [dynamic, static] + # thread-policy: [AVOID, SEPARATED, ISOLATE, PREFER] + # cpu-quota: + # limit: + # reserve: + # shares: + {%- endif %} + virtual-memory: + size: {{ memory }} + {%- if detailed is sameas true %} + #guest-epa: + # mempage-size: + # mem-quota: + # limit: + # reserve: + # shares: + {%- endif %} + sw-image-desc: + - id: "{{ image }}" + name: "{{ image }}" + image: "{{ image }}" + {%- if detailed is sameas true %} + #- id: + # name: + # image: + # vim-type: + {%- 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: + # proxy: + # vca-relationships: + # relation: + # - requires: + # provides: + # config-primitive: + # - name: + # parameter: + # - name: + # data-type: + # mandatory: + # default-value: + # parameter-pool: + # read-only: + # hidden: + # initial-config-primitive: + # - seq: + # name: + # parameter: + # - name: + # data-type: + # value: + # terminate-config-primitive: + # - seq: + # name: + # parameter: + # - name: + # data-type: + # value: + # metrics: + # - name: + # config-access: + # ssh-access: + # required: + # default-user: + #scaling-aspect: + #- id: + # name: + # max-scale-level: + # scaling-policy: + # - name: + # scaling-type: + # enabled: + # scale-in-operator-type: + # scale-out-operator-type: + # threshold-time: + # cooldown-time: + # scaling-criteria: + # - name: + # scale-in-threshold: + # scale-in-relational-operation: + # scale-out-threshold: + # scale-out-relational-operation: + # vnf-monitoring-param-ref: + # scaling-config-action: + # - trigger: + # vnf-config-primitive-name-ref: + # aspect-delta-details: + # id: -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: + # requirement: + # strategy: # COLOCATION, ISOLATION + # member-vdus: + # - member-vdu-ref: + {%- 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: + #cloud-init-file: + #supplemental-boot-data: + # boot-data-drive: + #alarm: + #- alarm-id: + # vnf-monitoring-param-ref: + # operation: + # value: + # actions: + # ok: + # - url: + # insufficient-data: + # - url: + # alarm: + # - url: + #pdu-type: + #alternative-sw-image-desc: + #- id: + # name: + # image: + # vim-type: + {%- endif %} + virtual-storage-desc: + - {{ name }}_vnfd-VM-storage + virtual-compute-desc: {{ name }}_vnfd-VM-compute + {%- if detailed is sameas true %} + #monitoring-parameter: + #- id: + # name: + # performance-metric: + {%- endif %} + int-cpd: + - id: eth0-int + virtual-network-interface-requirement: + - name: eth0 + virtual-interface: + type: PARAVIRT + {%- if detailed is sameas true %} + #vpci: + #bandwidth: + {%- 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: + #port-security-disable-strategy: + {%- 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 index 0000000..7da4086 --- /dev/null +++ b/osmclient/templates/vnfd_old.yaml.j2 @@ -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: + + {%- 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: + #mgmt-vpci: + {%- 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: + {%- 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: + #bandwidth: + {%- endif %} + external-connection-point-ref: vnf-cp0 + {%- if detailed is sameas true %} + #internal-connection-point-ref: + #mac-address + #mgmt-interface: + {%- endif %} + + {%- for x in range(1, interfaces + 1 ) %} + - name: eth{{ x }} + type: EXTERNAL + virtual-interface: + type: PARAVIRT + {%- if detailed is sameas true %} + #vpci: + #bandwidth: + {%- endif %} + external-connection-point-ref: vnf-cp{{ x }} + {%- if detailed is sameas true %} + #internal-connection-point-ref: + #mac-address + #mgmt-interface: + {%- endif %} + {%- endfor %} + + {%- if detailed is sameas true %} + #guest-epa: + # mempage-size: + # # Choice cpu-pinning / cpu-quota + # cpu-pinning-policy: [DEDICATED, SHARED, ANY] + # cpu-thread-pinning-policy: [AVOID, SEPARATED, ISOLATE, PREFER] + # cpu-quota: + # limit: + # reserve: + # shares: + # mem-quota: + # limit: + # reserve: + # shares: + # disk-io-quota: + # limit: + # reserve: + # shares: + # vif-quota: + # limit: + # reserve: + # shares: + + #alarm: + #- alarm-id: + # vnf-monitoring-param-ref: + # operation: + # value: + # actions: + # ok: + # - url: + # insufficient-data: + # - url: + # alarm: + # - url: + # + #alternative-images: + #- vim-type: + # image: + # image-checksum: + # + #vdu-configuration: + # # Configure the VNF or VDU through Juju. + # juju: + # charm: + # proxy: + # vca-relationships: + # relation: + # - requires: + # provides: + # config-primitive: + # - name: + # parameter: + # - name: + # data-type: + # mandatory: + # default-value: + # parameter-pool: + # read-only: + # hidden: + # initial-config-primitive: + # - seq: + # name: + # parameter: + # - name: + # data-type: + # value: + # terminate-config-primitive: + # - seq: + # name: + # parameter: + # - name: + # data-type: + # value: + # metrics: + # - name: + # config-access: + # ssh-access: + # required: + # default-user: + # + #monitoring-param: + #- id: + # nfvi-metric: + # interface-name-ref: + # + ## Choice cloud-init / cloud-init-file + #cloud-init: + #cloud-init-file: + #supplemental-boot-data: + # boot-data-drive: + # + #internal-connection-point: + #- id: + # name: + # short-name: + # type: + # port-security-enabled: + # internal-vld-ref: + # + #interface: + #- name: + # position: + # mgmt-interface: + # type: + # mac-address: + # # Choice: connection-point-type | internal-connection-point-ref / external-connection-point-ref + # internal-connection-point-ref: + # external-connection-point-ref: + # virtual-interface: + # type: # PARAVIRT,OM-MGMT,PCI-PASSTHROUGH,SR-IOV,VIRTIO,E1000,RTL8139,PCNET + # vpci: + # bandwidth: + # + #volumes: + #- name: + # description: + # size: + # device-bus: # ide, usb, virtio, iscsi + # device-type: # disk, cdrom, floopy, lun + # # Choice volume-source | ephemeral / image + # ephemeral: + # image: + # image-checksum: + + #scaling-group-descriptor: + #- name: + # min-instance-count: + # max-instance-count: + # scaling-policy: + # - name: + # scaling-type: + # enabled: + # scale-in-operator-type: + # scale-out-operator-type: + # threshold-time: + # cooldown-time: + # scaling-criteria: + # - name: + # scale-in-threshold: + # scale-in-relational-operation: + # scale-out-threshold: + # scale-out-relational-operation: + # vnf-monitoring-param-ref: + # vdu: + # - vdu-id-ref: + # count: + # scaling-config-action: + # - trigger: + # vnf-config-primitive-name-ref: + + # List of monitoring params at NS level + #monitoring-param: + #- id: + # name: + # aggregation-type: + # # Choice monitoring-type | vdu-monitoring-param / vnf-metric / vdu-metric + # vdu-monitoring-param: + # vdu-ref: + # vdu-monitoring-param-ref: + # vnf-metric: + # vnfm-metric-name-ref: + # vdu-metric: + # vdu-ref: + # vdu-metric-name-ref: + # + # Placement groups at VNF Level + #placement-groups: + #- name: + # requirement: + # strategy: # COLOCATION, ISOLATION + # member-vdus: + # - member-vdu-ref: + {%- 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: + #mgmt-vpci: + {%- 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: + {%- 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: + #bandwidth: + {%- endif %} + external-connection-point-ref: vnf-cp0 + {%- if detailed is sameas true %} + #internal-connection-point-ref: + #mac-address + #mgmt-interface: + {%- endif %} + + {%- for z in range(1, interfaces + 1 ) %} + - name: eth{{ z }} + type: EXTERNAL + virtual-interface: + type: PARAVIRT + {%- if detailed is sameas true %} + #vpci: + #bandwidth: + {%- endif %} + external-connection-point-ref: vnf-cp{{ z }} + {%- if detailed is sameas true %} + #internal-connection-point-ref: + #mac-address + #mgmt-interface: + {%- 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