From bdef9f5dfd8c95eff86e710ef94c1fab4e652854 Mon Sep 17 00:00:00 2001 From: Chenfei Gao Date: Fri, 28 Feb 2020 14:45:48 -0500 Subject: Build XACML PDP support for native xacml policy type Added a new native application to the service loader framework Added a new translator for the native application Added custom serialization providers for xacml+json and xacml+xml Added a new endpoint for native xacml decision api Added a new api provider function to handle the native xacml api calls Added corresponding junit tests Issue-ID: POLICY-2182 Change-Id: I30fa4637612c324d543f9952386cf1a27a52d76c Signed-off-by: Chenfei Gao --- .../onap/policy/pdpx/main/rest/TestDecision.java | 35 ++++++- .../rest/serialization/CommonSerialization.java | 83 +++++++++++++++++ .../TestXacmlJsonExceptionMapper.java | 57 ++++++++++++ .../TestXacmlJsonMessageBodyHandler.java | 59 ++++++++++++ .../serialization/TestXacmlXmlExceptionMapper.java | 57 ++++++++++++ .../TestXacmlXmlMessageBodyHandler.java | 101 +++++++++++++++++++++ .../test/resources/apps/native/xacml.properties | 31 +++++++ .../decisions/decision.native.request.xml | 19 ++++ .../decisions/decision.native.response.xml | 14 +++ .../decisions/decision.single.output.json | 46 ++++++++++ .../resources/decisions/decsion.single.output.json | 46 ---------- 11 files changed, 499 insertions(+), 49 deletions(-) create mode 100644 main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/CommonSerialization.java create mode 100644 main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonExceptionMapper.java create mode 100644 main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonMessageBodyHandler.java create mode 100644 main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlExceptionMapper.java create mode 100644 main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlMessageBodyHandler.java create mode 100644 main/src/test/resources/apps/native/xacml.properties create mode 100644 main/src/test/resources/decisions/decision.native.request.xml create mode 100644 main/src/test/resources/decisions/decision.native.response.xml create mode 100644 main/src/test/resources/decisions/decision.single.output.json delete mode 100644 main/src/test/resources/decisions/decsion.single.output.json (limited to 'main/src/test') diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java index e3ad7b67..178e4b14 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/TestDecision.java @@ -24,6 +24,7 @@ package org.onap.policy.pdpx.main.rest; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; +import com.att.research.xacml.std.dom.DOMStructureException; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import java.io.File; @@ -54,6 +55,7 @@ import org.onap.policy.common.endpoints.parameters.RestServerParameters; import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; import org.onap.policy.common.gson.GsonMessageBodyHandler; import org.onap.policy.common.utils.network.NetworkUtil; +import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.decisions.concepts.DecisionRequest; import org.onap.policy.models.decisions.concepts.DecisionResponse; import org.onap.policy.models.errors.concepts.ErrorResponse; @@ -73,6 +75,7 @@ public class TestDecision { private static Main main; private static HttpClient client; private static CommonTestData testData = new CommonTestData(); + private static final String APPLICATION_XACML_XML = "application/xacml+xml"; @ClassRule public static final TemporaryFolder appsFolder = new TemporaryFolder(); @@ -179,6 +182,22 @@ public class TestDecision { assertThat(response.getStatus()).isEqualTo("Permit"); } + @Test + public void testDecision_Native() throws IOException, DOMStructureException { + + LOGGER.info("Running test testDecision_Native"); + + String requestAsString = ResourceUtils.getResourceAsString( + "src/test/resources/decisions/decision.native.request.xml"); + if (requestAsString == null) { + throw new IOException("failed to read the xml request"); + } + + String response = getNativeDecision(requestAsString); + LOGGER.info("Response {}", response); + assertThat(response).contains("NOTAPPLICABLE"); + } + private static Main startXacmlPdpService(File params) throws PolicyXacmlPdpException { final String[] XacmlPdpConfigParameters = {"-c", params.getAbsolutePath()}; return new Main(XacmlPdpConfigParameters); @@ -191,17 +210,27 @@ public class TestDecision { private DecisionResponse getDecision(DecisionRequest request) { Entity entityRequest = Entity.entity(request, MediaType.APPLICATION_JSON); - Response response = client.post("", entityRequest, Collections.emptyMap()); + Response response = client.post("/decision", entityRequest, Collections.emptyMap()); assertEquals(200, response.getStatus()); return HttpClient.getBody(response, DecisionResponse.class); } + private String getNativeDecision(String request) { + + Entity entityRequest = Entity.entity(request, APPLICATION_XACML_XML); + Response response = client.post("/xacml", entityRequest, Collections.emptyMap()); + + assertEquals(200, response.getStatus()); + + return HttpClient.getBody(response, String.class); + } + private ErrorResponse getErrorDecision(DecisionRequest request) { Entity entityRequest = Entity.entity(request, MediaType.APPLICATION_JSON); - Response response = client.post("", entityRequest, Collections.emptyMap()); + Response response = client.post("/decision", entityRequest, Collections.emptyMap()); assertEquals(400, response.getStatus()); @@ -213,7 +242,7 @@ public class TestDecision { .clientName("testDecisionClient") .serializationProvider(GsonMessageBodyHandler.class.getName()) .useHttps(false).allowSelfSignedCerts(false).hostname("localhost").port(port) - .basePath("policy/pdpx/v1/decision") + .basePath("policy/pdpx/v1") .userName("healthcheck").password("zb!XztG34").managed(true).build()); } diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/CommonSerialization.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/CommonSerialization.java new file mode 100644 index 00000000..2b4a4fd0 --- /dev/null +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/CommonSerialization.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.pdpx.main.rest.serialization; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import com.att.research.xacml.api.Request; +import com.att.research.xacml.api.Response; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import javax.ws.rs.core.MediaType; + +public class CommonSerialization { + + @SuppressWarnings("rawtypes") + private static final Class REQUEST_CLASS = Request.class; + @SuppressWarnings("rawtypes") + private static final Class RESPONSE_CLASS = Response.class; + @SuppressWarnings("rawtypes") + private static final Class GENERAL_CLASS = MyObject.class; + + public static void testIsWritableOrReadable(String primaryType, String subType, + MultiArgsFunction, Type, Annotation[], MediaType, Boolean> getter) { + + // null media type + assertFalse(getter.apply(null, null, null, null)); + + // valid media type and class type + assertTrue("writeable " + subType, getter.apply( + REQUEST_CLASS, null, null, new MediaType(primaryType, subType))); + assertTrue("writeable " + subType, getter.apply( + RESPONSE_CLASS, null, null, new MediaType(primaryType, subType))); + + // valid media type but invalid class type + assertFalse(getter.apply( + GENERAL_CLASS, null, null, new MediaType(primaryType, subType))); + + // null subtype or invalid media type + assertFalse(getter.apply(null, null, null, new MediaType(primaryType, null))); + assertFalse(getter.apply(null, null, null, MediaType.APPLICATION_JSON_TYPE)); + } + + public static class MyObject { + private int id; + + public MyObject() { + super(); + } + + public MyObject(int id) { + this.id = id; + } + + @Override + public String toString() { + return "MyObject [id=" + id + "]"; + } + } + + @FunctionalInterface + public interface MultiArgsFunction { + public R apply(T value1, U value2, V value3, W value4); + } +} \ No newline at end of file diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonExceptionMapper.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonExceptionMapper.java new file mode 100644 index 00000000..1b3cc209 --- /dev/null +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonExceptionMapper.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.pdpx.main.rest.serialization; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import javax.ws.rs.core.Response; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.common.utils.coder.StandardCoder; + +public class TestXacmlJsonExceptionMapper { + private XacmlJsonExceptionMapper mapper; + + @Before + public void setUp() { + mapper = new XacmlJsonExceptionMapper(); + } + + @Test + public void testToResponse() throws CoderException { + final IOException writeToEx = new IOException("failed to convert a json response to a string"); + final IOException readFromEx = new IOException("failed to decode incoming request string to a json request"); + final IOException unexpectedEx = new IOException("unexpected exception"); + final Response writeToResp = mapper.toResponse(writeToEx); + final Response readFromResp = mapper.toResponse(readFromEx); + final Response unexpectedResp = mapper.toResponse(unexpectedEx); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), writeToResp.getStatus()); + assertEquals("{'errorDetails':'invalid JSON xacml response'}".replace('\'', '"'), + new StandardCoder().encode(writeToResp.getEntity())); + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), readFromResp.getStatus()); + assertEquals("{'errorDetails':'invalid JSON xacml request'}".replace('\'', '"'), + new StandardCoder().encode(readFromResp.getEntity())); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), unexpectedResp.getStatus()); + } +} \ No newline at end of file diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonMessageBodyHandler.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonMessageBodyHandler.java new file mode 100644 index 00000000..5d5a4b88 --- /dev/null +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlJsonMessageBodyHandler.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.pdpx.main.rest.serialization; + +import com.att.research.xacml.std.dom.DOMStructureException; +import java.io.IOException; +import org.junit.Before; +import org.junit.Test; + +public class TestXacmlJsonMessageBodyHandler { + + private static final String PRIMARY_TYPE = "application"; + private static final String SUB_TYPE = "xacml+json"; + + private XacmlJsonMessageBodyHandler hdlr; + + @Before + public void setUp() { + hdlr = new XacmlJsonMessageBodyHandler(); + } + + @Test + public void testIsWriteable() { + CommonSerialization.testIsWritableOrReadable(PRIMARY_TYPE, SUB_TYPE, hdlr::isWriteable); + } + + @Test + public void testWriteTo() throws IOException, DOMStructureException { + //TODO: placeholder for JsonResponseTranslator + } + + @Test + public void testIsReadable() { + CommonSerialization.testIsWritableOrReadable(PRIMARY_TYPE, SUB_TYPE, hdlr::isReadable); + } + + @Test + public void testReadFrom() throws IOException { + //TODO: placeholder for JsonRequestTranslator + } +} \ No newline at end of file diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlExceptionMapper.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlExceptionMapper.java new file mode 100644 index 00000000..c9b7bac5 --- /dev/null +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlExceptionMapper.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP + * ================================================================================ + * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.pdpx.main.rest.serialization; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import javax.ws.rs.core.Response; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.common.utils.coder.StandardCoder; + +public class TestXacmlXmlExceptionMapper { + private XacmlXmlExceptionMapper mapper; + + @Before + public void setUp() { + mapper = new XacmlXmlExceptionMapper(); + } + + @Test + public void testToResponse() throws CoderException { + final IOException writeToEx = new IOException("failed to convert a dom response to a string"); + final IOException readFromEx = new IOException("failed to decode incoming request string to a dom request"); + final IOException unexpectedEx = new IOException("unexpected exception"); + final Response writeToResp = mapper.toResponse(writeToEx); + final Response readFromResp = mapper.toResponse(readFromEx); + final Response unexpectedResp = mapper.toResponse(unexpectedEx); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), writeToResp.getStatus()); + assertEquals("{'errorDetails':'invalid XML xacml response'}".replace('\'', '"'), + new StandardCoder().encode(writeToResp.getEntity())); + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), readFromResp.getStatus()); + assertEquals("{'errorDetails':'invalid XML xacml request'}".replace('\'', '"'), + new StandardCoder().encode(readFromResp.getEntity())); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), unexpectedResp.getStatus()); + } +} \ No newline at end of file diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlMessageBodyHandler.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlMessageBodyHandler.java new file mode 100644 index 00000000..4ae75387 --- /dev/null +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/serialization/TestXacmlXmlMessageBodyHandler.java @@ -0,0 +1,101 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.pdpx.main.rest.serialization; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import com.att.research.xacml.api.Request; +import com.att.research.xacml.api.RequestAttributes; +import com.att.research.xacml.api.Response; +import com.att.research.xacml.std.dom.DOMResponse; +import com.att.research.xacml.std.dom.DOMStructureException; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Iterator; +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.utils.resources.ResourceUtils; + +public class TestXacmlXmlMessageBodyHandler { + + private static final String PRIMARY_TYPE = "application"; + private static final String SUB_TYPE = "xacml+xml"; + + @SuppressWarnings("rawtypes") + private static final Class REQUEST_CLASS = Request.class; + @SuppressWarnings("rawtypes") + private static final Class RESPONSE_CLASS = Response.class; + + private XacmlXmlMessageBodyHandler hdlr; + + @Before + public void setUp() { + hdlr = new XacmlXmlMessageBodyHandler(); + } + + @Test + public void testIsWriteable() { + CommonSerialization.testIsWritableOrReadable(PRIMARY_TYPE, SUB_TYPE, hdlr::isWriteable); + } + + @Test + public void testWriteTo() throws IOException, DOMStructureException { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + Response resp = DOMResponse.load(ResourceUtils.getResourceAsString( + "src/test/resources/decisions/decision.native.response.xml")); + hdlr.writeTo(resp, RESPONSE_CLASS, RESPONSE_CLASS, null, null, null, stream); + assertEquals(resp, DOMResponse.load(new ByteArrayInputStream(stream.toByteArray()))); + } + + @Test + public void testIsReadable() { + CommonSerialization.testIsWritableOrReadable(PRIMARY_TYPE, SUB_TYPE, hdlr::isReadable); + } + + @Test + @SuppressWarnings("unchecked") + public void testReadFrom() throws IOException { + Request req = hdlr.readFrom(REQUEST_CLASS, REQUEST_CLASS, null, null, null, ResourceUtils.getResourceAsStream( + "src/test/resources/decisions/decision.native.request.xml")); + assertFalse(req.getCombinedDecision()); + assertFalse(req.getReturnPolicyIdList()); + assertTrue(req.getRequestAttributes().size() == 4); + Iterator iter = req.getRequestAttributes().iterator(); + + RequestAttributes firstRequestAttributes = iter.next(); + assertTrue(firstRequestAttributes.getAttributes().size() == 1); + assertEquals("Julius Hibbert", firstRequestAttributes.getAttributes().iterator().next() + .getValues().iterator().next().getValue().toString()); + + RequestAttributes secondRequestAttributes = iter.next(); + assertTrue(secondRequestAttributes.getAttributes().size() == 1); + assertEquals("http://medico.com/record/patient/BartSimpson", secondRequestAttributes.getAttributes() + .iterator().next().getValues().iterator().next().getValue().toString()); + + RequestAttributes thirdRequestAttributes = iter.next(); + assertTrue(thirdRequestAttributes.getAttributes().size() == 1); + assertEquals("read", thirdRequestAttributes.getAttributes().iterator().next() + .getValues().iterator().next().getValue().toString()); + } +} \ No newline at end of file diff --git a/main/src/test/resources/apps/native/xacml.properties b/main/src/test/resources/apps/native/xacml.properties new file mode 100644 index 00000000..5ea247cf --- /dev/null +++ b/main/src/test/resources/apps/native/xacml.properties @@ -0,0 +1,31 @@ +# +# Properties that the embedded PDP engine uses to configure and load +# +# Standard API Factories +# +xacml.dataTypeFactory=com.att.research.xacml.std.StdDataTypeFactory +xacml.pdpEngineFactory=com.att.research.xacmlatt.pdp.ATTPDPEngineFactory +xacml.pepEngineFactory=com.att.research.xacml.std.pep.StdEngineFactory +xacml.pipFinderFactory=com.att.research.xacml.std.pip.StdPIPFinderFactory +xacml.traceEngineFactory=com.att.research.xacml.std.trace.LoggingTraceEngineFactory +# +# AT&T PDP Implementation Factories +# +xacml.att.evaluationContextFactory=com.att.research.xacmlatt.pdp.std.StdEvaluationContextFactory +xacml.att.combiningAlgorithmFactory=com.att.research.xacmlatt.pdp.std.StdCombiningAlgorithmFactory +xacml.att.functionDefinitionFactory=com.att.research.xacmlatt.pdp.std.StdFunctionDefinitionFactory +# +# ONAP PDP Implementation Factories +# +xacml.att.policyFinderFactory=org.onap.policy.pdp.xacml.application.common.OnapPolicyFinderFactory + +# +# Use a root combining algorithm +# +xacml.att.policyFinderFactory.combineRootPolicies=urn:com:att:xacml:3.0:policy-combining-algorithm:combined-permit-overrides + +# +# Policies to load +# +xacml.rootPolicies= +xacml.referencedPolicies= \ No newline at end of file diff --git a/main/src/test/resources/decisions/decision.native.request.xml b/main/src/test/resources/decisions/decision.native.request.xml new file mode 100644 index 00000000..3fe984a4 --- /dev/null +++ b/main/src/test/resources/decisions/decision.native.request.xml @@ -0,0 +1,19 @@ + + + + + Julius Hibbert + + + + + http://medico.com/record/patient/BartSimpson + + + + + read + + + + \ No newline at end of file diff --git a/main/src/test/resources/decisions/decision.native.response.xml b/main/src/test/resources/decisions/decision.native.response.xml new file mode 100644 index 00000000..8c484e0a --- /dev/null +++ b/main/src/test/resources/decisions/decision.native.response.xml @@ -0,0 +1,14 @@ + + + + Permit + + + + + \ No newline at end of file diff --git a/main/src/test/resources/decisions/decision.single.output.json b/main/src/test/resources/decisions/decision.single.output.json new file mode 100644 index 00000000..707a3964 --- /dev/null +++ b/main/src/test/resources/decisions/decision.single.output.json @@ -0,0 +1,46 @@ +{ + "policies": { + "onap.scaleout.tca": { + "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", + "version": "1.0.0", + "metadata": { + "policy-id": "onap.scaleout.tca", + "policy-version": 1 + }, + "properties": { + "tca_policy": { + "domain": "measurementsForVfScaling", + "metricsPerEventName": [ + { + "eventName": "vLoadBalancer", + "controlLoopSchemaType": "VNF", + "policyScope": "type=configuration", + "policyName": "onap.scaleout.tca", + "policyVersion": "v0.0.1", + "thresholds": [ + { + "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "closedLoopEventStatus": "ONSET", + "version": "1.0.2", + "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", + "thresholdValue": 500, + "direction": "LESS_OR_EQUAL", + "severity": "MAJOR" + }, + { + "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", + "closedLoopEventStatus": "ONSET", + "version": "1.0.2", + "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", + "thresholdValue": 5000, + "direction": "GREATER_OR_EQUAL", + "severity": "CRITICAL" + } + ] + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/main/src/test/resources/decisions/decsion.single.output.json b/main/src/test/resources/decisions/decsion.single.output.json deleted file mode 100644 index 707a3964..00000000 --- a/main/src/test/resources/decisions/decsion.single.output.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "policies": { - "onap.scaleout.tca": { - "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", - "version": "1.0.0", - "metadata": { - "policy-id": "onap.scaleout.tca", - "policy-version": 1 - }, - "properties": { - "tca_policy": { - "domain": "measurementsForVfScaling", - "metricsPerEventName": [ - { - "eventName": "vLoadBalancer", - "controlLoopSchemaType": "VNF", - "policyScope": "type=configuration", - "policyName": "onap.scaleout.tca", - "policyVersion": "v0.0.1", - "thresholds": [ - { - "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "closedLoopEventStatus": "ONSET", - "version": "1.0.2", - "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", - "thresholdValue": 500, - "direction": "LESS_OR_EQUAL", - "severity": "MAJOR" - }, - { - "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "closedLoopEventStatus": "ONSET", - "version": "1.0.2", - "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", - "thresholdValue": 5000, - "direction": "GREATER_OR_EQUAL", - "severity": "CRITICAL" - } - ] - } - ] - } - } - } - } -} \ No newline at end of file -- cgit 1.2.3-korg