From 89d67e34389cb87e0b0ef451f7194f5a1666f062 Mon Sep 17 00:00:00 2001 From: Mahesh Jethanandani Date: Mon, 25 Nov 2019 16:15:11 -0800 Subject: [PATCH 1/2] Issue#2 --- example-data/complex-vnfd.xml | 20 ++-- example-data/nfv-nsd.xml | 7 +- example-data/nfv-vnfd.xml | 8 +- example-data/nfv.xml | 15 ++- src/yang/etsi-nfv-common.yang | 12 +- src/yang/etsi-nfv-vnf.yang | 219 +++++++++++++++++++++++++--------- 6 files changed, 202 insertions(+), 79 deletions(-) diff --git a/example-data/complex-vnfd.xml b/example-data/complex-vnfd.xml index b10ec9f..9aa8ec9 100644 --- a/example-data/complex-vnfd.xml +++ b/example-data/complex-vnfd.xml @@ -78,11 +78,15 @@ 16 - + root - root-storage - 10 - + block + + 10 + true + CP + + CP CP @@ -116,17 +120,13 @@ internal-vl - - ipv4 - + ipv4 mgmt - - ipv4 - + ipv4 diff --git a/example-data/nfv-nsd.xml b/example-data/nfv-nsd.xml index ba4ec2d..deae7b8 100644 --- a/example-data/nfv-nsd.xml +++ b/example-data/nfv-nsd.xml @@ -36,8 +36,10 @@ asa-vsd - nfv:root-storage - 0 + nfv:block + + 0 + asa-image @@ -49,6 +51,7 @@ bare qcow2 + 0 2.0 1 http://www.cisco.com/asa.qcow2 diff --git a/example-data/nfv-vnfd.xml b/example-data/nfv-vnfd.xml index 7587240..f25d6b1 100644 --- a/example-data/nfv-vnfd.xml +++ b/example-data/nfv-vnfd.xml @@ -35,8 +35,11 @@ asa-vsd - nfv:root-storage - 0 + nfv:file + + 0 + asa-image + asa-image @@ -48,6 +51,7 @@ bare qcow2 + 0 2.0 1 http://www.cisco.com/asa.qcow2 diff --git a/example-data/nfv.xml b/example-data/nfv.xml index 9273101..18a4260 100644 --- a/example-data/nfv.xml +++ b/example-data/nfv.xml @@ -36,8 +36,12 @@ asa-vsd - root-storage - 0 + block + + 1 + true + asa-image + asa-image @@ -150,8 +154,11 @@ csr-vsd - root-storage - 0 + file + + 1 + csr-image + csr-image diff --git a/src/yang/etsi-nfv-common.yang b/src/yang/etsi-nfv-common.yang index 0a1c361..1fa6a08 100644 --- a/src/yang/etsi-nfv-common.yang +++ b/src/yang/etsi-nfv-common.yang @@ -225,22 +225,22 @@ submodule etsi-nfv-common { "Base type of storage that identities can derive from."; } - identity root-storage { + identity block { base storage-type; description - "Root type of storage."; + "Block type of storage."; } - identity swap-storage { + identity object { base storage-type; description - "Swap type of storage."; + "Object type of storage."; } - identity ephemeral-storage { + identity file { base storage-type; description - "Ephemeral type of storage."; + "File type of storage."; } /* diff --git a/src/yang/etsi-nfv-vnf.yang b/src/yang/etsi-nfv-vnf.yang index 43c1109..78e84c1 100755 --- a/src/yang/etsi-nfv-vnf.yang +++ b/src/yang/etsi-nfv-vnf.yang @@ -89,6 +89,62 @@ submodule etsi-nfv-vnf { } } + grouping block-storage-data { + leaf size-of-storage { + type uint64; + units "GB"; + default 0; + description + "Size of virtualized storage resource in GB."; + reference + "GS NFV IFA011: Section 7.1.9.4.3, BlockStorageData + Information element."; + } + + list vdu-storage-requirements { + key "key"; + + leaf key { + type string; + } + + leaf value { + type string; + } + description + "An array of key-value pairs that articulate + the storage deployment requirements."; + reference + "GS NFV IFA011: Section 7.1.9.4.3, BlockStorageData + Information element."; + } + + leaf rdma-enabled { + type boolean; + description + "Indicate if the storage support RDMA."; + reference + "GS NFV IFA011: Section 7.1.9.4.3, BlockStorageData + Information element."; + } + + leaf sw-image-desc { + type leafref { + path "../../../sw-image-desc/id"; + } + must "../size-of-storage >=" + + "../../../sw-image-desc[id=current()]/min-disk" { + } + description + "Software image to be loaded on the VirtualStorage + resource created based on this VirtualStorageDesc. + Shall be absent when used for virtual disks."; + reference + "GS NFV IFA011: Section 7.1.9.4.3, BlockStorageData + Information element."; + } + } + grouping vnfd { leaf id { type string; @@ -748,6 +804,24 @@ submodule etsi-nfv-vnf { VirtualCpuData information element."; } } + + list virtual-disk { + key "id"; + + description + "The local or ephemeral disk(s) of the virtualised compute."; + reference + "GS NFV IFA011: Section 7.1.9.2.2, VirtualComputeDesc + Information element."; + + leaf id { + type string; + description + "Unique identifier for the list of virtual disks."; + } + + uses block-storage-data; + } } list virtual-storage-desc { @@ -767,70 +841,105 @@ submodule etsi-nfv-vnf { leaf type-of-storage { // Needed to be able to onboard images - default root-storage; type identityref { base storage-type; } + default "nfv:block"; description - "Type of virtualised storage resource (e.g. volume, - object)."; - reference - "GS NFV IFA011: Section 7.1.9.4, Information elements - related to Virtual Storage."; - } - - leaf size-of-storage { - type uint64; - units "GB"; - default 0; - description - "Size of virtualised storage resource (e.g. size of - volume, in GB)"; - reference - "GS NFV IFA011: Section 7.1.9.4, Information elements - related to Virtual Storage."; - } - - list vdu-storage-requirements { - key "key"; - - leaf key { - type string; - } - - leaf value { - type string; - } - description - "Array of key-value pairs that articulate the storage - deployment requirements."; - reference - "GS NFV IFA011: Section 7.1.9.4.2, VirtualStorageDesc - information element."; - } - - leaf rdma-enabled { - type boolean; - description - "Indicate if the storage support RDMA."; + "Type of virtualised storage resource (BLOCK, OBJECT, + FILE)."; reference "GS NFV IFA011: Section 7.1.9.4, Information elements related to Virtual Storage."; } - leaf sw-image-desc { - type leafref { - path "../../sw-image-desc/id"; - } - must "../size-of-storage >=" + - "../../sw-image-desc[id=current()]/min-disk" { - } - description - "Software image to be loaded on the VirtualStorage - resource created based on this VirtualStorageDesc."; - reference - "GS NFV IFA011: Section 7.1.9.4, Information elements - related to Virtual Storage."; + choice storage { + container block-storage-data { + must '../type-of-storage = "nfv:block"' { + error-message "type-of-storage must be set to 'block'"; + } + description + "Specifies the details of block storage. It shall + be present when the 'typeOfStorage' attribute is set to + 'BLOCK'. It shall be absent otherwise."; + reference + "GS NFV IFA011: Section 7.1.9.4, Information elements + related to Virtual Storage."; + + uses block-storage-data; + } + + container object-storage-data { + must '../type-of-storage = "nfv:object"' { + error-message "type-of-storage must be set to 'object'"; + } + description + "Specifies the details of object storage. It shall be + present when the 'typeOfStorage' attribute is set to + 'OBJECT'. It shall be absent otherwise."; + reference + "GS NFV IFA011: Section 7.1.9.4, Information elements + related to Virtual Storage."; + + leaf max-size-of-storage { + type uint64; + units "GB"; + default 0; + description + "Max size of virtualised storage resource in GB."; + reference + "GS NFV IFA011: Section 7.1.9.4.4, ObjectStorage Information + element."; + } + } + + container file-storage-data { + must '../type-of-storage = "nfv:file"' { + error-message "type-of-storage must be set to 'file'"; + } + description + "Specifies the details of file storage. It shall be present + when the 'typeOfStorage' attribute is set to 'FILE'. It + shall be absent otherwise."; + reference + "GS NFV IFA011: Section 7.1.9.4, Information elements + related to Virtual Storage."; + + leaf size-of-storage { + type uint64; + units "GB"; + default 0; + description + "Size of virtualised storage resource in GB."; + reference + "GS NFV IFA011: Section 7.1.9.4.5, FileStorageData + Information element."; + } + + leaf file-system-protocol { + type string; + default "cifs"; + description + "The shared file system protocol (e.g. NFS, CIFS)."; + reference + "GS NFV IFA011: Section 7.1.9.4.5, FileStorageData + Information element."; + } + + leaf int-virtual-link-desc { + type leafref { + path "../../../sw-image-desc/id"; + } + mandatory true; + description + "Reference of the internal VLD which this file storage + connects to. The attached VDUs shall connect to the + same internal VLD."; + reference + "GS NFV IFA011: Section 7.1.9.4.5, FileStorageData + Information element."; + } + } } } -- GitLab From b34017eb081db9ff63766f5c88e283a90daca978 Mon Sep 17 00:00:00 2001 From: Mahesh Jethanandani Date: Tue, 26 Nov 2019 15:28:07 -0800 Subject: [PATCH 2/2] Changing must to a when statement. --- src/yang/etsi-nfv-vnf.yang | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/yang/etsi-nfv-vnf.yang b/src/yang/etsi-nfv-vnf.yang index 78e84c1..5544a81 100755 --- a/src/yang/etsi-nfv-vnf.yang +++ b/src/yang/etsi-nfv-vnf.yang @@ -855,9 +855,7 @@ submodule etsi-nfv-vnf { choice storage { container block-storage-data { - must '../type-of-storage = "nfv:block"' { - error-message "type-of-storage must be set to 'block'"; - } + when '../type-of-storage = "nfv:block"'; description "Specifies the details of block storage. It shall be present when the 'typeOfStorage' attribute is set to @@ -870,9 +868,7 @@ submodule etsi-nfv-vnf { } container object-storage-data { - must '../type-of-storage = "nfv:object"' { - error-message "type-of-storage must be set to 'object'"; - } + when '../type-of-storage = "nfv:object"'; description "Specifies the details of object storage. It shall be present when the 'typeOfStorage' attribute is set to @@ -894,9 +890,7 @@ submodule etsi-nfv-vnf { } container file-storage-data { - must '../type-of-storage = "nfv:file"' { - error-message "type-of-storage must be set to 'file'"; - } + when '../type-of-storage = "nfv:file"'; description "Specifies the details of file storage. It shall be present when the 'typeOfStorage' attribute is set to 'FILE'. It -- GitLab