summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@bell.ca>2022-07-25 10:46:57 +0100
committera.sreekumar <ajith.sreekumar@bell.ca>2022-07-26 10:18:58 +0100
commit751aa0f3c7f090bc10bc59f74aaace1f297a7c2c (patch)
treeacc983fd58594b56b24846e3ee6becb8c494418c /examples
parentcfa642373420fa2bc429c94f17e4f0c0798e5791 (diff)
Update APEX example to use JSON Schema plugin
Change-Id: Ic8b412ce0ca71b4452d67b1e4445e423b0ec5b54 Issue-ID: POLICY-4292 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'examples')
-rw-r--r--examples/examples-grpc/pom.xml13
-rw-r--r--examples/examples-grpc/src/main/resources/examples/config/APEXgRPC/ApexConfig.json3
-rw-r--r--examples/examples-grpc/src/main/resources/examples/events/APEXgRPC/CDSResponseStatusEvent.json2
-rw-r--r--examples/examples-grpc/src/main/resources/logic/CreateSubscriptionPayloadTask.js11
-rw-r--r--examples/examples-grpc/src/main/resources/logic/CreateSubscriptionRequestTask.js5
-rw-r--r--examples/examples-grpc/src/main/resources/logic/DeleteSubscriptionPayloadTask.js11
-rw-r--r--examples/examples-grpc/src/main/resources/logic/DeleteSubscriptionRequestTask.js5
-rw-r--r--examples/examples-grpc/src/main/resources/logic/ReceivePMSubscriptionTask.js3
-rw-r--r--examples/examples-grpc/src/main/resources/logic/ResponseTask.js6
-rw-r--r--examples/examples-grpc/src/main/resources/policy/APEXgRPCPolicy.apex36
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/CDSActionIdentifiersType.avsc23
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/CDSActionIdentifiersType.json24
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/CDSCreateSubscriptionPayloadType.avsc91
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/CDSCreateSubscriptionPayloadType.json133
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/CDSRequestCommonHeaderType.avsc19
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/CDSRequestCommonHeaderType.json43
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/CDSResponseCommonHeaderType.avsc23
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/CDSResponseCommonHeaderType.json28
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/CDSResponsePayloadType.avsc29
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/CDSResponsePayloadType.json28
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/CDSResponseStatusType.avsc23
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/CDSResponseStatusType.json24
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/PMSubscriptionType.avsc101
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/PMSubscriptionType.json101
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/SubscriptionStatusType.avsc23
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/SubscriptionStatusType.json24
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/SubscriptionType.avsc75
-rw-r--r--examples/examples-grpc/src/main/resources/schemas/SubscriptionType.json133
28 files changed, 596 insertions, 444 deletions
diff --git a/examples/examples-grpc/pom.xml b/examples/examples-grpc/pom.xml
index df4df5373..70dd31ba5 100644
--- a/examples/examples-grpc/pom.xml
+++ b/examples/examples-grpc/pom.xml
@@ -3,6 +3,7 @@
============LICENSE_START=======================================================
Copyright (C) 2020 Nordix Foundation.
Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ Modifications Copyright (C) 2022 Bell Canada. 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.
@@ -53,6 +54,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-schema</groupId>
+ <artifactId>plugins-context-schema-json</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.onap.policy.apex-pdp.plugins.plugins-executor</groupId>
<artifactId>plugins-executor-javascript</artifactId>
<version>${project.version}</version>
@@ -90,6 +96,13 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Xss1m</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
diff --git a/examples/examples-grpc/src/main/resources/examples/config/APEXgRPC/ApexConfig.json b/examples/examples-grpc/src/main/resources/examples/config/APEXgRPC/ApexConfig.json
index c34f9e33f..8e968acec 100644
--- a/examples/examples-grpc/src/main/resources/examples/config/APEXgRPC/ApexConfig.json
+++ b/examples/examples-grpc/src/main/resources/examples/config/APEXgRPC/ApexConfig.json
@@ -17,6 +17,9 @@
"Avro": {
"parameterClassName": "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters"
},
+ "Json": {
+ "parameterClassName": "org.onap.policy.apex.plugins.context.schema.json.JsonSchemaHelperParameters"
+ },
"Java": {
"parameterClassName": "org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters",
"jsonAdapters": {
diff --git a/examples/examples-grpc/src/main/resources/examples/events/APEXgRPC/CDSResponseStatusEvent.json b/examples/examples-grpc/src/main/resources/examples/events/APEXgRPC/CDSResponseStatusEvent.json
index d616ac12e..64142d4e8 100644
--- a/examples/examples-grpc/src/main/resources/examples/events/APEXgRPC/CDSResponseStatusEvent.json
+++ b/examples/examples-grpc/src/main/resources/examples/events/APEXgRPC/CDSResponseStatusEvent.json
@@ -6,8 +6,8 @@
"target": "DCAE",
"toscaPolicyState": "EXIT_SUCCESS",
"status": {
- "subscriptionName": "testPolicyB",
"nfName": "pnf300",
+ "subscriptionName": "testPolicyB",
"changeType": "CREATE",
"message": "success"
}
diff --git a/examples/examples-grpc/src/main/resources/logic/CreateSubscriptionPayloadTask.js b/examples/examples-grpc/src/main/resources/logic/CreateSubscriptionPayloadTask.js
index 85e7ae2e9..4cacf81e0 100644
--- a/examples/examples-grpc/src/main/resources/logic/CreateSubscriptionPayloadTask.js
+++ b/examples/examples-grpc/src/main/resources/logic/CreateSubscriptionPayloadTask.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix. All rights reserved.
+ * Modifications Copyright (C) 2022 Bell Canada. 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.
@@ -22,7 +23,7 @@ executor.logger.info(executor.subject.id);
var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(executor.inFields.get("albumID").toString())
-var payloadProperties = executor.subject.getOutFieldSchemaHelper("payload").createNewSubInstance("create_DasH_subscription_DasH_properties_record");
+var payloadProperties = new java.util.HashMap();
payloadProperties.put("nfName", pmSubscriptionInfo.get("nfName"))
payloadProperties.put("subscriptionName", pmSubscriptionInfo.get("subscription").get("subscriptionName"))
@@ -31,12 +32,12 @@ payloadProperties.put("fileBasedGP", pmSubscriptionInfo.get("subscription").get
payloadProperties.put("fileLocation", pmSubscriptionInfo.get("subscription").get("fileLocation"))
payloadProperties.put("measurementGroups", pmSubscriptionInfo.get("subscription").get("measurementGroups"))
-var payloadEntry = executor.subject.getOutFieldSchemaHelper("payload").createNewSubInstance("CDSRequestPayloadEntry");
-payloadEntry.put("create_DasH_subscription_DasH_properties", payloadProperties)
+var payloadEntry = new java.util.HashMap();
+payloadEntry.put("create-subscription-properties", payloadProperties)
-var payload = executor.subject.getOutFieldSchemaHelper("payload").createNewInstance();
+var payload = new java.util.HashMap();
var payloadSchemaHelper = executor.subject.getOutFieldSchemaHelper("payload");
-payload.put("create_DasH_subscription_DasH_request", payloadEntry);
+payload.put("create-subscription-request", payloadEntry);
executor.logger.info("CDS payload - " + executor.stringify2Json( payload, payloadSchemaHelper));
diff --git a/examples/examples-grpc/src/main/resources/logic/CreateSubscriptionRequestTask.js b/examples/examples-grpc/src/main/resources/logic/CreateSubscriptionRequestTask.js
index 638429817..33f12036c 100644
--- a/examples/examples-grpc/src/main/resources/logic/CreateSubscriptionRequestTask.js
+++ b/examples/examples-grpc/src/main/resources/logic/CreateSubscriptionRequestTask.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix. All rights reserved.
+ * Modifications Copyright (C) 2022 Bell Canada. 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.
@@ -24,12 +25,12 @@ var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(exe
var payload = executor.inFields.get("payload")
var actionName = "create-subscription"
-var commonHeader = executor.subject.getOutFieldSchemaHelper("commonHeader").createNewInstance();
+var commonHeader = new java.util.HashMap();
commonHeader.put("originatorId", "sdnc");
commonHeader.put("requestId", "123456-1000");
commonHeader.put("subRequestId", "sub-123456-1000");
-var actionIdentifiers = executor.subject.getOutFieldSchemaHelper("actionIdentifiers").createNewInstance();
+var actionIdentifiers = new java.util.HashMap();
actionIdentifiers.put("actionName", actionName);
actionIdentifiers.put("blueprintName", "pm_control");
actionIdentifiers.put("blueprintVersion", "1.0.0");
diff --git a/examples/examples-grpc/src/main/resources/logic/DeleteSubscriptionPayloadTask.js b/examples/examples-grpc/src/main/resources/logic/DeleteSubscriptionPayloadTask.js
index 180dcba71..7a897ea91 100644
--- a/examples/examples-grpc/src/main/resources/logic/DeleteSubscriptionPayloadTask.js
+++ b/examples/examples-grpc/src/main/resources/logic/DeleteSubscriptionPayloadTask.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix. All rights reserved.
+ * Modifications Copyright (C) 2022 Bell Canada. 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.
@@ -22,7 +23,7 @@ executor.logger.info(executor.subject.id);
var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(executor.inFields.get("albumID").toString())
-var payloadProperties = executor.subject.getOutFieldSchemaHelper("payload").createNewSubInstance("delete_DasH_subscription_DasH_properties_record");
+var payloadProperties = new java.util.HashMap();
payloadProperties.put("nfName", pmSubscriptionInfo.get("nfName"))
payloadProperties.put("subscriptionName", pmSubscriptionInfo.get("subscription").get("subscriptionName"))
@@ -31,11 +32,11 @@ payloadProperties.put("fileBasedGP", pmSubscriptionInfo.get("subscription").get
payloadProperties.put("fileLocation", pmSubscriptionInfo.get("subscription").get("fileLocation"))
payloadProperties.put("measurementGroups", pmSubscriptionInfo.get("subscription").get("measurementGroups"))
-var payloadEntry = executor.subject.getOutFieldSchemaHelper("payload").createNewSubInstance("CDSRequestPayloadEntry");
-payloadEntry.put("delete_DasH_subscription_DasH_properties", payloadProperties)
+var payloadEntry = new java.util.HashMap();
+payloadEntry.put("delete-subscription-properties", payloadProperties)
-var payload = executor.subject.getOutFieldSchemaHelper("payload").createNewInstance();
-payload.put("delete_DasH_subscription_DasH_request", payloadEntry);
+var payload = new java.util.HashMap();
+payload.put("delete-subscription-request", payloadEntry);
executor.outFields.put("albumID", executor.inFields.get("albumID"))
executor.outFields.put("payload", payload);
diff --git a/examples/examples-grpc/src/main/resources/logic/DeleteSubscriptionRequestTask.js b/examples/examples-grpc/src/main/resources/logic/DeleteSubscriptionRequestTask.js
index 9ec2a119b..dc0f23563 100644
--- a/examples/examples-grpc/src/main/resources/logic/DeleteSubscriptionRequestTask.js
+++ b/examples/examples-grpc/src/main/resources/logic/DeleteSubscriptionRequestTask.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix. All rights reserved.
+ * Modifications Copyright (C) 2022 Bell Canada. 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.
@@ -24,12 +25,12 @@ var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(exe
var payload = executor.inFields.get("payload")
var actionName = "delete-subscription"
-var commonHeader = executor.subject.getOutFieldSchemaHelper("commonHeader").createNewInstance();
+var commonHeader = new java.util.HashMap();
commonHeader.put("originatorId", "sdnc");
commonHeader.put("requestId", "123456-1000");
commonHeader.put("subRequestId", "sub-123456-1000");
-var actionIdentifiers = executor.subject.getOutFieldSchemaHelper("actionIdentifiers").createNewInstance();
+var actionIdentifiers = new java.util.HashMap();
actionIdentifiers.put("actionName", actionName);
actionIdentifiers.put("blueprintName", "pm_control");
actionIdentifiers.put("blueprintVersion", "1.0.0");
diff --git a/examples/examples-grpc/src/main/resources/logic/ReceivePMSubscriptionTask.js b/examples/examples-grpc/src/main/resources/logic/ReceivePMSubscriptionTask.js
index 0134b6bca..ea3a9e494 100644
--- a/examples/examples-grpc/src/main/resources/logic/ReceivePMSubscriptionTask.js
+++ b/examples/examples-grpc/src/main/resources/logic/ReceivePMSubscriptionTask.js
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix. All rights reserved.
+ * Modifications Copyright (C) 2022 Bell Canada. 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.
@@ -23,7 +24,7 @@ var HashMapType = java.util.HashMap;
//albumID will be used to fetch info from our album later
var albumID = uuidType.fromString("d0050623-18e5-46c9-9298-9a567990cd7c");
-var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").getSchemaHelper().createNewInstance();
+var pmSubscriptionInfo = new java.util.HashMap();
var returnValue = true;;
if (executor.inFields.get("policyName") != null) {
diff --git a/examples/examples-grpc/src/main/resources/logic/ResponseTask.js b/examples/examples-grpc/src/main/resources/logic/ResponseTask.js
index dc4948990..d3424bdc1 100644
--- a/examples/examples-grpc/src/main/resources/logic/ResponseTask.js
+++ b/examples/examples-grpc/src/main/resources/logic/ResponseTask.js
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix. All rights reserved.
- * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021-2022 Bell Canada. 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.
@@ -26,7 +26,7 @@ var albumID = uuidType.fromString("d0050623-18e5-46c9-9298-9a567990cd7c");
var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(albumID.toString());
-var responseStatus = executor.subject.getOutFieldSchemaHelper("CDSResponseStatusEvent", "status").createNewInstance();
+var responseStatus = new java.util.HashMap();
responseStatus.put("subscriptionName", pmSubscriptionInfo.get("subscription").get("subscriptionName"))
responseStatus.put("nfName", pmSubscriptionInfo.get("nfName"))
@@ -34,7 +34,7 @@ responseStatus.put("changeType", pmSubscriptionInfo.get("changeType"))
var response = executor.inFields.get("payload")
-if ("failure".equals(response.get("create_DasH_subscription_DasH_response").get("odl_DasH_response").get("status"))) {
+if ("failure".equals(response.get("create-subscription-response").get("odl-response").get("status"))) {
responseStatus.put("message", "failed")
} else {
responseStatus.put("message", "success")
diff --git a/examples/examples-grpc/src/main/resources/policy/APEXgRPCPolicy.apex b/examples/examples-grpc/src/main/resources/policy/APEXgRPCPolicy.apex
index 34d590dcf..bb08c7063 100644
--- a/examples/examples-grpc/src/main/resources/policy/APEXgRPCPolicy.apex
+++ b/examples/examples-grpc/src/main/resources/policy/APEXgRPCPolicy.apex
@@ -29,44 +29,44 @@ schema create name=SimpleStringType flavour=Java schema=java.lang.String
schema create name=UUIDType flavour=Java schema=java.util.UUID
schema create name=SimpleIntType flavour=Java schema=java.lang.Integer
-schema create name=CDSRequestCommonHeaderType flavour=Avro schema=LS
-#MACROFILE:"src/main/resources/schemas/CDSRequestCommonHeaderType.avsc"
+schema create name=CDSRequestCommonHeaderType flavour=Json schema=LS
+#MACROFILE:"src/main/resources/schemas/CDSRequestCommonHeaderType.json"
LE
-schema create name=CDSResponseCommonHeaderType flavour=Avro schema=LS
-#MACROFILE:"src/main/resources/schemas/CDSResponseCommonHeaderType.avsc"
+schema create name=CDSResponseCommonHeaderType flavour=Json schema=LS
+#MACROFILE:"src/main/resources/schemas/CDSResponseCommonHeaderType.json"
LE
-schema create name=CDSActionIdentifiersType flavour=Avro schema=LS
-#MACROFILE:"src/main/resources/schemas/CDSActionIdentifiersType.avsc"
+schema create name=CDSActionIdentifiersType flavour=Json schema=LS
+#MACROFILE:"src/main/resources/schemas/CDSActionIdentifiersType.json"
LE
-schema create name=CDSResponseStatusType flavour=Avro schema=LS
-#MACROFILE:"src/main/resources/schemas/CDSResponseStatusType.avsc"
+schema create name=CDSResponseStatusType flavour=Json schema=LS
+#MACROFILE:"src/main/resources/schemas/CDSResponseStatusType.json"
LE
-schema create name=CDSCreateSubscriptionPayloadType flavour=Avro schema=LS
-#MACROFILE:"src/main/resources/schemas/CDSCreateSubscriptionPayloadType.avsc"
+schema create name=CDSCreateSubscriptionPayloadType flavour=Json schema=LS
+#MACROFILE:"src/main/resources/schemas/CDSCreateSubscriptionPayloadType.json"
LE
schema create name=CDSDeleteSubscriptionPayloadType flavour=Avro schema=LS
#MACROFILE:"src/main/resources/schemas/CDSDeleteSubscriptionPayloadType.avsc"
LE
-schema create name=CDSResponsePayloadType flavour=Avro schema=LS
-#MACROFILE:"src/main/resources/schemas/CDSResponsePayloadType.avsc"
+schema create name=CDSResponsePayloadType flavour=Json schema=LS
+#MACROFILE:"src/main/resources/schemas/CDSResponsePayloadType.json"
LE
-schema create name=SubscriptionStatusType flavour=Avro schema=LS
-#MACROFILE:"src/main/resources/schemas/SubscriptionStatusType.avsc"
+schema create name=SubscriptionStatusType flavour=Json schema=LS
+#MACROFILE:"src/main/resources/schemas/SubscriptionStatusType.json"
LE
-schema create name=PMSubscriptionType flavour=Avro schema=LS
-#MACROFILE:"src/main/resources/schemas/PMSubscriptionType.avsc"
+schema create name=PMSubscriptionType flavour=Json schema=LS
+#MACROFILE:"src/main/resources/schemas/PMSubscriptionType.json"
LE
-schema create name=SubscriptionType flavour=Avro schema=LS
-#MACROFILE:"src/main/resources/schemas/SubscriptionType.avsc"
+schema create name=SubscriptionType flavour=Json schema=LS
+#MACROFILE:"src/main/resources/schemas/SubscriptionType.json"
LE
##
diff --git a/examples/examples-grpc/src/main/resources/schemas/CDSActionIdentifiersType.avsc b/examples/examples-grpc/src/main/resources/schemas/CDSActionIdentifiersType.avsc
deleted file mode 100644
index 1d5551704..000000000
--- a/examples/examples-grpc/src/main/resources/schemas/CDSActionIdentifiersType.avsc
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "type": "record",
- "name": "CDSActionIdentifiers_Type",
- "namespace": "org.onap.policy.apex.onap.helloworld",
- "fields": [
- {
- "name": "actionName",
- "type": "string"
- },
- {
- "name": "blueprintName",
- "type": "string"
- },
- {
- "name": "blueprintVersion",
- "type": "string"
- },
- {
- "name": "mode",
- "type": "string"
- }
- ]
-}
diff --git a/examples/examples-grpc/src/main/resources/schemas/CDSActionIdentifiersType.json b/examples/examples-grpc/src/main/resources/schemas/CDSActionIdentifiersType.json
new file mode 100644
index 000000000..a02d51f56
--- /dev/null
+++ b/examples/examples-grpc/src/main/resources/schemas/CDSActionIdentifiersType.json
@@ -0,0 +1,24 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "actionName": {
+ "type": "string"
+ },
+ "blueprintName": {
+ "type": "string"
+ },
+ "blueprintVersion": {
+ "type": "string"
+ },
+ "mode": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "actionName",
+ "blueprintName",
+ "blueprintVersion",
+ "mode"
+ ]
+}
diff --git a/examples/examples-grpc/src/main/resources/schemas/CDSCreateSubscriptionPayloadType.avsc b/examples/examples-grpc/src/main/resources/schemas/CDSCreateSubscriptionPayloadType.avsc
deleted file mode 100644
index 4dc03d300..000000000
--- a/examples/examples-grpc/src/main/resources/schemas/CDSCreateSubscriptionPayloadType.avsc
+++ /dev/null
@@ -1,91 +0,0 @@
-{
- "type": "map",
- "values": {
- "type": "record",
- "name": "CDSRequestPayloadEntry",
- "fields": [
- {
- "name": "create_DasH_subscription_DasH_properties",
- "type": {
- "name": "create_DasH_subscription_DasH_properties_record",
- "type": "record",
- "fields": [
- {
- "name": "nfName",
- "type": "string"
- },
- {
- "name": "subscriptionName",
- "type": "string"
- },
- {
- "name": "administrativeState",
- "type": "string"
- },
- {
- "name": "fileBasedGP",
- "type": "string"
- },
- {
- "name": "fileLocation",
- "type": "string"
- },
- {
- "name": "measurementGroups",
- "type": {
- "type": "array",
- "items": {
- "name": "measurementGroups_record",
- "type": "record",
- "fields": [
- {
- "name": "measurementGroup",
- "type": {
- "name": "measurementGroup",
- "type": "record",
- "fields": [
- {
- "name": "measurementTypes",
- "type": {
- "type": "array",
- "items": {
- "name": "measurementTypes_record",
- "type": "record",
- "fields": [
- {
- "name": "measurementType",
- "type": "string"
- }
- ]
- }
- }
- },
- {
- "name": "managedObjectDNsBasic",
- "type": {
- "type": "array",
- "items": {
- "name": "managedObjectDNsBasic_record",
- "type": "record",
- "fields": [
- {
- "name": "DN",
- "type": "string"
- }
- ]
- }
- }
- }
- ]
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- ]
- }
-} \ No newline at end of file
diff --git a/examples/examples-grpc/src/main/resources/schemas/CDSCreateSubscriptionPayloadType.json b/examples/examples-grpc/src/main/resources/schemas/CDSCreateSubscriptionPayloadType.json
new file mode 100644
index 000000000..10f961f76
--- /dev/null
+++ b/examples/examples-grpc/src/main/resources/schemas/CDSCreateSubscriptionPayloadType.json
@@ -0,0 +1,133 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "type": "object",
+ "required": [
+ "create-subscription-request"
+ ],
+ "properties": {
+ "create-subscription-request": {
+ "type": "object",
+ "required": [
+ "create-subscription-properties"
+ ],
+ "properties": {
+ "create-subscription-properties": {
+ "type": "object",
+ "required": [
+ "nfName",
+ "administrativeState",
+ "subscriptionName",
+ "measurementGroups",
+ "fileBasedGP",
+ "fileLocation"
+ ],
+ "properties": {
+ "nfName": {
+ "type": "string",
+ "default": "",
+ "examples": [
+ "pnf300"
+ ],
+ "pattern": "^.*$"
+ },
+ "administrativeState": {
+ "type": "string",
+ "default": "",
+ "examples": [
+ "UNLOCKED"
+ ],
+ "pattern": "^.*$"
+ },
+ "subscriptionName": {
+ "type": "string",
+ "default": "",
+ "examples": [
+ "testPolicyB"
+ ],
+ "pattern": "^.*$"
+ },
+ "measurementGroups": {
+ "type": "array",
+ "default": [],
+ "items": {
+ "type": "object",
+ "required": [
+ "measurementGroup"
+ ],
+ "properties": {
+ "measurementGroup": {
+ "type": "object",
+ "required": [
+ "measurementTypes",
+ "managedObjectDNsBasic"
+ ],
+ "properties": {
+ "measurementTypes": {
+ "type": "array",
+ "default": [],
+ "items": {
+ "type": "object",
+ "required": [
+ "measurementType"
+ ],
+ "properties": {
+ "measurementType": {
+ "type": "string",
+ "default": "",
+ "examples": [
+ "countera"
+ ],
+ "pattern": "^.*$"
+ }
+ }
+ }
+ },
+ "managedObjectDNsBasic": {
+ "type": "array",
+ "default": [],
+ "items": {
+ "$id": "#root/create-subscription-request/create-subscription-properties/measurementGroups/items/measurementGroup/managedObjectDNsBasic/items",
+ "title": "Items",
+ "type": "object",
+ "required": [
+ "DN"
+ ],
+ "properties": {
+ "DN": {
+ "type": "string",
+ "default": "",
+ "examples": [
+ "dna"
+ ],
+ "pattern": "^.*$"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "fileBasedGP": {
+ "type": "string",
+ "default": "",
+ "examples": [
+ "15.0"
+ ],
+ "pattern": "^.*$"
+ },
+ "fileLocation": {
+ "type": "string",
+ "default": "",
+ "examples": [
+ "/pm/pm.xml"
+ ],
+ "pattern": "^.*$"
+ }
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/examples/examples-grpc/src/main/resources/schemas/CDSRequestCommonHeaderType.avsc b/examples/examples-grpc/src/main/resources/schemas/CDSRequestCommonHeaderType.avsc
deleted file mode 100644
index 7e7e9256c..000000000
--- a/examples/examples-grpc/src/main/resources/schemas/CDSRequestCommonHeaderType.avsc
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "type": "record",
- "name": "CDSRequestCommonHeader_Type",
- "namespace": "org.onap.policy.apex.onap.helloworld",
- "fields": [
- {
- "name": "originatorId",
- "type": "string"
- },
- {
- "name": "requestId",
- "type": "string"
- },
- {
- "name": "subRequestId",
- "type": "string"
- }
- ]
-}
diff --git a/examples/examples-grpc/src/main/resources/schemas/CDSRequestCommonHeaderType.json b/examples/examples-grpc/src/main/resources/schemas/CDSRequestCommonHeaderType.json
new file mode 100644
index 000000000..c1890f963
--- /dev/null
+++ b/examples/examples-grpc/src/main/resources/schemas/CDSRequestCommonHeaderType.json
@@ -0,0 +1,43 @@
+{
+ "definitions": {},
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Root",
+ "type": "object",
+ "required": [
+ "requestId",
+ "subRequestId",
+ "originatorId"
+ ],
+ "properties": {
+ "requestId": {
+ "$id": "#root/requestId",
+ "title": "Requestid",
+ "type": "string",
+ "default": "",
+ "examples": [
+ "123456-1000"
+ ],
+ "pattern": "^.*$"
+ },
+ "subRequestId": {
+ "$id": "#root/subRequestId",
+ "title": "Subrequestid",
+ "type": "string",
+ "default": "",
+ "examples": [
+ "sub-123456-1000"
+ ],
+ "pattern": "^.*$"
+ },
+ "originatorId": {
+ "$id": "#root/originatorId",
+ "title": "Originatorid",
+ "type": "string",
+ "default": "",
+ "examples": [
+ "sdnc"
+ ],
+ "pattern": "^.*$"
+ }
+ }
+}
diff --git a/examples/examples-grpc/src/main/resources/schemas/CDSResponseCommonHeaderType.avsc b/examples/examples-grpc/src/main/resources/schemas/CDSResponseCommonHeaderType.avsc
deleted file mode 100644
index fe2fae8c7..000000000
--- a/examples/examples-grpc/src/main/resources/schemas/CDSResponseCommonHeaderType.avsc
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "type": "record",
- "name": "CDSResponseCommonHeader_Type",
- "namespace": "org.onap.policy.apex.onap.helloworld",
- "fields": [
- {
- "name": "originatorId",
- "type": "string"
- },
- {
- "name": "requestId",
- "type": "string"
- },
- {
- "name": "subRequestId",
- "type": "string"
- },
- {
- "name": "timestamp",
- "type": "string"
- }
- ]
-}
diff --git a/examples/examples-grpc/src/main/resources/schemas/CDSResponseCommonHeaderType.json b/examples/examples-grpc/src/main/resources/schemas/CDSResponseCommonHeaderType.json
new file mode 100644
index 000000000..08bc87c93
--- /dev/null
+++ b/examples/examples-grpc/src/main/resources/schemas/CDSResponseCommonHeaderType.json
@@ -0,0 +1,28 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "timestamp": {
+ "type": "string"
+ },
+ "requestId": {
+ "type": "string"
+ },
+ "subRequestId": {
+ "type": "string"
+ },
+ "flag": {
+ "type": "object"
+ },
+ "originatorId": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "timestamp",
+ "requestId",
+ "subRequestId",
+ "flag",
+ "originatorId"
+ ]
+}
diff --git a/examples/examples-grpc/src/main/resources/schemas/CDSResponsePayloadType.avsc b/examples/examples-grpc/src/main/resources/schemas/CDSResponsePayloadType.avsc
deleted file mode 100644
index e8a958119..000000000
--- a/examples/examples-grpc/src/main/resources/schemas/CDSResponsePayloadType.avsc
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "name": "CDSResponsePayloadEntry",
- "type": "record",
- "namespace": "com.acme.avro",
- "fields": [
- {
- "name": "create_DasH_subscription_DasH_response",
- "type": {
- "name": "create_DasH_subscription_DasH_response",
- "type": "record",
- "fields": [
- {
- "name": "odl_DasH_response",
- "type": {
- "name": "odl_DasH_response",
- "type": "record",
- "fields": [
- {
- "name": "status",
- "type": "string"
- }
- ]
- }
- }
- ]
- }
- }
- ]
-}
diff --git a/examples/examples-grpc/src/main/resources/schemas/CDSResponsePayloadType.json b/examples/examples-grpc/src/main/resources/schemas/CDSResponsePayloadType.json
new file mode 100644
index 000000000..a3cbd9f5b
--- /dev/null
+++ b/examples/examples-grpc/src/main/resources/schemas/CDSResponsePayloadType.json
@@ -0,0 +1,28 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "create-subscription-response": {
+ "type": "object",
+ "properties": {
+ "odl-response": {
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "status"
+ ]
+ }
+ },
+ "required": [
+ "odl-response"
+ ]
+ }
+ },
+ "required": [
+ "create-subscription-response"
+ ]
+}
diff --git a/examples/examples-grpc/src/main/resources/schemas/CDSResponseStatusType.avsc b/examples/examples-grpc/src/main/resources/schemas/CDSResponseStatusType.avsc
deleted file mode 100644
index fa2dfa7d6..000000000
--- a/examples/examples-grpc/src/main/resources/schemas/CDSResponseStatusType.avsc
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "type": "record",
- "name": "CDSResponseStatus_Type",
- "namespace": "org.onap.policy.apex.onap.helloworld",
- "fields": [
- {
- "name": "code",
- "type": "int"
- },
- {
- "name": "eventType",
- "type": "string"
- },
- {
- "name": "timestamp",
- "type": "string"
- },
- {
- "name": "message",
- "type": "string"
- }
- ]
-}
diff --git a/examples/examples-grpc/src/main/resources/schemas/CDSResponseStatusType.json b/examples/examples-grpc/src/main/resources/schemas/CDSResponseStatusType.json
new file mode 100644
index 000000000..9f3da62b6
--- /dev/null
+++ b/examples/examples-grpc/src/main/resources/schemas/CDSResponseStatusType.json
@@ -0,0 +1,24 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ },
+ "eventType": {
+ "type": "string"
+ },
+ "timestamp": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "eventType",
+ "timestamp"
+ ]
+}
diff --git a/examples/examples-grpc/src/main/resources/schemas/PMSubscriptionType.avsc b/examples/examples-grpc/src/main/resources/schemas/PMSubscriptionType.avsc
deleted file mode 100644
index 1d9c7d4b4..000000000
--- a/examples/examples-grpc/src/main/resources/schemas/PMSubscriptionType.avsc
+++ /dev/null
@@ -1,101 +0,0 @@
-{
- "name": "PMSubscription",
- "type": "record",
- "namespace": "org.onap.policy.apex.onap.pmcontrol",
- "fields": [
- {
- "name": "nfName",
- "type": "string"
- },
- {
- "name": "changeType",
- "type": "string"
- },
- {
- "name": "closedLoopControlName",
- "type": "string"
- },
- {
- "name": "policyName",
- "type": "string"
- },
- {
- "name": "subscription",
- "type": {
- "name": "subscription",
- "type": "record",
- "fields": [
- {
- "name": "subscriptionName",
- "type": "string"
- },
- {
- "name": "administrativeState",
- "type": "string"
- },
- {
- "name": "fileBasedGP",
- "type": "int"
- },
- {
- "name": "fileLocation",
- "type": "string"
- },
- {
- "name": "measurementGroups",
- "type": {
- "type": "array",
- "items": {
- "name": "Measurement_Groups_Type",
- "type": "record",
- "fields": [
- {
- "name": "measurementGroup",
- "type": {
- "name": "Measurement_Group_Type",
- "type": "record",
- "fields": [
- {
- "name": "measurementTypes",
- "type": {
- "type": "array",
- "items": {
- "name": "Measurement_Types_Type",
- "type": "record",
- "fields": [
- {
- "name": "measurementType",
- "type": "string"
- }
- ]
- }
- }
- },
- {
- "name": "managedObjectDNsBasic",
- "type": {
- "type": "array",
- "items": {
- "name": "Managed_Object_Dns_Basic_Type",
- "type": "record",
- "fields": [
- {
- "name": "DN",
- "type": "string"
- }
- ]
- }
- }
- }
- ]
- }
- }
- ]
- }
- }
- }
- ]
- }
- }
- ]
-} \ No newline at end of file
diff --git a/examples/examples-grpc/src/main/resources/schemas/PMSubscriptionType.json b/examples/examples-grpc/src/main/resources/schemas/PMSubscriptionType.json
new file mode 100644
index 000000000..ab0aaa228
--- /dev/null
+++ b/examples/examples-grpc/src/main/resources/schemas/PMSubscriptionType.json
@@ -0,0 +1,101 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "changeType": {
+ "type": "string"
+ },
+ "closedLoopControlName": {
+ "type": "string"
+ },
+ "policyName": {
+ "type": "string"
+ },
+ "nfName": {
+ "type": "string"
+ },
+ "subscription": {
+ "type": "array",
+ "items": [
+ {
+ "type": "object",
+ "properties": {
+ "measurementGroup": {
+ "type": "object",
+ "properties": {
+ "measurementTypes": {
+ "type": "array",
+ "items": [
+ {
+ "type": "object",
+ "properties": {
+ "measurementType": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "measurementType"
+ ]
+ },
+ {
+ "type": "object",
+ "properties": {
+ "measurementType": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "measurementType"
+ ]
+ }
+ ]
+ },
+ "managedObjectDNsBasic": {
+ "type": "array",
+ "items": [
+ {
+ "type": "object",
+ "properties": {
+ "DN": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "DN"
+ ]
+ },
+ {
+ "type": "object",
+ "properties": {
+ "DN": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "DN"
+ ]
+ }
+ ]
+ }
+ },
+ "required": [
+ "measurementTypes",
+ "managedObjectDNsBasic"
+ ]
+ }
+ },
+ "required": [
+ "measurementGroup"
+ ]
+ }
+ ]
+ }
+ },
+ "required": [
+ "changeType",
+ "closedLoopControlName",
+ "policyName",
+ "nfName",
+ "subscription"
+ ]
+}
diff --git a/examples/examples-grpc/src/main/resources/schemas/SubscriptionStatusType.avsc b/examples/examples-grpc/src/main/resources/schemas/SubscriptionStatusType.avsc
deleted file mode 100644
index 247ba8a8c..000000000
--- a/examples/examples-grpc/src/main/resources/schemas/SubscriptionStatusType.avsc
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "type": "record",
- "name": "ActivateSubscriptionStatus_Type",
- "namespace": "org.onap.policy.apex.onap.helloworld",
- "fields": [
- {
- "name": "subscriptionName",
- "type": "string"
- },
- {
- "name": "nfName",
- "type": "string"
- },
- {
- "name": "changeType",
- "type": "string"
- },
- {
- "name": "message",
- "type": "string"
- }
- ]
-} \ No newline at end of file
diff --git a/examples/examples-grpc/src/main/resources/schemas/SubscriptionStatusType.json b/examples/examples-grpc/src/main/resources/schemas/SubscriptionStatusType.json
new file mode 100644
index 000000000..fb81768e0
--- /dev/null
+++ b/examples/examples-grpc/src/main/resources/schemas/SubscriptionStatusType.json
@@ -0,0 +1,24 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "subscriptionName": {
+ "type": "string"
+ },
+ "nfName": {
+ "type": "string"
+ },
+ "changeType": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "subscriptionName",
+ "nfName",
+ "changeType",
+ "message"
+ ]
+}
diff --git a/examples/examples-grpc/src/main/resources/schemas/SubscriptionType.avsc b/examples/examples-grpc/src/main/resources/schemas/SubscriptionType.avsc
deleted file mode 100644
index 7172b7aab..000000000
--- a/examples/examples-grpc/src/main/resources/schemas/SubscriptionType.avsc
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "name": "subscription",
- "type": "record",
- "fields": [
- {
- "name": "subscriptionName",
- "type": "string"
- },
- {
- "name": "administrativeState",
- "type": "string"
- },
- {
- "name": "fileBasedGP",
- "type": "int"
- },
- {
- "name": "fileLocation",
- "type": "string"
- },
- {
- "name": "measurementGroups",
- "type": {
- "type": "array",
- "items": {
- "name": "Measurement_Groups_Type",
- "type": "record",
- "fields": [
- {
- "name": "measurementGroup",
- "type": {
- "name": "Measurement_Group_Type",
- "type": "record",
- "fields": [
- {
- "name": "measurementTypes",
- "type": {
- "type": "array",
- "items": {
- "name": "Measurement_Types_Type",
- "type": "record",
- "fields": [
- {
- "name": "measurementType",
- "type": "string"
- }
- ]
- }
- }
- },
- {
- "name": "managedObjectDNsBasic",
- "type": {
- "type": "array",
- "items": {
- "name": "Managed_Object_Dns_Basic_Type",
- "type": "record",
- "fields": [
- {
- "name": "DN",
- "type": "string"
- }
- ]
- }
- }
- }
- ]
- }
- }
- ]
- }
- }
- }
- ]
-} \ No newline at end of file
diff --git a/examples/examples-grpc/src/main/resources/schemas/SubscriptionType.json b/examples/examples-grpc/src/main/resources/schemas/SubscriptionType.json
new file mode 100644
index 000000000..4dbade513
--- /dev/null
+++ b/examples/examples-grpc/src/main/resources/schemas/SubscriptionType.json
@@ -0,0 +1,133 @@
+{
+ "definitions": {},
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Root",
+ "type": "object",
+ "required": [
+ "subscriptionName",
+ "administrativeState",
+ "fileBasedGP",
+ "fileLocation",
+ "measurementGroups"
+ ],
+ "properties": {
+ "subscriptionName": {
+ "$id": "#root/subscriptionName",
+ "title": "Subscriptionname",
+ "type": "string",
+ "default": "",
+ "examples": [
+ "testPolicyB"
+ ],
+ "pattern": "^.*$"
+ },
+ "administrativeState": {
+ "$id": "#root/administrativeState",
+ "title": "Administrativestate",
+ "type": "string",
+ "default": "",
+ "examples": [
+ "UNLOCKED"
+ ],
+ "pattern": "^.*$"
+ },
+ "fileBasedGP": {
+ "$id": "#root/fileBasedGP",
+ "title": "Filebasedgp",
+ "type": "integer",
+ "examples": [
+ 15
+ ],
+ "default": 0
+ },
+ "fileLocation": {
+ "$id": "#root/fileLocation",
+ "title": "Filelocation",
+ "type": "string",
+ "default": "",
+ "examples": [
+ "/pm/pm.xml"
+ ],
+ "pattern": "^.*$"
+ },
+ "measurementGroups": {
+ "$id": "#root/measurementGroups",
+ "title": "Measurementgroups",
+ "type": "array",
+ "default": [],
+ "items": {
+ "$id": "#root/measurementGroups/items",
+ "title": "Items",
+ "type": "object",
+ "required": [
+ "measurementGroup"
+ ],
+ "properties": {
+ "measurementGroup": {
+ "$id": "#root/measurementGroups/items/measurementGroup",
+ "title": "Measurementgroup",
+ "type": "object",
+ "required": [
+ "measurementTypes",
+ "managedObjectDNsBasic"
+ ],
+ "properties": {
+ "measurementTypes": {
+ "$id": "#root/measurementGroups/items/measurementGroup/measurementTypes",
+ "title": "Measurementtypes",
+ "type": "array",
+ "default": [],
+ "items": {
+ "$id": "#root/measurementGroups/items/measurementGroup/measurementTypes/items",
+ "title": "Items",
+ "type": "object",
+ "required": [
+ "measurementType"
+ ],
+ "properties": {
+ "measurementType": {
+ "$id": "#root/measurementGroups/items/measurementGroup/measurementTypes/items/measurementType",
+ "title": "Measurementtype",
+ "type": "string",
+ "default": "",
+ "examples": [
+ "countera"
+ ],
+ "pattern": "^.*$"
+ }
+ }
+ }
+ },
+ "managedObjectDNsBasic": {
+ "$id": "#root/measurementGroups/items/measurementGroup/managedObjectDNsBasic",
+ "title": "Managedobjectdnsbasic",
+ "type": "array",
+ "default": [],
+ "items": {
+ "$id": "#root/measurementGroups/items/measurementGroup/managedObjectDNsBasic/items",
+ "title": "Items",
+ "type": "object",
+ "required": [
+ "DN"
+ ],
+ "properties": {
+ "DN": {
+ "$id": "#root/measurementGroups/items/measurementGroup/managedObjectDNsBasic/items/DN",
+ "title": "Dn",
+ "type": "string",
+ "default": "",
+ "examples": [
+ "dna"
+ ],
+ "pattern": "^.*$"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}