diff options
Diffstat (limited to 'model/model-api/src/test')
14 files changed, 4057 insertions, 1676 deletions
diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextAlbumTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextAlbumTest.java index e6ed351ae..5ce6b6760 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextAlbumTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextAlbumTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,12 +27,13 @@ import org.junit.Test; /** * Context album for API tests. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class ApexEditorApiContextAlbumTest { @Test public void testContextAlbumCrud() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.validateContextAlbum(null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); @@ -44,13 +45,13 @@ public class ApexEditorApiContextAlbumTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createContextAlbum("MyMap002", "0.0.2", "APPLICATION", "true", "MapType", "0.0.1", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createContextAlbum("MyMap012", "0.1.2", "ZOOBY", "false", "MapType", "0.0.1", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createContextAlbum("MyMap012", "0.1.4", "UNDEFINED", null, "MapType", "0.0.1", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createContextAlbum("MyMap012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); @@ -73,16 +74,16 @@ public class ApexEditorApiContextAlbumTest { result = apexModel.createContextAlbum("MyMap012", null, "EPHEMERAL", "false", "MapType", null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createContextAlbum("MyMap002", "0.0.2", "APPLICATION", "true", "MapType", null, - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createContextAlbum("MyMap011", "0.1.2", "APPLICATION", "true", "MapType", "0.0.1", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.deleteContextAlbum("MyMap012", "0.1.2"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createContextAlbum("MyMap012", "0.1.2", "ZOOBY", "false", "MapType", "0.0.1", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.validateContextAlbum(null, null); @@ -95,7 +96,7 @@ public class ApexEditorApiContextAlbumTest { result = apexModel.updateContextAlbum("MyMap002", "0.0.2", "ZOOBY", "true", null, null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateContextAlbum("MyMap002", "0.0.2", null, null, null, null, - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateContextAlbum("MyMap012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); @@ -114,13 +115,13 @@ public class ApexEditorApiContextAlbumTest { result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "false", "String", null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "false", "StringType", "0.0.2", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "false", "StringType", "0.0.1", null, - null); + null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "Hello", "StringType", "0.0.1", null, - null); + null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.listContextAlbum("@£%%$", null); @@ -159,6 +160,7 @@ public class ApexEditorApiContextAlbumTest { result = apexModel.deleteContextAlbum("MyMap012", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); + assertEquals(2, result.getMessages().size()); result = apexModel.listContextAlbum("MyMap012", null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextSchemaTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextSchemaTest.java index 04605f4a1..20310a29e 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextSchemaTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextSchemaTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ import org.junit.Test; public class ApexEditorApiContextSchemaTest { @Test public void testContextSchemaCrud() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.validateContextSchemas(null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java index 775fcc1d3..ac9265e84 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,12 +28,13 @@ import org.junit.Test; /** * Test events for API tests. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class ApexEditorApiEventTest { @Test public void testEventCrud() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.validateEvent(null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); @@ -45,41 +46,41 @@ public class ApexEditorApiEventTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent002", "0.0.2", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent012", "0.1.2", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012", null); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent012", "0.1.4", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014", null); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createEvent("MyEvent002", "0.0.2", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createEvent("@£$%^", "0.2.5", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.deleteEvent("MyEvent012", "0.1.4"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent012", "0.1.4", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014", null); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.validateEvent(null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.updateContextSchema(null, null, null, null, null, null); + result = apexModel.updateEvent(null, null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = apexModel.updateEvent("MyEvent012", "0.1.2", "Another Namespace", null, "Another target", null, null, - null); + result = + apexModel.updateEvent("MyEvent012", "0.1.2", "Another Namespace", null, "Another target", null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateEvent("MyEvent002", "0.0.2", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateEvent("MyEvent012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); @@ -140,6 +141,8 @@ public class ApexEditorApiEventTest { result = apexModel.createEventPar("MyEvent002", "0.0.2", "NewPar00", null, null, true); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = apexModel.createContextSchema("eventContextItem0", "0.0.1", "Java", "java.lang.Integer", + "1fa2e430-f2b2-11e6-bc64-92361f002673", "A further updated description of hola"); result = apexModel.createEventPar("MyEvent002", "0.0.2", "NewPar00", "eventContextItem0", null, false); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEventPar("MyEvent002", "0.0.2", "NewPar00", "eventContextItem0", null, true); @@ -196,4 +199,4 @@ public class ApexEditorApiEventTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); assertEquals(0, result.getMessages().size()); } -}
\ No newline at end of file +} diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiKeyInfoTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiKeyInfoTest.java index caa25e4a4..2519b8cb2 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiKeyInfoTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiKeyInfoTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ public class ApexEditorApiKeyInfoTest { @Test public void testKeyInfoCrud() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.validateKeyInformation(null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java index 3e78921e9..0a4d72214 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ import org.junit.Test; public class ApexEditorApiPolicyTest { @Test public void testMyTestPolicyCrud() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.validatePolicy(null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); @@ -45,10 +45,10 @@ public class ApexEditorApiPolicyTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicy("MyPolicy002", "0.0.2", "SomeTemplate", "AState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicy("MyPolicy002", "0.0.2", "SomeTemplate", "AState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createPolicy("MyPolicy012", null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); @@ -59,19 +59,19 @@ public class ApexEditorApiPolicyTest { result = apexModel.createPolicy("MyPolicy012", null, "SomeTemplate", "AState", null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicy("MyPolicy002", "0.0.2", "SomeTemplate", "AState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createPolicy("MyPolicy012", "0.1.2", "SomeTemplate", "AState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicy("MyTestPolicy", "0.0.1", "SomeTemplate", "TestState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.deletePolicy("MyPolicy002", "0.0.2"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicy("MyPolicy002", "0.0.2", "SomeTemplate", "AState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.validatePolicy(null, null); @@ -84,7 +84,7 @@ public class ApexEditorApiPolicyTest { result = apexModel.updatePolicy("MyPolicy002", "0.0.1", null, null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicy("MyPolicy002", "0.0.2", "SomeOtherTemplate", "BState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicy("MyPolicy012", null, "SomeOtherTemplate", null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); @@ -137,7 +137,6 @@ public class ApexEditorApiPolicyTest { result = apexModel.deletePolicy("MyPolicy012", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); assertEquals(2, result.getMessages().size()); - result = apexModel.createPolicyState(null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyState("MyPolicy123", null, null, null, null, null, null); @@ -255,15 +254,15 @@ public class ApexEditorApiPolicyTest { assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "TestState1", "inEvent", "0.0.1", "task", - "0.0.1"); + "0.0.1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "TestState2", "outEvent0", "0.0.1", "task", - "0.0.1"); + "0.0.1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "TestState3", "outEvent1", "0.0.1", "task", - "0.0.1"); + "0.0.1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic(null, null, null, null, null); @@ -279,29 +278,29 @@ public class ApexEditorApiPolicyTest { result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "NewTSL00", null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "UNDEFINED", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "MVEL", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "JAVA", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "JYTHON", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", "JAVASCRIPT", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", "JRUBY", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic(null, null, null, null, null); @@ -321,15 +320,15 @@ public class ApexEditorApiPolicyTest { result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "NonExistantState", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "", - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "MVEL", - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic("MyPolicy012", null, "TestState1", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", null, - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); @@ -373,13 +372,13 @@ public class ApexEditorApiPolicyTest { result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", null, - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.listPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); assertEquals(1, result.getMessages().size()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", "JRUBY", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.listPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); @@ -397,37 +396,37 @@ public class ApexEditorApiPolicyTest { result = apexModel.createPolicyStateOutput("MyTestPolicy", null, "SomeState", "SomeOutput", null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "1.2.3", "TestState1", "SomeOutput", null, null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", null, null, - null); + null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", - "SomeDummyEvent", null, null); + "SomeDummyEvent", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "inEvent", - "1.2.3", null); + "1.2.3", null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "inEvent", - "0.0.1", "SomeDummyNextState"); + "0.0.1", "SomeDummyNextState"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "inEvent", - "0.0.1", null); + "0.0.1", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", - "0.0.1", "TestState1"); + "0.0.1", "TestState1"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", - "0.0.1", "TestState2"); + "0.0.1", "TestState2"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", - "0.0.1", "TestState2"); + "0.0.1", "TestState2"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "AnotherOtherOutput", - "outEvent0", "0.0.1", "TestState3"); + "outEvent0", "0.0.1", "TestState3"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "YetAnotherOtherOutput", - "outEvent0", "0.0.1", "TestState3"); + "outEvent0", "0.0.1", "TestState3"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.listPolicyStateOutput(null, null, null, null); @@ -495,19 +494,19 @@ public class ApexEditorApiPolicyTest { assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "inEvent", - "0.0.1", null); + "0.0.1", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", - "0.0.1", "TestState1"); + "0.0.1", "TestState1"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", - "0.0.1", "TestState2"); + "0.0.1", "TestState2"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "AnotherOtherOutput", - "outEvent0", "0.0.1", "TestState3"); + "outEvent0", "0.0.1", "TestState3"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "YetAnotherOtherOutput", - "outEvent0", "0.0.1", "TestState3"); + "outEvent0", "0.0.1", "TestState3"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic(null, null, null, null, null, null); @@ -519,34 +518,34 @@ public class ApexEditorApiPolicyTest { result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "SomeState", "SFLName01", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "1.2.3", "TestState1", "SFLName01", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName01", null, - null); + null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName01", - "NewTSL00", null); + "NewTSL00", null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName02", - "UNDEFINED", "Some Policy Logic"); + "UNDEFINED", "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName03", "MVEL", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName03", "MVEL", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName04", "JAVA", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName05", "JYTHON", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06", - "JAVASCRIPT", "Some Policy Logic"); + "JAVASCRIPT", "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName07", "JRUBY", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic(null, null, null, null, null, null); @@ -556,37 +555,37 @@ public class ApexEditorApiPolicyTest { result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, "TestState99", "SomeSFLName", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy2", null, "TestState1", "SomeSFLName", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy1", "0.0.2", "TestState1", "SomeSFLName", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "NonEistantSFL", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName06", null, - null); + null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName06", "", - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName06", "MVEL", - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyPolicy012", null, "TestState1", "SFLName06", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06", null, - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06", null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyPolicy015", null, "TestState1", "SFLName06", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyPolicy014", "0.1.5", "TestState1", "SFLName06", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.listPolicyStateFinalizerLogic(null, null, null, null); @@ -669,22 +668,22 @@ public class ApexEditorApiPolicyTest { assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName02", - "UNDEFINED", "Some Policy Logic"); + "UNDEFINED", "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName03", "MVEL", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName04", "JAVA", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName05", "JYTHON", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06", - "JAVASCRIPT", "Some Policy Logic"); + "JAVASCRIPT", "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName07", "JRUBY", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createTask("TestTask0", null, null, null); @@ -705,81 +704,81 @@ public class ApexEditorApiPolicyTest { result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "SomeState", null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "SomeState", null, null, null, null, - "DummyOutput"); + "DummyOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "1.2.3", "SomeState", null, null, null, null, - "DummyOutput"); + "DummyOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("AnyOldPolicy", "1.2.3", "SomeState", null, null, null, null, - "DummyOutput"); + "DummyOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", null, - null, null, "DummyOutput"); + null, null, "DummyOutput"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", - "SomeTask", "Zooby|", null, "DummyOutput"); + "SomeTask", "Zooby|", null, "DummyOutput"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", - "SomeTask", "0.0.1", null, "DummyOutput"); + "SomeTask", "0.0.1", null, "DummyOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "task", - "0.0.1", null, "DummyOutput"); + "0.0.1", null, "DummyOutput"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "Some Policy Logic", "DummyOutput"); + "0.0.1", "Some Policy Logic", "DummyOutput"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "DIRECT", "DummyOutput"); + "0.0.1", "DIRECT", "DummyOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "LOGIC", "DummyOutput"); + "0.0.1", "LOGIC", "DummyOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "DIRECT", "SFLName07"); + "0.0.1", "DIRECT", "SFLName07"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "LOGIC", "SomeOutput"); + "0.0.1", "LOGIC", "SomeOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "DIRECT", "SomeOutput"); + "0.0.1", "DIRECT", "SomeOutput"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "NonExistantTask", "0.0.1", "DIRECT", "SomeOutput"); + "NonExistantTask", "0.0.1", "DIRECT", "SomeOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "LOGIC", "SFLName07"); + "0.0.1", "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask0", "0.0.1", "LOGIC", "SFLName07"); + "TestTask0", "0.0.1", "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask1", "0.0.1", "DIRECT", "SomeOtherOutput"); + "TestTask1", "0.0.1", "DIRECT", "SomeOtherOutput"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask2", "0.0.1", "LOGIC", "SFLName07"); + "TestTask2", "0.0.1", "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask3", "0.0.1", "DIRECT", "SomeOtherOutput"); + "TestTask3", "0.0.1", "DIRECT", "SomeOtherOutput"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, "TestTask4", "0.0.1", - "LOGIC", "SFLName07"); + "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, "TestTask4", "0.0.1", - "LOGIC", "SFLName07"); + "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", null, "TestState1", "TestTask4", "0.0.1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask4", "0.0.1", "FUNKY", "SFLName07"); + "TestTask4", "0.0.1", "FUNKY", "SFLName07"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask4", "0.0.1", "UNDEFINED", "SFLName07"); + "TestTask4", "0.0.1", "UNDEFINED", "SFLName07"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask4", "0.0.1", "LOGIC", "SFLName07"); + "TestTask4", "0.0.1", "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, "TestTask0", "0.0.1", - "LOGIC", "SFLName07"); + "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.listPolicyStateTaskRef(null, null, null, null, null); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java index 026f67c29..15e53f925 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,12 +29,13 @@ import org.onap.policy.apex.model.modelapi.impl.ApexModelImpl; /** * Test tasks for API tests. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class ApexEditorApiTaskTest { @Test public void testTaskCrud() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.validateTask(null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); @@ -46,13 +47,13 @@ public class ApexEditorApiTaskTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createTask("@^^$^^$", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createTask("MyTask012", null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); @@ -60,16 +61,16 @@ public class ApexEditorApiTaskTest { assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.listTask(null, null); result = apexModel.createTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createTask("MyTask012", "0.1.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.deleteTask("MyTask002", "0.0.2"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.validateTask(null, null); @@ -82,7 +83,7 @@ public class ApexEditorApiTaskTest { result = apexModel.updateTask("MyTask002", "0.0.1", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updateTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateTask("MyTask012", null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java index a4b42276a..f28d0e634 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,6 @@ import java.util.UUID; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.modelapi.impl.ApexModelImpl; import org.onap.policy.common.utils.resources.TextFileUtils; @@ -60,7 +59,7 @@ public class ApexModelApiTest { @Test public void testApexModelLoadFromFile() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.loadFromFile("src/main/resources/models/PolicyModel.json"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); @@ -71,7 +70,7 @@ public class ApexModelApiTest { result = apexModel.deleteModel(); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.xml"); + result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.deleteModel(); @@ -79,97 +78,64 @@ public class ApexModelApiTest { result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.junk"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - assertEquals("format of input for Apex concept is neither JSON nor XML", result.getMessages().get(0)); + assertEquals("Unable to unmarshal Apex concept", result.getMessages().get(0).trim()); } @Test public void testApexModelSaveToFile() throws IOException { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); final File tempJsonModelFile = File.createTempFile("ApexModelTest", ".json"); - result = apexModel.saveToFile(tempJsonModelFile.getCanonicalPath(), false); + result = apexModel.saveToFile(tempJsonModelFile.getPath()); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - final ApexModel jsonApexModel = new ApexModelFactory().createApexModel(null, false); - result = jsonApexModel.loadFromFile(tempJsonModelFile.getCanonicalPath()); + final ApexModel jsonApexModel = new ApexModelFactory().createApexModel(null); + result = jsonApexModel.loadFromFile(tempJsonModelFile.getPath()); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); tempJsonModelFile.delete(); - final File tempXmlModelFile = File.createTempFile("ApexModelTest", ".xml"); - result = apexModel.saveToFile(tempXmlModelFile.getCanonicalPath(), true); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - - final ApexModel xmlApexModel = new ApexModelFactory().createApexModel(null, false); - result = xmlApexModel.loadFromFile(tempXmlModelFile.getCanonicalPath()); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - tempXmlModelFile.delete(); - } - - @Test - public void testApexModelDatabase() throws IOException { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); - - ApexApiResult result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - - final DaoParameters DaoParameters = new DaoParameters(); - DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - DaoParameters.setPersistenceUnit("DAOTest"); - - result = apexModel.saveToDatabase(DaoParameters); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - - result = apexModel.deleteModel(); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - - result = apexModel.loadFromDatabase("PolicyModel", "0.0.1", DaoParameters); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - - result = apexModel.deleteModel(); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - - result = apexModel.loadFromDatabase("PolicyModel", null, DaoParameters); + final File tempModelFile = File.createTempFile("ApexModelTest", ".json"); + result = apexModel.saveToFile(tempModelFile.getPath()); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.deleteModel(); + final ApexModel testApexModel = new ApexModelFactory().createApexModel(null); + result = testApexModel.loadFromFile(tempModelFile.getPath()); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - - result = apexModel.loadFromDatabase("VPNPolicyModel", "0.0.1", DaoParameters); - assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + tempModelFile.delete(); } @Test public void testApexModelUrl() throws IOException { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); assertThatThrownBy(() -> apexModel.readFromUrl(null)).isInstanceOf(IllegalArgumentException.class); - assertThatThrownBy(() -> apexModel.writeToUrl(null, true)).isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> apexModel.writeToUrl(null)).isInstanceOf(IllegalArgumentException.class); ApexApiResult result = null; result = apexModel.readFromUrl("zooby/looby"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = apexModel.writeToUrl("zooby/looby", true); + result = apexModel.writeToUrl("zooby/looby"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.readFromUrl("zooby://zooby/looby"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = apexModel.writeToUrl("zooby://zooby/looby", false); + result = apexModel.writeToUrl("zooby://zooby/looby"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - final File tempJsonModelFile = File.createTempFile("ApexModelTest", ".json"); + final File tempJsonModelFile = File.createTempFile("ApexModelTest", "json"); - result = apexModel.saveToFile(tempJsonModelFile.getCanonicalPath(), false); + result = apexModel.saveToFile(tempJsonModelFile.getPath()); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); final String tempFileUrlString = tempJsonModelFile.toURI().toString(); result = apexModel.readFromUrl(tempFileUrlString); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.writeToUrl(tempFileUrlString, false); + result = apexModel.writeToUrl(tempFileUrlString); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); assertEquals("protocol doesn't support output", result.getMessages().get(0)); @@ -178,7 +144,7 @@ public class ApexModelApiTest { @Test public void testApexModelMisc() throws IOException { - final ApexModelImpl apexModelImpl = (ApexModelImpl) new ApexModelFactory().createApexModel(null, false); + final ApexModelImpl apexModelImpl = (ApexModelImpl) new ApexModelFactory().createApexModel(null); ApexApiResult result = null; @@ -208,10 +174,7 @@ public class ApexModelApiTest { apexModelImpl.deleteModel(); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModelImpl.loadFromFile(tempFile.getCanonicalPath()); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - - result = apexModelImpl.saveToFile(null, false); + result = apexModelImpl.loadFromFile(tempFile.getPath()); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.analyse(); @@ -220,7 +183,7 @@ public class ApexModelApiTest { result = apexModelImpl.validate(); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModelImpl.compare(tempFile.getCanonicalPath(), true, true); + result = apexModelImpl.compare(tempFile.getPath(), true, true); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.compareWithString(modelString, true, true); @@ -229,10 +192,10 @@ public class ApexModelApiTest { result = apexModelImpl.split("policy"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModelImpl.split(tempFile.getCanonicalPath(), "policy"); + result = apexModelImpl.split(tempFile.getPath(), "policy"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModelImpl.merge(tempFile.getCanonicalPath(), true); + result = apexModelImpl.merge(tempFile.getPath(), true); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.mergeWithString(modelString, true); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelFacadeTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelFacadeTest.java index a5f258e4c..d3b32b923 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelFacadeTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelFacadeTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation + * Modifications Copyright (C) 2020,2022 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,14 +34,14 @@ public class ModelFacadeTest { @Test public void testModelFacade() { - assertThatThrownBy(() -> new ModelFacade(null, null, false)) + assertThatThrownBy(() -> new ModelFacade(null, null)) .hasMessage("apexModel may not be null"); - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); - assertThatThrownBy(() -> new ModelFacade(apexModel, null, false)) + assertThatThrownBy(() -> new ModelFacade(apexModel, null)) .hasMessage("apexProperties may not be null"); final Properties modelProperties = new Properties(); - final ModelFacade mf = new ModelFacade(apexModel, modelProperties, false); + final ModelFacade mf = new ModelFacade(apexModel, modelProperties); ApexApiResult result = mf.createModel(null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); @@ -91,7 +91,6 @@ public class ModelFacadeTest { result = mf.listModel(); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - assertEquals("AxPolicyModel:(AxPolicyModel:(key=AxArtifactKey:(n", result.getMessage().substring(0, 50)); result = mf.deleteModel(); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelHandlerFacadeTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelHandlerFacadeTest.java index 4a1c3276c..5bbc95992 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelHandlerFacadeTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelHandlerFacadeTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,6 @@ import java.io.File; import java.io.IOException; import java.util.Properties; import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.modelapi.impl.ModelHandlerFacade; import org.onap.policy.common.utils.resources.TextFileUtils; @@ -42,14 +41,14 @@ public class ModelHandlerFacadeTest { @Test public void testModelHandlerFacade() throws IOException { - assertThatThrownBy(() -> new ModelHandlerFacade(null, null, false)) + assertThatThrownBy(() -> new ModelHandlerFacade(null, null)) .hasMessage("apexModel may not be null"); - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); - assertThatThrownBy(() -> new ModelHandlerFacade(apexModel, null, false)) + assertThatThrownBy(() -> new ModelHandlerFacade(apexModel, null)) .hasMessage("apexProperties may not be null"); final Properties modelProperties = new Properties(); - final ModelHandlerFacade mhf = new ModelHandlerFacade(apexModel, modelProperties, false); + final ModelHandlerFacade mhf = new ModelHandlerFacade(apexModel, modelProperties); assertNotNull(mhf); ApexApiResult result = mhf.loadFromFile("src/test/resources/models/PolicyModel.json"); @@ -69,19 +68,9 @@ public class ModelHandlerFacadeTest { result = mhf.loadFromString(modelString); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); - final DaoParameters DaoParameters = new DaoParameters(); - result = mhf.loadFromDatabase("SomeModel", null, DaoParameters); - assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); - result = apexModel.deleteModel(); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = mhf.loadFromDatabase("SomeModel", null, DaoParameters); - assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - - result = mhf.saveToDatabase(DaoParameters); - assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = mhf.readFromUrl("blah://somewhere/over/the/rainbow"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); @@ -94,7 +83,7 @@ public class ModelHandlerFacadeTest { final File tempFile = File.createTempFile("ApexModel", "json"); tempFile.deleteOnExit(); - result = mhf.writeToUrl("File:///" + tempFile.getCanonicalPath(), false); + result = mhf.writeToUrl("File:///" + tempFile.getCanonicalPath()); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mhf.validate(); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/RealModelTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/RealModelTest.java new file mode 100644 index 000000000..2a29f5297 --- /dev/null +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/RealModelTest.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2022 Nordix Foundation. + * ================================================================================ + * 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.apex.model.modelapi; + +import static org.junit.Assert.assertTrue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import java.util.Map; +import org.junit.Test; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelCustomGsonMapAdapter; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.common.utils.resources.TextFileUtils; + +public class RealModelTest { + @Test + public void testRealModel() throws Exception { + + final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json"); + + AxPolicyModel policyModel = new ApexModelReader<AxPolicyModel>(AxPolicyModel.class).read(modelString); + + AxValidationResult result = new AxValidationResult(); + assertTrue(policyModel.validate(result).isValid()); + } +} diff --git a/model/model-api/src/test/resources/META-INF/persistence.xml b/model/model-api/src/test/resources/META-INF/persistence.xml deleted file mode 100644 index 2603d5496..000000000 --- a/model/model-api/src/test/resources/META-INF/persistence.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ============LICENSE_START======================================================= - Copyright (C) 2016-2018 Ericsson. 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========================================================= ---> - -<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"> - <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL"> - <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> - - <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class> - <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class> - <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class> - <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class> - <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class> - <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation</class> - <class>org.onap.policy.apex.model.basicmodel.concepts.AxModel</class> - <class>org.onap.policy.apex.model.basicmodel.concepts.TestEntity</class> - <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema</class> - <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas</class> - <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum</class> - <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums</class> - <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextModel</class> - <class>org.onap.policy.apex.model.eventmodel.concepts.AxField</class> - <class>org.onap.policy.apex.model.eventmodel.concepts.AxInputField</class> - <class>org.onap.policy.apex.model.eventmodel.concepts.AxOutputField</class> - <class>org.onap.policy.apex.model.eventmodel.concepts.AxEvent</class> - <class>org.onap.policy.apex.model.eventmodel.concepts.AxEvents</class> - <class>org.onap.policy.apex.model.eventmodel.concepts.AxEventModel</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxLogic</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxTask</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxTasks</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxStateFinalizerLogic</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxStateOutput</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxState</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicy</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicies</class> - <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel</class> - - <properties> - <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" /> - <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" /> - <property name="eclipselink.ddl-generation" value="create-or-extend-tables" /> - <property name="eclipselink.ddl-generation.output-mode" value="database" /> - <property name="eclipselink.logging.level" value="INFO" /> - </properties> - </persistence-unit> -</persistence> diff --git a/model/model-api/src/test/resources/models/PolicyModel.json b/model/model-api/src/test/resources/models/PolicyModel.json index 81c222609..fbb91bb0b 100644 --- a/model/model-api/src/test/resources/models/PolicyModel.json +++ b/model/model-api/src/test/resources/models/PolicyModel.json @@ -1,708 +1,775 @@ { - "apexPolicyModel" : { - "key" : { - "name" : "PolicyModel", - "version" : "0.0.1" - }, - "keyInformation" : { - "key" : { - "name" : "KeyInfoMapKey", - "version" : "0.0.1" - }, - "keyInfoMap" : { - "entry" : [ { - "key" : { - "name" : "ContextSchemas", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "ContextSchemas", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e000", - "description" : "Generated description for concept referred to by key \"ContextSchemas:0.0.1\"" - } - }, { - "key" : { - "name" : "KeyInfoMapKey", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "KeyInfoMapKey", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e001", - "description" : "Generated description for concept referred to by key \"KeyInfoMapKey:0.0.1\"" - } - }, { - "key" : { - "name" : "MapType", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "MapType", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e002", - "description" : "Generated description for concept referred to by key \"MapType:0.0.1\"" - } - }, { - "key" : { - "name" : "PolicyModel", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "PolicyModel", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e003", - "description" : "Generated description for concept referred to by key \"PolicyModel:0.0.1\"" - } - }, { - "key" : { - "name" : "StringType", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "StringType", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e004", - "description" : "Generated description for concept referred to by key \"StringType:0.0.1\"" - } - }, { - "key" : { - "name" : "context", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "context", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e005", - "description" : "Generated description for concept referred to by key \"context:0.0.1\"" - } - }, { - "key" : { - "name" : "contextAlbum0", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "contextAlbum0", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e006", - "description" : "Generated description for concept referred to by key \"contextAlbum0:0.0.1\"" - } - }, { - "key" : { - "name" : "contextAlbum1", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "contextAlbum1", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e007", - "description" : "Generated description for concept referred to by key \"contextAlbum1:0.0.1\"" - } - }, { - "key" : { - "name" : "eventContextItem0", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "eventContextItem0", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e008", - "description" : "Generated description for concept referred to by key \"eventContextItem0:0.0.1\"" - } - }, { - "key" : { - "name" : "eventContextItem1", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "eventContextItem1", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e009", - "description" : "Generated description for concept referred to by key \"eventContextItem1:0.0.1\"" - } - }, { - "key" : { - "name" : "events", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "events", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e010", - "description" : "Generated description for concept referred to by key \"events:0.0.1\"" - } - }, { - "key" : { - "name" : "inEvent", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "inEvent", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e011", - "description" : "Generated description for concept referred to by key \"inEvent:0.0.1\"" - } - }, { - "key" : { - "name" : "outEvent0", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "outEvent0", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e012", - "description" : "Generated description for concept referred to by key \"outEvent0:0.0.1\"" - } - }, { - "key" : { - "name" : "outEvent1", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "outEvent1", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e013", - "description" : "Generated description for concept referred to by key \"outEvent1:0.0.1\"" - } - }, { - "key" : { - "name" : "policies", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "policies", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e014", - "description" : "Generated description for concept referred to by key \"policies:0.0.1\"" - } - }, { - "key" : { - "name" : "policy", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "policy", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e015", - "description" : "Generated description for concept referred to by key \"policy:0.0.1\"" - } - }, { - "key" : { - "name" : "task", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "task", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e016", - "description" : "Generated description for concept referred to by key \"task:0.0.1\"" - } - }, { - "key" : { - "name" : "tasks", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "tasks", - "version" : "0.0.1" - }, - "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e017", - "description" : "Generated description for concept referred to by key \"tasks:0.0.1\"" - } - } ] - } - }, - "policies" : { - "key" : { - "name" : "policies", - "version" : "0.0.1" - }, - "policyMap" : { - "entry" : [ { - "key" : { - "name" : "policy", - "version" : "0.0.1" - }, - "value" : { - "policyKey" : { - "name" : "policy", - "version" : "0.0.1" - }, - "template" : "FREEFORM", - "state" : { - "entry" : [ { - "key" : "state", - "value" : { - "stateKey" : { - "parentKeyName" : "policy", - "parentKeyVersion" : "0.0.1", - "parentLocalName" : "NULL", - "localName" : "state" - }, - "trigger" : { - "name" : "inEvent", - "version" : "0.0.1" - }, - "stateOutputs" : { - "entry" : [ { - "key" : "stateOutput0", - "value" : { - "key" : { - "parentKeyName" : "policy", - "parentKeyVersion" : "0.0.1", - "parentLocalName" : "state", - "localName" : "stateOutput0" - }, - "outgoingEvent" : { - "name" : "outEvent0", - "version" : "0.0.1" - }, - "nextState" : { - "parentKeyName" : "NULL", - "parentKeyVersion" : "0.0.0", - "parentLocalName" : "NULL", - "localName" : "NULL" - } - } - } ] - }, - "contextAlbumReference" : [ { - "name" : "contextAlbum0", - "version" : "0.0.1" - }, { - "name" : "contextAlbum1", - "version" : "0.0.1" - } ], - "taskSelectionLogic" : { - "key" : "taskSelectionLogic", - "logicFlavour" : "MVEL", - "logic" : "Some TS logic" - }, - "stateFinalizerLogicMap" : { - "entry" : [ ] - }, - "defaultTask" : { - "name" : "task", - "version" : "0.0.1" - }, - "taskReferences" : { - "entry" : [ { - "key" : { - "name" : "task", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "parentKeyName" : "policy", - "parentKeyVersion" : "0.0.1", - "parentLocalName" : "state", - "localName" : "task" - }, - "outputType" : "DIRECT", - "output" : { - "parentKeyName" : "policy", - "parentKeyVersion" : "0.0.1", - "parentLocalName" : "state", - "localName" : "stateOutput0" - } - } - } ] - } + "key": { + "name": "PolicyModel", + "version": "0.0.1" + }, + "keyInformation": { + "key": { + "name": "KeyInfoMapKey", + "version": "0.0.1" + }, + "keyInfoMap": { + "entry": [ + { + "key": { + "name": "ContextSchemas", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ContextSchemas", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e000", + "description": "Generated description for concept referred to by key \"ContextSchemas:0.0.1\"" + } + }, + { + "key": { + "name": "KeyInfoMapKey", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "KeyInfoMapKey", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e001", + "description": "Generated description for concept referred to by key \"KeyInfoMapKey:0.0.1\"" + } + }, + { + "key": { + "name": "MapType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "MapType", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e002", + "description": "Generated description for concept referred to by key \"MapType:0.0.1\"" + } + }, + { + "key": { + "name": "PolicyModel", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "PolicyModel", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e003", + "description": "Generated description for concept referred to by key \"PolicyModel:0.0.1\"" + } + }, + { + "key": { + "name": "StringType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "StringType", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e004", + "description": "Generated description for concept referred to by key \"StringType:0.0.1\"" + } + }, + { + "key": { + "name": "context", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "context", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e005", + "description": "Generated description for concept referred to by key \"context:0.0.1\"" + } + }, + { + "key": { + "name": "contextAlbum0", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "contextAlbum0", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e006", + "description": "Generated description for concept referred to by key \"contextAlbum0:0.0.1\"" + } + }, + { + "key": { + "name": "contextAlbum1", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "contextAlbum1", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e007", + "description": "Generated description for concept referred to by key \"contextAlbum1:0.0.1\"" + } + }, + { + "key": { + "name": "eventContextItem0", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "eventContextItem0", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e008", + "description": "Generated description for concept referred to by key \"eventContextItem0:0.0.1\"" + } + }, + { + "key": { + "name": "eventContextItem1", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "eventContextItem1", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e009", + "description": "Generated description for concept referred to by key \"eventContextItem1:0.0.1\"" + } + }, + { + "key": { + "name": "events", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "events", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e010", + "description": "Generated description for concept referred to by key \"events:0.0.1\"" + } + }, + { + "key": { + "name": "inEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "inEvent", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e011", + "description": "Generated description for concept referred to by key \"inEvent:0.0.1\"" + } + }, + { + "key": { + "name": "outEvent0", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "outEvent0", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e012", + "description": "Generated description for concept referred to by key \"outEvent0:0.0.1\"" + } + }, + { + "key": { + "name": "outEvent1", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "outEvent1", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e013", + "description": "Generated description for concept referred to by key \"outEvent1:0.0.1\"" + } + }, + { + "key": { + "name": "policies", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "policies", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e014", + "description": "Generated description for concept referred to by key \"policies:0.0.1\"" + } + }, + { + "key": { + "name": "policy", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "policy", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e015", + "description": "Generated description for concept referred to by key \"policy:0.0.1\"" + } + }, + { + "key": { + "name": "task", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "task", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e016", + "description": "Generated description for concept referred to by key \"task:0.0.1\"" + } + }, + { + "key": { + "name": "tasks", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "tasks", + "version": "0.0.1" + }, + "UUID": "0ce9168c-e6df-414f-9646-6da464b6e017", + "description": "Generated description for concept referred to by key \"tasks:0.0.1\"" + } + } + ] + } + }, + "policies": { + "key": { + "name": "policies", + "version": "0.0.1" + }, + "policyMap": { + "entry": [ + { + "key": { + "name": "policy", + "version": "0.0.1" + }, + "value": { + "policyKey": { + "name": "policy", + "version": "0.0.1" + }, + "template": "FREEFORM", + "state": { + "entry": [ + { + "key": "state", + "value": { + "stateKey": { + "parentKeyName": "policy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "state" + }, + "trigger": { + "name": "inEvent", + "version": "0.0.1" + }, + "stateOutputs": { + "entry": [ + { + "key": "stateOutput0", + "value": { + "key": { + "parentKeyName": "policy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "state", + "localName": "stateOutput0" + }, + "outgoingEvent": { + "name": "outEvent0", + "version": "0.0.1" + }, + "nextState": { + "parentKeyName": "NULL", + "parentKeyVersion": "0.0.0", + "parentLocalName": "NULL", + "localName": "NULL" + } + } } - } ] - }, - "firstState" : "state" - } - } ] - } - }, - "tasks" : { - "key" : { - "name" : "tasks", - "version" : "0.0.1" - }, - "taskMap" : { - "entry" : [ { - "key" : { - "name" : "task", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "task", - "version" : "0.0.1" - }, - "inputFields" : { - "entry" : [ { - "key" : "IEPAR0", - "value" : { - "key" : "IEPAR0", - "fieldSchemaKey" : { - "name" : "eventContextItem0", - "version" : "0.0.1" - } + ] + }, + "contextAlbumReference": [ + { + "name": "contextAlbum0", + "version": "0.0.1" + }, + { + "name": "contextAlbum1", + "version": "0.0.1" + } + ], + "taskSelectionLogic": { + "key": "taskSelectionLogic", + "logicFlavour": "MVEL", + "logic": "Some TS logic" + }, + "stateFinalizerLogicMap": { + "entry": [] + }, + "defaultTask": { + "name": "task", + "version": "0.0.1" + }, + "taskReferences": { + "entry": [ + { + "key": { + "name": "task", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "policy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "state", + "localName": "task" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "policy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "state", + "localName": "stateOutput0" + } + } } - }, { - "key" : "IEPAR1", - "value" : { - "key" : "IEPAR1", - "fieldSchemaKey" : { - "name" : "eventContextItem1", - "version" : "0.0.1" - } - } - } ] - }, - "outputFields" : { - "entry" : [ { - "key" : "OE0PAR0", - "value" : { - "key" : "OE0PAR0", - "fieldSchemaKey" : { - "name" : "eventContextItem0", - "version" : "0.0.1" - } - } - }, { - "key" : "OE0PAR1", - "value" : { - "key" : "OE0PAR1", - "fieldSchemaKey" : { - "name" : "eventContextItem1", - "version" : "0.0.1" - } - } - }, { - "key" : "OE1PAR0", - "value" : { - "key" : "OE1PAR0", - "fieldSchemaKey" : { - "name" : "eventContextItem0", - "version" : "0.0.1" - } - } - }, { - "key" : "OE1PAR1", - "value" : { - "key" : "OE1PAR1", - "fieldSchemaKey" : { - "name" : "eventContextItem1", - "version" : "0.0.1" - } - } - } ] - }, - "taskParameters" : { - "entry" : [ { - "key" : "taskParameter0", - "value" : { - "key" : { - "parentKeyName" : "task", - "parentKeyVersion" : "0.0.1", - "parentLocalName" : "NULL", - "localName" : "taskParameter0" - }, - "defaultValue" : "Task parameter 0 value" - } - }, { - "key" : "taskParameter1", - "value" : { - "key" : { - "parentKeyName" : "task", - "parentKeyVersion" : "0.0.1", - "parentLocalName" : "NULL", - "localName" : "taskParameter1" - }, - "defaultValue" : "Task parameter 1 value" - } - } ] - }, - "contextAlbumReference" : [ { - "name" : "contextAlbum0", - "version" : "0.0.1" - }, { - "name" : "contextAlbum1", - "version" : "0.0.1" - } ], - "taskLogic" : { - "key" : "taskLogic", - "logicFlavour" : "MVEL", - "logic" : "Some task logic" + ] + } } - } - } ] - } - }, - "events" : { - "key" : { - "name" : "events", - "version" : "0.0.1" - }, - "eventMap" : { - "entry" : [ { - "key" : { - "name" : "inEvent", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "inEvent", - "version" : "0.0.1" - }, - "nameSpace" : "org.onap.policy.apex.model.policymodel.events", - "source" : "Source", - "target" : "Target", - "parameter" : { - "entry" : [ { - "key" : "IEPAR0", - "value" : { - "key" : "IEPAR0", - "fieldSchemaKey" : { - "name" : "eventContextItem0", - "version" : "0.0.1" - } - } - }, { - "key" : "IEPAR1", - "value" : { - "key" : "IEPAR1", - "fieldSchemaKey" : { - "name" : "eventContextItem1", - "version" : "0.0.1" - } - } - } ] + } + ] + }, + "firstState": "state" + } + } + ] + } + }, + "tasks": { + "key": { + "name": "tasks", + "version": "0.0.1" + }, + "taskMap": { + "entry": [ + { + "key": { + "name": "task", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "task", + "version": "0.0.1" + }, + "inputFields": { + "entry": [ + { + "key": "IEPAR0", + "value": { + "key": "IEPAR0", + "fieldSchemaKey": { + "name": "eventContextItem0", + "version": "0.0.1" + } } - } - }, { - "key" : { - "name" : "outEvent0", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "outEvent0", - "version" : "0.0.1" - }, - "nameSpace" : "org.onap.policy.apex.model.policymodel.events", - "source" : "Source", - "target" : "Target", - "parameter" : { - "entry" : [ { - "key" : "OE0PAR0", - "value" : { - "key" : "OE0PAR0", - "fieldSchemaKey" : { - "name" : "eventContextItem0", - "version" : "0.0.1" - } - } - }, { - "key" : "OE0PAR1", - "value" : { - "key" : "OE0PAR1", - "fieldSchemaKey" : { - "name" : "eventContextItem1", - "version" : "0.0.1" - } - } - }, { - "key" : "OE1PAR0", - "value" : { - "key" : "OE1PAR0", - "fieldSchemaKey" : { - "name" : "eventContextItem0", - "version" : "0.0.1" - } - } - }, { - "key" : "OE1PAR1", - "value" : { - "key" : "OE1PAR1", - "fieldSchemaKey" : { - "name" : "eventContextItem1", - "version" : "0.0.1" - } - } - } ] + }, + { + "key": "IEPAR1", + "value": { + "key": "IEPAR1", + "fieldSchemaKey": { + "name": "eventContextItem1", + "version": "0.0.1" + } } - } - }, { - "key" : { - "name" : "outEvent1", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "outEvent1", - "version" : "0.0.1" - }, - "nameSpace" : "org.onap.policy.apex.model.policymodel.events", - "source" : "Source", - "target" : "Target", - "parameter" : { - "entry" : [ { - "key" : "OE1PAR0", - "value" : { - "key" : "OE1PAR0", - "fieldSchemaKey" : { - "name" : "eventContextItem0", - "version" : "0.0.1" - } - } - }, { - "key" : "OE1PAR1", - "value" : { - "key" : "OE1PAR1", - "fieldSchemaKey" : { - "name" : "eventContextItem1", - "version" : "0.0.1" - } - } - } ] + } + ] + }, + "outputFields": { + "entry": [ + { + "key": "OE0PAR0", + "value": { + "key": "OE0PAR0", + "fieldSchemaKey": { + "name": "eventContextItem0", + "version": "0.0.1" + } + } + }, + { + "key": "OE0PAR1", + "value": { + "key": "OE0PAR1", + "fieldSchemaKey": { + "name": "eventContextItem1", + "version": "0.0.1" + } + } + }, + { + "key": "OE1PAR0", + "value": { + "key": "OE1PAR0", + "fieldSchemaKey": { + "name": "eventContextItem0", + "version": "0.0.1" + } + } + }, + { + "key": "OE1PAR1", + "value": { + "key": "OE1PAR1", + "fieldSchemaKey": { + "name": "eventContextItem1", + "version": "0.0.1" + } + } + } + ] + }, + "taskParameters": { + "entry": [ + { + "key": "taskParameter0", + "value": { + "key": { + "parentKeyName": "task", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "taskParameter0" + }, + "defaultValue": "Task parameter 0 value" + } + }, + { + "key": "taskParameter1", + "value": { + "key": { + "parentKeyName": "task", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "taskParameter1" + }, + "defaultValue": "Task parameter 1 value" + } + } + ] + }, + "contextAlbumReference": [ + { + "name": "contextAlbum0", + "version": "0.0.1" + }, + { + "name": "contextAlbum1", + "version": "0.0.1" + } + ], + "taskLogic": { + "key": "taskLogic", + "logicFlavour": "MVEL", + "logic": "Some task logic" + } + } + } + ] + } + }, + "events": { + "key": { + "name": "events", + "version": "0.0.1" + }, + "eventMap": { + "entry": [ + { + "key": { + "name": "inEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "inEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.model.policymodel.events", + "source": "Source", + "target": "Target", + "parameter": { + "entry": [ + { + "key": "IEPAR0", + "value": { + "key": "IEPAR0", + "fieldSchemaKey": { + "name": "eventContextItem0", + "version": "0.0.1" + } + } + }, + { + "key": "IEPAR1", + "value": { + "key": "IEPAR1", + "fieldSchemaKey": { + "name": "eventContextItem1", + "version": "0.0.1" + } + } + } + ] + } + } + }, + { + "key": { + "name": "outEvent0", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "outEvent0", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.model.policymodel.events", + "source": "Source", + "target": "Target", + "parameter": { + "entry": [ + { + "key": "OE0PAR0", + "value": { + "key": "OE0PAR0", + "fieldSchemaKey": { + "name": "eventContextItem0", + "version": "0.0.1" + } + } + }, + { + "key": "OE0PAR1", + "value": { + "key": "OE0PAR1", + "fieldSchemaKey": { + "name": "eventContextItem1", + "version": "0.0.1" + } + } + }, + { + "key": "OE1PAR0", + "value": { + "key": "OE1PAR0", + "fieldSchemaKey": { + "name": "eventContextItem0", + "version": "0.0.1" + } + } + }, + { + "key": "OE1PAR1", + "value": { + "key": "OE1PAR1", + "fieldSchemaKey": { + "name": "eventContextItem1", + "version": "0.0.1" + } } - } - } ] - } - }, - "albums" : { - "key" : { - "name" : "context", - "version" : "0.0.1" - }, - "albums" : { - "entry" : [ { - "key" : { - "name" : "contextAlbum0", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "contextAlbum0", - "version" : "0.0.1" - }, - "scope" : "APPLICATION", - "isWritable" : true, - "itemSchema" : { - "name" : "MapType", - "version" : "0.0.1" + } + ] + } + } + }, + { + "key": { + "name": "outEvent1", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "outEvent1", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.model.policymodel.events", + "source": "Source", + "target": "Target", + "parameter": { + "entry": [ + { + "key": "OE1PAR0", + "value": { + "key": "OE1PAR0", + "fieldSchemaKey": { + "name": "eventContextItem0", + "version": "0.0.1" + } } - } - }, { - "key" : { - "name" : "contextAlbum1", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "contextAlbum1", - "version" : "0.0.1" - }, - "scope" : "GLOBAL", - "isWritable" : false, - "itemSchema" : { - "name" : "StringType", - "version" : "0.0.1" + }, + { + "key": "OE1PAR1", + "value": { + "key": "OE1PAR1", + "fieldSchemaKey": { + "name": "eventContextItem1", + "version": "0.0.1" + } } - } - } ] - } - }, - "schemas" : { - "key" : { - "name" : "ContextSchemas", - "version" : "0.0.1" - }, - "schemas" : { - "entry" : [ { - "key" : { - "name" : "MapType", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "MapType", - "version" : "0.0.1" - }, - "schemaFlavour" : "Java", - "schemaDefinition" : "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A" - } - }, { - "key" : { - "name" : "StringType", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "StringType", - "version" : "0.0.1" - }, - "schemaFlavour" : "Java", - "schemaDefinition" : "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000" - } - }, { - "key" : { - "name" : "eventContextItem0", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "eventContextItem0", - "version" : "0.0.1" - }, - "schemaFlavour" : "Java", - "schemaDefinition" : "java.lang.String" - } - }, { - "key" : { - "name" : "eventContextItem1", - "version" : "0.0.1" - }, - "value" : { - "key" : { - "name" : "eventContextItem1", - "version" : "0.0.1" - }, - "schemaFlavour" : "Java", - "schemaDefinition" : "java.lang.Long" - } - } ] - } - } - } -}
\ No newline at end of file + } + ] + } + } + } + ] + } + }, + "albums": { + "key": { + "name": "context", + "version": "0.0.1" + }, + "albums": { + "entry": [ + { + "key": { + "name": "contextAlbum0", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "contextAlbum0", + "version": "0.0.1" + }, + "scope": "APPLICATION", + "isWritable": true, + "itemSchema": { + "name": "MapType", + "version": "0.0.1" + } + } + }, + { + "key": { + "name": "contextAlbum1", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "contextAlbum1", + "version": "0.0.1" + }, + "scope": "GLOBAL", + "isWritable": false, + "itemSchema": { + "name": "StringType", + "version": "0.0.1" + } + } + } + ] + } + }, + "schemas": { + "key": { + "name": "ContextSchemas", + "version": "0.0.1" + }, + "schemas": { + "entry": [ + { + "key": { + "name": "MapType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "MapType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A" + } + }, + { + "key": { + "name": "StringType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "StringType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000" + } + }, + { + "key": { + "name": "eventContextItem0", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "eventContextItem0", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "java.lang.String" + } + }, + { + "key": { + "name": "eventContextItem1", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "eventContextItem1", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "java.lang.Long" + } + } + ] + } + } +} diff --git a/model/model-api/src/test/resources/models/PolicyModel.xml b/model/model-api/src/test/resources/models/PolicyModel.xml deleted file mode 100644 index e47e21afc..000000000 --- a/model/model-api/src/test/resources/models/PolicyModel.xml +++ /dev/null @@ -1,697 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ============LICENSE_START======================================================= - Copyright (C) 2016-2018 Ericsson. 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========================================================= ---> - -<apexPolicyModel xmlns="http://www.onap.org/policy/apex-pdp"> - <key> - <name>PolicyModel</name> - <version>0.0.1</version> - </key> - <keyInformation> - <key> - <name>KeyInfoMapKey</name> - <version>0.0.1</version> - </key> - <keyInfoMap> - <entry> - <key> - <name>ContextSchemas</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>ContextSchemas</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e000</UUID> - <description><![CDATA[Description for concept with key "ContextSchemas:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>KeyInfoMapKey</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>KeyInfoMapKey</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e001</UUID> - <description><![CDATA[Description for concept with key "KeyInfoMapKey:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>MapType</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>MapType</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e002</UUID> - <description><![CDATA[Description for concept with key "MapType:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>PolicyModel</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>PolicyModel</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e003</UUID> - <description><![CDATA[Description for concept with key "PolicyModel:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>StringType</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>StringType</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e004</UUID> - <description><![CDATA[Description for concept with key "StringType:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>context</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>context</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e005</UUID> - <description><![CDATA[Description for concept with key "context:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>contextAlbum0</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>contextAlbum0</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e006</UUID> - <description><![CDATA[Description for concept with key "contextAlbum0:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>contextAlbum1</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>contextAlbum1</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e007</UUID> - <description><![CDATA[Description for concept with key "contextAlbum1:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>eventContextItem0</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>eventContextItem0</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e008</UUID> - <description><![CDATA[Description for concept with key "eventContextItem0:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>eventContextItem1</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>eventContextItem1</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e009</UUID> - <description><![CDATA[Description for concept with key "eventContextItem1:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>events</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>events</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e010</UUID> - <description><![CDATA[Description for concept with key "events:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>inEvent</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>inEvent</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e011</UUID> - <description><![CDATA[Description for concept with key "inEvent:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>outEvent0</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>outEvent0</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e012</UUID> - <description><![CDATA[Description for concept with key "outEvent0:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>outEvent1</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>outEvent1</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e013</UUID> - <description><![CDATA[Description for concept with key "outEvent1:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>policies</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>policies</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e014</UUID> - <description><![CDATA[Description for concept with key "policies:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>policy</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>policy</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e015</UUID> - <description><![CDATA[Description for concept with key "policy:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>task</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>task</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e016</UUID> - <description><![CDATA[Description for concept with key "task:0.0.1"]]></description> - </value> - </entry> - <entry> - <key> - <name>tasks</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>tasks</name> - <version>0.0.1</version> - </key> - <UUID>0ce9168c-e6df-414f-9646-6da464b6e017</UUID> - <description><![CDATA[Description for concept with key "tasks:0.0.1"]]></description> - </value> - </entry> - </keyInfoMap> - </keyInformation> - <policies> - <key> - <name>policies</name> - <version>0.0.1</version> - </key> - <policyMap> - <entry> - <key> - <name>policy</name> - <version>0.0.1</version> - </key> - <value> - <policyKey> - <name>policy</name> - <version>0.0.1</version> - </policyKey> - <template>FREEFORM</template> - <state> - <entry> - <key>state</key> - <value> - <stateKey> - <parentKeyName>policy</parentKeyName> - <parentKeyVersion>0.0.1</parentKeyVersion> - <parentLocalName>NULL</parentLocalName> - <localName>state</localName> - </stateKey> - <trigger> - <name>inEvent</name> - <version>0.0.1</version> - </trigger> - <stateOutputs> - <entry> - <key>stateOutput0</key> - <value> - <key> - <parentKeyName>policy</parentKeyName> - <parentKeyVersion>0.0.1</parentKeyVersion> - <parentLocalName>state</parentLocalName> - <localName>stateOutput0</localName> - </key> - <outgoingEvent> - <name>outEvent0</name> - <version>0.0.1</version> - </outgoingEvent> - <nextState> - <parentKeyName>NULL</parentKeyName> - <parentKeyVersion>0.0.0</parentKeyVersion> - <parentLocalName>NULL</parentLocalName> - <localName>NULL</localName> - </nextState> - </value> - </entry> - </stateOutputs> - <contextAlbumReference> - <name>contextAlbum0</name> - <version>0.0.1</version> - </contextAlbumReference> - <contextAlbumReference> - <name>contextAlbum1</name> - <version>0.0.1</version> - </contextAlbumReference> - <taskSelectionLogic> - <key>taskSelectionLogic</key> - <logicFlavour>MVEL</logicFlavour> - <logic><![CDATA[Some TS logic]]></logic> - </taskSelectionLogic> - <defaultTask> - <name>task</name> - <version>0.0.1</version> - </defaultTask> - <taskReferences> - <entry> - <key> - <name>task</name> - <version>0.0.1</version> - </key> - <value> - <key> - <parentKeyName>policy</parentKeyName> - <parentKeyVersion>0.0.1</parentKeyVersion> - <parentLocalName>state</parentLocalName> - <localName>task</localName> - </key> - <outputType>DIRECT</outputType> - <output> - <parentKeyName>policy</parentKeyName> - <parentKeyVersion>0.0.1</parentKeyVersion> - <parentLocalName>state</parentLocalName> - <localName>stateOutput0</localName> - </output> - </value> - </entry> - </taskReferences> - </value> - </entry> - </state> - <firstState>state</firstState> - </value> - </entry> - </policyMap> - </policies> - <tasks> - <key> - <name>tasks</name> - <version>0.0.1</version> - </key> - <taskMap> - <entry> - <key> - <name>task</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>task</name> - <version>0.0.1</version> - </key> - <taskParameters> - <entry> - <key>taskParameter0</key> - <value> - <key> - <parentKeyName>task</parentKeyName> - <parentKeyVersion>0.0.1</parentKeyVersion> - <parentLocalName>NULL</parentLocalName> - <localName>taskParameter0</localName> - </key> - <defaultValue>Task parameter 0 value</defaultValue> - </value> - </entry> - <entry> - <key>taskParameter1</key> - <value> - <key> - <parentKeyName>task</parentKeyName> - <parentKeyVersion>0.0.1</parentKeyVersion> - <parentLocalName>NULL</parentLocalName> - <localName>taskParameter1</localName> - </key> - <defaultValue>Task parameter 1 value</defaultValue> - </value> - </entry> - </taskParameters> - <contextAlbumReference> - <name>contextAlbum0</name> - <version>0.0.1</version> - </contextAlbumReference> - <contextAlbumReference> - <name>contextAlbum1</name> - <version>0.0.1</version> - </contextAlbumReference> - <taskLogic> - <key>taskLogic</key> - <logicFlavour>MVEL</logicFlavour> - <logic><![CDATA[Some task logic]]></logic> - </taskLogic> - </value> - </entry> - </taskMap> - </tasks> - <events> - <key> - <name>events</name> - <version>0.0.1</version> - </key> - <eventMap> - <entry> - <key> - <name>inEvent</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>inEvent</name> - <version>0.0.1</version> - </key> - <nameSpace>org.onap.policy.apex.model.policymodel.events</nameSpace> - <source>Source</source> - <target>Target</target> - <parameter> - <entry> - <key>IEPAR0</key> - <value> - <key>IEPAR0</key> - <fieldSchemaKey> - <name>eventContextItem0</name> - <version>0.0.1</version> - </fieldSchemaKey> - </value> - </entry> - <entry> - <key>IEPAR1</key> - <value> - <key>IEPAR1</key> - <fieldSchemaKey> - <name>eventContextItem1</name> - <version>0.0.1</version> - </fieldSchemaKey> - </value> - </entry> - </parameter> - </value> - </entry> - <entry> - <key> - <name>outEvent0</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>outEvent0</name> - <version>0.0.1</version> - </key> - <nameSpace>org.onap.policy.apex.model.policymodel.events</nameSpace> - <source>Source</source> - <target>Target</target> - <parameter> - <entry> - <key>OE0PAR0</key> - <value> - <key>OE0PAR0</key> - <fieldSchemaKey> - <name>eventContextItem0</name> - <version>0.0.1</version> - </fieldSchemaKey> - </value> - </entry> - <entry> - <key>OE0PAR1</key> - <value> - <key>OE0PAR1</key> - <fieldSchemaKey> - <name>eventContextItem1</name> - <version>0.0.1</version> - </fieldSchemaKey> - </value> - </entry> - <entry> - <key>OE1PAR0</key> - <value> - <key>OE1PAR0</key> - <fieldSchemaKey> - <name>eventContextItem0</name> - <version>0.0.1</version> - </fieldSchemaKey> - </value> - </entry> - <entry> - <key>OE1PAR1</key> - <value> - <key>OE1PAR1</key> - <fieldSchemaKey> - <name>eventContextItem1</name> - <version>0.0.1</version> - </fieldSchemaKey> - </value> - </entry> - </parameter> - </value> - </entry> - <entry> - <key> - <name>outEvent1</name> - <version>0.0.1</version> - </key> - <value> - <key> - <name>outEvent1</name> - <version>0.0.1</version> - </key> - <nameSpace>org.onap.policy.apex.model.policymodel.events</nameSpace> - <source>Source</source> - <target>Target</target> - <parameter> - <entry> - <key>OE1PAR0</key> - <value> - <key>OE1PAR0</key> - <fieldSchemaKey> - <name>eventContextItem0</name> - <version>0.0.1</version> - </fieldSchemaKey> - </value> - </entry> - <entry> - <key>OE1PAR1</key> - <value> - <key>OE1PAR1</key> - <fieldSchemaKey> - <name>eventContextItem1</name> - <version>0.0.1</version> - </fieldSchemaKey> - </value> - </entry> - </parameter> - </value> - </entry> - </eventMap> - </events> - <albums> - <key xmlns="http://www.onap.org/policy/apex-pdp"> - <name xmlns="http://www.onap.org/policy/apex-pdp">context</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <albums xmlns="http://www.onap.org/policy/apex-pdp"> - <entry> - <key> - <name xmlns="http://www.onap.org/policy/apex-pdp">contextAlbum0</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <value> - <key> - <name xmlns="http://www.onap.org/policy/apex-pdp">contextAlbum0</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <scope>APPLICATION</scope> - <isWritable>true</isWritable> - <itemSchema> - <name xmlns="http://www.onap.org/policy/apex-pdp">MapType</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </itemSchema> - </value> - </entry> - <entry> - <key> - <name xmlns="http://www.onap.org/policy/apex-pdp">contextAlbum1</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <value> - <key> - <name xmlns="http://www.onap.org/policy/apex-pdp">contextAlbum1</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <scope>GLOBAL</scope> - <isWritable>false</isWritable> - <itemSchema> - <name xmlns="http://www.onap.org/policy/apex-pdp">StringType</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </itemSchema> - </value> - </entry> - </albums> - </albums> - <schemas> - <key xmlns="http://www.onap.org/policy/apex-pdp"> - <name xmlns="http://www.onap.org/policy/apex-pdp">ContextSchemas</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <schemas xmlns="http://www.onap.org/policy/apex-pdp"> - <entry> - <key> - <name xmlns="http://www.onap.org/policy/apex-pdp">MapType</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <value> - <key> - <name xmlns="http://www.onap.org/policy/apex-pdp">MapType</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <schemaFlavour>Java</schemaFlavour> - <schemaDefinition>org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A - </schemaDefinition> - </value> - </entry> - <entry> - <key> - <name xmlns="http://www.onap.org/policy/apex-pdp">StringType</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <value> - <key> - <name xmlns="http://www.onap.org/policy/apex-pdp">StringType</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <schemaFlavour>Java</schemaFlavour> - <schemaDefinition>org.onap.policy.apex.model.policymodel.concepts.TestContextItem000 - </schemaDefinition> - </value> - </entry> - <entry> - <key> - <name xmlns="http://www.onap.org/policy/apex-pdp">eventContextItem0</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <value> - <key> - <name xmlns="http://www.onap.org/policy/apex-pdp">eventContextItem0</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <schemaFlavour>Java</schemaFlavour> - <schemaDefinition>java.lang.String</schemaDefinition> - </value> - </entry> - <entry> - <key> - <name xmlns="http://www.onap.org/policy/apex-pdp">eventContextItem1</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <value> - <key> - <name xmlns="http://www.onap.org/policy/apex-pdp">eventContextItem1</name> - <version xmlns="http://www.onap.org/policy/apex-pdp">0.0.1</version> - </key> - <schemaFlavour>Java</schemaFlavour> - <schemaDefinition>java.lang.Long</schemaDefinition> - </value> - </entry> - </schemas> - </schemas> -</apexPolicyModel> diff --git a/model/model-api/src/test/resources/models/RealPolicyModel.json b/model/model-api/src/test/resources/models/RealPolicyModel.json new file mode 100644 index 000000000..f084747f2 --- /dev/null +++ b/model/model-api/src/test/resources/models/RealPolicyModel.json @@ -0,0 +1,3076 @@ +{ + "key": { + "name": "ONAPvCPEPolicyModel", + "version": "0.0.1" + }, + "keyInformation": { + "key": { + "name": "ONAPvCPEPolicyModel_KeyInfo", + "version": "0.0.1" + }, + "keyInfoMap": { + "entry": [ + { + "key": { + "name": "AAILookupTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "AAILookupTask", + "version": "0.0.1" + }, + "UUID": "bc77813f-e2fa-33e0-aef0-c5b6a8832698", + "description": "Generated description for concept referred to by key \"AAILookupTask:0.0.1\"" + } + }, + { + "key": { + "name": "APPCLCMRequestType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "APPCLCMRequestType", + "version": "0.0.1" + }, + "UUID": "ab26e475-d09d-36cd-a65c-8a8b556f0fa2", + "description": "Generated description for concept referred to by key \"APPCLCMRequestType:0.0.1\"" + } + }, + { + "key": { + "name": "APPCLCMResponseType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "APPCLCMResponseType", + "version": "0.0.1" + }, + "UUID": "a60b42bb-c308-30ea-be59-5bc54864508b", + "description": "Generated description for concept referred to by key \"APPCLCMResponseType:0.0.1\"" + } + }, + { + "key": { + "name": "APPCRestartVNFRequestEvent", + "version": "2.0.0" + }, + "value": { + "key": { + "name": "APPCRestartVNFRequestEvent", + "version": "2.0.0" + }, + "UUID": "0b16f8d9-6ee9-30d7-bcd2-e4ded9fccf9b", + "description": "Generated description for concept referred to by key \"APPCRestartVNFRequestEvent:2.0.0\"" + } + }, + { + "key": { + "name": "APPCRestartVNFRequestTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "APPCRestartVNFRequestTask", + "version": "0.0.1" + }, + "UUID": "719ae90e-ab01-322e-ace3-8c379e7c1fbf", + "description": "Generated description for concept referred to by key \"APPCRestartVNFRequestTask:0.0.1\"" + } + }, + { + "key": { + "name": "APPCRestartVNFResponseEvent", + "version": "2.0.0" + }, + "value": { + "key": { + "name": "APPCRestartVNFResponseEvent", + "version": "2.0.0" + }, + "UUID": "7034c5a9-2ea7-3e9e-9ccf-3610c3bf80d9", + "description": "Generated description for concept referred to by key \"APPCRestartVNFResponseEvent:2.0.0\"" + } + }, + { + "key": { + "name": "APPCRestartVNFResponseTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "APPCRestartVNFResponseTask", + "version": "0.0.1" + }, + "UUID": "fe641fd9-6583-37c5-b317-2a33a3ca5ac7", + "description": "Generated description for concept referred to by key \"APPCRestartVNFResponseTask:0.0.1\"" + } + }, + { + "key": { + "name": "AbatedTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "AbatedTask", + "version": "0.0.1" + }, + "UUID": "0eb3974f-4fdc-3c90-b351-34e7e18ff1ab", + "description": "Generated description for concept referred to by key \"AbatedTask:0.0.1\"" + } + }, + { + "key": { + "name": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "version": "1.0.2" + }, + "value": { + "key": { + "name": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "version": "1.0.2" + }, + "UUID": "63ff5c25-f245-37e9-a580-6ac274ced3a7", + "description": "Generated description for concept referred to by key \"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e:1.0.2\"" + } + }, + { + "key": { + "name": "ControlLoopExecutionIDAlbum", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ControlLoopExecutionIDAlbum", + "version": "0.0.1" + }, + "UUID": "5b2bc0cf-0807-3ab1-9004-f21806d800f0", + "description": "Generated description for concept referred to by key \"ControlLoopExecutionIDAlbum:0.0.1\"" + } + }, + { + "key": { + "name": "ControlLoopLogEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ControlLoopLogEvent", + "version": "0.0.1" + }, + "UUID": "ed8a82ad-52c2-3d58-8c08-601606894b86", + "description": "Generated description for concept referred to by key \"ControlLoopLogEvent:0.0.1\"" + } + }, + { + "key": { + "name": "ControlLoopLogTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ControlLoopLogTask", + "version": "0.0.1" + }, + "UUID": "1b175691-6b5d-31f6-bf2d-4be95a01f92e", + "description": "Generated description for concept referred to by key \"ControlLoopLogTask:0.0.1\"" + } + }, + { + "key": { + "name": "DeniedTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "DeniedTask", + "version": "0.0.1" + }, + "UUID": "00142e3c-ee3b-323f-9490-6e4b7f34b09f", + "description": "Generated description for concept referred to by key \"DeniedTask:0.0.1\"" + } + }, + { + "key": { + "name": "GetVCPEStateTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "GetVCPEStateTask", + "version": "0.0.1" + }, + "UUID": "644d2a3d-0f3a-3664-8000-280c400a5cc1", + "description": "Generated description for concept referred to by key \"GetVCPEStateTask:0.0.1\"" + } + }, + { + "key": { + "name": "GuardDecisionAttributesType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "GuardDecisionAttributesType", + "version": "0.0.1" + }, + "UUID": "5f6dff51-c183-322f-9aba-c6074aa0ece5", + "description": "Generated description for concept referred to by key \"GuardDecisionAttributesType:0.0.1\"" + } + }, + { + "key": { + "name": "GuardRequestEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "GuardRequestEvent", + "version": "0.0.1" + }, + "UUID": "fb383a58-715b-3972-a3e6-38010a8de234", + "description": "Generated description for concept referred to by key \"GuardRequestEvent:0.0.1\"" + } + }, + { + "key": { + "name": "GuardRequestTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "GuardRequestTask", + "version": "0.0.1" + }, + "UUID": "0427d63c-da78-334c-a5bd-95fbbb162398", + "description": "Generated description for concept referred to by key \"GuardRequestTask:0.0.1\"" + } + }, + { + "key": { + "name": "GuardResponseEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "GuardResponseEvent", + "version": "0.0.1" + }, + "UUID": "395f6d46-cf24-3d3e-b1fd-1a189a58993d", + "description": "Generated description for concept referred to by key \"GuardResponseEvent:0.0.1\"" + } + }, + { + "key": { + "name": "GuardResponseTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "GuardResponseTask", + "version": "0.0.1" + }, + "UUID": "1a8b3f30-a7aa-330b-8131-4aea06ad6934", + "description": "Generated description for concept referred to by key \"GuardResponseTask:0.0.1\"" + } + }, + { + "key": { + "name": "NoAAILookupTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "NoAAILookupTask", + "version": "0.0.1" + }, + "UUID": "648bc8f9-ad2b-3a1b-abe2-89401645f191", + "description": "Generated description for concept referred to by key \"NoAAILookupTask:0.0.1\"" + } + }, + { + "key": { + "name": "ONAPvCPEPolicyModel", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ONAPvCPEPolicyModel", + "version": "0.0.1" + }, + "UUID": "cf1aa7f4-6fe3-3cba-90b4-49dcf46f0d57", + "description": "Generated description for concept referred to by key \"ONAPvCPEPolicyModel:0.0.1\"" + } + }, + { + "key": { + "name": "ONAPvCPEPolicyModel_Albums", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ONAPvCPEPolicyModel_Albums", + "version": "0.0.1" + }, + "UUID": "13f8471b-2b9c-32e0-940b-fe640ea442cf", + "description": "Generated description for concept referred to by key \"ONAPvCPEPolicyModel_Albums:0.0.1\"" + } + }, + { + "key": { + "name": "ONAPvCPEPolicyModel_Events", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ONAPvCPEPolicyModel_Events", + "version": "0.0.1" + }, + "UUID": "4b8e6653-731d-38c5-a195-0cadf533a7a1", + "description": "Generated description for concept referred to by key \"ONAPvCPEPolicyModel_Events:0.0.1\"" + } + }, + { + "key": { + "name": "ONAPvCPEPolicyModel_KeyInfo", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ONAPvCPEPolicyModel_KeyInfo", + "version": "0.0.1" + }, + "UUID": "87a9d6da-7d4b-3041-8a70-49442750d590", + "description": "Generated description for concept referred to by key \"ONAPvCPEPolicyModel_KeyInfo:0.0.1\"" + } + }, + { + "key": { + "name": "ONAPvCPEPolicyModel_Policies", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ONAPvCPEPolicyModel_Policies", + "version": "0.0.1" + }, + "UUID": "6220cca4-66f5-3d1b-9f19-688a9b4b70f5", + "description": "Generated description for concept referred to by key \"ONAPvCPEPolicyModel_Policies:0.0.1\"" + } + }, + { + "key": { + "name": "ONAPvCPEPolicyModel_Schemas", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ONAPvCPEPolicyModel_Schemas", + "version": "0.0.1" + }, + "UUID": "3df4eef8-e764-3398-afe9-86730e20905a", + "description": "Generated description for concept referred to by key \"ONAPvCPEPolicyModel_Schemas:0.0.1\"" + } + }, + { + "key": { + "name": "ONAPvCPEPolicyModel_Tasks", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ONAPvCPEPolicyModel_Tasks", + "version": "0.0.1" + }, + "UUID": "1781b875-a3e8-3407-98bd-ba9580cfc543", + "description": "Generated description for concept referred to by key \"ONAPvCPEPolicyModel_Tasks:0.0.1\"" + } + }, + { + "key": { + "name": "ReceiveEventPolicy", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ReceiveEventPolicy", + "version": "0.0.1" + }, + "UUID": "568b7345-9de1-36d3-b6a3-9b857e6809a1", + "description": "Generated description for concept referred to by key \"ReceiveEventPolicy:0.0.1\"" + } + }, + { + "key": { + "name": "RequestIDVNFIDAlbum", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "RequestIDVNFIDAlbum", + "version": "0.0.1" + }, + "UUID": "5d8e8298-ded6-30a5-9825-48111dc17a58", + "description": "Generated description for concept referred to by key \"RequestIDVNFIDAlbum:0.0.1\"" + } + }, + { + "key": { + "name": "RestartAPPCRequestPolicy", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "RestartAPPCRequestPolicy", + "version": "0.0.1" + }, + "UUID": "33d02162-314b-352b-b8b9-2862e8883894", + "description": "Generated description for concept referred to by key \"RestartAPPCRequestPolicy:0.0.1\"" + } + }, + { + "key": { + "name": "RestartAPPCResponsePolicy", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "RestartAPPCResponsePolicy", + "version": "0.0.1" + }, + "UUID": "ef4fcbd2-1609-377c-9875-8d27f7a901df", + "description": "Generated description for concept referred to by key \"RestartAPPCResponsePolicy:0.0.1\"" + } + }, + { + "key": { + "name": "SimpleBooleanType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SimpleBooleanType", + "version": "0.0.1" + }, + "UUID": "7218fb2f-59e3-321d-9ae1-bc97b19eb4ae", + "description": "Generated description for concept referred to by key \"SimpleBooleanType:0.0.1\"" + } + }, + { + "key": { + "name": "SimpleLongType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SimpleLongType", + "version": "0.0.1" + }, + "UUID": "2dfcd9ec-a6f9-3f9f-958f-9b36cf4ac574", + "description": "Generated description for concept referred to by key \"SimpleLongType:0.0.1\"" + } + }, + { + "key": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "UUID": "8a4957cf-9493-3a76-8c22-a208e23259af", + "description": "Generated description for concept referred to by key \"SimpleStringType:0.0.1\"" + } + }, + { + "key": { + "name": "UUIDType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "UUIDType", + "version": "0.0.1" + }, + "UUID": "6a8cc68e-dfc8-3403-9c6d-071c886b319c", + "description": "Generated description for concept referred to by key \"UUIDType:0.0.1\"" + } + }, + { + "key": { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + }, + "UUID": "47a4403e-3074-3964-83ef-93eefaffd192", + "description": "Generated description for concept referred to by key \"VCPEClosedLoopStatusAlbum:0.0.1\"" + } + }, + { + "key": { + "name": "VCPEClosedLoopStatusType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "VCPEClosedLoopStatusType", + "version": "0.0.1" + }, + "UUID": "6e7dced1-53f1-39e2-b4e6-412b75d5b9e6", + "description": "Generated description for concept referred to by key \"VCPEClosedLoopStatusType:0.0.1\"" + } + }, + { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "UUID": "5e56a3fd-f82a-3ced-821b-b9fbaf65d367", + "description": "Generated description for concept referred to by key \"VCPEStateUpdatedEvent:0.0.1\"" + } + }, + { + "key": { + "name": "VirtualControlLoopEventType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "VirtualControlLoopEventType", + "version": "0.0.1" + }, + "UUID": "15aca887-8f6c-3713-8114-0f49f03adab7", + "description": "Generated description for concept referred to by key \"VirtualControlLoopEventType:0.0.1\"" + } + }, + { + "key": { + "name": "VirtualControlLoopNotificationType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "VirtualControlLoopNotificationType", + "version": "0.0.1" + }, + "UUID": "283f5b0d-d8cd-31b0-91fa-89b9de2e1fda", + "description": "Generated description for concept referred to by key \"VirtualControlLoopNotificationType:0.0.1\"" + } + } + ] + } + }, + "policies": { + "key": { + "name": "ONAPvCPEPolicyModel_Policies", + "version": "0.0.1" + }, + "policyMap": { + "entry": [ + { + "key": { + "name": "ReceiveEventPolicy", + "version": "0.0.1" + }, + "value": { + "policyKey": { + "name": "ReceiveEventPolicy", + "version": "0.0.1" + }, + "template": "Freestyle", + "state": { + "entry": [ + { + "key": "AbatedState", + "value": { + "stateKey": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "AbatedState" + }, + "trigger": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "stateOutputs": { + "entry": [ + { + "key": "AbatedOutput", + "value": { + "key": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "AbatedState", + "localName": "AbatedOutput" + }, + "outgoingEvent": { + "name": "ControlLoopLogEvent", + "version": "0.0.1" + }, + "outgoingEventReference": [ + { + "name": "ControlLoopLogEvent", + "version": "0.0.1" + } + ], + "nextState": { + "parentKeyName": "NULL", + "parentKeyVersion": "0.0.0", + "parentLocalName": "NULL", + "localName": "NULL" + } + } + } + ] + }, + "contextAlbumReference": [], + "taskSelectionLogic": { + "key": "NULL", + "logicFlavour": "UNDEFINED", + "logic": "" + }, + "stateFinalizerLogicMap": { + "entry": [] + }, + "defaultTask": { + "name": "ControlLoopLogTask", + "version": "0.0.1" + }, + "taskReferences": { + "entry": [ + { + "key": { + "name": "ControlLoopLogTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "AbatedState", + "localName": "ReceiveEventPolicy" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "AbatedState", + "localName": "AbatedOutput" + } + } + } + ] + } + } + }, + { + "key": "GetVCPEState", + "value": { + "stateKey": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "GetVCPEState" + }, + "trigger": { + "name": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "version": "1.0.2" + }, + "stateOutputs": { + "entry": [ + { + "key": "GetVCPEStateOutput", + "value": { + "key": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "GetVCPEState", + "localName": "GetVCPEStateOutput" + }, + "outgoingEvent": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "outgoingEventReference": [ + { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + } + ], + "nextState": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "RequestAAIState" + } + } + } + ] + }, + "contextAlbumReference": [], + "taskSelectionLogic": { + "key": "NULL", + "logicFlavour": "UNDEFINED", + "logic": "" + }, + "stateFinalizerLogicMap": { + "entry": [] + }, + "defaultTask": { + "name": "GetVCPEStateTask", + "version": "0.0.1" + }, + "taskReferences": { + "entry": [ + { + "key": { + "name": "GetVCPEStateTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "GetVCPEState", + "localName": "ReceiveEventPolicy" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "GetVCPEState", + "localName": "GetVCPEStateOutput" + } + } + } + ] + } + } + }, + { + "key": "OnsetOrAbatedState", + "value": { + "stateKey": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "OnsetOrAbatedState" + }, + "trigger": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "stateOutputs": { + "entry": [ + { + "key": "AbatedOutput", + "value": { + "key": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "OnsetOrAbatedState", + "localName": "AbatedOutput" + }, + "outgoingEvent": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "outgoingEventReference": [ + { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + } + ], + "nextState": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "AbatedState" + } + } + }, + { + "key": "OnsetOutput", + "value": { + "key": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "OnsetOrAbatedState", + "localName": "OnsetOutput" + }, + "outgoingEvent": { + "name": "GuardRequestEvent", + "version": "0.0.1" + }, + "outgoingEventReference": [ + { + "name": "GuardRequestEvent", + "version": "0.0.1" + } + ], + "nextState": { + "parentKeyName": "NULL", + "parentKeyVersion": "0.0.0", + "parentLocalName": "NULL", + "localName": "NULL" + } + } + } + ] + }, + "contextAlbumReference": [ + { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + } + ], + "taskSelectionLogic": { + "key": "TaskSelectionLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar returnValue = true;\nvar status = null;\n\nif( executor.inFields.get(\"vnfID\") == null) {\n executor.logger.info(\"OnsetOrAbatedStateTSL: vnfID is null\");\n var vnfName = executor.inFields.get(\"vnfName\");\n var vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(\n executor.inFields.get(\"vnfName\"));\n status = vcpeClosedLoopStatus.get(\"closedLoopEventStatus\").toString();\n} else {\n var vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(\n executor.inFields.get(\"vnfID\").toString());\n status = vcpeClosedLoopStatus.get(\"closedLoopEventStatus\").toString();\n}\n\nif (status == \"ONSET\") {\n executor.subject.getTaskKey(\"GuardRequestTask\").copyTo(executor.selectedTask);\n} else if (status == \"ABATED\") {\n executor.subject.getTaskKey(\"AbatedTask\").copyTo(executor.selectedTask);\n onsetFlag = executor.isFalse;\n} else {\n executor.message = \"closedLoopEventStatus is \\\"\" + status + \"\\\", it must be either \\\"ONSET\\\" or \\\"ABATED\\\"\";\n returnValue = false;\n}\n\nexecutor.logger.info(\"ReceiveEventPolicyOnsetOrAbatedStateTSL State Selected Task:\" + executor.selectedTask);\n\nreturnValue;" + }, + "stateFinalizerLogicMap": { + "entry": [] + }, + "defaultTask": { + "name": "AbatedTask", + "version": "0.0.1" + }, + "taskReferences": { + "entry": [ + { + "key": { + "name": "AbatedTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "OnsetOrAbatedState", + "localName": "ReceiveEventPolicy" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "OnsetOrAbatedState", + "localName": "AbatedOutput" + } + } + }, + { + "key": { + "name": "GuardRequestTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "OnsetOrAbatedState", + "localName": "ReceiveEventPolicy" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "OnsetOrAbatedState", + "localName": "OnsetOutput" + } + } + } + ] + } + } + }, + { + "key": "RequestAAIState", + "value": { + "stateKey": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "RequestAAIState" + }, + "trigger": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "stateOutputs": { + "entry": [ + { + "key": "RequestAAIStateOutput", + "value": { + "key": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "RequestAAIState", + "localName": "RequestAAIStateOutput" + }, + "outgoingEvent": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "outgoingEventReference": [ + { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + } + ], + "nextState": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "OnsetOrAbatedState" + } + } + } + ] + }, + "contextAlbumReference": [ + { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + } + ], + "taskSelectionLogic": { + "key": "NULL", + "logicFlavour": "UNDEFINED", + "logic": "" + }, + "stateFinalizerLogicMap": { + "entry": [] + }, + "defaultTask": { + "name": "AAILookupTask", + "version": "0.0.1" + }, + "taskReferences": { + "entry": [ + { + "key": { + "name": "AAILookupTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "RequestAAIState", + "localName": "ReceiveEventPolicy" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "ReceiveEventPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "RequestAAIState", + "localName": "RequestAAIStateOutput" + } + } + } + ] + } + } + } + ] + }, + "firstState": "GetVCPEState" + } + }, + { + "key": { + "name": "RestartAPPCRequestPolicy", + "version": "0.0.1" + }, + "value": { + "policyKey": { + "name": "RestartAPPCRequestPolicy", + "version": "0.0.1" + }, + "template": "Freestyle", + "state": { + "entry": [ + { + "key": "DeniedState", + "value": { + "stateKey": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "DeniedState" + }, + "trigger": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "stateOutputs": { + "entry": [ + { + "key": "DeniedOutput", + "value": { + "key": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "DeniedState", + "localName": "DeniedOutput" + }, + "outgoingEvent": { + "name": "ControlLoopLogEvent", + "version": "0.0.1" + }, + "outgoingEventReference": [ + { + "name": "ControlLoopLogEvent", + "version": "0.0.1" + } + ], + "nextState": { + "parentKeyName": "NULL", + "parentKeyVersion": "0.0.0", + "parentLocalName": "NULL", + "localName": "NULL" + } + } + } + ] + }, + "contextAlbumReference": [], + "taskSelectionLogic": { + "key": "NULL", + "logicFlavour": "UNDEFINED", + "logic": "" + }, + "stateFinalizerLogicMap": { + "entry": [] + }, + "defaultTask": { + "name": "ControlLoopLogTask", + "version": "0.0.1" + }, + "taskReferences": { + "entry": [ + { + "key": { + "name": "ControlLoopLogTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "DeniedState", + "localName": "RestartAPPCRequestPolicy" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "DeniedState", + "localName": "DeniedOutput" + } + } + } + ] + } + } + }, + { + "key": "PermitOrDenyState", + "value": { + "stateKey": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "PermitOrDenyState" + }, + "trigger": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "stateOutputs": { + "entry": [ + { + "key": "DenyOutput", + "value": { + "key": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "PermitOrDenyState", + "localName": "DenyOutput" + }, + "outgoingEvent": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "outgoingEventReference": [ + { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + } + ], + "nextState": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "DeniedState" + } + } + }, + { + "key": "PermitOutput", + "value": { + "key": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "PermitOrDenyState", + "localName": "PermitOutput" + }, + "outgoingEvent": { + "name": "APPCRestartVNFRequestEvent", + "version": "2.0.0" + }, + "outgoingEventReference": [ + { + "name": "APPCRestartVNFRequestEvent", + "version": "2.0.0" + } + ], + "nextState": { + "parentKeyName": "NULL", + "parentKeyVersion": "0.0.0", + "parentLocalName": "NULL", + "localName": "NULL" + } + } + } + ] + }, + "contextAlbumReference": [ + { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + } + ], + "taskSelectionLogic": { + "key": "TaskSelectionLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(\n executor.inFields.get(\"vnfID\").toString());\n\nvar guardResult = vcpeClosedLoopStatus.get(\"notification\");\n\nif (guardResult == \"OPERATION: GUARD_PERMIT\") {\n executor.subject.getTaskKey(\"APPCRestartVNFRequestTask\").copyTo(executor.selectedTask);\n} else {\n executor.subject.getTaskKey(\"DeniedTask\").copyTo(executor.selectedTask);\n}\n\nexecutor.logger.info(\"RestartAPPCRequestPolicyPermitOrDenyTSL State Selected Task:\" + executor.selectedTask);\n\ntrue;" + }, + "stateFinalizerLogicMap": { + "entry": [] + }, + "defaultTask": { + "name": "DeniedTask", + "version": "0.0.1" + }, + "taskReferences": { + "entry": [ + { + "key": { + "name": "APPCRestartVNFRequestTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "PermitOrDenyState", + "localName": "RestartAPPCRequestPolicy" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "PermitOrDenyState", + "localName": "PermitOutput" + } + } + }, + { + "key": { + "name": "DeniedTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "PermitOrDenyState", + "localName": "RestartAPPCRequestPolicy" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "PermitOrDenyState", + "localName": "DenyOutput" + } + } + } + ] + } + } + }, + { + "key": "PolicyGuardResponseState", + "value": { + "stateKey": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "PolicyGuardResponseState" + }, + "trigger": { + "name": "GuardResponseEvent", + "version": "0.0.1" + }, + "stateOutputs": { + "entry": [ + { + "key": "GuardResponseOutput", + "value": { + "key": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "PolicyGuardResponseState", + "localName": "GuardResponseOutput" + }, + "outgoingEvent": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "outgoingEventReference": [ + { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + } + ], + "nextState": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "PermitOrDenyState" + } + } + } + ] + }, + "contextAlbumReference": [], + "taskSelectionLogic": { + "key": "NULL", + "logicFlavour": "UNDEFINED", + "logic": "" + }, + "stateFinalizerLogicMap": { + "entry": [] + }, + "defaultTask": { + "name": "GuardResponseTask", + "version": "0.0.1" + }, + "taskReferences": { + "entry": [ + { + "key": { + "name": "GuardResponseTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "PolicyGuardResponseState", + "localName": "RestartAPPCRequestPolicy" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "RestartAPPCRequestPolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "PolicyGuardResponseState", + "localName": "GuardResponseOutput" + } + } + } + ] + } + } + } + ] + }, + "firstState": "PolicyGuardResponseState" + } + }, + { + "key": { + "name": "RestartAPPCResponsePolicy", + "version": "0.0.1" + }, + "value": { + "policyKey": { + "name": "RestartAPPCResponsePolicy", + "version": "0.0.1" + }, + "template": "Freestyle", + "state": { + "entry": [ + { + "key": "ResponseLogState", + "value": { + "stateKey": { + "parentKeyName": "RestartAPPCResponsePolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "ResponseLogState" + }, + "trigger": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "stateOutputs": { + "entry": [ + { + "key": "ResponseLogOutput", + "value": { + "key": { + "parentKeyName": "RestartAPPCResponsePolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "ResponseLogState", + "localName": "ResponseLogOutput" + }, + "outgoingEvent": { + "name": "ControlLoopLogEvent", + "version": "0.0.1" + }, + "outgoingEventReference": [ + { + "name": "ControlLoopLogEvent", + "version": "0.0.1" + } + ], + "nextState": { + "parentKeyName": "NULL", + "parentKeyVersion": "0.0.0", + "parentLocalName": "NULL", + "localName": "NULL" + } + } + } + ] + }, + "contextAlbumReference": [], + "taskSelectionLogic": { + "key": "NULL", + "logicFlavour": "UNDEFINED", + "logic": "" + }, + "stateFinalizerLogicMap": { + "entry": [] + }, + "defaultTask": { + "name": "ControlLoopLogTask", + "version": "0.0.1" + }, + "taskReferences": { + "entry": [ + { + "key": { + "name": "ControlLoopLogTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "RestartAPPCResponsePolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "ResponseLogState", + "localName": "RestartAPPCResponsePolicy" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "RestartAPPCResponsePolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "ResponseLogState", + "localName": "ResponseLogOutput" + } + } + } + ] + } + } + }, + { + "key": "RestartAPPCResponseState", + "value": { + "stateKey": { + "parentKeyName": "RestartAPPCResponsePolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "RestartAPPCResponseState" + }, + "trigger": { + "name": "APPCRestartVNFResponseEvent", + "version": "2.0.0" + }, + "stateOutputs": { + "entry": [ + { + "key": "APPCRestartVNFResponseOutput", + "value": { + "key": { + "parentKeyName": "RestartAPPCResponsePolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "RestartAPPCResponseState", + "localName": "APPCRestartVNFResponseOutput" + }, + "outgoingEvent": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "outgoingEventReference": [ + { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + } + ], + "nextState": { + "parentKeyName": "RestartAPPCResponsePolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "NULL", + "localName": "ResponseLogState" + } + } + } + ] + }, + "contextAlbumReference": [], + "taskSelectionLogic": { + "key": "NULL", + "logicFlavour": "UNDEFINED", + "logic": "" + }, + "stateFinalizerLogicMap": { + "entry": [] + }, + "defaultTask": { + "name": "APPCRestartVNFResponseTask", + "version": "0.0.1" + }, + "taskReferences": { + "entry": [ + { + "key": { + "name": "APPCRestartVNFResponseTask", + "version": "0.0.1" + }, + "value": { + "key": { + "parentKeyName": "RestartAPPCResponsePolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "RestartAPPCResponseState", + "localName": "RestartAPPCResponsePolicy" + }, + "outputType": "DIRECT", + "output": { + "parentKeyName": "RestartAPPCResponsePolicy", + "parentKeyVersion": "0.0.1", + "parentLocalName": "RestartAPPCResponseState", + "localName": "APPCRestartVNFResponseOutput" + } + } + } + ] + } + } + } + ] + }, + "firstState": "RestartAPPCResponseState" + } + } + ] + } + }, + "tasks": { + "key": { + "name": "ONAPvCPEPolicyModel_Tasks", + "version": "0.0.1" + }, + "taskMap": { + "entry": [ + { + "key": { + "name": "AAILookupTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "AAILookupTask", + "version": "0.0.1" + }, + "inputEvent": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + }, + "outputEvents": { + "entry": [ + { + "key": "VCPEStateUpdatedEvent", + "value": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + } + } + ] + }, + "taskParameters": { + "entry": [] + }, + "contextAlbumReference": [ + { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + } + ], + "taskLogic": { + "key": "TaskLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(\n executor.inFields.get(\"vnfID\").toString());\n\nexecutor.logger.info(\"Executing A&AI Lookup\");\nexecutor.logger.info(vcpeClosedLoopStatus);\n\nvar aaiInfo = vcpeClosedLoopStatus.get(\"AAI\");\nvar returnValue = true;\n\nif (aaiInfo.get(\"vserverName\") == null) {\n executor.message = \"the field vserver.vserver-name must exist in the onset control loop event\";\n executor.logger.warn(executor.message);\n returnValue = false;\n}\nelse if (aaiInfo.get(\"genericVnfVnfId\") == null && aaiInfo.get(\"genericVnfVnfName\") == null) {\n executor.message = \"either the field generic-vnf.vnf-id or generic-vnf.vnf-name must exist\"\n + \" in the onset control loop event\";\n executor.logger.warn(executor.message);\n returnValue = false;\n}\nelse {\n var restManager = new org.onap.policy.rest.RestManager;\n var aaiManager = new org.onap.policy.aai.AaiManager(restManager);\n\n // We need to instantiate the type in order to trigger the static JAXB handling\n // in the AaiCqResponse class\n var aaiCqResponseType = org.onap.policy.aai.AaiCqResponse;\n\n var aaiResponse = aaiManager.getCustomQueryResponse(\n \"http://localhost:54321/OnapVCpeSim/sim\",\n \"aai.username\",\n \"aai.password\",\n executor.inFields.get(\"requestID\"),\n vcpeClosedLoopStatus.get(\"AAI\").get(\"vserverName\")\n );\n\n var genericVnf;\n\n if (aaiInfo.get(\"genericVnfVnfId\") != null) {\n genericVnf = aaiResponse.getGenericVnfByModelInvariantId(aaiInfo.get(\"genericVnfVnfId\"));\n }\n else {\n genericVnf = aaiResponse.getGenericVnfByVnfName(aaiInfo.get(\"genericVnfVnfId\"));\n }\n\n aaiInfo.put(\"genericVnfResourceVersion\", genericVnf.getResourceVersion());\n aaiInfo.put(\"genericVnfVnfName\", genericVnf.getVnfName());\n aaiInfo.put(\"genericVnfProvStatus\", genericVnf.getProvStatus());\n aaiInfo.put(\"genericVnfIsClosedLoopDisabled\", genericVnf.isIsClosedLoopDisabled().toString());\n aaiInfo.put(\"genericVnfVnfType\", genericVnf.getVnfType());\n aaiInfo.put(\"genericVnfInMaint\", genericVnf.isInMaint().toString());\n aaiInfo.put(\"genericVnfServiceId\", genericVnf.getServiceId());\n aaiInfo.put(\"genericVnfVnfId\", genericVnf.getVnfId());\n aaiInfo.put(\"genericVnfOrchestrationStatus\",\n genericVnf.getVfModules().getVfModule().get(0).getOrchestrationStatus());\n\n executor.outFields.put(\"requestID\", executor.inFields.get(\"requestID\"));\n executor.outFields.put(\"vnfID\", executor.inFields.get(\"vnfID\"));\n\n executor.logger.info(executor.outFields);\n}\n\nreturnValue;" + } + } + }, + { + "key": { + "name": "APPCRestartVNFRequestTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "APPCRestartVNFRequestTask", + "version": "0.0.1" + }, + "inputEvent": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + }, + "outputEvents": { + "entry": [ + { + "key": "APPCRestartVNFRequestEvent", + "value": { + "key": { + "name": "APPCRestartVNFRequestEvent", + "version": "2.0.0" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APPC", + "parameter": { + "entry": [ + { + "key": "APPCLCMRequestEvent", + "value": { + "key": "APPCLCMRequestEvent", + "fieldSchemaKey": { + "name": "APPCLCMRequestType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "toscaPolicyState": "" + } + } + ] + }, + "taskParameters": { + "entry": [] + }, + "contextAlbumReference": [ + { + "name": "RequestIDVNFIDAlbum", + "version": "0.0.1" + }, + { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + } + ], + "taskLogic": { + "key": "TaskLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar appcRequest = new org.onap.policy.appclcm.AppcLcmDmaapWrapper;\nappcRequest.setBody(new org.onap.policy.appclcm.AppcLcmBody);\nappcRequest.getBody().setInput(new org.onap.policy.appclcm.AppcLcmInput);\nappcRequest.getBody().getInput().setCommonHeader(\n new org.onap.policy.appclcm.AppcLcmCommonHeader);\n\nappcRequest.setVersion(\"2.0.0\");\nappcRequest.setRpcName(\"restart\");\nappcRequest.setCorrelationId(executor.inFields.get(\"requestID\"));\nappcRequest.setType(\"request\");\n\nvar vcpeClosedLoopStatus = executor\n .getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(\n executor.inFields.get(\"vnfID\").toString());\n\nappcRequest.getBody().getInput().getCommonHeader().setTimeStamp(java.time.Instant.now());\nappcRequest.getBody().getInput().getCommonHeader().setApiVer(\"2.00\");\nappcRequest.getBody().getInput().getCommonHeader().setOriginatorId(\n executor.inFields.get(\"requestID\").toString());\nappcRequest.getBody().getInput().getCommonHeader().setRequestId(\n executor.inFields.get(\"requestID\"));\nappcRequest.getBody().getInput().getCommonHeader().setSubRequestId(\"1\");\nappcRequest.getBody().getInput().getCommonHeader().getFlags().put(\"ttl\", \"10000\");\nappcRequest.getBody().getInput().getCommonHeader().getFlags().put(\"force\", \"TRUE\");\nappcRequest.getBody().getInput().getCommonHeader().getFlags().put(\"mode\", \"EXCLUSIVE\");\n\nappcRequest.getBody().getInput().setAction(\"Restart\");\nappcRequest.getBody().getInput().setActionIdentifiers(new java.util.HashMap());\nappcRequest.getBody().getInput().getActionIdentifiers().put(\"vnf-id\",\n executor.inFields.get(\"vnfID\").toString());\n\nexecutor.getContextAlbum(\"RequestIDVNFIDAlbum\").put(\n executor.inFields.get(\"requestID\").toString(),\n executor.inFields.get(\"vnfID\"));\n\nvcpeClosedLoopStatus.put(\"notification\", \"OPERATION\");\nvcpeClosedLoopStatus.put(\"notificationTime\", java.lang.System\n .currentTimeMillis());\n\nexecutor.outFields.put(\"APPCLCMRequestEvent\", appcRequest);\n\nexecutor.logger.info(executor.outFields);\n\ntrue;" + } + } + }, + { + "key": { + "name": "APPCRestartVNFResponseTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "APPCRestartVNFResponseTask", + "version": "0.0.1" + }, + "inputEvent": { + "key": { + "name": "APPCRestartVNFResponseEvent", + "version": "2.0.0" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APPC", + "parameter": { + "entry": [ + { + "key": "APPCLCMResponseEvent", + "value": { + "key": "APPCLCMResponseEvent", + "fieldSchemaKey": { + "name": "APPCLCMResponseType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "toscaPolicyState": "" + }, + "outputEvents": { + "entry": [ + { + "key": "VCPEStateUpdatedEvent", + "value": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + } + } + ] + }, + "taskParameters": { + "entry": [] + }, + "contextAlbumReference": [ + { + "name": "RequestIDVNFIDAlbum", + "version": "0.0.1" + }, + { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + } + ], + "taskLogic": { + "key": "TaskLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * APPC LCM Response code: 100 ACCEPTED\n * 200 ERROR UNEXPECTED ERROR means failure\n * 312 REJECTED DUPLICATE REQUEST\n * 400 SUCCESS\n *\n * Note: Sometimes the corelationId has a -1 at the tail, need to get rid of it when present.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar appcResponse = executor.inFields.get(\"APPCLCMResponseEvent\");\n\nvar requestIDString = appcResponse.getCorrelationId().substr(0, 36);\nexecutor.logger.info(\"requestIDString = \" + requestIDString);\nvar vnfID = executor.getContextAlbum(\"RequestIDVNFIDAlbum\")\n .get(requestIDString);\nexecutor.logger.info(\"Size of RequestIDVNFIDAlbum = \"\n + executor.getContextAlbum(\"RequestIDVNFIDAlbum\").size());\nexecutor.logger.info(\"vnfID = \" + vnfID);\n\nvar returnValue = true;\n\nif (vnfID != null) {\n var vcpeClosedLoopStatus = executor.getContextAlbum(\n \"VCPEClosedLoopStatusAlbum\").get(vnfID.toString());\n var requestId = java.util.UUID.fromString(vcpeClosedLoopStatus\n .get(\"requestID\"));\n\n vcpeClosedLoopStatus.put(\"notificationTime\", java.lang.System\n .currentTimeMillis());\n\n executor.logger.info(\"Got from APPC code: \"\n + org.onap.policy.appclcm.AppcLcmResponseCode\n .toResponseValue(appcResponse.getBody().getOutput()\n .getStatus().getCode()));\n\n if (org.onap.policy.appclcm.AppcLcmResponseCode\n .toResponseValue(appcResponse.getBody().getOutput().getStatus()\n .getCode()) == org.onap.policy.appclcm.AppcLcmResponseCode.SUCCESS) {\n vcpeClosedLoopStatus.put(\"notification\", \"OPERATION_SUCCESS\");\n vcpeClosedLoopStatus.put(\"message\", \"vCPE restarted\");\n executor.getContextAlbum(\"RequestIDVNFIDAlbum\").remove(requestIDString);\n } else if (org.onap.policy.appclcm.AppcLcmResponseCode\n .toResponseValue(appcResponse.getBody().getOutput().getStatus()\n .getCode()) == \"ACCEPTED\"\n || org.onap.policy.appclcm.AppcLcmResponseCode\n .toResponseValue(appcResponse.getBody().getOutput()\n .getStatus().getCode()) == \"REJECT\") {\n executor.logger\n .info(\"Got ACCEPTED 100 or REJECT 312, keep the context, wait for next response. Code is: \"\n + org.onap.policy.appclcm.AppcLcmResponseCode\n .toResponseValue(appcResponse.getBody()\n .getOutput().getStatus().getCode()));\n } else {\n executor.getContextAlbum(\"RequestIDVNFIDAlbum\").remove(requestIDString);\n vcpeClosedLoopStatus.put(\"notification\", \"OPERATION_FAILURE\");\n vcpeClosedLoopStatus.put(\"message\", \"vCPE restart failed\");\n }\n\n executor.outFields.put(\"requestID\", requestId);\n executor.outFields.put(\"vnfID\", vnfID);\n} else {\n executor.message = \"VNF ID not found in context album for request ID \"\n + requestIDString;\n returnValue = false\n}\n\nexecutor.logger.info(executor.outFields);\n\nreturnValue;" + } + } + }, + { + "key": { + "name": "AbatedTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "AbatedTask", + "version": "0.0.1" + }, + "inputEvent": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + }, + "outputEvents": { + "entry": [ + { + "key": "VCPEStateUpdatedEvent", + "value": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + } + } + ] + }, + "taskParameters": { + "entry": [] + }, + "contextAlbumReference": [ + { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + } + ], + "taskLogic": { + "key": "TaskLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar vcpeClosedLoopStatus = null;\nif( executor.inFields.get(\"vnfID\") == null) {\n executor.logger.info(\"AbatedTask: vnfID is null\");\n var vnfName = executor.inFields.get(\"vnfName\");\n vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(\n executor.inFields.get(\"vnfName\"));\n} else {\n vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(\n executor.inFields.get(\"vnfID\").toString());\n}\n\nvcpeClosedLoopStatus.put(\"notification\", \"FINAL_SUCCESS\");\nvcpeClosedLoopStatus.put(\"notificationTime\", java.lang.System.currentTimeMillis());\nvcpeClosedLoopStatus.put(\"message\", \"situation has been abated\");\n\nexecutor.logger.info(executor.outFields);\n\ntrue;" + } + } + }, + { + "key": { + "name": "ControlLoopLogTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ControlLoopLogTask", + "version": "0.0.1" + }, + "inputEvent": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + }, + "outputEvents": { + "entry": [ + { + "key": "ControlLoopLogEvent", + "value": { + "key": { + "name": "ControlLoopLogEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "VirtualControlLoopNotification", + "value": { + "key": "VirtualControlLoopNotification", + "fieldSchemaKey": { + "name": "VirtualControlLoopNotificationType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "toscaPolicyState": "" + } + } + ] + }, + "taskParameters": { + "entry": [] + }, + "contextAlbumReference": [ + { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + } + ], + "taskLogic": { + "key": "TaskLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar vnfID = executor.inFields.get(\"vnfID\");\nif(vnfID == null) {\n vnfID = executor.inFields.get(\"vnfName\");\n}\nexecutor.logger.info(\"vnfID=\" + vnfID);\n\nvar vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(vnfID.toString());\n\nexecutor.logger.info(\"Logging context information for VNF \\\"\" + vnfID + \"\\\"\");\n\nvar clNotification = new org.onap.policy.controlloop.VirtualControlLoopNotification();\n\nclNotification.setClosedLoopControlName(vcpeClosedLoopStatus.get(\"closedLoopControlName\"));\nclNotification.setClosedLoopAlarmStart(java.time.Instant.ofEpochMilli(vcpeClosedLoopStatus.get(\"closedLoopAlarmStart\")));\nclNotification.setClosedLoopAlarmEnd(java.time.Instant.ofEpochMilli(vcpeClosedLoopStatus.get(\"closedLoopAlarmEnd\")));\nclNotification.setClosedLoopEventClient(vcpeClosedLoopStatus.get(\"closedLoopEventClient\"));\nclNotification.setVersion(vcpeClosedLoopStatus.get(\"version\"));\nclNotification.setRequestId(java.util.UUID.fromString(vcpeClosedLoopStatus.get(\"requestID\")));\nclNotification.setTargetType(vcpeClosedLoopStatus.get(\"target_type\"));\nclNotification.setTarget(vcpeClosedLoopStatus.get(\"target\"));\nclNotification.setFrom(vcpeClosedLoopStatus.get(\"from\"));\nclNotification.setPolicyScope(vcpeClosedLoopStatus.get(\"policyScope\"));\nclNotification.setPolicyName(vcpeClosedLoopStatus.get(\"policyName\"));\nclNotification.setPolicyVersion(vcpeClosedLoopStatus.get(\"policyVersion\"));\nclNotification.setNotification(org.onap.policy.controlloop.ControlLoopNotificationType.toType(vcpeClosedLoopStatus.get(\"notification\")));\nclNotification.setMessage(vcpeClosedLoopStatus.get(\"message\"));\n\nvar notificationInstant = java.time.Instant.ofEpochSecond(vcpeClosedLoopStatus.get(\"notificationTime\"));\nvar notificationTime = java.time.ZonedDateTime.ofInstant(notificationInstant, java.time.ZoneOffset.UTC);\nclNotification.setNotificationTime(notificationTime);\n\nvar aaiInfo = vcpeClosedLoopStatus.get(\"AAI\");\n\nclNotification.getAai().put(\"generic-vnf.resource-version\", aaiInfo.get(\"genericVnfResourceVersion\"));\nclNotification.getAai().put(\"generic-vnf.vnf-name\", aaiInfo.get(\"genericVnfVnfName\"));\nclNotification.getAai().put(\"generic-vnf.prov-status\", aaiInfo.get(\"genericVnfProvStatus\"));\nclNotification.getAai().put(\"generic-vnf.is-closed-loop-disabled\", aaiInfo.get(\"genericVnfIsClosedLoopDisabled\"));\nclNotification.getAai().put(\"generic-vnf.orchestration-status\", aaiInfo.get(\"genericVnfOrchestrationStatus\"));\nclNotification.getAai().put(\"generic-vnf.vnf-type\", aaiInfo.get(\"genericVnfVnfType\"));\nclNotification.getAai().put(\"generic-vnf.in-maint\", aaiInfo.get(\"genericVnfInMaint\"));\nclNotification.getAai().put(\"generic-vnf.service-id\", aaiInfo.get(\"genericVnfServiceId\"));\n\nif(vnfID != null) {\n clNotification.getAai().put(\"generic-vnf.vnf-id\", aaiInfo.get(\"genericVnfVnfId\"));\n}\nexecutor.outFields.put(\"VirtualControlLoopNotification\", clNotification);\n\nexecutor.logger.info(executor.outFields);\n\ntrue;" + } + } + }, + { + "key": { + "name": "DeniedTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "DeniedTask", + "version": "0.0.1" + }, + "inputEvent": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + }, + "outputEvents": { + "entry": [ + { + "key": "VCPEStateUpdatedEvent", + "value": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + } + } + ] + }, + "taskParameters": { + "entry": [] + }, + "contextAlbumReference": [ + { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + } + ], + "taskLogic": { + "key": "TaskLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(\n executor.inFields.get(\"vnfID\").toString());\n\nvcpeClosedLoopStatus.put(\"notification\", \"REJECTED\");\nvcpeClosedLoopStatus.put(\"notificationTime\", java.lang.System.currentTimeMillis());\n\nexecutor.logger.info(executor.outFields);\n\ntrue;" + } + } + }, + { + "key": { + "name": "GetVCPEStateTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "GetVCPEStateTask", + "version": "0.0.1" + }, + "inputEvent": { + "key": { + "name": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "version": "1.0.2" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "DCAE", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "VirtualControlLoopEvent", + "value": { + "key": "VirtualControlLoopEvent", + "fieldSchemaKey": { + "name": "VirtualControlLoopEventType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "toscaPolicyState": "" + }, + "outputEvents": { + "entry": [ + { + "key": "VCPEStateUpdatedEvent", + "value": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + } + } + ] + }, + "taskParameters": { + "entry": [] + }, + "contextAlbumReference": [ + { + "name": "RequestIDVNFIDAlbum", + "version": "0.0.1" + }, + { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + } + ], + "taskLogic": { + "key": "TaskLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * Note: The incoming closedloop message can be ONSET with both VNF-name and VNF-ID\n * or ABATED with only VNF-name. So need to handle differently. For ABATED case,\n * since we still keep the RequireIDVNFID context album, we can get it from there.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar clEventType = org.onap.policy.controlloop.VirtualControlLoopEvent;\nvar longType = java.lang.Long;\nvar uuidType = java.util.UUID;\n\nvar clEvent = executor.inFields.get(\"VirtualControlLoopEvent\");\n\nexecutor.logger.info(clEvent.toString());\nexecutor.logger.info(clEvent.getClosedLoopControlName());\n\nvar requestID = clEvent.getRequestId();\nexecutor.logger.info(\"requestID = \" + requestID);\nvar vnfID = null;\nvar vcpeClosedLoopStatus = null;\n\nif (clEvent.getAai().get(\"generic-vnf.vnf-id\") != null) {\n vnfID = uuidType.fromString(clEvent.getAai().get(\"generic-vnf.vnf-id\"));\n executor.logger.info(\"vnfID = \" + vnfID);\n vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(vnfID);\n\n if (vcpeClosedLoopStatus == null) {\n executor.logger.info(\"Creating context information for new vCPE VNF \\\"\" + vnfID.toString() + \"\\\"\");\n\n vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").getSchemaHelper().createNewInstance();\n\n vcpeClosedLoopStatus.put(\"closedLoopControlName\", clEvent.getClosedLoopControlName());\n vcpeClosedLoopStatus.put(\"closedLoopAlarmStart\", clEvent.getClosedLoopAlarmStart().toEpochMilli());\n vcpeClosedLoopStatus.put(\"closedLoopEventClient\", clEvent.getClosedLoopEventClient());\n vcpeClosedLoopStatus.put(\"closedLoopEventStatus\", clEvent.getClosedLoopEventStatus().toString());\n vcpeClosedLoopStatus.put(\"version\", clEvent.getVersion());\n vcpeClosedLoopStatus.put(\"requestID\", clEvent.getRequestId().toString());\n vcpeClosedLoopStatus.put(\"target_type\", clEvent.getTargetType().toString());\n vcpeClosedLoopStatus.put(\"target\", clEvent.getTarget());\n vcpeClosedLoopStatus.put(\"from\", clEvent.getFrom());\n vcpeClosedLoopStatus.put(\"policyScope\", \"vCPE\");\n vcpeClosedLoopStatus.put(\"policyName\", \"ONAPvCPEPolicyModel\");\n vcpeClosedLoopStatus.put(\"policyVersion\", \"0.0.1\");\n vcpeClosedLoopStatus.put(\"notification\", \"ACTIVE\");\n vcpeClosedLoopStatus.put(\"notificationTime\", java.lang.System.currentTimeMillis());\n vcpeClosedLoopStatus.put(\"message\", \"\");\n\n var aaiInfo = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").getSchemaHelper().createNewSubInstance(\"VCPE_AAI_Type\");\n\n aaiInfo.put(\"genericVnfResourceVersion\", clEvent.getAai().get(\"generic-vnf.resource-version\"));\n aaiInfo.put(\"genericVnfVnfName\", clEvent.getAai().get(\"generic-vnf.vnf-name\"));\n aaiInfo.put(\"genericVnfProvStatus\", clEvent.getAai().get(\"generic-vnf.prov-status\"));\n aaiInfo.put(\"genericVnfIsClosedLoopDisabled\", clEvent.getAai().get(\"generic-vnf.is-closed-loop-disabled\"));\n aaiInfo.put(\"genericVnfOrchestrationStatus\", clEvent.getAai().get(\"generic-vnf.orchestration-status\"));\n aaiInfo.put(\"genericVnfVnfType\", clEvent.getAai().get(\"generic-vnf.vnf-type\"));\n aaiInfo.put(\"genericVnfInMaint\", clEvent.getAai().get(\"generic-vnf.in-maint\"));\n aaiInfo.put(\"genericVnfServiceId\", clEvent.getAai().get(\"generic-vnf.service-id\"));\n aaiInfo.put(\"genericVnfVnfId\", clEvent.getAai().get(\"generic-vnf.vnf-id\"));\n aaiInfo.put(\"vserverIsClosedLoopDisabled\", clEvent.getAai().get(\"vserver.is-closed-loop-disabled\"));\n aaiInfo.put(\"vserverProvStatus\", clEvent.getAai().get(\"vserver.prov-status\"));\n aaiInfo.put(\"vserverName\", clEvent.getAai().get(\"vserver.vserver-name\"));\n\n vcpeClosedLoopStatus.put(\"AAI\", aaiInfo);\n\n if (clEvent.getClosedLoopAlarmEnd() != null) {\n vcpeClosedLoopStatus.put(\"closedLoopAlarmEnd\", clEvent.getClosedLoopAlarmEnd().toEpochMilli());\n } else {\n vcpeClosedLoopStatus.put(\"closedLoopAlarmEnd\", java.lang.Long.valueOf(0));\n }\n\n executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").put(vnfID.toString(), vcpeClosedLoopStatus);\n\n executor.logger.info(\"Created context information for new vCPE VNF \\\"\" + vnfID.toString() + \"\\\"\");\n }\n\n executor.outFields.put(\"requestID\", requestID);\n executor.outFields.put(\"vnfID\", vnfID);\n\n executor.logger.info(executor.outFields);\n}\nelse {\n executor.logger.info(\"No vnf-id in VirtualControlLoopEvent, status:\" + clEvent.getClosedLoopEventStatus().toString());\n var vnfName = clEvent.getAai().get(\"generic-vnf.vnf-name\");\n executor.logger.info(\"No vnf-id in VirtualControlLoopEvent for \" + vnfName);\n\n vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(vnfName.toString());\n\n if (vcpeClosedLoopStatus == null) {\n executor.logger.info(\"Creating context information for new vCPE VNF \\\"\" + vnfName.toString() + \"\\\"\");\n\n vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").getSchemaHelper().createNewInstance();\n\n vcpeClosedLoopStatus.put(\"closedLoopControlName\", clEvent.getClosedLoopControlName());\n vcpeClosedLoopStatus.put(\"closedLoopAlarmStart\", clEvent.getClosedLoopAlarmStart().toEpochMilli());\n vcpeClosedLoopStatus.put(\"closedLoopEventClient\", clEvent.getClosedLoopEventClient());\n vcpeClosedLoopStatus.put(\"closedLoopEventStatus\", clEvent.getClosedLoopEventStatus().toString());\n vcpeClosedLoopStatus.put(\"version\", clEvent.getVersion());\n vcpeClosedLoopStatus.put(\"requestID\", clEvent.getRequestId().toString());\n vcpeClosedLoopStatus.put(\"target_type\", clEvent.getTargetType().toString());\n vcpeClosedLoopStatus.put(\"target\", clEvent.getTarget());\n vcpeClosedLoopStatus.put(\"from\", clEvent.getFrom());\n vcpeClosedLoopStatus.put(\"policyScope\", \"vCPE\");\n vcpeClosedLoopStatus.put(\"policyName\", \"ONAPvCPEPolicyModel\");\n vcpeClosedLoopStatus.put(\"policyVersion\", \"0.0.1\");\n vcpeClosedLoopStatus.put(\"notification\", \"ACTIVE\");\n vcpeClosedLoopStatus.put(\"notificationTime\", java.lang.System.currentTimeMillis());\n vcpeClosedLoopStatus.put(\"message\", \"\");\n\n var aaiInfo = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").getSchemaHelper().createNewSubInstance(\"VCPE_AAI_Type\");\n\n aaiInfo.put(\"genericVnfVnfName\", clEvent.getAai().get(\"generic-vnf.vnf-name\"));\n vcpeClosedLoopStatus.put(\"AAI\", aaiInfo);\n\n if (clEvent.getClosedLoopAlarmEnd() != null) {\n vcpeClosedLoopStatus.put(\"closedLoopAlarmEnd\", clEvent.getClosedLoopAlarmEnd().toEpochMilli());\n } else {\n vcpeClosedLoopStatus.put(\"closedLoopAlarmEnd\", java.lang.Long.valueOf(0));\n }\n\n executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").put(vnfName.toString(), vcpeClosedLoopStatus);\n\n executor.logger.info(\"Created context information for new vCPE VNF \\\"\" + vnfName.toString() + \"\\\"\");\n }\n executor.outFields.put(\"requestID\", requestID);\n executor.outFields.put(\"vnfName\", vnfName);\n executor.logger.info(executor.outFields);\n}\n\ntrue;" + } + } + }, + { + "key": { + "name": "GuardRequestTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "GuardRequestTask", + "version": "0.0.1" + }, + "inputEvent": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + }, + "outputEvents": { + "entry": [ + { + "key": "GuardRequestEvent", + "value": { + "key": { + "name": "GuardRequestEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "decisionAttributes", + "value": { + "key": "decisionAttributes", + "fieldSchemaKey": { + "name": "GuardDecisionAttributesType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "onapName", + "value": { + "key": "onapName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "toscaPolicyState": "" + } + } + ] + }, + "taskParameters": { + "entry": [] + }, + "contextAlbumReference": [ + { + "name": "ControlLoopExecutionIDAlbum", + "version": "0.0.1" + }, + { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + } + ], + "taskLogic": { + "key": "TaskLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(\n executor.inFields.get(\"vnfID\").toString());\n\nvar guardDecisionAttributes = executor.subject.getOutFieldSchemaHelper(\"decisionAttributes\").createNewInstance();\n\nguardDecisionAttributes.put(\"actor\", \"APPC\");\nguardDecisionAttributes.put(\"recipe\", \"Restart\");\nguardDecisionAttributes.put(\"target\", executor.inFields.get(\"vnfID\").toString());\nguardDecisionAttributes.put(\"clname\", \"APEXvCPEImplementation\");\n\nexecutor.logger.info(guardDecisionAttributes);\n\nexecutor.outFields.put(\"decisionAttributes\", guardDecisionAttributes);\nexecutor.outFields.put(\"onapName\", \"PDPD\");\n\nexecutor.getContextAlbum(\"ControlLoopExecutionIDAlbum\").put(executor.executionId.toString(),\n executor.inFields.get(\"vnfID\"));\n\nexecutor.logger.info(executor.outFields);\n\ntrue;" + } + } + }, + { + "key": { + "name": "GuardResponseTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "GuardResponseTask", + "version": "0.0.1" + }, + "inputEvent": { + "key": { + "name": "GuardResponseEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "decision", + "value": { + "key": "decision", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "details", + "value": { + "key": "details", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "toscaPolicyState": "" + }, + "outputEvents": { + "entry": [ + { + "key": "VCPEStateUpdatedEvent", + "value": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + } + } + ] + }, + "taskParameters": { + "entry": [] + }, + "contextAlbumReference": [ + { + "name": "ControlLoopExecutionIDAlbum", + "version": "0.0.1" + }, + { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + } + ], + "taskLogic": { + "key": "TaskLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nvar vnfID = executor.getContextAlbum(\"ControlLoopExecutionIDAlbum\").remove(executor.executionId.toString());\n\nexecutor.logger.info(\"Continuing execution with VNF ID: \" + vnfID);\n\nvar vcpeClosedLoopStatus = executor.getContextAlbum(\"VCPEClosedLoopStatusAlbum\").get(vnfID.toString());\nexecutor.logger.info(vcpeClosedLoopStatus);\n\nvar guardResult = executor.inFields.get(\"decision\");\nvar returnValue = true;\n\nif (guardResult == \"PERMIT\") {\n vcpeClosedLoopStatus.put(\"notification\", \"OPERATION: GUARD_PERMIT\");\n} else if (guardResult == \"DENY\") {\n vcpeClosedLoopStatus.put(\"notification\", \"OPERATION: GUARD_DENY\");\n} else {\n executor.message = \"guard result must be either \\\"PERMIT\\\" or \\\"DENY\\\"\";\n returnValue = false;\n}\n\nvar uuidType = java.util.UUID;\nvar requestID = uuidType.fromString(vcpeClosedLoopStatus.get(\"requestID\"));\n\nexecutor.outFields.put(\"requestID\", requestID);\nexecutor.outFields.put(\"vnfID\", vnfID);\n\nexecutor.logger.info(executor.outFields);\n\n\nreturnValue;" + } + } + }, + { + "key": { + "name": "NoAAILookupTask", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "NoAAILookupTask", + "version": "0.0.1" + }, + "taskParameters": { + "entry": [] + }, + "contextAlbumReference": [], + "taskLogic": { + "key": "TaskLogic", + "logicFlavour": "JAVASCRIPT", + "logic": "/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2016-2018 Ericsson. All rights reserved.\n * Modifications Copyright (C) 2020 Nordix Foundation.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\nexecutor.logger.info(executor.inFields);\n\nexecutor.logger.info(executor.outFields);\n\ntrue;" + } + } + } + ] + } + }, + "events": { + "key": { + "name": "ONAPvCPEPolicyModel_Events", + "version": "0.0.1" + }, + "eventMap": { + "entry": [ + { + "key": { + "name": "APPCRestartVNFRequestEvent", + "version": "2.0.0" + }, + "value": { + "key": { + "name": "APPCRestartVNFRequestEvent", + "version": "2.0.0" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APPC", + "parameter": { + "entry": [ + { + "key": "APPCLCMRequestEvent", + "value": { + "key": "APPCLCMRequestEvent", + "fieldSchemaKey": { + "name": "APPCLCMRequestType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "toscaPolicyState": "" + } + }, + { + "key": { + "name": "APPCRestartVNFResponseEvent", + "version": "2.0.0" + }, + "value": { + "key": { + "name": "APPCRestartVNFResponseEvent", + "version": "2.0.0" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APPC", + "parameter": { + "entry": [ + { + "key": "APPCLCMResponseEvent", + "value": { + "key": "APPCLCMResponseEvent", + "fieldSchemaKey": { + "name": "APPCLCMResponseType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "toscaPolicyState": "" + } + }, + { + "key": { + "name": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "version": "1.0.2" + }, + "value": { + "key": { + "name": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "version": "1.0.2" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "DCAE", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "VirtualControlLoopEvent", + "value": { + "key": "VirtualControlLoopEvent", + "fieldSchemaKey": { + "name": "VirtualControlLoopEventType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "toscaPolicyState": "" + } + }, + { + "key": { + "name": "ControlLoopLogEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ControlLoopLogEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "VirtualControlLoopNotification", + "value": { + "key": "VirtualControlLoopNotification", + "fieldSchemaKey": { + "name": "VirtualControlLoopNotificationType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "toscaPolicyState": "" + } + }, + { + "key": { + "name": "GuardRequestEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "GuardRequestEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "decisionAttributes", + "value": { + "key": "decisionAttributes", + "fieldSchemaKey": { + "name": "GuardDecisionAttributesType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "onapName", + "value": { + "key": "onapName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "toscaPolicyState": "" + } + }, + { + "key": { + "name": "GuardResponseEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "GuardResponseEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "decision", + "value": { + "key": "decision", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "details", + "value": { + "key": "details", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": false + } + } + ] + }, + "toscaPolicyState": "" + } + }, + { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "VCPEStateUpdatedEvent", + "version": "0.0.1" + }, + "nameSpace": "org.onap.policy.apex.onap.vcpe", + "source": "APEX", + "target": "APEX", + "parameter": { + "entry": [ + { + "key": "requestID", + "value": { + "key": "requestID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfID", + "value": { + "key": "vnfID", + "fieldSchemaKey": { + "name": "UUIDType", + "version": "0.0.1" + }, + "optional": false + } + }, + { + "key": "vnfName", + "value": { + "key": "vnfName", + "fieldSchemaKey": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "optional": true + } + } + ] + }, + "toscaPolicyState": "" + } + } + ] + } + }, + "albums": { + "key": { + "name": "ONAPvCPEPolicyModel_Albums", + "version": "0.0.1" + }, + "albums": { + "entry": [ + { + "key": { + "name": "ControlLoopExecutionIDAlbum", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "ControlLoopExecutionIDAlbum", + "version": "0.0.1" + }, + "scope": "policy", + "isWritable": true, + "itemSchema": { + "name": "UUIDType", + "version": "0.0.1" + } + } + }, + { + "key": { + "name": "RequestIDVNFIDAlbum", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "RequestIDVNFIDAlbum", + "version": "0.0.1" + }, + "scope": "policy", + "isWritable": true, + "itemSchema": { + "name": "UUIDType", + "version": "0.0.1" + } + } + }, + { + "key": { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "VCPEClosedLoopStatusAlbum", + "version": "0.0.1" + }, + "scope": "policy", + "isWritable": true, + "itemSchema": { + "name": "VCPEClosedLoopStatusType", + "version": "0.0.1" + } + } + } + ] + } + }, + "schemas": { + "key": { + "name": "ONAPvCPEPolicyModel_Schemas", + "version": "0.0.1" + }, + "schemas": { + "entry": [ + { + "key": { + "name": "APPCLCMRequestType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "APPCLCMRequestType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "org.onap.policy.appclcm.AppcLcmDmaapWrapper" + } + }, + { + "key": { + "name": "APPCLCMResponseType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "APPCLCMResponseType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "org.onap.policy.appclcm.AppcLcmDmaapWrapper" + } + }, + { + "key": { + "name": "GuardDecisionAttributesType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "GuardDecisionAttributesType", + "version": "0.0.1" + }, + "schemaFlavour": "Avro", + "schemaDefinition": "{\n \"type\": \"record\",\n \"name\": \"GuardDecisionAttributes_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.vcpe\",\n \"fields\": [\n {\n \"name\": \"actor\",\n \"type\": \"string\"\n },\n {\n \"name\": \"recipe\",\n \"type\": \"string\"\n },\n {\n \"name\": \"target\",\n \"type\": \"string\"\n },\n {\n \"name\": \"clname\",\n \"type\": \"string\"\n }\n ]\n}" + } + }, + { + "key": { + "name": "SimpleBooleanType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SimpleBooleanType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "java.lang.Boolean" + } + }, + { + "key": { + "name": "SimpleLongType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SimpleLongType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "java.lang.Long" + } + }, + { + "key": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "SimpleStringType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "java.lang.String" + } + }, + { + "key": { + "name": "UUIDType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "UUIDType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "java.util.UUID" + } + }, + { + "key": { + "name": "VCPEClosedLoopStatusType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "VCPEClosedLoopStatusType", + "version": "0.0.1" + }, + "schemaFlavour": "Avro", + "schemaDefinition": "{\n \"type\": \"record\",\n \"name\": \"VCPEClosedLoopStatus\",\n \"fields\": [\n {\n \"name\": \"AAI\",\n \"type\": {\n \"type\": \"record\",\n \"name\": \"VCPE_AAI_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.vcpe\",\n \"fields\": [\n {\n \"name\": \"genericVnfResourceVersion\",\n \"type\": \"string\"\n },\n {\n \"name\": \"genericVnfVnfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"genericVnfProvStatus\",\n \"type\": \"string\"\n },\n {\n \"name\": \"genericVnfIsClosedLoopDisabled\",\n \"type\": \"string\"\n },\n {\n \"name\": \"genericVnfOrchestrationStatus\",\n \"type\": \"string\"\n },\n {\n \"name\": \"genericVnfVnfType\",\n \"type\": \"string\"\n },\n {\n \"name\": \"genericVnfInMaint\",\n \"type\": \"string\"\n },\n {\n \"name\": \"genericVnfServiceId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"genericVnfVnfId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"vserverIsClosedLoopDisabled\",\n \"type\": \"string\"\n },\n {\n \"name\": \"vserverName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"vserverProvStatus\",\n \"type\": \"string\"\n }\n ]\n }\n },\n {\n \"name\": \"closedLoopAlarmStart\",\n \"type\": \"long\"\n },\n {\n \"name\": \"closedLoopAlarmEnd\",\n \"type\": \"long\"\n },\n {\n \"name\": \"closedLoopControlName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"version\",\n \"type\": \"string\"\n },\n {\n \"name\": \"requestID\",\n \"type\": \"string\"\n },\n {\n \"name\": \"closedLoopEventClient\",\n \"type\": \"string\"\n },\n {\n \"name\": \"closedLoopEventStatus\",\n \"type\": \"string\"\n },\n {\n \"name\": \"target_type\",\n \"type\": \"string\"\n },\n {\n \"name\": \"target\",\n \"type\": \"string\"\n },\n {\n \"name\": \"from\",\n \"type\": \"string\"\n },\n {\n \"name\": \"policyScope\",\n \"type\": \"string\"\n },\n {\n \"name\": \"policyName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"policyVersion\",\n \"type\": \"string\"\n },\n {\n \"name\": \"notification\",\n \"type\": \"string\"\n },\n {\n \"name\": \"notificationTime\",\n \"type\": \"long\"\n },\n {\n \"name\": \"message\",\n \"type\": \"string\"\n }\n ]\n}" + } + }, + { + "key": { + "name": "VirtualControlLoopEventType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "VirtualControlLoopEventType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "org.onap.policy.controlloop.VirtualControlLoopEvent" + } + }, + { + "key": { + "name": "VirtualControlLoopNotificationType", + "version": "0.0.1" + }, + "value": { + "key": { + "name": "VirtualControlLoopNotificationType", + "version": "0.0.1" + }, + "schemaFlavour": "Java", + "schemaDefinition": "org.onap.policy.controlloop.VirtualControlLoopNotification" + } + } + ] + } + } +} |