Update APEX example to use JSON Schema plugin 21/130021/4
authora.sreekumar <ajith.sreekumar@bell.ca>
Mon, 25 Jul 2022 09:46:57 +0000 (10:46 +0100)
committera.sreekumar <ajith.sreekumar@bell.ca>
Tue, 26 Jul 2022 09:18:58 +0000 (10:18 +0100)
Change-Id: Ic8b412ce0ca71b4452d67b1e4445e423b0ec5b54
Issue-ID: POLICY-4292
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
29 files changed:
examples/examples-grpc/pom.xml
examples/examples-grpc/src/main/resources/examples/config/APEXgRPC/ApexConfig.json
examples/examples-grpc/src/main/resources/examples/events/APEXgRPC/CDSResponseStatusEvent.json
examples/examples-grpc/src/main/resources/logic/CreateSubscriptionPayloadTask.js
examples/examples-grpc/src/main/resources/logic/CreateSubscriptionRequestTask.js
examples/examples-grpc/src/main/resources/logic/DeleteSubscriptionPayloadTask.js
examples/examples-grpc/src/main/resources/logic/DeleteSubscriptionRequestTask.js
examples/examples-grpc/src/main/resources/logic/ReceivePMSubscriptionTask.js
examples/examples-grpc/src/main/resources/logic/ResponseTask.js
examples/examples-grpc/src/main/resources/policy/APEXgRPCPolicy.apex
examples/examples-grpc/src/main/resources/schemas/CDSActionIdentifiersType.avsc [deleted file]
examples/examples-grpc/src/main/resources/schemas/CDSActionIdentifiersType.json [new file with mode: 0644]
examples/examples-grpc/src/main/resources/schemas/CDSCreateSubscriptionPayloadType.avsc [deleted file]
examples/examples-grpc/src/main/resources/schemas/CDSCreateSubscriptionPayloadType.json [new file with mode: 0644]
examples/examples-grpc/src/main/resources/schemas/CDSRequestCommonHeaderType.avsc [deleted file]
examples/examples-grpc/src/main/resources/schemas/CDSRequestCommonHeaderType.json [new file with mode: 0644]
examples/examples-grpc/src/main/resources/schemas/CDSResponseCommonHeaderType.avsc [deleted file]
examples/examples-grpc/src/main/resources/schemas/CDSResponseCommonHeaderType.json [new file with mode: 0644]
examples/examples-grpc/src/main/resources/schemas/CDSResponsePayloadType.avsc [deleted file]
examples/examples-grpc/src/main/resources/schemas/CDSResponsePayloadType.json [new file with mode: 0644]
examples/examples-grpc/src/main/resources/schemas/CDSResponseStatusType.avsc [deleted file]
examples/examples-grpc/src/main/resources/schemas/CDSResponseStatusType.json [new file with mode: 0644]
examples/examples-grpc/src/main/resources/schemas/PMSubscriptionType.avsc [deleted file]
examples/examples-grpc/src/main/resources/schemas/PMSubscriptionType.json [new file with mode: 0644]
examples/examples-grpc/src/main/resources/schemas/SubscriptionStatusType.avsc [deleted file]
examples/examples-grpc/src/main/resources/schemas/SubscriptionStatusType.json [new file with mode: 0644]
examples/examples-grpc/src/main/resources/schemas/SubscriptionType.avsc [deleted file]
examples/examples-grpc/src/main/resources/schemas/SubscriptionType.json [new file with mode: 0644]
plugins/plugins-context/plugins-context-schema/plugins-context-schema-json/pom.xml

index df4df53..70dd31b 100644 (file)
@@ -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.
          <artifactId>plugins-context-schema-avro</artifactId>
          <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>
    </dependencies>
    <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>
index c34f9e3..8e968ac 100644 (file)
@@ -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": {
index d616ac1..64142d4 100644 (file)
@@ -6,8 +6,8 @@
   "target": "DCAE",
   "toscaPolicyState": "EXIT_SUCCESS",
   "status": {
-    "subscriptionName": "testPolicyB",
     "nfName": "pnf300",
+    "subscriptionName": "testPolicyB",
     "changeType": "CREATE",
     "message": "success"
   }
index 85e7ae2..4cacf81 100644 (file)
@@ -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));
 
index 6384298..33f1203 100644 (file)
@@ -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");
index 180dcba..7a897ea 100644 (file)
@@ -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);
index 9ec2a11..dc0f235 100644 (file)
@@ -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");
index 0134b6b..ea3a9e4 100644 (file)
@@ -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) {
index dc49489..d3424bd 100644 (file)
@@ -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")
index 34d590d..bb08c70 100644 (file)
@@ -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 (file)
index 1d55517..0000000
+++ /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 (file)
index 0000000..a02d51f
--- /dev/null
@@ -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 (file)
index 4dc03d3..0000000
+++ /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 (file)
index 0000000..10f961f
--- /dev/null
@@ -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 (file)
index 7e7e925..0000000
+++ /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 (file)
index 0000000..c1890f9
--- /dev/null
@@ -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 (file)
index fe2fae8..0000000
+++ /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 (file)
index 0000000..08bc87c
--- /dev/null
@@ -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 (file)
index e8a9581..0000000
+++ /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 (file)
index 0000000..a3cbd9f
--- /dev/null
@@ -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 (file)
index fa2dfa7..0000000
+++ /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 (file)
index 0000000..9f3da62
--- /dev/null
@@ -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 (file)
index 1d9c7d4..0000000
+++ /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 (file)
index 0000000..ab0aaa2
--- /dev/null
@@ -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 (file)
index 247ba8a..0000000
+++ /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 (file)
index 0000000..fb81768
--- /dev/null
@@ -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 (file)
index 7172b7a..0000000
+++ /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 (file)
index 0000000..4dbade5
--- /dev/null
@@ -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": "^.*$"
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
index 75c42fa..62dcb85 100644 (file)
@@ -33,7 +33,6 @@
         <dependency>
             <groupId>com.worldturner.medeia</groupId>
             <artifactId>medeia-validator-gson</artifactId>
-            <version>1.1.1</version>
         </dependency>
         <dependency>
             <groupId>junit</groupId>