Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
outlinetrue
POMBA Validation Rules

The POMBA Validation Service comes with a set of rules that verify the data provided from the supported context builders. The rules delivered are not exhaustive (refer to the POMBA Rules) but the architecture allows for operators to add their own rules or customize existing rules in order to fulfill their specific needs.

...

In ONAP, POMBA rules are delivered via the OOM project in default-rules.groovy.

The Rule Tester Utility can be used to test and debug new rules.

Update Rules

The structure and logic of the validation rules can be found here: https://wikilf-onap.onapatlassian.orgnet/wiki/display/DW/Validation+Service.

The purpose of this page is to show how to add rules to a POMBA deployment.

...

Add the new rule definition to any rule file (currently only default-rules.groovy exists).  There can be more than 1 rule fileMultiple rule files can exist, however a rule can only be defined once, then can subsequently be used multiple times.

Rule definitions look like the following code block.  Notice that only the content of the groovy method is in the validate section.  (For more examples, see Validation+Service#ValidationService-Examples)

Code Block
languagebash
rule {
  name        'validate-service-type'
  category    'INVALID_TYPE'
  description 'Invalid service type'
  errorText   'Invalid type - value contains invalid characters, only [a-z,0-9,-] accepted'
  severity    'MINOR'
  attributes  'type'
  validate    'type != null && type.matches("[a-z,0-9,-]*")'
}

...

Now add the useRule clause(s) in the validation section of all targeted entities.  Currently POMBA only has 1 entity defined for default rules (see entity definition here).

useRule contains 2 fields:

  • name: contains the name of the newly created rule.
  • attributes: specifies the location of the attributes to be passed to the rule at runtime; it's a full JSON path, starting from the incoming event's entity section, see example event above.

...

Code Block
languagebash
entity {
  name 'POA-EVENT'
  indexing {
	indices 'default-rules'
  }
  validation {
    // AAI service type
	useRule {
	  name 'validate-service-type'
	  attributes 'context-list.aai.service.type'
	}
	// SDC service type
	useRule {
	  name 'validate-service-type'
	  attributes 'context-list.sdc.service.type'
	}
  }
}

Restart Validation

...

Validation loads all the rule files at startup, so the pod needs to be restarted.

Since helm is recommended to deploy POMBA, the deployment must be deleted and reinstalled.  (Note that helm upgrade --restart-pods can't be used to restart validation, there's an open helm defect for this)

Code Block
languagebash
$ docker ps
CONTAINER ID helm list
NAME                    IMAGEREVISION        UPDATED                         STATUS          CHART           NAMESPACE
demo2-pomba             1         ... 73dad4fc56b7     Tue Feb  dockercentral.it.att.com:5100/com.att.ecomp.aai.dev/onap-validation:1902.0.519 20:29:22 2019        DEPLOYED        pomba-4.0.0     onap
...
...
$ docker container restart 73dad4fc56b7

...


$ helm delete demo2-pomba --purge
$
$ cd ~/oom/kubernetes/pomba
$ helm install . --name demo2-pomba --namespace onap
...

Submit Updated Rules to OOM

Once the rule has been properly tested, submit the updated rules file in OOM's validation chart:

https://git.onap.org/oom/tree/kubernetes/pomba/charts/pomba-validation-service/resources/bundleconfig/etc/rules/poa-event

If a new rule file has been created, don't forget to update the chart's deployment.yaml.