aboutsummaryrefslogtreecommitdiffstats
path: root/applications/native/src/test
diff options
context:
space:
mode:
authorajinkya-patil <ajinkya-patil@t-systems.com>2024-09-24 12:24:42 +0530
committerAjinkya Patil <ajinkya-patil@t-systems.com>2024-10-17 09:48:50 +0000
commita7577cb59e90ef1c6ba5031b138fb1b45b828f95 (patch)
tree16156234d9ee9a427424dc0bf515cf17e3a80d24 /applications/native/src/test
parentd1c420217e67337bec7cee3071db995d97a4a87c (diff)
Added tosca xacml policy type in Native Application
Added new onap.policies.native.ToscaXacml policy type in native application. Issue-ID: POLICY-5128 Change-Id: I2b5b606f93be82b78f69c2a4d7d8f021f3db328b Signed-off-by: ajinkya-patil <ajinkya-patil@t-systems.com>
Diffstat (limited to 'applications/native/src/test')
-rw-r--r--applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java93
-rw-r--r--applications/native/src/test/resources/policies/bad.native.tosca.policy.target.yaml78
-rw-r--r--applications/native/src/test/resources/policies/bad.native.toscapolicy.yaml36
-rw-r--r--applications/native/src/test/resources/policies/native.toscapolicy.yaml1324
4 files changed, 1527 insertions, 4 deletions
diff --git a/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java b/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java
index 47e92c09..04fe1fe8 100644
--- a/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java
+++ b/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2021, 2024 Nordix Foundation.
+ * Modifications Copyright (C) 2024 Deutsche Telekom AG.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,9 +37,11 @@ import java.nio.file.Path;
import java.util.Map;
import java.util.Properties;
import java.util.ServiceLoader;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicySetType;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardYamlCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.common.utils.resources.TextFileUtils;
@@ -47,6 +50,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
import org.onap.policy.pdp.xacml.application.common.ToscaPolicyConversionException;
+import org.onap.policy.pdp.xacml.application.common.XacmlApplicationException;
import org.onap.policy.pdp.xacml.application.common.XacmlApplicationServiceProvider;
import org.onap.policy.pdp.xacml.application.common.XacmlPolicyUtils;
import org.onap.policy.pdp.xacml.xacmltest.TestUtils;
@@ -79,12 +83,12 @@ class NativePdpApplicationTest {
//
XacmlPolicyUtils.FileCreator myCreator = (String filename) -> policyFolder.resolve(filename).toFile();
propertiesFile = XacmlPolicyUtils.copyXacmlPropertiesContents("src/test/resources/xacml.properties",
- properties, myCreator);
+ properties, myCreator);
//
// Load service
//
ServiceLoader<XacmlApplicationServiceProvider> applicationLoader =
- ServiceLoader.load(XacmlApplicationServiceProvider.class);
+ ServiceLoader.load(XacmlApplicationServiceProvider.class);
//
// Find the native application and save for use in all the tests
//
@@ -130,9 +134,11 @@ class NativePdpApplicationTest {
NativePdpApplication application = new NativePdpApplication();
assertThat(application.canSupportPolicyType(new ToscaConceptIdentifier(
- "onap.policies.native.Xacml", "1.0.0"))).isTrue();
+ "onap.policies.native.Xacml", "1.0.0"))).isTrue();
assertThat(application.canSupportPolicyType(new ToscaConceptIdentifier(
- "onap.policies.native.SomethingElse", "1.0.0"))).isFalse();
+ "onap.policies.native.ToscaXacml", "1.0.0"))).isTrue();
+ assertThat(application.canSupportPolicyType(new ToscaConceptIdentifier(
+ "onap.policies.native.SomethingElse", "1.0.0"))).isFalse();
assertThat(application.actionDecisionsSupported()).contains("native");
}
@@ -187,6 +193,63 @@ class NativePdpApplicationTest {
requestAndCheckDecision(request);
}
+ @Test
+ void testNativeToscaXacmlPolicy() throws Exception {
+ String policySetTypeYaml = ResourceUtils
+ .getResourceAsString("src/test/resources/policies/native.toscapolicy.yaml");
+ checkPolicySetType(policySetTypeYaml);
+ }
+
+ @Test
+ void testBadToscaXacmlPolicyRule() throws Exception {
+ NativePdpApplicationTranslator translator = new NativePdpApplicationTranslator();
+ String policyYaml = ResourceUtils
+ .getResourceAsString("src/test/resources/policies/bad.native.toscapolicy.yaml");
+
+ ToscaServiceTemplate serviceTemplate = yamlCoder.decode(policyYaml, ToscaServiceTemplate.class);
+ JpaToscaServiceTemplate jtst = new JpaToscaServiceTemplate();
+ jtst.fromAuthorative(serviceTemplate);
+ ToscaServiceTemplate completedJtst = jtst.toAuthorative();
+
+ for (Map<String, ToscaPolicy> policies : completedJtst.getToscaTopologyTemplate().getPolicies()) {
+ for (ToscaPolicy policy : policies.values()) {
+ assertThatExceptionOfType(ToscaPolicyConversionException.class).isThrownBy(() ->
+ translator.convertPolicy(policy)
+ ).as((String) policy.getMetadata().get("policy-id"))
+ .withMessageContaining("Invalid rule format");
+ }
+ }
+ }
+
+ @Test
+ void testBadToscaXacmlPolicyTarget() throws Exception {
+ NativePdpApplicationTranslator translator = new NativePdpApplicationTranslator();
+ String policyYaml = ResourceUtils
+ .getResourceAsString("src/test/resources/policies/bad.native.tosca.policy.target.yaml");
+
+ ToscaServiceTemplate serviceTemplate = yamlCoder.decode(policyYaml, ToscaServiceTemplate.class);
+ JpaToscaServiceTemplate jtst = new JpaToscaServiceTemplate();
+ jtst.fromAuthorative(serviceTemplate);
+ ToscaServiceTemplate completedJtst = jtst.toAuthorative();
+
+ for (Map<String, ToscaPolicy> policies : completedJtst.getToscaTopologyTemplate().getPolicies()) {
+ for (ToscaPolicy policy : policies.values()) {
+ if ("bad.tosca.policy.test".equals(policy.getName())) {
+ assertThatExceptionOfType(ToscaPolicyConversionException.class).isThrownBy(() ->
+ translator.convertPolicy(policy)
+ ).as((String) policy.getMetadata().get("policy-id"))
+ .withMessageContaining("Invalid operator");
+ }
+ if ("bad.tosca.policy.target.test".equals(policy.getName())) {
+ assertThatExceptionOfType(ToscaPolicyConversionException.class).isThrownBy(() ->
+ translator.convertPolicy(policy)
+ ).as((String) policy.getMetadata().get("policy-id"))
+ .withMessageContaining("Invalid target format");
+ }
+ }
+ }
+ }
+
/**
* Request a decision and check that it matches expectation.
*
@@ -218,4 +281,26 @@ class NativePdpApplicationTest {
assertThat(decision).hasToString(NativePdpApplicationTest.PERMIT);
LOGGER.info("Xacml response we received {}", DOMResponse.toString(response));
}
+
+ private void checkPolicySetType(String policySetTypeYaml) throws ToscaPolicyConversionException, CoderException {
+ NativePdpApplicationTranslator translator = new NativePdpApplicationTranslator();
+ ToscaServiceTemplate serviceTemplate = yamlCoder.decode(policySetTypeYaml, ToscaServiceTemplate.class);
+ JpaToscaServiceTemplate jtst = new JpaToscaServiceTemplate();
+ jtst.fromAuthorative(serviceTemplate);
+ ToscaServiceTemplate completedJtst = jtst.toAuthorative();
+ for (Map<String, ToscaPolicy> policies : completedJtst.getToscaTopologyTemplate().getPolicies()) {
+ for (ToscaPolicy policy : policies.values()) {
+ try {
+ service.loadPolicy(policy);
+ } catch (XacmlApplicationException e) {
+ LOGGER.error("Application failed to load policy", e);
+ }
+ PolicySetType policySetType = (PolicySetType) translator.convertPolicy(policy);
+ assertThat(policySetType).isNotNull();
+ assertThat(policySetType.getPolicySetId()).isEqualTo("tosca.policy.test");
+ assertThat(policySetType.getPolicyCombiningAlgId())
+ .isEqualTo("urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:first-applicable");
+ }
+ }
+ }
}
diff --git a/applications/native/src/test/resources/policies/bad.native.tosca.policy.target.yaml b/applications/native/src/test/resources/policies/bad.native.tosca.policy.target.yaml
new file mode 100644
index 00000000..2d2d966e
--- /dev/null
+++ b/applications/native/src/test/resources/policies/bad.native.tosca.policy.target.yaml
@@ -0,0 +1,78 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+topology_template:
+ inputs: {}
+ policies:
+ - bad.tosca.policy.test:
+ type: onap.policies.native.ToscaXacml
+ type_version: 1.0.0
+ properties:
+ policies:
+ - properties:
+ description: Policy that allows minimum number of available cells for
+ a slice to be feasible, prio=1
+ target:
+ anyOne:
+ - allOf:
+ - key: action-id
+ operator:
+ value: "1"
+ rules:
+ - condition:
+ apply:
+ keys:
+ - feasibleCellsForSlice
+ operator: integer-equal
+ compareWith:
+ value: 2
+ decision: Permit
+ advice:
+ value: Slice is feasible since minumum number of cells are available
+ metadata:
+ policy-id: bad.tosca.policy.test.1
+ policy-version: 1.0.0
+ name: bad.tosca.policy.test
+ version: 3.0.0
+ metadata:
+ action: sfc-policy
+ description: This policy set specifies the conditions for slice feasibility
+ based on availability of cells
+ policy-id: bad.tosca.policy.test
+ policy-version: 3.0.0
+ - bad.tosca.policy.target.test:
+ type: onap.policies.native.ToscaXacml
+ type_version: 1.0.0
+ properties:
+ policies:
+ - properties:
+ description: Policy that allows minimum number of available cells for
+ a slice to be feasible, prio=1
+ target:
+ anyOne:
+ - allOf:
+ - key: action-id
+ operator: integer-equal
+ value:
+ rules:
+ - condition:
+ apply:
+ keys:
+ - feasibleCellsForSlice
+ operator: integer-equal
+ compareWith:
+ value: 2
+ decision: Permit
+ advice:
+ value: Slice is feasible since minumum number of cells are available
+ metadata:
+ policy-id: bad.tosca.policy.test.1
+ policy-version: 1.0.0
+ name: bad.tosca.policy.target.test
+ version: 3.0.0
+ metadata:
+ action: sfc-policy
+ description: This policy set specifies the conditions for slice feasibility
+ based on availability of cells
+ policy-id: bad.tosca.policy.target.test
+ policy-version: 3.0.0
+name: ToscaServiceTemplateSimple
+version: 1.0.0
diff --git a/applications/native/src/test/resources/policies/bad.native.toscapolicy.yaml b/applications/native/src/test/resources/policies/bad.native.toscapolicy.yaml
new file mode 100644
index 00000000..d19f0854
--- /dev/null
+++ b/applications/native/src/test/resources/policies/bad.native.toscapolicy.yaml
@@ -0,0 +1,36 @@
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+topology_template:
+ inputs: {}
+ policies:
+ - bad.tosca.policy.test:
+ type: onap.policies.native.ToscaXacml
+ type_version: 1.0.0
+ properties:
+ policies:
+ - properties:
+ description: Policy that allows minimum number of available cells for
+ a slice to be feasible, prio=1
+ rules:
+ - condition:
+ apply:
+ keys:
+ - feasibleCellsForSlice
+ operator: integ
+ compareWith:
+ value: 2
+ decision: Permit
+ advice:
+ value: Slice is feasible since minumum number of cells are available
+ metadata:
+ policy-id: bad.tosca.policy.test.1
+ policy-version: 1.0.0
+ name: bad.tosca.policy.test
+ version: 3.0.0
+ metadata:
+ action: sfc-policy
+ description: This policy set specifies the conditions for slice feasibility
+ based on availability of cells
+ policy-id: tnap.policy.slice.sfc.set
+ policy-version: 3.0.0
+name: ToscaServiceTemplateSimple
+version: 1.0.0
diff --git a/applications/native/src/test/resources/policies/native.toscapolicy.yaml b/applications/native/src/test/resources/policies/native.toscapolicy.yaml
new file mode 100644
index 00000000..d4858366
--- /dev/null
+++ b/applications/native/src/test/resources/policies/native.toscapolicy.yaml
@@ -0,0 +1,1324 @@
+---
+tosca_definitions_version: tosca_simple_yaml_1_1_0
+topology_template:
+ inputs: {}
+ policies:
+ - tosca.policy.test:
+ type: onap.policies.native.ToscaXacml
+ type_version: 1.0.0
+ properties:
+ policies:
+ - properties:
+ description: Policy that allows minimum number of available cells for a slice to
+ be feasible, prio=1
+ combiningAlgo: first-applicable
+ target:
+ anyOne:
+ - allOf:
+ - key: action-id
+ operator: string-less-than
+ value: "1"
+ - allOf:
+ - key: action-id
+ operator: string-ends-with
+ value: "2"
+ - allOf:
+ - key: action-id
+ operator: time-greater-than-or-equal
+ value: "19:00:00 05:00"
+ - allOf:
+ - key: action-id
+ operator: string-less-than
+ value: "4"
+ - allOf:
+ - key: action-id
+ operator: yearmonthduration-one-and-only
+ value: "P16Y"
+ - allOf:
+ - key: action-id
+ operator: boolean-equal
+ value: "1"
+ rules:
+ - target:
+ anyOne:
+ - allOf:
+ - key: action-id
+ operator: string-equal-ignore-case
+ value: "1"
+ - allOf:
+ - key: action-id
+ operator: string-starts-with
+ value: "1"
+ - allOf:
+ - key: action-id
+ operator: time-greater-than
+ value: "19:00:00 05:00"
+ - allOf:
+ - key: action-id
+ operator: daytimeduration-one-and-only
+ value: "1"
+ - allOf:
+ - key: action-id
+ operator: double-equal
+ value: "1"
+ description : Policy that allows minimum number of available cells for a slice to
+ condition:
+ apply:
+ keys:
+ - feasibleCellsForSlice
+ - apply:
+ operator: string-is-in
+ keys:
+ - apply:
+ operator: double-divide
+ keys:
+ - function: any-of
+ - apply:
+ operator: double-divide
+ keys:
+ - feasibleCellsForSlice
+ - apply:
+ operator: integer-mod
+ keys:
+ - totalCellsForSlice
+ - "'100'"
+ - apply:
+ keys:
+ - function: string-less-than-or-equal
+ - total-resource-usage-UL
+ operator: integer-abs
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: double-abs
+ compareWith:
+ value: "30"
+ - apply:
+ keys:
+ - function: string-greater-than-or-equal
+ - total-resource-usage-UL
+ operator: integer-abs
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: double-abs
+ compareWith:
+ value: "30"
+ - apply:
+ keys:
+ - function: any-of-any
+ - total-resource-usage-UL
+ operator: integer-abs
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: double-abs
+ compareWith:
+ value: "30"
+ - apply:
+ keys:
+ - function: string-less-than-or-equal
+ - "'90'"
+ operator: yearMonthDuration-equal
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'90'"
+ operator: anyURI-equal
+ compareWith:
+ value: "30"
+ - apply:
+ keys:
+ - function: hexBinary-equal
+ - total-resource-usage-UL
+ operator: hexBinary-equal
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'90'"
+ operator: rfc822Name-equal
+ compareWith:
+ value: "30"
+ - apply:
+ keys:
+ - function: any-of-any
+ - "'90'"
+ operator: x500Name-equal
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'90'"
+ operator: string-from-ipAddress
+ compareWith:
+ value: "30"
+ - apply:
+ keys:
+ - function: string-less-than-or-equal
+ - "'90'"
+ operator: string-from-dnsName
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: double-abs
+ compareWith:
+ value: "30"
+ - apply:
+ keys:
+ - function: string-greater-than-or-equal
+ - total-resource-usage-UL
+ operator: integer-abs
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: double-abs
+ compareWith:
+ value: "30"
+ - apply:
+ keys:
+ - function: any-of-any
+ - total-resource-usage-UL
+ operator: integer-abs
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: double-abs
+ compareWith:
+ value: "30"
+ - apply:
+ operator: time-equal
+ keys:
+ - apply:
+ operator: datetime-equal
+ keys:
+ - apply:
+ operator: daytimeduration-equal
+ keys:
+ - "19:00:00 05:00"
+ - apply:
+ operator: base64binary-equal
+ keys:
+ - 100
+ - "'100'"
+ - apply:
+ keys:
+ - function: string-normalize-space
+ - total-resource-usage-UL
+ operator: round
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: floor
+ compareWith:
+ value: "30"
+ - apply:
+ operator: string-normalize-to-lower-case
+ keys:
+ - apply:
+ operator: time-one-and-only
+ keys:
+ - apply:
+ operator: double-to-integer
+ keys:
+ - 02
+ - apply:
+ operator: present
+ keys:
+ - 30
+ - "'100'"
+ - apply:
+ keys:
+ - function: time-in-range
+ - total-resource-usage-UL
+ operator: double-add
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: string-bag-size
+ compareWith:
+ value: "30"
+ - apply:
+ operator: boolean-bag-size
+ keys:
+ - apply:
+ operator: integer-bag-size
+ keys:
+ - apply:
+ operator: double-bag-size
+ keys:
+ - "'30'"
+ - apply:
+ operator: time-bag-size
+ keys:
+ - "19:00:00 05:00"
+ - "'100'"
+ - apply:
+ keys:
+ - function: time-is-in
+ - total-resource-usage-UL
+ operator: time-bag
+ compareWith:
+ value: "19:00:00 05:00"
+ apply:
+ keys:
+ - "'30'"
+ operator: date-bag-size
+ compareWith:
+ value: "30"
+ - apply:
+ operator: rfc822name-is-in
+ keys:
+ - apply:
+ operator: rfc822name-bag
+ keys:
+ - apply:
+ operator: ipaddress-one-and-only
+ keys:
+ - "'30'"
+ - apply:
+ operator: ipaddress-bag-size
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: ipaddress-is-in
+ - "'30'"
+ operator: ipaddress-bag
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: dnsname-one-and-only
+ compareWith:
+ value: "30"
+ - apply:
+ operator: dnsname-bag-size
+ keys:
+ - apply:
+ operator: dnsname-is-in
+ keys:
+ - apply:
+ operator: dnsname-bag
+ keys:
+ - "'30'"
+ - apply:
+ operator: string-concatenate
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: boolean-from-string
+ - "'30'"
+ operator: string-from-boolean
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: integer-from-string
+ compareWith:
+ value: "30"
+ - apply:
+ operator: string-from-integer
+ keys:
+ - apply:
+ operator: double-from-string
+ keys:
+ - apply:
+ operator: string-from-double
+ keys:
+ - "'30'"
+ - apply:
+ operator: time-from-string
+ keys:
+ - "19:00:00 05:00"
+ - "'100'"
+ - apply:
+ keys:
+ - function: time-is-in
+ - "19:00:00 05:00"
+ operator: time-bag
+ compareWith:
+ value: "19:00:00 05:00"
+ apply:
+ keys:
+ - "'30'"
+ operator: date-bag-size
+ compareWith:
+ value: "30"
+ - apply:
+ operator: date-is-in
+ keys:
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ compareWith:
+ key: total-resource-usage-UL
+ - apply:
+ operator: date-bag
+ keys:
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ - apply:
+ operator: anyuri-from-string
+ keys:
+ - apply:
+ operator: string-from-anyuri
+ keys:
+ - feasibleCellsForSlice
+ - apply:
+ operator: daytimeduration-from-string
+ keys:
+ - 100
+ - "'100'"
+ - apply:
+ keys:
+ - function: string-from-daytimeturation
+ - "19:00:00 05:00"
+ operator: yearmonthduration-from-string
+ compareWith:
+ value: "P16Y"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: string-from-yearmonthduration
+ compareWith:
+ value: "P16Y"
+ - apply:
+ operator: x500name-from-string
+ keys:
+ - apply:
+ operator: string-from-x500name
+ keys:
+ - apply:
+ operator: rfc822name-from-string
+ keys:
+ - 02
+ - apply:
+ operator: string-from-rfc822name
+ keys:
+ - 30
+ - "'100'"
+ - apply:
+ keys:
+ - function: dnsname-from-string
+ - "'30'"
+ operator: anyuri-starts-with
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'100'"
+ operator: anyuri-ends-with
+ compareWith:
+ value: "30"
+ - apply:
+ operator: anyuri-contains
+ keys:
+ - apply:
+ operator: string-substring
+ keys:
+ - apply:
+ operator: anyuri-substring
+ keys:
+ - "'30'"
+ - apply:
+ operator: map
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ operator: ipaddress-from-string
+ keys:
+ - apply:
+ operator: double-intersection
+ keys:
+ - apply:
+ operator: anyuri-subset
+ keys:
+ - "'30'"
+ - apply:
+ operator: base64binary-at-least-one-member-of
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: x500name-match
+ - "'30'"
+ operator: rfc822name-match
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: anyuri-regexp-match
+ compareWith:
+ value: "30"
+ - apply:
+ operator: ipaddress-regexp-match
+ keys:
+ - apply:
+ operator: dnsname-regexp-match
+ keys:
+ - apply:
+ operator: rfc822name-regexp-match
+ keys:
+ - "'30'"
+ - apply:
+ operator: x500name-regexp-match
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: xpath-node-count
+ - "'30'"
+ operator: xpath-node-equal
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: xpath-node-match
+ compareWith:
+ value: "30"
+ - apply:
+ operator: string-intersection
+ keys:
+ - apply:
+ operator: string-at-least-one-member-of
+ keys:
+ - apply:
+ operator: string-union
+ keys:
+ - "'30'"
+ - apply:
+ operator: string-subset
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: string-set-equals
+ - "'30'"
+ operator: boolean-intersection
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: boolean-at-least-one-member-of
+ compareWith:
+ value: "30"
+ - apply:
+ operator: boolean-union
+ keys:
+ - apply:
+ operator: boolean-subset
+ keys:
+ - apply:
+ operator: boolean-set-equals
+ keys:
+ - "'30'"
+ - apply:
+ operator: integer-intersection
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: integer-at-least-one-member-of
+ - "'30'"
+ operator: integer-union
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: integer-subset
+ compareWith:
+ value: "30"
+ - apply:
+ operator: integer-set-equals
+ keys:
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ compareWith:
+ key: double-intersection
+ - apply:
+ operator: double-at-least-one-member-of
+ keys:
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ operator: string-equal
+ compareWith:
+ value: "2"
+ decision: Deny
+ advice:
+ value: Slice is feasible since minumum number of cells are available
+ default: Deny
+ metadata:
+ policy-id: tosca.policy.test.1
+ policy-version: 1.0.0
+ - properties:
+ description: Policy that allows minimum percentage of available cells for a
+ slice to be feasible, prio=2
+ rules:
+ - target:
+ anyOne:
+ - allOf:
+ - key: sst
+ operator: integer-greater-than
+ value: "1"
+ - allOf:
+ - key: sst
+ operator: string-greater-than
+ value: "1"
+ - allOf:
+ - key: sst
+ operator: date-add-yearmonthduration
+ value: "P16Y"
+ - allOf:
+ - key: sst
+ operator: time-less-than
+ value: "19:00:00 05:00"
+ - allOf:
+ - key: sst
+ operator: hexbinary-one-and-only
+ value: "1"
+ - allOf:
+ - key: sst
+ operator: datetime-bag-size
+ value: "1"
+ - allOf:
+ - key: sst
+ operator: double-union
+ value: "1"
+ condition:
+ apply:
+ operator: double-greater-than-or-equal
+ keys:
+ - apply:
+ operator: double-multiply
+ keys:
+ - function: all-of-any
+ - apply:
+ operator: double-divide
+ keys:
+ - apply:
+ operator: integer-to-double
+ keys:
+ - feasibleCellsForSlice
+ - apply:
+ operator: integer-to-double
+ keys:
+ - totalCellsForSlice
+ - "'100'"
+ - apply:
+ keys:
+ - function: integer-greater-than-or-equal
+ - total-resource-usage-UL
+ operator: integer-less-than
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: integer-less-than
+ compareWith:
+ value: "30"
+ - apply:
+ operator: integer-is-in
+ keys:
+ - function: all-of-all
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ compareWith:
+ key: total-resource-usage-UL
+ - apply:
+ operator: boolean-is-in
+ keys:
+ - function: all-of
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ - apply:
+ operator: integer-divide
+ keys:
+ - apply:
+ operator: double-divide
+ keys:
+ - apply:
+ operator: double-divide
+ keys:
+ - feasibleCellsForSlice
+ - apply:
+ operator: integer-mod
+ keys:
+ - totalCellsForSlice
+ - "'100'"
+ - apply:
+ keys:
+ - function: string-less-than-or-equal
+ - total-resource-usage-UL
+ operator: integer-abs
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: double-abs
+ compareWith:
+ value: "30"
+ - apply:
+ operator: string-contains
+ keys:
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ compareWith:
+ key: total-resource-usage-UL
+ - apply:
+ operator: string-regexp-match
+ keys:
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ - apply:
+ operator: datetime-subtract-daytimeturation
+ keys:
+ - function: not
+ - apply:
+ operator: datetime-add-yearmonthduration
+ keys:
+ - apply:
+ operator: datetime-add-daytimeduration
+ keys:
+ - "P16Y"
+ - apply:
+ operator: double-less-than-or-equal
+ keys:
+ - totalCellsForSlice
+ - "'100'"
+ - apply:
+ keys:
+ - function: string-equal
+ - total-resource-usage-UL
+ operator: double-less-than
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: double-greater-than
+ compareWith:
+ value: "30"
+ - apply:
+ operator: integer-less-than-or-equal
+ keys:
+ - function: n-of
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ compareWith:
+ key: total-resource-usage-UL
+ - apply:
+ operator: integer-equal
+ keys:
+ - function: and
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ - apply:
+ operator: date-less-than
+ keys:
+ - apply:
+ operator: date-greater-than-or-equal
+ keys:
+ - function: or
+ - apply:
+ operator: date-greater-than
+ keys:
+ - feasibleCellsForSlice
+ - apply:
+ operator: datetime-less-than-or-equal
+ keys:
+ - totalCellsForSlice
+ - "'100'"
+ - apply:
+ keys:
+ - function: datetime-less-than
+ - total-resource-usage-UL
+ operator: datetime-greater-than-or-equal
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: datetime-greater-than
+ compareWith:
+ value: "30"
+ - apply:
+ operator: boolean-bag
+ keys:
+ - function: any-of-all
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ compareWith:
+ key: total-resource-usage-UL
+ - apply:
+ operator: integer-bag
+ keys:
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ - apply:
+ operator: datetime-one-and-only
+ keys:
+ - apply:
+ operator: time-one-and-only
+ keys:
+ - apply:
+ operator: integer-multiply
+ keys:
+ - feasibleCellsForSlice
+ - apply:
+ operator: double-subtract
+ keys:
+ - totalCellsForSlice
+ - "19:00:00 05:00"
+ - apply:
+ keys:
+ - function: integer-subtract
+ - total-resource-usage-UL
+ operator: double-add
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: integer-add
+ compareWith:
+ value: "30"
+ - apply:
+ operator: double-is-in
+ keys:
+ - list:
+ - jkjd
+ - lll
+ - 90
+ - "'89'"
+ compareWith:
+ key: total-resource-usage-UL
+ - apply:
+ operator: string-is-in
+ keys:
+ - list:
+ - jkjd
+ - lll
+ - "'90'"
+ - "'89'"
+ - apply:
+ operator: base64binary-union
+ keys:
+ - apply:
+ operator: base64binary-subset
+ keys:
+ - apply:
+ operator: base64binary-set-equals
+ keys:
+ - "'100'"
+ - apply:
+ operator: daytimeduration-intersection
+ keys:
+ - 100
+ - "'100'"
+ - apply:
+ keys:
+ - function: daytimeduration-at-least-one-member-of
+ - total-resource-usage-UL
+ operator: daytimeduration-union
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - total-resource-usage-DL
+ operator: daytimeduration-subset
+ compareWith:
+ value: "30"
+ - apply:
+ operator: daytimeduration-set-equals
+ keys:
+ - apply:
+ operator: yearmonthduration-intersection
+ keys:
+ - apply:
+ operator: yearmonthduration-at-least-one-member-of
+ keys:
+ - 02
+ - apply:
+ operator: yearmonthduration-union
+ keys:
+ - 30
+ - "'100'"
+ - apply:
+ keys:
+ - function: yearmonthduration-subset
+ - "'30'"
+ operator: yearmonthduration-set-equals
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'100'"
+ operator: x500name-intersection
+ compareWith:
+ value: "30"
+ - apply:
+ operator: x500name-at-least-one-member-of
+ keys:
+ - apply:
+ operator: x500name-union
+ keys:
+ - apply:
+ operator: x500name-subset
+ keys:
+ - "'30'"
+ - apply:
+ operator: x500name-set-equals
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ operator: rfc822name-intersection
+ keys:
+ - apply:
+ operator: rfc822name-at-least-one-member-of
+ keys:
+ - apply:
+ operator: rfc822name-union
+ keys:
+ - "'30'"
+ - apply:
+ operator: rfc822name-subset
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: rfc822name-set-equals
+ - "'30'"
+ operator: ipaddress-intersection
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: ipaddress-at-least-one-member-of
+ compareWith:
+ value: "30"
+ - apply:
+ operator: ipaddress-union
+ keys:
+ - apply:
+ operator: ipaddress-subset
+ keys:
+ - apply:
+ operator: ipaddress-set-equals
+ keys:
+ - "'30'"
+ - apply:
+ operator: dnsname-intersection
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: dnsname-at-least-one-member-of
+ - "'30'"
+ operator: dnsname-union
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: dnsname-subset
+ compareWith:
+ value: "30"
+ - apply:
+ operator: dnsname-set-equals
+ keys:
+ - apply:
+ operator: access-permitted
+ keys:
+ - apply:
+ operator: string-union
+ keys:
+ - "'30'"
+ - apply:
+ operator: string-subset
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: string-set-equals
+ - "'30'"
+ operator: boolean-intersection
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: boolean-at-least-one-member-of
+ compareWith:
+ value: "30"
+ - apply:
+ operator: boolean-union
+ keys:
+ - apply:
+ operator: boolean-subset
+ keys:
+ - apply:
+ operator: boolean-set-equals
+ keys:
+ - "'30'"
+ - apply:
+ operator: integer-intersection
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: integer-at-least-one-member-of
+ - "'30'"
+ operator: integer-union
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: integer-subset
+ compareWith:
+ value: "30"
+ - apply:
+ operator: datetime-one-and-only
+ keys:
+ - apply:
+ operator: datetime-bag
+ keys:
+ - apply:
+ operator: anyuri-bag-size
+ keys:
+ - "'30'"
+ - apply:
+ operator: anyuri-is-in
+ keys:
+ - "'30'"
+ - "19:00:00 05:00"
+ - apply:
+ keys:
+ - function: anyuri-bag
+ - "'30'"
+ operator: hexbinary-bag-size
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: hexbinary-is-in
+ compareWith:
+ value: "30"
+ - apply:
+ operator: hexbinary-bag
+ keys:
+ - apply:
+ operator: base64binary-bag-size
+ keys:
+ - apply:
+ operator: base64binary-is-in
+ keys:
+ - "'30'"
+ - apply:
+ operator: base64binary-bag
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: daytimeduration-bag-size
+ - "'30'"
+ operator: daytimeduration-is-in
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: daytimeduration-bag
+ compareWith:
+ value: "30"
+ - apply:
+ operator: yearmonthduration-bag-size
+ keys:
+ - apply:
+ operator: yearmonthduration-is-in
+ keys:
+ - apply:
+ operator: yearmonthduration-bag
+ keys:
+ - "'30'"
+ - apply:
+ operator: x500name-one-and-only
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: x500name-bag-size
+ - "'30'"
+ operator: x500name-is-in
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: x500name-bag
+ compareWith:
+ value: "30"
+ - apply:
+ operator: rfc822name-bag-size
+ keys:
+ - apply:
+ operator: string-from-time
+ keys:
+ - apply:
+ operator: date-from-string
+ keys:
+ - "'30'"
+ - apply:
+ operator: string-from-date
+ keys:
+ - "'30'"
+ - apply:
+ keys:
+ - "'30'"
+ operator: rfc822name-one-and-only
+ compareWith:
+ value: "30"
+ - apply:
+ operator: double-set-equals
+ keys:
+ - apply:
+ operator: time-intersection
+ keys:
+ - apply:
+ operator: time-at-least-one-member-of
+ keys:
+ - "19:00:00 05:00"
+ - apply:
+ operator: time-union
+ keys:
+ - "19:00:00 05:00"
+ - "'100'"
+ - apply:
+ keys:
+ - function: time-subset
+ - "'30'"
+ operator: time-set-equals
+ compareWith:
+ value: "19:00:00 05:00"
+ apply:
+ keys:
+ - "'30'"
+ operator: date-intersection
+ compareWith:
+ value: "30"
+ - apply:
+ operator: date-at-least-one-member-of
+ keys:
+ - apply:
+ operator: date-union
+ keys:
+ - apply:
+ operator: date-subset
+ keys:
+ - "'30'"
+ - apply:
+ operator: date-set-equals
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: datetime-intersection
+ - "'30'"
+ operator: datetime-at-least-one-member-of
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: datetime-union
+ compareWith:
+ value: "30"
+ - apply:
+ operator: datetime-subset
+ keys:
+ - apply:
+ operator: datetime-set-equals
+ keys:
+ - apply:
+ operator: anyuri-intersection
+ keys:
+ - "'30'"
+ - apply:
+ operator: anyuri-at-least-one-member-of
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: anyuri-union
+ - "'30'"
+ operator: anyuri-set-equals
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: hexbinary-intersection
+ compareWith:
+ value: "30"
+ - apply:
+ operator: hexbinary-at-least-one-member-of
+ keys:
+ - apply:
+ operator: hexbinary-union
+ keys:
+ - apply:
+ operator: hexbinary-subset
+ keys:
+ - "'30'"
+ - apply:
+ operator: hexbinary-set-equals
+ keys:
+ - "'30'"
+ - apply:
+ keys:
+ - "'30'"
+ operator: base64binary-intersection
+ compareWith:
+ value: "30"
+ - apply:
+ operator: datetime-subtract-yearmonthduration
+ keys:
+ - apply:
+ operator: date-subtract-yearmonthduration
+ keys:
+ - apply:
+ operator: time-less-than-or-equal
+ keys:
+ - "19:00:00 05:00"
+ - apply:
+ operator: date-less-than-or-equal
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ operator: date-equal
+ keys:
+ - apply:
+ operator: datetime-is-in
+ keys:
+ - apply:
+ operator: datetime-from-string
+ keys:
+ - "'30'"
+ - apply:
+ operator: string-from-datetime
+ keys:
+ - "'30'"
+ - "'100'"
+ - apply:
+ keys:
+ - function: double-subset
+ - "'30'"
+ operator: base64binary-one-and-only
+ compareWith:
+ value: "30"
+ apply:
+ keys:
+ - "'30'"
+ operator: hexbinary-intersection
+ compareWith:
+ value: "30"
+ compareWith:
+ value: "50"
+ decision: Permit
+ advice:
+ value: Slice is feasible since minimum percentage of cells is available
+ default: Permit
+ metadata:
+ policy-id: tosca.policy.test.2
+ policy-version: 1.0.0
+ name: tosca.policy.test
+ version: 2.0.0
+ metadata:
+ action: sfc-policy
+ description: This policy set specifies the conditions for slice feasibility
+ based on availability of cells
+ policy-id: tosca.policy.test
+ policy-version: 2.0.0
+name: ToscaServiceTemplateSimple
+version: 1.0.0