From 5f4b3db5c14181852d93544716ce6b52ee7ae19d Mon Sep 17 00:00:00 2001 From: Pierre Rioux Date: Wed, 9 Jan 2019 15:41:17 -0500 Subject: [LOG-404] adding data-dictonary config Change-Id: Ie786aa3d9d3094409c48a741064d39facd3a6f94 Signed-off-by: Pierre Rioux Issue-ID: LOG-404 --- .../appconfig/rule-data-dictionary.properties | 9 ++++++ .../etc/rules/poa-event/default-rules.groovy | 33 ++++++++++++++++++++++ .../templates/deployment.yaml | 2 ++ .../charts/pomba-validation-service/values.yaml | 5 ++-- 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 kubernetes/pomba/charts/pomba-validation-service/resources/appconfig/rule-data-dictionary.properties (limited to 'kubernetes/pomba') diff --git a/kubernetes/pomba/charts/pomba-validation-service/resources/appconfig/rule-data-dictionary.properties b/kubernetes/pomba/charts/pomba-validation-service/resources/appconfig/rule-data-dictionary.properties new file mode 100644 index 0000000000..d93f030395 --- /dev/null +++ b/kubernetes/pomba/charts/pomba-validation-service/resources/appconfig/rule-data-dictionary.properties @@ -0,0 +1,9 @@ +rule.datadictionary.hostport={{ .Values.config.dataDictHostPort }} +rule.datadictionary.connect.timeout=1000 +rule.datadictionary.read.timeout=1000 + +# basic authentication: base64 encoding of username:password +rule.datadictionary.credentials={{ .Values.config.dataDictCredentials }} + +# ex: /commonModelElements/instance~nfValuesCatalog~1.0/ +rule.datadictionary.uri=/commonModelElements/{0}~{1}~1.0/validateInstance diff --git a/kubernetes/pomba/charts/pomba-validation-service/resources/bundleconfig/etc/rules/poa-event/default-rules.groovy b/kubernetes/pomba/charts/pomba-validation-service/resources/bundleconfig/etc/rules/poa-event/default-rules.groovy index 1dc97da288..fd2385af08 100644 --- a/kubernetes/pomba/charts/pomba-validation-service/resources/bundleconfig/etc/rules/poa-event/default-rules.groovy +++ b/kubernetes/pomba/charts/pomba-validation-service/resources/bundleconfig/etc/rules/poa-event/default-rules.groovy @@ -481,3 +481,36 @@ rule { return new Tuple2(result, details) ''' } + +/* + * The data-dictionary rule below can be used with this useRule clause: + * useRule { + * name 'Data-Dictionary validate VF type' + * attributes 'context-list.ndcb.vfList[*].vfModuleList[*].networkList[*].type' + * } + */ +rule { + name 'Data-Dictionary validate VF type' + category 'INVALID_VALUE' + description 'Validate all VF type values against data-dictionary' + errorText 'VF type [{0}] failed data-dictionary validation: {1}' + severity 'ERROR' + attributes 'typeList' + validate ''' + boolean success = true + List details = new ArrayList<>() + typeList.any { + if(!success) { + // break out of 'any' loop + return false + } + def result = org.onap.aai.validation.ruledriven.rule.builtin.DataDictionary.validate("instance", "vfModuleNetworkType", "type", "$it") + if(!result.isEmpty()) { + success = false + details.add("$it") + details.add("$result") + } + } + return new Tuple2(success, details) + ''' +} diff --git a/kubernetes/pomba/charts/pomba-validation-service/templates/deployment.yaml b/kubernetes/pomba/charts/pomba-validation-service/templates/deployment.yaml index f802245c5a..df62915b64 100644 --- a/kubernetes/pomba/charts/pomba-validation-service/templates/deployment.yaml +++ b/kubernetes/pomba/charts/pomba-validation-service/templates/deployment.yaml @@ -104,6 +104,8 @@ spec: path: validation-service-auth.properties - key: rule-indexing.properties path: rule-indexing.properties + - key: rule-data-dictionary.properties + path: rule-data-dictionary.properties - key: aai-environment.properties path: aai-environment.properties - key: schemaIngest.properties diff --git a/kubernetes/pomba/charts/pomba-validation-service/values.yaml b/kubernetes/pomba/charts/pomba-validation-service/values.yaml index bb513cf001..2cb175a265 100644 --- a/kubernetes/pomba/charts/pomba-validation-service/values.yaml +++ b/kubernetes/pomba/charts/pomba-validation-service/values.yaml @@ -37,7 +37,6 @@ pullPolicy: IfNotPresent debugEnabled: false # application configuration -# Example: config: appDir: /opt/app/validation-service configDir: /opt/app/validation-service/appconfig @@ -45,8 +44,8 @@ config: configTopicsDir: /opt/app/validation-service/appconfig/topics rulesDir: /opt/app/validation-service/bundleconfig/etc/rules/poa-event maxHeap: 1024 -# username: myusername -# password: mypassword + dataDictHostPort: http://dummy-host:443 + dataDictCredentials: cG9tYmE6cG9tYmE= # default number of instances replicaCount: 1 -- cgit 1.2.3-korg