Versions Compared

Key

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

...

  • a rule name that is unique within the validation service
  • a set of named attributes (arguments)
  • a validation expression, written in the Groovy programming language, that uses the named attributes and evaluates to produce a Boolean value
  • meta-data which will appear in the violation details, including
    • category
    • severity
    • errorText

Examples

Simple Rule

...

Code Block
languagegroovy
titleSimple Rule
collapsetrue
Simple Rule Collapse sourcerule {
    name        'vnf-name'
    category    'INVALID_NAME'
    description 'Invalid naming convention'
    errorText   'Invalid name - attribute does not match xxxxxnnnvbc (where x = alphanumeric and n = numeric)'
    severity    'MINOR'
    attributes  'name'
    validate    'name != null && name.matches("[a-z,0-9]{5}[0-9]{3}vbc")'
}

Complex Rule

...

The following example defines a rule that :

...


The entity configuration element defines which rules are applied to a specific entity type. The configuration is comprised of the following properties:

type / indexing

if using type, the value is a unique name of the type of entity

if using indexing, the value is a list of runtime indices extracted from the event; or a pre-configured default value

validationthe set of rules to apply to this entity and (for each rule) the attributes to be read from the entity (in order to create the rule's arguments)

The validation comprises a set of useRule elements. Each specifies a rule to be applied to the entity.

...

This element is repeated within the validation element as illustrated in the example below. The following properties may be defined:

name(Mandatory)The name of the rule to apply to this entity. This rule must be defined within a.groovy file stored in the rules directory.
The referenced rule does not need to be defined in the same file as the entity.
attributes(Optional)A comma-separated list of attribute(s) to extract from the entity. Each list item is a string storing a (JSON) path within the entity. The path is used to extract a value (or set of values) to be passed to the rule as an argument. Therefore the number of attributes defined must match with the number of attributes defined by the rule.
If the attribute specifiers are omitted then the attribute paths are implicitly taken from the rule definition.

Example entity

Code Block
languagegroovy
titleExample entity configuration
collapsetrue
entity {
	type 'complex'
	validation {
		useRule {
			name 'CLLI'
			attributes 'physical-location-id'
		}
		useRule {name 'complex is related to 1 oam-network' }
		useRule {
			name 'if a customer is related to an oam-network then oam-network.network-name must match naming convention'
			attributes 'relationship-list.relationship[*]'
		}
	}
}

...

Rules are determined based on the incoming event's values

model-version-idmodel-invariant-idRule
version-1invariant-1rule-1
version-2invariant-2rule-2
version-1invariant-2default-rule
version-3invariant-3default-rule

Configuration

The event type and attributes must be pre-configured. The attributes are defined as JSON path expression within an event entity.

...