aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLianhao Lu <lianhao.lu@intel.com>2018-09-15 00:07:27 +0800
committerLianhao Lu <lianhao.lu@intel.com>2018-09-18 08:46:42 +0800
commitbd7eac8ddf51acb1ddb1d10a5d4c90bafb07b0c0 (patch)
treed4b1d7687ce50c71d08591049d0f43beef88c746
parent5fa8e546e6c0e068c46410932683ffbec27574f9 (diff)
Updated to new hpa schema
Change-Id: I2e546f4a3b56bfb331207034c285323728a3b774 Issue-ID: VNFSDK-326 Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
-rw-r--r--tests/resources/hpa.csarbin7984 -> 7990 bytes
-rw-r--r--tests/resources/hpa_bad.csarbin7984 -> 7991 bytes
-rw-r--r--vnfsdk_pkgtools/validator/hpa.yaml304
-rw-r--r--vnfsdk_pkgtools/validator/toscaparser_validator.py3
4 files changed, 155 insertions, 152 deletions
diff --git a/tests/resources/hpa.csar b/tests/resources/hpa.csar
index a9558ae..61e53bc 100644
--- a/tests/resources/hpa.csar
+++ b/tests/resources/hpa.csar
Binary files differ
diff --git a/tests/resources/hpa_bad.csar b/tests/resources/hpa_bad.csar
index 4431d61..45bdef2 100644
--- a/tests/resources/hpa_bad.csar
+++ b/tests/resources/hpa_bad.csar
Binary files differ
diff --git a/vnfsdk_pkgtools/validator/hpa.yaml b/vnfsdk_pkgtools/validator/hpa.yaml
index 98ac42b..6b71feb 100644
--- a/vnfsdk_pkgtools/validator/hpa.yaml
+++ b/vnfsdk_pkgtools/validator/hpa.yaml
@@ -7,238 +7,238 @@ schemas:
# hpa key name
cpuModelSpecificationBinding:
# json encoded key name: reg expression for the valid value
- schema-version: &any '.*'
- schema-location: *any
- platform-id: &generic 'generic'
+ schemaVersion: &any '.*'
+ schemaSelector: *any
+ hardwarePlatform: &generic 'generic'
mandatory: &bool 'true|false|TRUE|FALSE|True|False'
- configuration-value: 'strictBinding|equalOrBetterBinding'
+ configurationValue: '^(strictBinding|equalOrBetterBinding)$'
instructionSetRequirements:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
simultaneousMultiThreading:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: 'enabled|disabled'
+ configurationValue: '^(enabled|disabled)$'
hypervisorConfiguration:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
computeRas:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: 'pciDetectedAndCorrectedErrors|pciDetectedAndUncorrectedErrors'
+ configurationValue: '^(pciDetectedAndCorrectedErrors|pciDetectedAndUncorrectedErrors)$'
cpuModel:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
directIoAccessToCache:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
accelerator:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
measuredLaunchEnvironment:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
secureEnclave:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
numVirtualCpu:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: '\d+'
+ configurationValue: &pos_int '^\d+$'
virtualCpuClock:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: '\d+\s*(Hz|kHz|MHz|GHz)'
+ configurationValue: '^\d+\s*(Hz|kHz|MHz|GHz)$'
logicalCpuPinningPolicy:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: 'dedicated|shared'
+ configurationValue: '^(dedicated|shared)$'
logicalCpuThreadPinningPolicy:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: 'require|isolate|prefer'
+ configurationValue: '^(require|isolate|prefer)$'
vduMemRequirements:
memoryPageSize:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: '\d+\s*(B|kB|KB|KiB|MB|MiB|GB|GiB|TB|TiB)'
+ configurationValue: &mem_size '^\d+\s*(B|kB|KB|KiB|MB|MiB|GB|GiB|TB|TiB)$'
numberOfPages:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: '\d+'
+ configurationValue: *pos_int
memoryAllocationPolicy:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: 'strictLocalAffinity|preferredLocalAffinity'
+ configurationValue: '^(strictLocalAffinity|preferredLocalAffinity)$'
memoryType:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
memorySpeed:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
memoryRas:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
memoryBandwidth:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: '\d+'
+ configurationValue: *pos_int
processorCacheAllocationType:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
processorCacheAllocationSize:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
vduStorageRequirements:
storageIops:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: '\d+'
+ configurationValue: *pos_int
storageResilencyMechanism:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: 'erasure|tripleReplication'
+ configurationValue: '^(erasure|tripleReplication)$'
processorCacheAllocationSize:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
processorCacheAllocationSize:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
logicalNodeComputeMemoryRequirements:
numberCpu:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: '\d+'
+ configurationValue: *pos_int
localNumaMemorySize:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: '\d+\s*(B|kB|KB|KiB|MB|MiB|GB|GiB|TB|TiB)'
+ configurationValue: *mem_size
logicalNodeIoRequirements:
pciVendorId:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
pciDeviceId:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
pciNumDevices:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: '\d+'
+ configurationValue: *pos_int
pciAddress:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
pciDeviceLocalToNumaNode:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: 'required|notRequired'
+ configurationValue: '^(required|notRequired)$'
networkInterfaceRequirements:
nicFeature:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
dataProcessingAccelerationLibrary:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: 'DPDK|dpdk'
+ configurationValue: '^(DPDK|dpdk)$'
dataProcessingAccelerationLibraryVersion:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: *any
+ configurationValue: *any
interfaceType:
- schema-version: *any
- schema-location: *any
- platform-id: *generic
+ schemaVersion: *any
+ schemaSelector: *any
+ hardwarePlatform: *generic
mandatory: *bool
- configuration-value: 'virtio|PCI-Passthrough|SR-IOV|E1000|RTL8139|PCNET'
+ configurationValue: '^(virtio|PCI-Passthrough|SR-IOV|E1000|RTL8139|PCNET)$'
mappings:
# mapping between property value of a tosca node type and the valid hpa schema
# type: tosca node type
diff --git a/vnfsdk_pkgtools/validator/toscaparser_validator.py b/vnfsdk_pkgtools/validator/toscaparser_validator.py
index dfe44b8..533cc00 100644
--- a/vnfsdk_pkgtools/validator/toscaparser_validator.py
+++ b/vnfsdk_pkgtools/validator/toscaparser_validator.py
@@ -138,6 +138,9 @@ class ToscaparserValidator(validator.ValidatorBase):
if attr not in hpa_schema[key]:
msg = "node %s, HPA key %s: %s is NOT valid HPA attribute"
raise HpaValueError(msg % (refkey, key, attr))
+ if not isinstance(val, basestring):
+ msg = ("node %s, HPA key %s, attr %s: %s is not a string attr value")
+ raise HpaValueError(msg % (refkey, key, attr, str(val).encode('ascii','replace')))
attr_schema = hpa_schema[key][attr]
if not re.match(attr_schema, str(val)):
msg = ("node %s, HPA key %s, attr %s: %s is not a valid HPA "