Merge "Further updates to the auto-test environment"
authorHenrik Andersson <henrik.b.andersson@est.tech>
Tue, 5 May 2020 07:27:13 +0000 (07:27 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Tue, 5 May 2020 07:27:13 +0000 (07:27 +0000)
70 files changed:
docs/policy-agent-api.rst
docs/sdnc-a1-controller-api.rst
policy-agent/pom.xml
policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java
policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java
policy-agent/src/main/java/org/oransc/policyagent/clients/OscA1Client.java
policy-agent/src/main/java/org/oransc/policyagent/clients/SdncOscA1Client.java
policy-agent/src/main/java/org/oransc/policyagent/configuration/ApplicationConfigParser.java
policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageConsumer.java
policy-agent/src/main/java/org/oransc/policyagent/tasks/RefreshConfigTask.java
policy-agent/src/test/java/org/oransc/policyagent/ApplicationTest.java
policy-agent/src/test/java/org/oransc/policyagent/ConcurrencyTestRunnable.java
policy-agent/src/test/java/org/oransc/policyagent/clients/SdncOscA1ClientTest.java
policy-agent/src/test/java/org/oransc/policyagent/configuration/ApplicationConfigParserTest.java
policy-agent/src/test/java/org/oransc/policyagent/dmaap/DmaapMessageConsumerTest.java
policy-agent/src/test/java/org/oransc/policyagent/tasks/RefreshConfigTaskTest.java
policy-agent/src/test/resources/test_osc_get_schema_response.json [new file with mode: 0644]
sdnc-a1-controller/README.md
sdnc-a1-controller/northbound/README.md
sdnc-a1-controller/northbound/features/features-sdnc-a1-northbound/pom.xml [moved from sdnc-a1-controller/northbound/features/features-sdnc-northbound/pom.xml with 80% similarity]
sdnc-a1-controller/northbound/features/installer/pom.xml
sdnc-a1-controller/northbound/features/pom.xml
sdnc-a1-controller/northbound/features/sdnc-a1-northbound-all/pom.xml [moved from sdnc-a1-controller/northbound/features/sdnc-northbound-all/pom.xml with 88% similarity]
sdnc-a1-controller/northbound/nonrt-ric-api/features/ccsdk-dblib/pom.xml [deleted file]
sdnc-a1-controller/northbound/nonrt-ric-api/features/ccsdk-dblib/src/main/feature/feature.xml [deleted file]
sdnc-a1-controller/northbound/nonrt-ric-api/features/ccsdk-sli/pom.xml [deleted file]
sdnc-a1-controller/northbound/nonrt-ric-api/features/features-nonrt-ric-api/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/features/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/features/sdnc-nonrt-ric-api/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/installer/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/model/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/model/src/main/yang/NONRT-RIC-API.yang
sdnc-a1-controller/northbound/nonrt-ric-api/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/provider/pom.xml
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/provider/NonrtRicApiProvider.java [moved from sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java with 80% similarity]
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/restadapter/RestAdapter.java [moved from sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadapter/RestAdapter.java with 96% similarity]
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/restadapter/RestAdapterImpl.java [new file with mode: 0644]
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadapter/RestAdapterImpl.java [deleted file]
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/resources/OSGI-INF/blueprint/nonrt-ric-api-blueprint.xml
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/resources/nonrt-ric-api-provider.properties [moved from sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/resources/NearRtRicList.properties with 74% similarity]
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/resources/org/opendaylight/blueprint/nonrt-ric-api-blueprint.xml
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/NonrtRicApiProviderTest.java [moved from sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/onap/sdnc/northbound/NonrtRicApiProviderTest.java with 82% similarity]
sdnc-a1-controller/northbound/pom.xml
sdnc-a1-controller/oam/README.md
sdnc-a1-controller/oam/installation/TagVersion.groovy
sdnc-a1-controller/oam/installation/pom.xml
sdnc-a1-controller/oam/installation/sdnc-a1/pom.xml [moved from sdnc-a1-controller/oam/installation/sdnc/pom.xml with 89% similarity]
sdnc-a1-controller/oam/installation/sdnc-a1/src/main/docker/standalone.Dockerfile [moved from sdnc-a1-controller/oam/installation/sdnc/src/main/docker/standalone.Dockerfile with 63% similarity]
sdnc-a1-controller/oam/installation/sdnc-a1/src/main/resources/keystore.jks [new file with mode: 0644]
sdnc-a1-controller/oam/installation/sdnc-a1/src/main/resources/sdnctl.dump [moved from sdnc-a1-controller/oam/installation/sdnc/src/main/resources/sdnctl.dump with 100% similarity]
sdnc-a1-controller/oam/installation/sdnc-a1/src/main/scripts/healthcheck.py [new file with mode: 0644]
sdnc-a1-controller/oam/installation/sdnc-a1/src/main/scripts/installSdncDb.sh [moved from sdnc-a1-controller/oam/installation/sdnc/src/main/scripts/installSdncDb.sh with 100% similarity]
sdnc-a1-controller/oam/installation/sdnc-a1/src/main/scripts/startODL.sh [moved from sdnc-a1-controller/oam/installation/sdnc/src/main/scripts/startODL.sh with 91% similarity]
sdnc-a1-controller/oam/installation/sdnc/src/main/resources/truststoreONAPall.jks [deleted file]
sdnc-a1-controller/oam/installation/sdnc/src/main/scripts/addSdncKeyStore.sh [deleted file]
sdnc-a1-controller/oam/installation/sdnc/src/main/scripts/installCerts.py [deleted file]
sdnc-a1-controller/oam/installation/src/main/properties/org.onap.sdnc.cred.props [deleted file]
sdnc-a1-controller/oam/installation/src/main/properties/org.onap.sdnc.props [deleted file]
sdnc-a1-controller/oam/installation/src/main/stores/keystore.sdnc.p12 [deleted file]
sdnc-a1-controller/oam/installation/src/main/stores/org.onap.sdnc.keyfile [deleted file]
sdnc-a1-controller/oam/installation/src/main/stores/org.onap.sdnc.p12 [deleted file]
sdnc-a1-controller/oam/installation/src/main/stores/org.onap.sdnc.trust.jks [deleted file]
sdnc-a1-controller/oam/installation/src/main/stores/truststore.onap.client.jks [deleted file]
sdnc-a1-controller/oam/installation/src/main/stores/truststore.openecomp.client.jks [deleted file]
sdnc-a1-controller/oam/installation/src/main/yaml/docker-compose.yml
sdnc-a1-controller/oam/platform-logic/installer/pom.xml
sdnc-a1-controller/oam/platform-logic/pom.xml
sdnc-a1-controller/oam/platform-logic/setup/pom.xml
sdnc-a1-controller/oam/pom.xml
sdnc-a1-controller/pom.xml

index 7161bdf..ce94b3d 100644 (file)
@@ -10,9 +10,9 @@
 
 .. _policy-agent-api:
 
-############################
-A1 Policy Management Service
-############################
+################################
+A1 Policy Management Service API
+################################
 
 
 *******************************************
@@ -53,15 +53,17 @@ The Policy Agent also keeps an updated view of the policy types available, and w
 support which types. Also, the Policy Agent can tell if a Managed Element is managed by a certain
 Near |nbh| RT |nbsp| RIC.
 
-The Policy Agent NBI has four distinct parts, described in the sections below:
+The Policy Agent NBI has five distinct parts, described in the sections below:
 
 * Service Management
+* Policy Types
 * Policy Management
 * Near-RT RIC Repository
 * Health Check
 
+******************
 Service Management
-==================
+******************
 
 A service can register itself in the Policy Agent.
 
@@ -75,9 +77,6 @@ Near |nbh| RT |nbsp| RICs where they were earlier created. **Note!** |nbsp| If t
 "*Keep Alive Interval*", then the service maintains full responsibility to delete all of its policies when they are no
 longer needed.
 
-Service Management Operations
------------------------------
-
 /service
 ~~~~~~~~
 
@@ -86,51 +85,67 @@ PUT
 
 Register a service.
 
+Definition
+""""""""""
+
 **URL path:**
-  /service
+
+/service
 
 **Parameters:**
-  None.
+
+None.
 
 **Body:**  (*Required*)
-    A JSON object (ServiceRegistrationInfo): ::
 
-      {
-        "callbackUrl": "string",         (An empty string means the service will never get any callbacks.)
-        "keepAliveIntervalSeconds": 0,   (0 means the service will always be considered alive.)
-        "serviceName": "string"          (Required, must be unique.)
-      }
+A JSON object (ServiceRegistrationInfo): ::
+
+  {
+    "callbackUrl": "string",         (An empty string means the service will never get any callbacks.)
+    "keepAliveIntervalSeconds": 0,   (0 means the service will always be considered alive.)
+    "serviceName": "string"          (Required, must be unique.)
+  }
 
 **Responses:**
-  200:
-        Service updated.
-  201:
-        Service created.
-  400:
-        The ServiceRegistrationInfo is not accepted.
 
-**Examples:**
-  **Call**: ::
+200:
 
-    curl -X PUT "http://localhost:8081/service" -H "Content-Type: application/json" -d '{
-        "callbackUrl": "URL",
-        "keepAliveIntervalSeconds": 0,
-        "serviceName": "existing"
-      }'
+Service updated.
 
-  Result:
-    201: ::
+201:
 
-       OK
+Service created.
 
-  **Call**: ::
+400:
 
-     curl -X PUT "http://localhost:8081/service" -H  "Content-Type: application/json" -d "{}"
+The ServiceRegistrationInfo is not accepted.
 
-  Result:
-     400: ::
+Examples
+""""""""
 
-       Missing mandatory parameter 'serviceName'
+**Call**: ::
+
+  curl -X PUT "http://localhost:8081/service" -H "Content-Type: application/json" -d '{
+      "callbackUrl": "URL",
+      "keepAliveIntervalSeconds": 0,
+      "serviceName": "existing"
+    }'
+
+**Result**:
+
+201: ::
+
+   OK
+
+**Call**: ::
+
+   curl -X PUT "http://localhost:8081/service" -H  "Content-Type: application/json" -d "{}"
+
+**Result**:
+
+400: ::
+
+  Missing mandatory parameter 'serviceName'
 
 /services
 ~~~~~~~~~
@@ -140,88 +155,114 @@ GET
 
 Query service information.
 
+Definition
+""""""""""
+
 **URL path:**
-  /services?name=<service-name>
+
+/services?name=<service-name>
 
 **Parameters:**
-  name: (*Optional*)
-    The name of the service.
+
+name: (*Optional*)
+
+The name of the service.
 
 **Responses:**
-  200:
-        Array of JSON objects (ServiceStatus). ::
 
-         {
-             "callbackUrl": "string",             (Callback URL)
-             "keepAliveIntervalSeconds": 0,       (Policy keep alive interval)
-             "serviceName": "string",             (Identity of the service)
-             "timeSinceLastActivitySeconds": 0    (Time since last invocation by the service)
-         }
-  404:
-        Service is not found.
+200:
+
+Array of JSON objects (ServiceStatus). ::
+
+  {
+    "callbackUrl": "string",             (Callback URL)
+    "keepAliveIntervalSeconds": 0,       (Policy keep alive interval)
+    "serviceName": "string",             (Identity of the service)
+    "timeSinceLastActivitySeconds": 0    (Time since last invocation by the service)
+  }
+
+404:
+
+Service is not found.
+
+Examples
+""""""""
 
-**Examples:**
-  **Call**: ::
+**Call**: ::
 
-    curl -X GET "http://localhost:8081/services?name=existing"
+  curl -X GET "http://localhost:8081/services?name=existing"
 
-  Result:
-    200: ::
+**Result**:
 
-       [
-         {
-           "serviceName":"existing",
-           "keepAliveIntervalSeconds":0,
-           "timeSinceLastActivitySeconds":7224,
-           "callbackUrl":"URL"
-         }
-      ]
+200: ::
 
-  **Call**: ::
+  [
+    {
+      "serviceName":"existing",
+      "keepAliveIntervalSeconds":0,
+      "timeSinceLastActivitySeconds":7224,
+      "callbackUrl":"URL"
+    }
+  ]
 
-    curl -X GET "http://localhost:8081/services?name=nonexistent"
+**Call**: ::
 
-  Result:
-     404: ::
+  curl -X GET "http://localhost:8081/services?name=nonexistent"
 
-       Service not found
+Result:
+
+404: ::
+
+  Service not found
 
 DELETE
 ++++++
 
 Delete a service.
 
+Definition
+""""""""""
+
 **URL path:**
-  /services?name=<service-name>
+
+/services?name=<service-name>
 
 **Parameters:**
-  name: (*Required*)
-    The name of the service.
+
+name: (*Required*)
+
+The name of the service.
 
 **Responses:**
-  204:
-        OK
-  404:
-        Service not found.
 
-**Examples:**
-  **Call**: ::
+204:
+  OK
+
+404:
+  Service not found.
+
+Examples
+""""""""
+
+**Call**: ::
 
-    curl -X DELETE "http://localhost:8081/services?name=existing"
+  curl -X DELETE "http://localhost:8081/services?name=existing"
 
-  Result:
-    204: ::
+**Result**:
 
-       OK
+204: ::
 
-  **Call**: ::
+  OK
 
-    curl -X DELETE "http://localhost:8081/services?name=nonexistent"
+**Call**: ::
 
-  Result:
-     404: ::
+  curl -X DELETE "http://localhost:8081/services?name=nonexistent"
 
-       Could not find service: nonexistent
+Result:
+
+404: ::
+
+  Could not find service: nonexistent
 
 /services/keepalive
 ~~~~~~~~~~~~~~~~~~~
@@ -231,42 +272,57 @@ PUT
 
 Heart beat from a service.
 
+Definition
+""""""""""
+
 **URL path:**
-  /services/keepalive?name=<service-name>
+
+/services/keepalive?name=<service-name>
 
 **Parameters:**
-  name: (*Required*)
-    The name of the service.
+
+name: (*Required*)
+
+The name of the service.
 
 **Responses:**
-  200:
-        OK
-  404:
-        Service is not found.
 
-**Examples:**
-  **Call**: ::
+200:
+
+OK
+
+404:
+
+Service is not found.
+
+Examples
+""""""""
 
-    curl -X PUT "http://localhost:8081/services/keepalive?name=existing"
+**Call**: ::
 
-  Result:
-    200: ::
+  curl -X PUT "http://localhost:8081/services/keepalive?name=existing"
 
-       OK
+**Result**:
 
-  **Call**: ::
+200: ::
 
-    curl -X PUT "http://localhost:8081/services/keepalive?name=nonexistent"
+  OK
 
-  Result:
-     404: ::
+**Call**: ::
 
-       Could not find service: nonexistent
+  curl -X PUT "http://localhost:8081/services/keepalive?name=nonexistent"
+
+**Result**:
+
+404: ::
+
+  Could not find service: nonexistent
 
 .. _policy-management:
 
-Policy Management
-=================
+************
+Policy Types
+************
 
 Policies are based on types. The set of available policy types is determined by the set of policy types supported by
 Near |nbh| RT |nbsp| RICs. At startup, the Policy Agent queries all Near |nbh| RT |nbsp| RICs for their supported types
@@ -274,20 +330,6 @@ and stores them in its internal repository. It then checks this at regular inter
 to date. Policy types cannot be created, updated or deleted using this interface since this must be done via the
 Near |nbh| RT |nbsp| RICs.
 
-Policies can be queried, created, updated, and deleted. A policy is always created in a specific
-Near |nbh| RT |nbsp| RIC.
-
-When a policy is created, the Policy Agent stores information about it in its internal repository. At regular intervals,
-it then checks with all Near |nbh| RT |nbsp| RICs that this repository is synchronized. If, for some reason, there is an
-inconsistency, the Policy Agent will start a synchronization job and try to reflect the status of the
-Near |nbh| RT |nbsp| RIC. If this fails, the Policy Agent will delete all policies for the specific
-Near |nbh| RT |nbsp| RIC in the internal repository and set its state to *UNKNOWN*. This means that no interaction with
-the Near |nbh| RT |nbsp| RIC is possible until the Policy Agent has been able to contact it again and re-synchronize its
-state in the repository.
-
-Policy Types
-------------
-
 A policy type defines a name and a JSON schema that constrains the content of a policy of that type.
 
 /policy_types
@@ -298,42 +340,55 @@ GET
 
 Query policy type names.
 
+Definition
+""""""""""
+
 **URL path:**
-  /policy_types?ric=<name-of-ric>
+
+/policy_types?ric=<name-of-ric>
 
 **Parameters:**
-  ric: (*Optional*)
-    The name of the Near |nbh| RT |nbsp| RIC to get types for.
+
+ric: (*Optional*)
+
+The name of the Near |nbh| RT |nbsp| RIC to get types for.
 
 **Responses:**
 
-  200:
-        Array of policy type names.
-  404:
-        Near |nbh| RT |nbsp| RIC is not found.
+200:
+
+  Array of policy type names.
+
+404:
+
+  Near |nbh| RT |nbsp| RIC is not found.
+
+Examples
+""""""""
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policy_types"
 
-**Examples:**
-  **Call**: ::
+**Result**:
 
-    curl -X GET "http://localhost:8081/policy_types"
+200: ::
 
-  Result:
-    200: ::
+  [
+    "STD_PolicyModelUnconstrained_0.2.0",
+    "Example_QoETarget_1.0.0",
+    "ERIC_QoSNudging_0.2.0"
+  ]
 
-       [
-         "STD_PolicyModelUnconstrained_0.2.0",
-         "Example_QoETarget_1.0.0",
-         "ERIC_QoSNudging_0.2.0"
-      ]
+**Call**: ::
 
-  **Call**: ::
+  curl -X GET "http://localhost:8081/policy_types?ric=nonexistent"
 
-    curl -X GET "http://localhost:8081/policy_types?ric=nonexistent"
+**Result**:
 
-  Result:
-     404: ::
+404: ::
 
-       org.oransc.policyagent.exceptions.ServiceException: Could not find ric: nonexistent
+  org.oransc.policyagent.exceptions.ServiceException: Could not find ric: nonexistent
 
 /policy_schema
 ~~~~~~~~~~~~~~
@@ -343,81 +398,95 @@ GET
 
 Returns one policy type schema definition.
 
+Definition
+""""""""""
+
 **URL path:**
-  /policy_schema?id=<name-of-type>
+
+/policy_schema?id=<name-of-type>
 
 **Parameters:**
-  id: (*Required*)
-    The ID of the policy type to get the definition for.
+
+id: (*Required*)
+
+The ID of the policy type to get the definition for.
 
 **Responses:**
-  200:
-        Policy schema as JSON schema.
-  404:
-        Policy type is not found.
 
-**Examples:**
-  **Call**: ::
+200:
 
-    curl -X GET "http://localhost:8081/policy_schema?id=STD_PolicyModelUnconstrained_0.2.0"
+Policy schema as JSON schema.
 
-  Result:
-    200: ::
+404:
 
-      {
-        "$schema": "http://json-schema.org/draft-07/schema#",
-        "title": "STD_PolicyModelUnconstrained_0.2.0",
-        "description": "Standard model of a policy with unconstrained scope id combinations",
+Policy type is not found.
+
+Examples
+""""""""
+
+**Call**: ::
+
+ curl -X GET "http://localhost:8081/policy_schema?id=STD_PolicyModelUnconstrained_0.2.0"
+
+**Result**:
+
+200: ::
+
+  {
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "STD_PolicyModelUnconstrained_0.2.0",
+    "description": "Standard model of a policy with unconstrained scope id combinations",
+    "type": "object",
+    "properties": {
+     "scope": {
         "type": "object",
         "properties": {
-         "scope": {
-            "type": "object",
-            "properties": {
-              "ueId": {"type": "string"},
-              "groupId": {"type": "string"}
-            },
-            "minProperties": 1,
-            "additionalProperties": false
-          },
-          "qosObjectives": {
-            "type": "object",
-            "properties": {
-              "gfbr": {"type": "number"},
-              "mfbr": {"type": "number"}
-            },
-            "additionalProperties": false
-          },
-          "resources": {
-            "type": "array",
-            "items": {
-              "type": "object",
-              "properties": {
-                "cellIdList": {
-                  "type": "array",
-                  "minItems": 1,
-                  "uniqueItems": true,
-                  "items": {
-                    "type": "string"
-                  }
-                },
-              "additionalProperties": false,
-              "required": ["cellIdList"]
-            }
-          }
+          "ueId": {"type": "string"},
+          "groupId": {"type": "string"}
         },
         "minProperties": 1,
-        "additionalProperties": false,
-        "required": ["scope"]
+        "additionalProperties": false
+      },
+      "qosObjectives": {
+        "type": "object",
+        "properties": {
+          "gfbr": {"type": "number"},
+          "mfbr": {"type": "number"}
+        },
+        "additionalProperties": false
+      },
+      "resources": {
+        "type": "array",
+        "items": {
+          "type": "object",
+          "properties": {
+            "cellIdList": {
+              "type": "array",
+              "minItems": 1,
+              "uniqueItems": true,
+              "items": {
+                "type": "string"
+              }
+            },
+          "additionalProperties": false,
+          "required": ["cellIdList"]
+        }
       }
+    },
+    "minProperties": 1,
+    "additionalProperties": false,
+    "required": ["scope"]
+  }
 
-  **Call**: ::
+**Call**: ::
 
-    curl -X GET "http://localhost:8081/policy_schema?id=nonexistent"
+  curl -X GET "http://localhost:8081/policy_schema?id=nonexistent"
 
-  Result:
-     404: ::
+**Result**:
 
-       org.oransc.policyagent.exceptions.ServiceException: Could not find type: nonexistent
+404: ::
+
+  org.oransc.policyagent.exceptions.ServiceException: Could not find type: nonexistent
 
 /policy_schemas
 ~~~~~~~~~~~~~~~
@@ -427,70 +496,102 @@ GET
 
 Returns policy type schema definitions.
 
+Definition
+""""""""""
+
 **URL path:**
-  /policy_schemas?ric=<name-of-ric>
+
+/policy_schemas?ric=<name-of-ric>
 
 **Parameters:**
-  ric: (*Optional*)
-    The name of the Near |nbh| RT |nbsp| RIC to get the definitions for.
+
+ric: (*Optional*)
+
+The name of the Near |nbh| RT |nbsp| RIC to get the definitions for.
 
 **Responses:**
-  200:
-        An array of policy schemas as JSON schemas.
-  404:
-        Near |nbh| RT |nbsp| RIC is not found.
 
-**Examples:**
-  **Call**: ::
+200:
 
-    curl -X GET "http://localhost:8081/policy_schemas"
+An array of policy schemas as JSON schemas.
 
-  Result:
-    200: ::
+404:
 
-      [{
-        "$schema": "http://json-schema.org/draft-07/schema#",
-        "title": "STD_PolicyModelUnconstrained_0.2.0",
-        "description": "Standard model of a policy with unconstrained scope id combinations",
-        "type": "object",
-        "properties": {
-         "scope": {
-            "type": "object",
+Near |nbh| RT |nbsp| RIC is not found.
+
+Examples
+""""""""
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policy_schemas"
+
+**Result**:
+
+200: ::
+
+  [
+    {
+      "$schema": "http://json-schema.org/draft-07/schema#",
+      "title": "STD_PolicyModelUnconstrained_0.2.0",
+      "description": "Standard model of a policy with unconstrained scope id combinations",
+      "type": "object",
+      "properties": {
+        "scope": {
+          "type": "object",
             .
             .
             .
+        }
         "additionalProperties": false,
         "required": ["scope"]
       },
-       .
-       .
-       .
+        .
+        .
+        .
       {
         "$schema": "http://json-schema.org/draft-07/schema#",
         "title": "Example_QoETarget_1.0.0",
         "description": "Example QoE Target policy type",
         "type": "object",
-        "properties": {
-         "scope": {
-            "type": "object",
-            .
-            .
-            .
-        "additionalProperties": false,
-        "required": ["scope"]
-      }]
+          "properties": {
+            "scope": {
+              "type": "object",
+                .
+                .
+                .
+            }
+            "additionalProperties": false,
+           "required": ["scope"]
+        }
+      }
+    }
+  ]
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policy_schemas?ric=nonexistent"
 
-  **Call**: ::
+**Result**:
 
-    curl -X GET "http://localhost:8081/policy_schemas?ric=nonexistent"
+404: ::
 
-  Result:
-     404: ::
+  org.oransc.policyagent.exceptions.ServiceException: Could not find ric: nonexistent
 
-       org.oransc.policyagent.exceptions.ServiceException: Could not find ric: nonexistent
+*****************
+Policy Management
+*****************
 
-Policy
-------
+Policies can be queried, created, updated, and deleted. A policy is always created in a specific
+Near |nbh| RT |nbsp| RIC.
+
+When a policy is created, the Policy Agent stores information about it in its internal repository. At regular intervals,
+it then checks with all Near |nbh| RT |nbsp| RICs that this repository is synchronized. If, for some reason, there is an
+inconsistency, the Policy Agent will start a synchronization job and try to reflect the status of the
+Near |nbh| RT |nbsp| RIC. If this fails, the Policy Agent will delete all policies for the specific
+Near |nbh| RT |nbsp| RIC in the internal repository and set its state to *UNKNOWN*. This means that no interaction with
+the Near |nbh| RT |nbsp| RIC is possible until the Policy Agent has been able to contact it again and re-synchronize its
+state in the repository.
 
 A policy is defined by its type schema.
 
@@ -512,81 +613,98 @@ GET
 
 Query policies.
 
+Definition
+""""""""""
+
 **URL path:**
-  /policies?ric=<name-of-ric>&service=<name-of-service>&type=<name-of-type>
+
+/policies?ric=<name-of-ric>&service=<name-of-service>&type=<name-of-type>
 
 **Parameters:**
-  ric: (*Optional*)
-    The name of the Near |nbh| RT |nbsp| RIC to get policies for.
-  service: (*Optional*)
-    The name of the service to get policies for.
-  type: (*Optional*)
-    The name of the policy type to get policies for.
+
+ric: (*Optional*)
+
+The name of the Near |nbh| RT |nbsp| RIC to get policies for.
+
+service: (*Optional*)
+
+The name of the service to get policies for.
+
+type: (*Optional*)
+
+The name of the policy type to get policies for.
 
 **Responses:**
-  200:
-        Array of JSON objects (PolicyInfo). ::
-
-          {
-            "id": "string",              (Identity of the policy)
-            "json": "object",            (The configuration of the policy)
-            "lastModified": "string",    (Timestamp, last modification time)
-            "ric": "string",             (Identity of the target Near |nbh| RT |nbsp| RIC)
-            "service": "string",         (The name of the service owning the policy)
-            "type": "string"             (Name of the policy type)
-          }
-  404:
-        Near |nbh| RT |nbsp| RIC or policy type not found.
-
-**Examples:**
-  **Call**: ::
-
-    curl -X GET "http://localhost:8081/policies?ric=existing"
-
-  Result:
-    200: ::
-
-       [
-         {
-           "id": "Policy 1",
-           "json": {
-             "scope": {
-               "ueId": "UE 1",
-               "groupId": "Group 1"
-             },
-             "qosObjectives": {
-               "gfbr": 1,
-               "mfbr": 2
-             },
-             "cellId": "Cell 1"
-           },
-           "lastModified": "Wed, 01 Apr 2020 07:45:45 GMT",
-           "ric": "existing",
-           "service": "Service 1",
-           "type": "STD_PolicyModelUnconstrained_0.2.0"
-         },
-         {
-           "id": "Policy 2",
-           "json": {
-               .
-               .
-               .
-           },
-           "lastModified": "Wed, 01 Apr 2020 07:45:45 GMT",
-           "ric": "existing",
-           "service": "Service 2",
-           "type": "Example_QoETarget_1.0.0"
-         }
-      ]
-
-  **Call**: ::
-
-    curl -X GET "http://localhost:8081/policies?type=nonexistent"
-
-  Result:
-     404: ::
-
-       Policy type not found
+
+200:
+
+Array of JSON objects (PolicyInfo). ::
+
+  {
+    "id": "string",              (Identity of the policy)
+    "json": "object",            (The configuration of the policy)
+    "lastModified": "string",    (Timestamp, last modification time)
+    "ric": "string",             (Identity of the target Near |nbh| RT |nbsp| RIC)
+    "service": "string",         (The name of the service owning the policy)
+    "type": "string"             (Name of the policy type)
+  }
+
+404:
+  Near |nbh| RT |nbsp| RIC or policy type not found.
+
+Examples
+""""""""
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policies?ric=existing"
+
+**Result**:
+
+200: ::
+
+  [
+    {
+      "id": "Policy 1",
+      "json": {
+        "scope": {
+          "ueId": "UE 1",
+          "groupId": "Group 1"
+        },
+        "qosObjectives": {
+          "gfbr": 1,
+          "mfbr": 2
+        },
+        "cellId": "Cell 1"
+      },
+      "lastModified": "Wed, 01 Apr 2020 07:45:45 GMT",
+      "ric": "existing",
+      "service": "Service 1",
+      "type": "STD_PolicyModelUnconstrained_0.2.0"
+    },
+    {
+      "id": "Policy 2",
+      "json": {
+          .
+          .
+          .
+      },
+      "lastModified": "Wed, 01 Apr 2020 07:45:45 GMT",
+      "ric": "existing",
+      "service": "Service 2",
+      "type": "Example_QoETarget_1.0.0"
+    }
+  ]
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policies?type=nonexistent"
+
+**Result**:
+
+404: ::
+
+  Policy type not found
 
 /policy
 ~~~~~~~
@@ -596,71 +714,85 @@ GET
 
 Returns a policy configuration.
 
+Definition
+""""""""""
+
 **URL path:**
-  /policy?id=<policy-id>
+
+/policy?id=<policy-id>
 
 **Parameters:**
-  id: (*Required*)
-    The ID of the policy instance.
+
+id: (*Required*)
+
+The ID of the policy instance.
 
 **Responses:**
-  200:
-        JSON object containing policy information. ::
-
-          {
-            "id": "string",                  (ID of policy)
-            "json": "object",                (JSON with policy data speified by the type)
-            "ownerServiceName": "string",    (Name of the service that created the policy)
-            "ric": "string",                 (Name of the Near |nbh| RT |nbsp| RIC where the policy resides)
-            "type": "string",                (Name of the policy type of the policy)
-            "lastModified"                   (Timestamp, last modification time)
-          }
-  404:
-        Policy is not found.
-
-**Examples:**
-  **Call**: ::
-
-    curl -X GET "http://localhost:8081/policy?id=Policy 1"
-
-  Result:
-    200: ::
-
-       {
-         "id": "Policy 1",
-         "json", {
-           "scope": {
-             "ueId": "UE1 ",
-             "cellId": "Cell 1"
-           },
-           "qosObjectives": {
-             "gfbr": 319.5,
-             "mfbr": 782.75,
-             "priorityLevel": 268.5,
-             "pdb": 44.0
-           },
-           "qoeObjectives": {
-             "qoeScore": 329.0,
-             "initialBuffering": 27.75,
-             "reBuffFreq": 539.0,
-             "stallRatio": 343.0
-           },
-           "resources": []
-         },
-         "ownerServiceName": "Service 1",
-         "ric": "ric1",
-         "type": "STD_PolicyModelUnconstrained_0.2.0",
-         "lastModified": "Wed, 01 Apr 2020 07:45:45 GMT"
-       }
-
-  **Call**: ::
-
-    curl -X GET "http://localhost:8081/policy?id=nonexistent"
-
-  Result:
-     404: ::
-
-       Policy is not found
+
+200:
+
+JSON object containing policy information. ::
+
+  {
+    "id": "string",                  (ID of policy)
+    "json": "object",                (JSON with policy data speified by the type)
+    "ownerServiceName": "string",    (Name of the service that created the policy)
+    "ric": "string",                 (Name of the Near |nbh| RT |nbsp| RIC where the policy resides)
+    "type": "string",                (Name of the policy type of the policy)
+    "lastModified"                   (Timestamp, last modification time)
+  }
+
+404:
+
+Policy is not found.
+
+Examples
+""""""""
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policy?id=Policy 1"
+
+**Result**:
+
+200: ::
+
+  {
+    "id": "Policy 1",
+    "json", {
+      "scope": {
+        "ueId": "UE1 ",
+        "cellId": "Cell 1"
+      },
+      "qosObjectives": {
+        "gfbr": 319.5,
+        "mfbr": 782.75,
+        "priorityLevel": 268.5,
+        "pdb": 44.0
+      },
+      "qoeObjectives": {
+        "qoeScore": 329.0,
+        "initialBuffering": 27.75,
+        "reBuffFreq": 539.0,
+        "stallRatio": 343.0
+      },
+      "resources": []
+    },
+    "ownerServiceName": "Service 1",
+    "ric": "ric1",
+    "type": "STD_PolicyModelUnconstrained_0.2.0",
+    "lastModified": "Wed, 01 Apr 2020 07:45:45 GMT"
+  }
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policy?id=nonexistent"
+
+**Result**:
+
+404: ::
+
+  Policy is not found
 
 PUT
 +++
@@ -668,59 +800,83 @@ PUT
 Create/Update a policy. **Note!** Calls to this method will also trigger "*Keep Alive*" for a service which has a
 "*Keep Alive Interval*" registered.
 
+Definition
+""""""""""
+
 **URL path:**
-  /policy?id=<policy-id>&ric=<name-of-ric>&service=<name-of-service>&type=<name-of-policy-type>
+
+/policy?id=<policy-id>&ric=<name-of-ric>&service=<name-of-service>&type=<name-of-policy-type>
 
 **Parameters:**
-  id: (*Required*)
-    The ID of the policy instance.
-  ric: (*Required*)
-    The name of the Near |nbh| RT |nbsp| RIC where the policy will be created.
-  service: (*Required*)
-    The name of the service creating the policy.
-  type: (*Optional*)
-    The name of the policy type.
+
+id: (*Required*)
+
+The ID of the policy instance.
+
+ric: (*Required*)
+
+The name of the Near |nbh| RT |nbsp| RIC where the policy will be created.
+
+service: (*Required*)
+
+The name of the service creating the policy.
+
+type: (*Optional*)
+
+The name of the policy type.
 
 **Body:** (*Required*)
-    A JSON object containing the data specified by the type.
+
+A JSON object containing the data specified by the type.
 
 **Responses:**
-  200:
-        Policy updated.
-  201:
-        Policy created.
-  404:
-        Near |nbh| RT |nbsp| RIC or policy type is not found.
-  423:
-        Near |nbh| RT |nbsp| RIC is not operational.
-
-**Examples:**
-  **Call**: ::
-
-    curl -X PUT "http://localhost:8081/policy?id=Policy%201&ric=ric1&service=Service%201&type=STD_PolicyModelUnconstrained_0.2.0"
-      -H  "Content-Type: application/json"
-      -d '{
-            "scope": {
-              "ueId": "UE 1",
-              "cellId": "Cell 1"
-            },
-            "qosObjectives": {
-              "gfbr": 319.5,
-              "mfbr": 782.75,
-              "priorityLevel": 268.5,
-              "pdb": 44.0
-            },
-            "qoeObjectives": {
-              "qoeScore": 329.0,
-              "initialBuffering": 27.75,
-              "reBuffFreq": 539.0,
-              "stallRatio": 343.0
-            },
-            "resources": []
-          }'
 
-  Result:
-    200
+200:
+
+Policy updated.
+
+201:
+
+Policy created.
+
+404:
+
+Near |nbh| RT |nbsp| RIC or policy type is not found.
+
+423:
+
+Near |nbh| RT |nbsp| RIC is not operational.
+
+Examples
+""""""""
+
+**Call**: ::
+
+  curl -X PUT "http://localhost:8081/policy?id=Policy%201&ric=ric1&service=Service%201&type=STD_PolicyModelUnconstrained_0.2.0"
+    -H  "Content-Type: application/json"
+    -d '{
+          "scope": {
+            "ueId": "UE 1",
+            "cellId": "Cell 1"
+          },
+          "qosObjectives": {
+            "gfbr": 319.5,
+            "mfbr": 782.75,
+            "priorityLevel": 268.5,
+            "pdb": 44.0
+          },
+          "qoeObjectives": {
+            "qoeScore": 329.0,
+            "initialBuffering": 27.75,
+            "reBuffFreq": 539.0,
+            "stallRatio": 343.0
+          },
+          "resources": []
+        }'
+
+**Result**:
+
+200
 
 DELETE
 ++++++
@@ -728,28 +884,43 @@ DELETE
 Deletes a policy. **Note!** Calls to this method will also trigger "*Keep Alive*" for a service which has a
 "*Keep Alive Interval*" registered.
 
+Definition
+""""""""""
+
 **URL path:**
-  /policy?id=<policy-id>
+
+/policy?id=<policy-id>
 
 **Parameters:**
-  id: (*Required*)
-    The ID of the policy instance.
+
+id: (*Required*)
+
+The ID of the policy instance.
 
 **Responses:**
-  204:
-        Policy deleted.
-  404:
-        Policy is not found.
-  423:
-        Near |nbh| RT |nbsp| RIC is not operational.
 
-**Examples:**
-  **Call**: ::
+204:
+
+Policy deleted.
 
-    curl -X DELETE "http://localhost:8081/policy?id=Policy 1"
+404:
 
-  Result:
-    204
+Policy is not found.
+
+423:
+
+Near |nbh| RT |nbsp| RIC is not operational.
+
+Examples
+""""""""
+
+**Call**: ::
+
+  curl -X DELETE "http://localhost:8081/policy?id=Policy 1"
+
+**Result**:
+
+204
 
 /policy_ids
 ~~~~~~~~~~~
@@ -759,45 +930,63 @@ GET
 
 Query policy type IDs.
 
+Definition
+""""""""""
+
 **URL path:**
-  /policy_ids?ric=<name-of-ric>&service=<name-of-service>&type=<name-of-policy-type>
+
+/policy_ids?ric=<name-of-ric>&service=<name-of-service>&type=<name-of-policy-type>
 
 **Parameters:**
-  ric: (*Optional*)
-    The name of the Near |nbh| RT |nbsp| RIC to get policies for.
-  service: (*Optional*)
-    The name of the service to get policies for.
-  type: (*Optional*)
-    The name of the policy type to get policies for.
+
+ric: (*Optional*)
+
+The name of the Near |nbh| RT |nbsp| RIC to get policies for.
+
+service: (*Optional*)
+
+The name of the service to get policies for.
+
+type: (*Optional*)
+
+The name of the policy type to get policies for.
 
 **Responses:**
-  200:
-        Array of policy type names.
-  404:
-        RIC or policy type not found.
 
-**Examples:**
-  **Call**: ::
+200:
+
+Array of policy type names.
+
+404:
+
+RIC or policy type not found.
+
+Examples
+""""""""
 
-    curl -X GET "http://localhost:8081/policy_ids"
+**Call**: ::
 
-  Result:
-    200: ::
+  curl -X GET "http://localhost:8081/policy_ids"
 
-       [
-         "Policy 1",
-         "Policy 2",
-         "Policy 3"
-      ]
+**Result**:
 
-  **Call**: ::
+200: ::
 
-    curl -X GET "http://localhost:8081/policy_ids?ric=nonexistent"
+  [
+    "Policy 1",
+    "Policy 2",
+    "Policy 3"
+  ]
 
-  Result:
-     404: ::
+**Call**: ::
 
-       Ric not found
+  curl -X GET "http://localhost:8081/policy_ids?ric=nonexistent"
+
+**Result**:
+
+404: ::
+
+  Ric not found
 
 /policy_status
 ~~~~~~~~~~~~~~
@@ -807,29 +996,37 @@ GET
 
 Returns the status of a policy.
 
+Definition
+""""""""""
+
 **URL path:**
-  /policy_status?id=<policy-id>
+
+/policy_status?id=<policy-id>
 
 **Parameters:**
-  id: (*Required*)
-    The ID of the policy.
+
+id: (*Required*)
+
+The ID of the policy.
 
 **Responses:**
-  200:
-        JSON object with policy status.
-  404:
-        Policy not found.
 
+200:
+
+JSON object with policy status.
+
+404:
+
+Policy not found.
+
+**********************
 Near-RT RIC Repository
-======================
+**********************
 
 The Policy Agent keeps an updated view of the Near |nbh| RT |nbsp| RICs that are available in the system. A service can
 find out which Near |nbh| RT |nbsp| RIC that manages a specific element in the network or which
 Near |nbh| RT |nbsp| RICs that support a specific policy type.
 
-Near-RT RIC
------------
-
 /ric
 ~~~~
 
@@ -838,35 +1035,49 @@ GET
 
 Returns the name of a Near |nbh| RT |nbsp| RIC managing a specific Mananged Element.
 
- **URL path:**
-  /ric?managedElementId=<id-of-managed-element>
+Definition
+""""""""""
+
+**URL path:**
+
+/ric?managedElementId=<id-of-managed-element>
 
 **Parameters:**
-  managedElementId: (*Required*)
-    The ID of the Managed Element.
+
+managedElementId: (*Required*)
+
+The ID of the Managed Element.
 
 **Responses:**
-  200:
-        Name of the Near |nbh| RT |nbsp| RIC managing the Managed Element.
-  404:
-        No Near |nbh| RT |nbsp| RIC manages the given Managed Element.
 
-**Examples:**
-  **Call**: ::
+200:
+
+Name of the Near |nbh| RT |nbsp| RIC managing the Managed Element.
+
+404:
 
-    curl -X GET "http://localhost:8081/ric?managedElementId=Node 1"
+No Near |nbh| RT |nbsp| RIC manages the given Managed Element.
 
-  Result:
-    200: ::
+Examples
+""""""""
 
-      Ric 1
+**Call**: ::
 
-  **Call**: ::
+  curl -X GET "http://localhost:8081/ric?managedElementId=Node 1"
 
-    curl -X GET "http://localhost:8081/ric?managedElementId=notmanaged"
+**Result**:
 
-  Result:
-     404
+200: ::
+
+  Ric 1
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/ric?managedElementId=notmanaged"
+
+**Result**:
+
+404
 
 /rics
 ~~~~~
@@ -876,86 +1087,98 @@ GET
 
 Query Near |nbh| RT |nbsp| RIC information.
 
- **URL path:**
-  /rics?policyType=<name-of-policy-type>
+Definition
+""""""""""
 
-**Parameters:**
-  policyType: (*Optional*)
-    The name of the policy type.
+**URL path:**
 
-**Responses:**
-  200:
-        Array of JSON objects containing Near |nbh| RT |nbsp| RIC information. ::
-
-          [
-            {
-              "managedElementIds": [
-                "string"
-              ],
-              "policyTypes": [
-                "string"
-              ],
-              "ricName": "string",
-              "state": "string"
-            }
-          ]
-  404:
-        Policy type is not found.
-
-**Examples:**
-  **Call**: ::
-
-    curl -X GET "http://localhost:8081/rics?policyType=STD_PolicyModelUnconstrained_0.2.0"
-
-  Result:
-    200: ::
-
-      [
-        {
-          "managedElementIds": [
-            "ME 1",
-            "ME 2"
-          ],
-          "policyTypes": [
-            "STD_PolicyModelUnconstrained_0.2.0",
-            "Example_QoETarget_1.0.0",
-            "ERIC_QoSNudging_0.2.0"
-          ],
-          "ricName": "Ric 1",
-          "state": "AVAILABLE"
-        },
-          .
-          .
-          .
-        {
-          "managedElementIds": [
-            "ME 3"
-          ],
-          "policyTypes": [
-            "STD_PolicyModelUnconstrained_0.2.0"
-          ],
-          "ricName": "Ric X",
-          "state": "UNAVAILABLE"
-        }
-      ]
+/rics?policyType=<name-of-policy-type>
 
-  **Call**: ::
+**Parameters:**
 
-    curl -X GET "http://localhost:8081/rics?policyType=nonexistent"
+policyType: (*Optional*)
 
-  Result:
-     404: ::
+The name of the policy type.
 
-      Policy type not found
+**Responses:**
 
+200:
+
+Array of JSON objects containing Near |nbh| RT |nbsp| RIC information. ::
+
+  [
+    {
+      "managedElementIds": [
+        "string"
+      ],
+      "policyTypes": [
+        "string"
+      ],
+      "ricName": "string",
+      "state": "string"
+    }
+  ]
+
+404:
+
+Policy type is not found.
+
+Examples
+""""""""
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/rics?policyType=STD_PolicyModelUnconstrained_0.2.0"
+
+**Result**:
+
+200: ::
+
+  [
+    {
+      "managedElementIds": [
+        "ME 1",
+        "ME 2"
+      ],
+      "policyTypes": [
+        "STD_PolicyModelUnconstrained_0.2.0",
+        "Example_QoETarget_1.0.0",
+        "ERIC_QoSNudging_0.2.0"
+      ],
+      "ricName": "Ric 1",
+      "state": "AVAILABLE"
+    },
+      .
+      .
+      .
+    {
+      "managedElementIds": [
+        "ME 3"
+      ],
+      "policyTypes": [
+        "STD_PolicyModelUnconstrained_0.2.0"
+      ],
+      "ricName": "Ric X",
+      "state": "UNAVAILABLE"
+    }
+  ]
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/rics?policyType=nonexistent"
+
+**Result**:
+
+404: ::
+
+  Policy type not found
+
+************
 Health Check
-============
+************
 
 The status of the Policy Agent.
 
-Health Check
-------------
-
 /status
 ~~~~~~~
 
@@ -964,23 +1187,33 @@ GET
 
 Returns the status of the Policy Agent.
 
- **URL path:**
-  /status
+Definition
+""""""""""
+
+**URL path:**
+
+/status
 
 **Parameters:**
-  None.
+
+None.
 
 **Responses:**
-  200:
-        Service is living.
 
-**Examples:**
-  **Call**: ::
+200:
+
+Service is living.
 
-    curl -X GET "http://localhost:8081/status"
+Examples
+""""""""
 
-  Result:
-    200
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/status"
+
+**Result**:
+
+200
 
 ****************
 A1 through DMaaP
@@ -991,7 +1224,7 @@ Policy Agent polls the DMaaP Message Router regularly and processes any messages
 published back to the DMaaP Message Router with the result of the call.
 
 Send Message
-============
+~~~~~~~~~~~~
 
 The message to send is a JSON like the one below. The "*url*" is one of the URLs described under
 :ref:`policy-management`. The "*target*" must always be "*policy-agent*" for the message to be processed by the Policy
@@ -1010,7 +1243,7 @@ Agent. The "*operation*" can be one of the following: "*GET | PUT | POST | DELET
   }
 
 Example
--------
++++++++
 
 To get all policy types for a specific Near |nbh| RT |nbsp| RIC the following message should be sent to DMaaP Message
 Router: ::
@@ -1028,7 +1261,7 @@ Router: ::
   }
 
 Receive Message
-===============
+~~~~~~~~~~~~~~~
 
 The message the Policy Agent sends back to the DMaaP Message Router is a JSON like the one below. The "*requestId*"
 "*correlationId*", and "*originatorId*" are the same as in the message sent to DMaaP MR. ::
@@ -1039,13 +1272,13 @@ The message the Policy Agent sends back to the DMaaP Message Router is a JSON li
     "originatorId": "string",
     "type": "string",
     "message": "string",
-    "type":  string",
+    "type":  "string",
     "timestamp": "string",
     "status": "string"
   }
 
 Example
--------
++++++++
 
 The response containing all policy types for a specific Near |nbh| RT |nbsp| RIC sent to the DMaaP Message Router from
 the Policy Agent: ::
index fb6f177..24f9d45 100644 (file)
@@ -10,9 +10,9 @@
 .. |nbh| unicode:: 0x2011
    :trim:
 
-##################
-SDNC A1 Controller
-##################
+######################
+SDNC A1 Controller API
+######################
 
 The A1 of a Near |nbh| RT |nbsp| RIC can be used through the SDNC A1 Controller.
 
index aec78f2..8ed3368 100644 (file)
@@ -58,7 +58,7 @@
         <formatter-maven-plugin.version>2.8.1</formatter-maven-plugin.version>
         <spotless-maven-plugin.version>1.18.0</spotless-maven-plugin.version>
         <docker-maven-plugin>0.30.0</docker-maven-plugin>
-        <version.dmaap>1.1.9</version.dmaap>
+        <version.dmaap>1.1.11</version.dmaap>
         <javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
         <sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
         <jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
index 546979c..57ac980 100644 (file)
@@ -86,13 +86,20 @@ public class A1ClientFactory {
     private ControllerConfig getControllerConfig(Ric ric) throws ServiceException {
         String controllerName = ric.getConfig().controllerName();
         if (controllerName.isEmpty()) {
+            ric.setProtocolVersion(A1ProtocolType.UNKNOWN);
             throw new ServiceException("No controller configured for RIC: " + ric.name());
         }
-        return this.appConfig.getControllerConfig(controllerName);
+        try {
+            return this.appConfig.getControllerConfig(controllerName);
+        } catch (ServiceException e) {
+            ric.setProtocolVersion(A1ProtocolType.UNKNOWN);
+            throw e;
+        }
     }
 
     private void assertNoControllerConfig(Ric ric, A1ProtocolType version) throws ServiceException {
         if (!ric.getConfig().controllerName().isEmpty()) {
+            ric.setProtocolVersion(A1ProtocolType.UNKNOWN);
             throw new ServiceException(
                 "Controller config should be empty, ric: " + ric.name() + " when using protocol version: " + version);
         }
index ef1acfc..26d5152 100644 (file)
@@ -28,6 +28,7 @@ import io.netty.handler.timeout.ReadTimeoutHandler;
 import io.netty.handler.timeout.WriteTimeoutHandler;
 
 import java.lang.invoke.MethodHandles;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.net.ssl.SSLException;
 
@@ -52,13 +53,16 @@ public class AsyncRestClient {
     private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
     private WebClient webClient = null;
     private final String baseUrl;
+    private static final AtomicInteger sequenceNumber = new AtomicInteger();
 
     public AsyncRestClient(String baseUrl) {
         this.baseUrl = baseUrl;
     }
 
     public Mono<ResponseEntity<String>> postForEntity(String uri, @Nullable String body) {
-        logger.debug("POST uri = '{}{}''", baseUrl, uri);
+        Object traceTag = createTraceTag();
+        logger.debug("{} POST uri = '{}{}''", traceTag, baseUrl, uri);
+        logger.trace("{} POST body: {}", traceTag, body);
         Mono<String> bodyProducer = body != null ? Mono.just(body) : Mono.empty();
         return getWebClient() //
             .flatMap(client -> {
@@ -66,7 +70,7 @@ public class AsyncRestClient {
                     .uri(uri) //
                     .contentType(MediaType.APPLICATION_JSON) //
                     .body(bodyProducer, String.class);
-                return retrieve(request);
+                return retrieve(traceTag, request);
             });
     }
 
@@ -76,7 +80,9 @@ public class AsyncRestClient {
     }
 
     public Mono<String> postWithAuthHeader(String uri, String body, String username, String password) {
-        logger.debug("POST (auth) uri = '{}{}''", baseUrl, uri);
+        Object traceTag = createTraceTag();
+        logger.debug("{} POST (auth) uri = '{}{}''", traceTag, baseUrl, uri);
+        logger.trace("{} POST body: {}", traceTag, body);
         return getWebClient() //
             .flatMap(client -> {
                 RequestHeadersSpec<?> request = client.post() //
@@ -84,30 +90,34 @@ public class AsyncRestClient {
                     .headers(headers -> headers.setBasicAuth(username, password)) //
                     .contentType(MediaType.APPLICATION_JSON) //
                     .bodyValue(body);
-                return retrieve(request) //
+                return retrieve(traceTag, request) //
                     .flatMap(this::toBody);
             });
     }
 
     public Mono<ResponseEntity<String>> putForEntity(String uri, String body) {
-        logger.debug("PUT uri = '{}{}''", baseUrl, uri);
+        Object traceTag = createTraceTag();
+        logger.debug("{} PUT uri = '{}{}''", traceTag, baseUrl, uri);
+        logger.trace("{} PUT body: {}", traceTag, body);
         return getWebClient() //
             .flatMap(client -> {
                 RequestHeadersSpec<?> request = client.put() //
                     .uri(uri) //
                     .contentType(MediaType.APPLICATION_JSON) //
                     .bodyValue(body);
-                return retrieve(request);
+                return retrieve(traceTag, request);
             });
     }
 
     public Mono<ResponseEntity<String>> putForEntity(String uri) {
-        logger.debug("PUT uri = '{}{}''", baseUrl, uri);
+        Object traceTag = createTraceTag();
+        logger.debug("{} PUT uri = '{}{}''", traceTag, baseUrl, uri);
+        logger.trace("{} PUT body: <empty>", traceTag);
         return getWebClient() //
             .flatMap(client -> {
                 RequestHeadersSpec<?> request = client.put() //
                     .uri(uri);
-                return retrieve(request);
+                return retrieve(traceTag, request);
             });
     }
 
@@ -117,11 +127,12 @@ public class AsyncRestClient {
     }
 
     public Mono<ResponseEntity<String>> getForEntity(String uri) {
-        logger.debug("GET uri = '{}{}''", baseUrl, uri);
+        Object traceTag = createTraceTag();
+        logger.debug("{} GET uri = '{}{}''", traceTag, baseUrl, uri);
         return getWebClient() //
             .flatMap(client -> {
                 RequestHeadersSpec<?> request = client.get().uri(uri);
-                return retrieve(request);
+                return retrieve(traceTag, request);
             });
     }
 
@@ -131,11 +142,12 @@ public class AsyncRestClient {
     }
 
     public Mono<ResponseEntity<String>> deleteForEntity(String uri) {
-        logger.debug("DELETE uri = '{}{}''", baseUrl, uri);
+        Object traceTag = createTraceTag();
+        logger.debug("{} DELETE uri = '{}{}''", traceTag, baseUrl, uri);
         return getWebClient() //
             .flatMap(client -> {
                 RequestHeadersSpec<?> request = client.delete().uri(uri);
-                return retrieve(request);
+                return retrieve(traceTag, request);
             });
     }
 
@@ -144,19 +156,24 @@ public class AsyncRestClient {
             .flatMap(this::toBody);
     }
 
-    private Mono<ResponseEntity<String>> retrieve(RequestHeadersSpec<?> request) {
+    private Mono<ResponseEntity<String>> retrieve(Object traceTag, RequestHeadersSpec<?> request) {
         return request.retrieve() //
             .toEntity(String.class) //
-            .doOnError(this::onHttpError);
+            .doOnNext(entity -> logger.trace("{} Received: {}", traceTag, entity.getBody()))
+            .doOnError(throwable -> onHttpError(traceTag, throwable));
     }
 
-    private void onHttpError(Throwable t) {
+    private static Object createTraceTag() {
+        return sequenceNumber.incrementAndGet();
+    }
+
+    private void onHttpError(Object traceTag, Throwable t) {
         if (t instanceof WebClientResponseException) {
             WebClientResponseException exception = (WebClientResponseException) t;
-            logger.debug("HTTP error status = '{}', body '{}'", exception.getStatusCode(),
+            logger.debug("{} HTTP error status = '{}', body '{}'", traceTag, exception.getStatusCode(),
                 exception.getResponseBodyAsString());
         } else {
-            logger.debug("HTTP error: {}", t.getMessage());
+            logger.debug("{} HTTP error: {}", traceTag, t.getMessage());
         }
     }
 
@@ -179,7 +196,7 @@ public class AsyncRestClient {
             .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10_000) //
             .secure(c -> c.sslContext(sslContext)) //
             .doOnConnected(connection -> {
-                connection.addHandler(new ReadTimeoutHandler(10));
+                connection.addHandler(new ReadTimeoutHandler(30));
                 connection.addHandler(new WriteTimeoutHandler(30));
             });
         HttpClient httpClient = HttpClient.from(tcpClient);
index aaa9519..90fbd10 100644 (file)
@@ -126,6 +126,19 @@ public class OscA1Client implements A1Client {
         uri = new UriBuilder(ricConfig);
     }
 
+    public static Mono<String> extractCreateSchema(String policyTypeResponse, String policyTypeId) {
+        try {
+            JSONObject obj = new JSONObject(policyTypeResponse);
+            JSONObject schemaObj = obj.getJSONObject("create_schema");
+            schemaObj.put(TITLE, policyTypeId);
+            return Mono.just(schemaObj.toString());
+        } catch (Exception e) {
+            String exceptionString = e.toString();
+            logger.error("Unexpected response for policy type: {}, exception: {}", policyTypeResponse, exceptionString);
+            return Mono.error(e);
+        }
+    }
+
     @Override
     public Mono<List<String>> getPolicyTypeIdentities() {
         return getPolicyTypeIds() //
@@ -143,7 +156,7 @@ public class OscA1Client implements A1Client {
     public Mono<String> getPolicyTypeSchema(String policyTypeId) {
         String schemaUri = uri.createGetSchemaUri(policyTypeId);
         return restClient.get(schemaUri) //
-            .flatMap(response -> getCreateSchema(response, policyTypeId));
+            .flatMap(response -> extractCreateSchema(response, policyTypeId));
     }
 
     @Override
@@ -186,19 +199,6 @@ public class OscA1Client implements A1Client {
             .flatMapMany(SdncJsonHelper::parseJsonArrayOfString);
     }
 
-    private Mono<String> getCreateSchema(String policyTypeResponse, String policyTypeId) {
-        try {
-            JSONObject obj = new JSONObject(policyTypeResponse);
-            JSONObject schemaObj = obj.getJSONObject("create_schema");
-            schemaObj.put(TITLE, policyTypeId);
-            return Mono.just(schemaObj.toString());
-        } catch (Exception e) {
-            String exceptionString = e.toString();
-            logger.error("Unexpected response for policy type: {}, exception: {}", policyTypeResponse, exceptionString);
-            return Mono.error(e);
-        }
-    }
-
     private Mono<String> deletePolicyById(String typeId, String policyId) {
         String policyUri = uri.createDeleteUri(typeId, policyId);
         return restClient.delete(policyUri);
index c29d70e..fcb3236 100644 (file)
@@ -132,7 +132,8 @@ public class SdncOscA1Client implements A1Client {
         } else if (this.protocolType == A1ProtocolType.SDNC_OSC_OSC_V1) {
             OscA1Client.UriBuilder uri = new OscA1Client.UriBuilder(ricConfig);
             final String ricUrl = uri.createGetSchemaUri(policyTypeId);
-            return post(GET_POLICY_RPC, ricUrl, Optional.empty());
+            return post(GET_POLICY_RPC, ricUrl, Optional.empty()) //
+                .flatMap(response -> OscA1Client.extractCreateSchema(response, policyTypeId));
         } else {
             return Mono.error(createIllegalProtocolException());
         }
index dd35e5b..8418749 100644 (file)
@@ -119,9 +119,9 @@ public class ApplicationConfigParser {
             JsonObject ricAsJson = ricElem.getAsJsonObject();
             JsonElement controllerNameElement = ricAsJson.get(CONTROLLER);
             ImmutableRicConfig ricConfig = ImmutableRicConfig.builder() //
-                .name(ricAsJson.get("name").getAsString()) //
-                .baseUrl(ricAsJson.get("baseUrl").getAsString()) //
-                .managedElementIds(parseManagedElementIds(ricAsJson.get("managedElementIds").getAsJsonArray())) //
+                .name(get(ricAsJson, "name").getAsString()) //
+                .baseUrl(get(ricAsJson, "baseUrl").getAsString()) //
+                .managedElementIds(parseManagedElementIds(get(ricAsJson, "managedElementIds").getAsJsonArray())) //
                 .controllerName(controllerNameElement != null ? controllerNameElement.getAsString() : "") //
                 .build();
             result.add(ricConfig);
@@ -137,10 +137,10 @@ public class ApplicationConfigParser {
         for (JsonElement element : getAsJsonArray(config, CONTROLLER)) {
             JsonObject controllerAsJson = element.getAsJsonObject();
             ImmutableControllerConfig controllerConfig = ImmutableControllerConfig.builder() //
-                .name(controllerAsJson.get("name").getAsString()) //
-                .baseUrl(controllerAsJson.get("baseUrl").getAsString()) //
-                .password(controllerAsJson.get("password").getAsString()) //
-                .userName(controllerAsJson.get("userName").getAsString()) // )
+                .name(get(controllerAsJson, "name").getAsString()) //
+                .baseUrl(get(controllerAsJson, "baseUrl").getAsString()) //
+                .password(get(controllerAsJson, "password").getAsString()) //
+                .userName(get(controllerAsJson, "userName").getAsString()) // )
                 .build();
 
             if (result.put(controllerConfig.name(), controllerConfig) != null) {
@@ -164,7 +164,7 @@ public class ApplicationConfigParser {
     private static JsonElement get(JsonObject obj, String memberName) throws ServiceException {
         JsonElement elem = obj.get(memberName);
         if (elem == null) {
-            throw new ServiceException("Could not find member: " + memberName + " in: " + obj);
+            throw new ServiceException("Could not find member: '" + memberName + "' in: " + obj);
         }
         return elem;
     }
@@ -205,8 +205,8 @@ public class ApplicationConfigParser {
             dmaapProps.put("group", path.consumerGroup);
             dmaapProps.put("id", path.consumerId);
             dmaapProps.put("TransportType", ProtocolTypeConstants.HTTPNOAUTH.toString());
-            dmaapProps.put("timeout", 15000);
-            dmaapProps.put("limit", 100);
+            dmaapProps.put("timeout", "15000");
+            dmaapProps.put("limit", "100");
             dmaapProps.put("maxBatchSize", "10");
             dmaapProps.put("maxAgeMs", "10000");
             dmaapProps.put("compress", true);
index f03aa58..da209a8 100644 (file)
@@ -110,7 +110,7 @@ public class DmaapMessageConsumer implements Runnable {
     }
 
     private DmaapMessageHandler getDmaapMessageHandler() throws IOException {
-        String agentBaseUrl = "http://localhost:" + this.localServerPort;
+        String agentBaseUrl = "https://localhost:" + this.localServerPort;
         AsyncRestClient agentClient = createRestClient(agentBaseUrl);
         Properties dmaapPublisherProperties = applicationConfig.getDmaapPublisherConfig();
         MRBatchingPublisher producer = getMessageRouterPublisher(dmaapPublisherProperties);
index 7cfe486..05bcb0f 100644 (file)
@@ -24,7 +24,6 @@ import com.google.gson.GsonBuilder;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
-import com.google.gson.JsonSyntaxException;
 import com.google.gson.TypeAdapterFactory;
 
 import java.io.BufferedInputStream;
@@ -109,9 +108,8 @@ public class RefreshConfigTask {
         logger.debug("Starting refreshConfigTask");
         stop();
         refreshTask = createRefreshTask() //
-            .subscribe(
-                notUsed -> logger.debug("Refreshed configuration data"), throwable -> logger
-                    .error("Configuration refresh terminated due to exception {}", throwable.getMessage()),
+            .subscribe(notUsed -> logger.debug("Refreshed configuration data"),
+                throwable -> logger.error("Configuration refresh terminated due to exception {}", throwable.toString()),
                 () -> logger.error("Configuration refresh terminated"));
     }
 
@@ -123,17 +121,17 @@ public class RefreshConfigTask {
 
     Flux<RicConfigUpdate.Type> createRefreshTask() {
         Flux<JsonObject> loadFromFile = Flux.interval(Duration.ZERO, FILE_CONFIG_REFRESH_INTERVAL) //
-            .filter(notUsed -> configFileExists()) //
             .filter(notUsed -> !this.isConsulUsed) //
             .flatMap(notUsed -> loadConfigurationFromFile()) //
-            .onErrorResume(this::ignoreError) //
+            .onErrorResume(this::ignoreErrorFlux) //
             .doOnNext(json -> logger.debug("loadFromFile succeeded")) //
             .doOnTerminate(() -> logger.error("loadFromFile Terminate"));
 
-        Flux<JsonObject> loadFromConsul = getEnvironment(systemEnvironment) //
+        Flux<JsonObject> loadFromConsul = Flux.interval(Duration.ZERO, CONSUL_CONFIG_REFRESH_INTERVAL) //
+            .flatMap(i -> getEnvironment(systemEnvironment)) //
             .flatMap(this::createCbsClient) //
-            .flatMapMany(this::periodicConfigurationUpdates) //
-            .onErrorResume(this::ignoreError) //
+            .flatMap(this::getFromCbs) //
+            .onErrorResume(this::ignoreErrorMono) //
             .doOnNext(json -> logger.debug("loadFromConsul succeeded")) //
             .doOnNext(json -> this.isConsulUsed = true) //
             .doOnTerminate(() -> logger.error("loadFromConsul Terminated"));
@@ -147,20 +145,32 @@ public class RefreshConfigTask {
     }
 
     Mono<EnvProperties> getEnvironment(Properties systemEnvironment) {
-        return EnvironmentProcessor.readEnvironmentVariables(systemEnvironment);
+        return EnvironmentProcessor.readEnvironmentVariables(systemEnvironment) //
+            .onErrorResume(t -> Mono.empty());
     }
 
     Mono<CbsClient> createCbsClient(EnvProperties env) {
-        return CbsClientFactory.createCbsClient(env);
+        return CbsClientFactory.createCbsClient(env) //
+            .onErrorResume(this::ignoreErrorMono);
     }
 
-    private Flux<JsonObject> periodicConfigurationUpdates(CbsClient cbsClient) {
-        final Duration initialDelay = Duration.ZERO;
+    private Mono<JsonObject> getFromCbs(CbsClient cbsClient) {
         final CbsRequest getConfigRequest = CbsRequests.getAll(RequestDiagnosticContext.create());
-        return cbsClient.updates(getConfigRequest, initialDelay, CONSUL_CONFIG_REFRESH_INTERVAL);
+        try {
+            return cbsClient.get(getConfigRequest) //
+                .onErrorResume(this::ignoreErrorMono);
+        } catch (Exception e) {
+            return ignoreErrorMono(e);
+        }
+    }
+
+    private <R> Flux<R> ignoreErrorFlux(Throwable throwable) {
+        String errMsg = throwable.toString();
+        logger.warn("Could not refresh application configuration. {}", errMsg);
+        return Flux.empty();
     }
 
-    private <R> Mono<R> ignoreError(Throwable throwable) {
+    private <R> Mono<R> ignoreErrorMono(Throwable throwable) {
         String errMsg = throwable.toString();
         logger.warn("Could not refresh application configuration. {}", errMsg);
         return Mono.empty();
@@ -170,9 +180,10 @@ public class RefreshConfigTask {
         try {
             ApplicationConfigParser parser = new ApplicationConfigParser();
             return Mono.just(parser.parse(jsonObject));
-        } catch (ServiceException e) {
-            logger.error("Could not parse configuration {}", e.toString(), e);
-            return Mono.error(e);
+        } catch (Exception e) {
+            String str = e.toString();
+            logger.error("Could not parse configuration {}", str);
+            return Mono.empty();
         }
     }
 
@@ -180,8 +191,7 @@ public class RefreshConfigTask {
         return this.appConfig.setConfiguration(config);
     }
 
-    boolean configFileExists() {
-        String filepath = appConfig.getLocalConfigurationFilePath();
+    boolean fileExists(String filepath) {
         return (filepath != null && (new File(filepath).exists()));
     }
 
@@ -223,6 +233,10 @@ public class RefreshConfigTask {
      */
     Flux<JsonObject> loadConfigurationFromFile() {
         String filepath = appConfig.getLocalConfigurationFilePath();
+        if (!fileExists(filepath)) {
+            return Flux.empty();
+        }
+
         GsonBuilder gsonBuilder = new GsonBuilder();
         ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory);
 
@@ -232,8 +246,8 @@ public class RefreshConfigTask {
             appParser.parse(rootObject);
             logger.debug("Local configuration file loaded: {}", filepath);
             return Flux.just(rootObject);
-        } catch (JsonSyntaxException | ServiceException | IOException e) {
-            logger.debug("Local configuration file not loaded: {}", filepath, e);
+        } catch (IOException | ServiceException e) {
+            logger.error("Local configuration file not loaded: {}, {}", filepath, e.getMessage());
             return Flux.empty();
         }
     }
index 0027cca..d274d5a 100644 (file)
@@ -72,7 +72,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
 import org.springframework.boot.test.context.TestConfiguration;
+import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
 import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.http.HttpStatus;
@@ -164,6 +166,12 @@ public class ApplicationTest {
             Duration checkInterval = Duration.ofMillis(1);
             return new ServiceSupervision(this.services, this.policies, this.getA1ClientFactory(), checkInterval);
         }
+
+        @Bean
+        public ServletWebServerFactory servletContainer() {
+            return new TomcatServletWebServerFactory();
+        }
+
     }
 
     @LocalServerPort
@@ -301,6 +309,10 @@ public class ApplicationTest {
         String rsp = restClient().get(url).block();
         assertThat(rsp.contains(policyInstanceId)).isTrue();
 
+        url = "/policy?id=" + policyInstanceId;
+        rsp = restClient().get(url).block();
+        assertThat(rsp).isEqualTo(policyBody);
+
         // Test of error codes
         url = putPolicyUrl(serviceName, ricName + "XX", policyTypeName, policyInstanceId);
         testErrorCode(restClient().put(url, policyBody), HttpStatus.NOT_FOUND);
@@ -663,7 +675,7 @@ public class ApplicationTest {
     }
 
     private String jsonString() {
-        return "{\n  \"servingCellNrcgi\": \"1\"\n }";
+        return "{\"servingCellNrcgi\":\"1\"}";
     }
 
     @Test
index f3aaa24..f8f7ca3 100644 (file)
@@ -22,6 +22,7 @@ package org.oransc.policyagent;
 
 import java.util.concurrent.atomic.AtomicInteger;
 
+import org.oransc.policyagent.clients.AsyncRestClient;
 import org.oransc.policyagent.repository.ImmutablePolicy;
 import org.oransc.policyagent.repository.Policy;
 import org.oransc.policyagent.repository.PolicyType;
@@ -33,10 +34,6 @@ import org.oransc.policyagent.utils.MockA1Client;
 import org.oransc.policyagent.utils.MockA1ClientFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.web.client.RestTemplate;
 
 /**
  * Invoke operations over the NBI and start synchronizations in a separate
@@ -44,8 +41,7 @@ import org.springframework.web.client.RestTemplate;
  */
 class ConcurrencyTestRunnable implements Runnable {
     private static final Logger logger = LoggerFactory.getLogger(ConcurrencyTestRunnable.class);
-    private final RestTemplate restTemplate = new RestTemplate();
-    private final String baseUrl;
+    private final AsyncRestClient webClient;
     static AtomicInteger nextCount = new AtomicInteger(0);
     private final int count;
     private final RicSupervision supervision;
@@ -55,12 +51,12 @@ class ConcurrencyTestRunnable implements Runnable {
 
     ConcurrencyTestRunnable(String baseUrl, RicSupervision supervision, MockA1ClientFactory a1ClientFactory, Rics rics,
         PolicyTypes types) {
-        this.baseUrl = baseUrl;
         this.count = nextCount.incrementAndGet();
         this.supervision = supervision;
         this.a1ClientFactory = a1ClientFactory;
         this.rics = rics;
         this.types = types;
+        this.webClient = new AsyncRestClient(baseUrl);
     }
 
     @Override
@@ -80,7 +76,7 @@ class ConcurrencyTestRunnable implements Runnable {
                 deletePolicy(name + "-");
             }
         } catch (Exception e) {
-            logger.error("Concurrency exception " + e.toString());
+            logger.error("Concurrency test exception " + e.toString());
         }
     }
 
@@ -105,29 +101,22 @@ class ConcurrencyTestRunnable implements Runnable {
     }
 
     private void listPolicies() {
-        String uri = baseUrl + "/policies";
-        restTemplate.getForObject(uri, String.class);
+        String uri = "/policies";
+        webClient.getForEntity(uri).block();
     }
 
     private void listTypes() {
-        String uri = baseUrl + "/policy_types";
-        restTemplate.getForObject(uri, String.class);
+        String uri = "/policy_types";
+        webClient.getForEntity(uri).block();
     }
 
     private void putPolicy(String name) {
-        String putUrl = baseUrl + "/policy?type=type1&id=" + name + "&ric=ric&service=service1";
-        restTemplate.put(putUrl, createJsonHttpEntity("{}"));
+        String putUrl = "/policy?type=type1&id=" + name + "&ric=ric&service=service1";
+        webClient.putForEntity(putUrl, "{}").block();
     }
 
     private void deletePolicy(String name) {
-        String deleteUrl = baseUrl + "/policy?id=" + name;
-        restTemplate.delete(deleteUrl);
+        String deleteUrl = "/policy?id=" + name;
+        webClient.delete(deleteUrl).block();
     }
-
-    private static HttpEntity<String> createJsonHttpEntity(String content) {
-        HttpHeaders headers = new HttpHeaders();
-        headers.setContentType(MediaType.APPLICATION_JSON);
-        return new HttpEntity<String>(content, headers);
-    }
-
 }
index fd50425..2cdfe35 100644 (file)
@@ -27,7 +27,12 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import com.google.gson.Gson;
+import com.google.gson.JsonElement;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.nio.file.Files;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Optional;
@@ -112,7 +117,30 @@ public class SdncOscA1ClientTest {
         String expInput = SdncJsonHelper.createInputJsonString(expectedParams);
         verify(asyncRestClientMock).postWithAuthHeader(GET_A1_POLICY_URL, expInput, CONTROLLER_USERNAME,
             CONTROLLER_PASSWORD);
+    }
+
+    private String loadFile(String fileName) throws IOException {
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+        URL url = loader.getResource(fileName);
+        File file = new File(url.getFile());
+        return new String(Files.readAllBytes(file.toPath()));
+    }
+
+    @Test
+    public void testGetTypeSchema_OSC() throws IOException {
+        clientUnderTest = new SdncOscA1Client(A1ProtocolType.SDNC_OSC_OSC_V1, //
+            A1ClientHelper.createRic(RIC_1_URL).getConfig(), //
+            controllerConfig(), asyncRestClientMock);
+
+        String ricResponse = loadFile("test_osc_get_schema_response.json");
+        JsonElement elem = gson().fromJson(ricResponse, JsonElement.class);
+        String responseFromController = createResponse(elem);
+        whenAsyncPostThenReturn(Mono.just(responseFromController));
 
+        String response = clientUnderTest.getPolicyTypeSchema("policyTypeId").block();
+        JsonElement respJson = gson().fromJson(response, JsonElement.class);
+        assertEquals("policyTypeId", respJson.getAsJsonObject().get("title").getAsString(),
+            "title should be updated to contain policyType ID");
     }
 
     private String policiesUrl() {
index 3303e3f..79eb07a 100644 (file)
@@ -68,8 +68,8 @@ public class ApplicationConfigParserTest {
             () -> assertEquals("admin", actualPublisherConfig.get("password"), "Wrong password"),
             () -> assertEquals(ProtocolTypeConstants.HTTPNOAUTH.toString(), actualPublisherConfig.get("TransportType"),
                 "Wrong TransportType"),
-            () -> assertEquals(15000, actualPublisherConfig.get("timeout"), "Wrong timeout"),
-            () -> assertEquals(100, actualPublisherConfig.get("limit"), "Wrong limit"));
+            () -> assertEquals("15000", actualPublisherConfig.get("timeout"), "Wrong timeout"),
+            () -> assertEquals("100", actualPublisherConfig.get("limit"), "Wrong limit"));
 
         Properties actualConsumerConfig = result.dmaapConsumerConfig();
         assertAll("consumerConfig",
@@ -84,8 +84,8 @@ public class ApplicationConfigParserTest {
             () -> assertEquals("policy-agent", actualConsumerConfig.get("id"), "Wrong id"),
             () -> assertEquals(ProtocolTypeConstants.HTTPNOAUTH.toString(), actualConsumerConfig.get("TransportType"),
                 "Wrong TransportType"),
-            () -> assertEquals(15000, actualConsumerConfig.get("timeout"), "Wrong timeout"),
-            () -> assertEquals(100, actualConsumerConfig.get("limit"), "Wrong limit"));
+            () -> assertEquals("15000", actualConsumerConfig.get("timeout"), "Wrong timeout"),
+            () -> assertEquals("100", actualConsumerConfig.get("limit"), "Wrong limit"));
 
         Map<String, ControllerConfig> controllers = result.controllerConfigs();
         assertEquals(1, controllers.size(), "size");
@@ -201,7 +201,7 @@ public class ApplicationConfigParserTest {
         JsonObject jsonRootObject = getJsonRootObject();
         JsonObject json = jsonRootObject.getAsJsonObject("config");
         json.remove("ric");
-        final String message = "Could not find member: ric in: " + json;
+        final String message = "Could not find member: 'ric' in: " + json;
 
         Exception actualException = assertThrows(ServiceException.class, () -> parserUnderTest.parse(jsonRootObject));
 
index 153c4ec..8dd3647 100644 (file)
@@ -170,7 +170,7 @@ public class DmaapMessageConsumerTest {
 
         messageConsumerUnderTest.run();
 
-        verify(messageConsumerUnderTest).createRestClient("http://localhost:0");
+        verify(messageConsumerUnderTest).createRestClient("https://localhost:0");
         verify(messageConsumerUnderTest).getMessageRouterPublisher(properties);
 
         verify(messageHandlerMock).handleDmaapMsg("message");
index e24867b..cb91133 100644 (file)
@@ -124,7 +124,7 @@ public class RefreshConfigTaskTest {
         RefreshConfigTask obj = spy(new RefreshConfigTask(appConfig, rics, policies, new Services(), new PolicyTypes(),
             new A1ClientFactory(appConfig)));
         if (stubConfigFileExists) {
-            doReturn(configFileExists).when(obj).configFileExists();
+            doReturn(configFileExists).when(obj).fileExists(any());
         }
         return obj;
     }
@@ -221,7 +221,7 @@ public class RefreshConfigTaskTest {
         doReturn(Mono.just(props)).when(refreshTaskUnderTest).getEnvironment(any());
 
         doReturn(Mono.just(cbsClient)).when(refreshTaskUnderTest).createCbsClient(props);
-        when(cbsClient.updates(any(), any(), any())).thenReturn(Flux.error(new IOException()));
+        when(cbsClient.get(any())).thenReturn(Mono.error(new IOException()));
 
         final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(RefreshConfigTask.class, WARN);
         Flux<Type> task = refreshTaskUnderTest.createRefreshTask();
@@ -229,7 +229,7 @@ public class RefreshConfigTaskTest {
         StepVerifier //
             .create(task) //
             .expectSubscription() //
-            .expectNoEvent(Duration.ofMillis(100)) //
+            .expectNoEvent(Duration.ofMillis(1000)) //
             .thenCancel() //
             .verify();
 
@@ -262,7 +262,7 @@ public class RefreshConfigTaskTest {
         JsonObject configAsJson = getJsonRootObject();
         String newBaseUrl = "newBaseUrl";
         modifyTheRicConfiguration(configAsJson, newBaseUrl);
-        when(cbsClient.updates(any(), any(), any())).thenReturn(Flux.just(configAsJson));
+        when(cbsClient.get(any())).thenReturn(Mono.just(configAsJson));
         doNothing().when(refreshTaskUnderTest).runRicSynchronization(any(Ric.class));
 
         Flux<Type> task = refreshTaskUnderTest.createRefreshTask();
diff --git a/policy-agent/src/test/resources/test_osc_get_schema_response.json b/policy-agent/src/test/resources/test_osc_get_schema_response.json
new file mode 100644 (file)
index 0000000..537d86f
--- /dev/null
@@ -0,0 +1,45 @@
+{
+  "name": "pt1",
+  "description": "pt1 policy type",
+  "policy_type_id": 1,
+  "create_schema": {
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "OSC_Type1_1.0.0",
+    "description": "Type 1 policy type",
+    "type": "object",
+    "properties": {
+      "scope": {
+        "type": "object",
+        "properties": {
+          "ueId": {
+            "type": "string"
+          },
+          "qosId": {
+            "type": "string"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "ueId",
+          "qosId"
+        ]
+      },
+      "qosObjective": {
+        "type": "object",
+        "properties": {
+          "priorityLevel": {
+            "type": "number"
+          }
+        },
+        "additionalProperties": false,
+        "required": [
+          "priorityLevel"
+        ]
+      }
+    },
+    "additionalProperties": false,
+    "required": [
+      "scope", "qosObjective"
+    ]
+  }
+}
index 477707b..bd0d366 100644 (file)
@@ -1,6 +1,12 @@
 # O-RAN-SC Non-RealTime RIC - A1 Controller
 
-SDNC provides Northbound Interface for A1 operation to do policy management on XAPPS's in Near-RealTime RIC's.
+SDNC-A1 controller provides a Northbound Interface for A1 operations to do policy management in Near-RealTime RICs.
+
+It is a very lightweight version of ONAP SDNC.
+
+Many features/components of SDNC that are not needed for A1 operations have been removed from both northbound and oam directories.
+
+This makes it very fast to start the controller and also puts less load on the CPU.
 
 Please see the documentation in the docs/ folder
 
index f5ae129..0a325f0 100644 (file)
@@ -1,9 +1,8 @@
-This source repository contains the code for the SDN Controller northbound interface adaptors.
-To compile this code:
+This source repository contains the code for the SDNC-A1 Controller northbound interface.
 
-1. Make sure your local Maven settings file ($HOME/.m2/settings.xml) contains references to the OpenECOMP repositories and OpenDaylight repositories.  See example-settings.xml for an example.
+It contains an OSGI bundle named "nonrt-ric-api" that provides the interface for A1 operations.
 
-2. To compile, run "mvn clean install".
+To compile, run "mvn clean install".
 
 ## License
 
         <relativePath/>
     </parent>
 
-    <groupId>org.onap.sdnc.northbound</groupId>
-    <artifactId>features-sdnc-northbound</artifactId>
+    <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
+    <artifactId>features-sdnc-a1-northbound</artifactId>
     <version>1.7.3-SNAPSHOT</version>
     <packaging>feature</packaging>
 
-    <name>sdnc-northbound :: features :: ${project.artifactId}</name>
+    <name>sdnc-a1-northbound :: features :: ${project.artifactId}</name>
 
     <dependencies>
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>sdnc-northbound-all</artifactId>
+            <artifactId>sdnc-a1-northbound-all</artifactId>
             <version>${project.version}</version>
             <type>xml</type>
             <classifier>features</classifier>
index ea67490..d2e7dcc 100755 (executable)
@@ -9,24 +9,24 @@
                <relativePath/>
        </parent>
 
-       <groupId>org.onap.sdnc.northbound</groupId>
-       <artifactId>sdnc-northbound-features-installer</artifactId>
+       <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
+       <artifactId>sdnc-a1-northbound-features-installer</artifactId>
        <version>1.7.3-SNAPSHOT</version>
        <packaging>pom</packaging>
 
-       <name>sdnc-northbound :: features :: ${project.artifactId}</name>
+       <name>sdnc-a1-northbound :: features :: ${project.artifactId}</name>
 
        <properties>
-               <application.name>sdnc-northbound-all</application.name>
+               <application.name>sdnc-a1-northbound-all</application.name>
                <features.boot>${application.name}</features.boot>
-               <features.repositories>mvn:org.onap.sdnc.northbound/${features.boot}/${project.version}/xml/features</features.repositories>
+               <features.repositories>mvn:org.o-ran-sc.nonrtric.sdnc-a1.northbound/${features.boot}/${project.version}/xml/features</features.repositories>
                <include.transitive.dependencies>false</include.transitive.dependencies>
        </properties>
 
        <dependencies>
 
                <dependency>
-                       <groupId>org.onap.sdnc.northbound</groupId>
+                       <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
                        <artifactId>${application.name}</artifactId>
                        <version>${project.version}</version>
                        <type>xml</type>
@@ -98,7 +98,7 @@
                                                        <useRepositoryLayout>true</useRepositoryLayout>
                                                        <addParentPoms>false</addParentPoms>
                                                        <copyPom>false</copyPom>
-                             <includeGroupIds>org.onap.sdnc.northbound</includeGroupIds>
+                             <includeGroupIds>org.o-ran-sc.nonrtric.sdnc-a1.northbound</includeGroupIds>
                                                        <scope>provided</scope>
                                                </configuration>
                                        </execution>
index 37336a2..43302a5 100755 (executable)
@@ -9,16 +9,16 @@
                <relativePath/>
        </parent>
 
-       <groupId>org.onap.sdnc.northbound</groupId>
+       <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
        <artifactId>sdnc-northbound-feature-aggregator</artifactId>
        <version>1.7.3-SNAPSHOT</version>
        <packaging>pom</packaging>
 
-       <name>sdnc-northbound :: features</name>
+       <name>sdnc-a1-northbound :: features</name>
 
        <modules>
-        <module>sdnc-northbound-all</module>
-        <module>features-sdnc-northbound</module>
+        <module>sdnc-a1-northbound-all</module>
+        <module>features-sdnc-a1-northbound</module>
         <module>installer</module>
     </modules>
 </project>
                <relativePath/>
        </parent>
 
-       <groupId>org.onap.sdnc.northbound</groupId>
-       <artifactId>sdnc-northbound-all</artifactId>
+       <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
+       <artifactId>sdnc-a1-northbound-all</artifactId>
        <version>1.7.3-SNAPSHOT</version>
        <packaging>feature</packaging>
 
-       <name>sdnc-northbound :: features :: ${project.artifactId}</name>
+       <name>sdnc-a1-northbound :: features :: ${project.artifactId}</name>
        <dependencyManagement>
            <dependencies>
                <dependency>
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/features/ccsdk-dblib/pom.xml b/sdnc-a1-controller/northbound/nonrt-ric-api/features/ccsdk-dblib/pom.xml
deleted file mode 100644 (file)
index 5c9ae5e..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ============LICENSE_START=======================================================
-   Copyright (C) 2020 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=========================================================
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-       <modelVersion>4.0.0</modelVersion>
-
-       <parent>
-               <groupId>org.onap.ccsdk.parent</groupId>
-               <artifactId>single-feature-parent</artifactId>
-               <version>1.4.3</version>
-               <relativePath/>
-       </parent>
-
-       <groupId>org.onap.ccsdk.sli.core</groupId>
-       <artifactId>ccsdk-dblib</artifactId>
-       <version>${ccsdk.sli.core.version}</version>
-       <packaging>feature</packaging>
-
-       <name>sdnc-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
-
-       <dependencies>
-               <dependency>
-                       <groupId>${project.groupId}</groupId>
-                       <artifactId>dblib-provider</artifactId>
-                       <version>${project.version}</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.mariadb.jdbc</groupId>
-                       <artifactId>mariadb-java-client</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.apache.tomcat</groupId>
-                       <artifactId>tomcat-jdbc</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.onap.ccsdk.sli.core</groupId>
-                       <artifactId>utils-provider</artifactId>
-                       <version>${project.version}</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.apache.derby</groupId>
-                       <artifactId>derby</artifactId>
-               </dependency>
-       </dependencies>
-
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.karaf.tooling</groupId>
-                               <artifactId>karaf-maven-plugin</artifactId>
-                               <extensions>true</extensions>
-                               <configuration>
-                                       <excludedArtifactIds>
-                                               <excludedArtifactId>slf4j-api</excludedArtifactId>
-                                               <excludedArtifactId>tomcat-jdbc</excludedArtifactId>
-                                               <excludedArtifactId>tomcat-juli</excludedArtifactId>
-                                       </excludedArtifactIds>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
-</project>
\ No newline at end of file
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/features/ccsdk-dblib/src/main/feature/feature.xml b/sdnc-a1-controller/northbound/nonrt-ric-api/features/ccsdk-dblib/src/main/feature/feature.xml
deleted file mode 100644 (file)
index 771c374..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="ccsdk-dblib">
-
-    <feature name="ccsdk-dblib" description="ccsdk-sli-core :: dblib :: ccsdk-dblib" version="${project.version}">
-        <details>Root POM to be used in place of odlparent for CCSDK based projects</details>
-        <feature prerequisite="true" dependency="false">wrap</feature>
-        <bundle>mvn:org.onap.ccsdk.sli.core/dblib-provider/${project.version}</bundle>
-        <bundle>mvn:org.mariadb.jdbc/mariadb-java-client/${mariadb.connector.version}</bundle>
-        <bundle>wrap:mvn:org.apache.tomcat/tomcat-jdbc/${tomcat-jdbc.version}/$DynamicImport-Package=org.mariadb.*,org.apache.derby.*&amp;overwrite=merge</bundle>
-        <bundle>wrap:mvn:org.apache.tomcat/tomcat-juli/${tomcat-jdbc.version}/$DynamicImport-Package=org.mariadb.*,org.apache.derby.*&amp;overwrite=merge</bundle>
-        <bundle>mvn:org.onap.ccsdk.sli.core/utils-provider/${project.version}</bundle>
-    </feature>
-</features>
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/features/ccsdk-sli/pom.xml b/sdnc-a1-controller/northbound/nonrt-ric-api/features/ccsdk-sli/pom.xml
deleted file mode 100644 (file)
index feacb4e..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ============LICENSE_START=======================================================
-   Copyright (C) 2020 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=========================================================
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-       <modelVersion>4.0.0</modelVersion>
-
-       <parent>
-               <groupId>org.onap.ccsdk.parent</groupId>
-               <artifactId>single-feature-parent</artifactId>
-               <version>1.4.3</version>
-               <relativePath/>
-       </parent>
-
-       <groupId>org.onap.ccsdk.sli.core</groupId>
-       <artifactId>ccsdk-sli</artifactId>
-       <version>${ccsdk.sli.core.version}</version>
-       <packaging>feature</packaging>
-
-       <name>sdnc-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
-
-       <dependencies>
-               <dependency>
-                       <groupId>org.onap.ccsdk.sli.core</groupId>
-                       <artifactId>sli-common</artifactId>
-                       <version>${project.version}</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.onap.ccsdk.sli.core</groupId>
-                       <artifactId>sli-provider</artifactId>
-                       <version>${project.version}</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.onap.ccsdk.sli.core</groupId>
-                       <artifactId>dblib-provider</artifactId>
-                       <version>${project.version}</version>
-                       <scope>provided</scope>
-               </dependency>
-               <dependency>
-                       <groupId>org.mariadb.jdbc</groupId>
-                       <artifactId>mariadb-java-client</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.onap.ccsdk.sli.core</groupId>
-                       <artifactId>ccsdk-dblib</artifactId>
-                       <version>${project.version}</version>
-                       <type>xml</type>
-                       <classifier>features</classifier>
-               </dependency>
-       </dependencies>
-</project>
\ No newline at end of file
index 8a2a516..10b5d43 100644 (file)
                <relativePath/>
        </parent>
 
-       <groupId>org.onap.sdnc.northbound</groupId>
+       <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
        <artifactId>features-nonrt-ric-api</artifactId>
        <version>1.7.3-SNAPSHOT</version>
        <packaging>feature</packaging>
 
-       <name>sdnc-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
+       <name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
 
        <dependencies>
                <dependency>
index c05b80e..a83de20 100644 (file)
         <relativePath/>
     </parent>
 
-    <groupId>org.onap.sdnc.northbound</groupId>
+    <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
     <artifactId>nonrt-ric-api-features</artifactId>
     <version>1.7.3-SNAPSHOT</version>
     <packaging>pom</packaging>
 
-    <name>sdnc-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
+    <name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
 
     <modules>
         <module>sdnc-nonrt-ric-api</module>
         <module>features-nonrt-ric-api</module>
-       <module>ccsdk-sli</module>
-       <module>ccsdk-dblib</module>
     </modules>
 </project>
index b58293d..f39d9ca 100644 (file)
         <relativePath/>
     </parent>
 
-    <groupId>org.onap.sdnc.northbound</groupId>
+    <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
     <artifactId>sdnc-nonrt-ric-api</artifactId>
     <version>1.7.3-SNAPSHOT</version>
     <packaging>feature</packaging>
 
-    <name>sdnc-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
+    <name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
 
     <dependencies>
         <dependency>
index 966686b..2532d11 100755 (executable)
                <relativePath/>
        </parent>
 
-       <groupId>org.onap.sdnc.northbound</groupId>
+       <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
        <artifactId>nonrt-ric-api-installer</artifactId>
        <version>1.7.3-SNAPSHOT</version>
        <packaging>pom</packaging>
 
-       <name>sdnc-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
+       <name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
 
        <properties>
                <application.name>sdnc-nonrt-ric-api</application.name>
                <features.boot>${application.name}</features.boot>
-               <features.repositories>mvn:org.onap.sdnc.northbound/${application.name}/${project.version}/xml/features</features.repositories>
+               <features.repositories>mvn:org.o-ran-sc.nonrtric.sdnc-a1.northbound/${application.name}/${project.version}/xml/features</features.repositories>
                <include.transitive.dependencies>false</include.transitive.dependencies>
        </properties>
 
        <dependencies>
 
                <dependency>
-                       <groupId>org.onap.sdnc.northbound</groupId>
+                       <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
                        <artifactId>${application.name}</artifactId>
                        <version>${project.version}</version>
                        <type>xml</type>
@@ -59,7 +59,7 @@
                </dependency>
 
                <dependency>
-                       <groupId>org.onap.sdnc.northbound</groupId>
+                       <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
                        <artifactId>nonrt-ric-api-provider</artifactId>
                        <version>${project.version}</version>
                </dependency>
                                                        <useRepositoryLayout>true</useRepositoryLayout>
                                                        <addParentPoms>false</addParentPoms>
                                                        <copyPom>false</copyPom>
-                                                       <includeGroupIds>org.onap.sdnc.northbound</includeGroupIds>
+                                                       <includeGroupIds>org.o-ran-sc.nonrtric.sdnc-a1.northbound</includeGroupIds>
                                                        <scope>provided</scope>
                                                </configuration>
                                        </execution>
index ea5ed71..7d45eb5 100644 (file)
         <relativePath/>
     </parent>
 
-    <groupId>org.onap.sdnc.northbound</groupId>
+    <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
     <artifactId>nonrt-ric-api-model</artifactId>
     <version>1.7.3-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
-    <name>sdnc-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
+    <name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
 
     <dependencies>
         <dependency>
             <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
             <artifactId>rfc6991</artifactId>
         </dependency>
-
-        
     </dependencies>
 
     <build>
index 1933660..34c0a72 100644 (file)
@@ -19,7 +19,7 @@
 //\r
 module A1-ADAPTER-API {\r
 \r
-    namespace "org:onap:sdnc:northbound:a1-adapter";\r
+    namespace "org:o_ran_sc:nonrtric:sdnc_a1:northbound:a1-adapter";\r
 \r
     prefix a1-adapter-api;\r
 \r
index 44b02e2..2868a0c 100644 (file)
                <relativePath />
        </parent>
 
-       <groupId>org.onap.sdnc.northbound</groupId>
+       <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
        <artifactId>nonrt-ric-api</artifactId>
        <version>1.7.3-SNAPSHOT</version>
        <packaging>pom</packaging>
 
-       <name>sdnc-northbound :: nonrt-ric-api</name>
+       <name>sdnc-a1-northbound :: nonrt-ric-api</name>
 
        <properties>
                <sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
index e3c7ab9..02e32e7 100644 (file)
         <relativePath/>
     </parent>
 
-    <groupId>org.onap.sdnc.northbound</groupId>
+    <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
     <artifactId>nonrt-ric-api-provider</artifactId>
     <version>1.7.3-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
-    <name>sdnc-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
+    <name>sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId}</name>
 
     <build>
         <plugins>
@@ -93,7 +93,7 @@
        </dependencyManagement>
     <dependencies>
         <dependency>
-            <groupId>org.onap.sdnc.northbound</groupId>
+            <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
             <artifactId>nonrt-ric-api-model</artifactId>
             <version>${project.version}</version>
         </dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.onap.ccsdk.sli.core</groupId>
             <artifactId>sli-common</artifactId>
@@ -18,7 +18,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.sdnc.northbound.provider;
+package org.o_ran_sc.nonrtric.sdnc_a1.northbound.provider;
 
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
@@ -26,31 +26,31 @@ import com.google.common.util.concurrent.ListenableFuture;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import org.onap.sdnc.northbound.restadapter.RestAdapter;
-import org.onap.sdnc.northbound.restadapter.RestAdapterImpl;
+import org.o_ran_sc.nonrtric.sdnc_a1.northbound.restadapter.RestAdapter;
+import org.o_ran_sc.nonrtric.sdnc_a1.northbound.restadapter.RestAdapterImpl;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.A1ADAPTERAPIService;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.DeleteA1PolicyInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.DeleteA1PolicyOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.DeleteA1PolicyOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyStatusInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyStatusOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyStatusOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyTypeInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyTypeOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyTypeOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.PutA1PolicyInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.PutA1PolicyOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.PutA1PolicyOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.A1ADAPTERAPIService;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.DeleteA1PolicyInput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.DeleteA1PolicyOutput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.DeleteA1PolicyOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyInput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyInputBuilder;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyOutput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyStatusInput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyStatusOutput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyStatusOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyTypeInput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyTypeOutput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyTypeOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.PutA1PolicyInput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.PutA1PolicyOutput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.PutA1PolicyOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/restadapter/RestAdapterImpl.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/restadapter/RestAdapterImpl.java
new file mode 100644 (file)
index 0000000..d317e56
--- /dev/null
@@ -0,0 +1,143 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 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.o_ran_sc.nonrtric.sdnc_a1.northbound.restadapter;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.KeyManagementException;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import java.util.Properties;
+import org.apache.http.client.HttpClient;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContexts;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.util.ResourceUtils;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * This class provides the Generic Rest Adapter interface to the RestTemplate
+ *
+ * @author lathishbabu.ganesan@est.tech
+ *
+ */
+
+public class RestAdapterImpl implements RestAdapter {
+
+  private static final String PROPERTIES_FILE = "nonrt-ric-api-provider.properties";
+  private final Logger log = LoggerFactory.getLogger(RestAdapterImpl.class);
+
+  private RestTemplate restTemplateHttp;
+  private RestTemplate restTemplateHttps;
+
+  public RestAdapterImpl() {
+      restTemplateHttp = new RestTemplate();
+      try {
+          restTemplateHttps = createRestTemplateForHttps();
+      } catch (IOException | UnrecoverableKeyException | KeyManagementException | CertificateException
+              | NoSuchAlgorithmException | KeyStoreException ex) {
+        log.error("Caught exception when trying to create restTemplateHttps: {}", ex.getMessage());
+      }
+  }
+
+  private RestTemplate createRestTemplateForHttps() throws IOException, UnrecoverableKeyException, CertificateException,
+              NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
+      InputStream inputStream = RestAdapterImpl.class.getClassLoader().getResourceAsStream(PROPERTIES_FILE);
+      if (inputStream == null) {
+          throw new FileNotFoundException("properties file not found in classpath");
+      } else {
+          Properties properties = new Properties();
+          properties.load(inputStream);
+          final String keystorePassword = properties.getProperty("key-store-password");
+          SSLConnectionSocketFactory scsf = new SSLConnectionSocketFactory(
+                  SSLContexts.custom()
+                             .loadKeyMaterial(ResourceUtils.getFile(properties.getProperty("key-store")),
+                                     keystorePassword.toCharArray(), keystorePassword.toCharArray())
+                             .loadTrustMaterial(null, new TrustSelfSignedStrategy())
+                             .build(),
+                  NoopHostnameVerifier.INSTANCE);
+          HttpClient client = HttpClients.custom().setSSLSocketFactory(scsf).build();
+          HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
+          requestFactory.setHttpClient(client);
+          inputStream.close();
+          return new RestTemplate(requestFactory);
+      }
+  }
+
+  private HttpEntity<?> getHttpEntity(final Object object) {
+    return new HttpEntity<>(object);
+  }
+
+  @Override
+  public <T> ResponseEntity<T> get(String uri, Class<?> clazz) {
+    HttpEntity<?> entity = getHttpEntity(null);
+    return invokeHttpRequest(uri, HttpMethod.GET, clazz, entity);
+  }
+
+  @Override
+  public <T> ResponseEntity<T> put(String uri, String body, Class<T> clazz) {
+    HttpHeaders headers = new HttpHeaders();
+    headers.setContentType(MediaType.APPLICATION_JSON);
+    HttpEntity<String> entity = new HttpEntity<>(body, headers);
+    return invokeHttpRequest(uri, HttpMethod.PUT, clazz, entity);
+  }
+
+  @Override
+  public <T> ResponseEntity<T> delete(String uri) {
+    HttpEntity<?> entity = getHttpEntity(null);
+    return invokeHttpRequest(uri, HttpMethod.DELETE, null, entity);
+  }
+
+  @SuppressWarnings("unchecked")
+  private <T> ResponseEntity<T> invokeHttpRequest(String uri, HttpMethod httpMethod, Class<?> clazz,
+      HttpEntity<?> entity) {
+    try {
+        URL url = new URL(uri);
+        if (url.getProtocol().equals("https")) {
+            return (ResponseEntity<T>) restTemplateHttps.exchange(uri, httpMethod, entity, clazz);
+        } else if (url.getProtocol().equals("http")) {
+            return (ResponseEntity<T>) restTemplateHttp.exchange(uri, httpMethod, entity, clazz);
+        } else {
+            log.error("Invalid protocol in URL");
+            return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
+        }
+    } catch (MalformedURLException ex) {
+        log.error("URL is not valid, exception: {}", ex.getMessage());
+        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
+    }
+  }
+}
\ No newline at end of file
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadapter/RestAdapterImpl.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadapter/RestAdapterImpl.java
deleted file mode 100644 (file)
index 9e9d28a..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 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.sdnc.northbound.restadapter;
-
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.RestTemplate;
-
-/**
- * This class provides the Generic Rest Adapter interface to the RestTemplate
- *
- * @author lathishbabu.ganesan@est.tech
- *
- */
-
-public class RestAdapterImpl implements RestAdapter {
-
-  private RestTemplate restTemplate;
-
-  public RestAdapterImpl() {
-    restTemplate = new RestTemplate();
-  }
-
-  private HttpEntity<?> getHttpEntity(final Object object) {
-    return new HttpEntity<>(object);
-  }
-
-  @Override
-  public <T> ResponseEntity<T> get(String uri, Class<?> clazz) {
-    HttpEntity<?> entity = getHttpEntity(null);
-    return invokeHttpRequest(uri, HttpMethod.GET, clazz, entity);
-  }
-
-  @Override
-  public <T> ResponseEntity<T> put(String uri, String body, Class<T> clazz) {
-    HttpHeaders headers = new HttpHeaders();
-    headers.setContentType(MediaType.APPLICATION_JSON);
-    HttpEntity<String> entity = new HttpEntity<>(body, headers);
-    return invokeHttpRequest(uri, HttpMethod.PUT, clazz, entity);
-  }
-
-  @Override
-  public <T> ResponseEntity<T> delete(String uri) {
-    HttpEntity<?> entity = getHttpEntity(null);
-    return invokeHttpRequest(uri, HttpMethod.DELETE, null, entity);
-  }
-
-  @SuppressWarnings("unchecked")
-  private <T> ResponseEntity<T> invokeHttpRequest(String uri, HttpMethod httpMethod, Class<?> clazz,
-      HttpEntity<?> entity) {
-    return (ResponseEntity<T>) restTemplate.exchange(uri, httpMethod, entity, clazz);
-  }
-}
index 3f732ab..53c1509 100644 (file)
@@ -34,7 +34,7 @@
                interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
                odl:type="default" />
 
-    <bean id="provider" class="org.onap.sdnc.northbound.provider.NonrtRicApiProvider">
+    <bean id="provider" class="org.o_ran_sc.nonrtric.sdnc_a1.northbound.provider.NonrtRicApiProvider">
         <argument ref="dataBroker" />
         <argument ref="notificationService" />
         <argument ref="rpcRegistry" />
@@ -1,7 +1,7 @@
 # ========================LICENSE_START=================================
 # O-RAN-SC
 # %%
-# Copyright (C) 2019 Nordix Foundation
+# Copyright (C) 2020 Nordix Foundation
 # %%
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -16,8 +16,5 @@
 # limitations under the License.
 # ========================LICENSE_END===================================
 
-# Defines the list of Near-RT RICs that the SDNC can contact,
-# where key is nearRTRicId and value is domainname:port of a Near-RT Ric.
-
-NearRtRic1 = nearRtRic-sim1:8080
-NearRtRic2 = nearRtRic-sim2:8080
\ No newline at end of file
+key-store-password = sdnc-a1-controller
+key-store = /etc/ssl/certs/java/keystore.jks
\ No newline at end of file
index 3f732ab..53c1509 100644 (file)
@@ -34,7 +34,7 @@
                interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
                odl:type="default" />
 
-    <bean id="provider" class="org.onap.sdnc.northbound.provider.NonrtRicApiProvider">
+    <bean id="provider" class="org.o_ran_sc.nonrtric.sdnc_a1.northbound.provider.NonrtRicApiProvider">
         <argument ref="dataBroker" />
         <argument ref="notificationService" />
         <argument ref="rpcRegistry" />
@@ -18,7 +18,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.sdnc.northbound;
+package org.o_ran_sc.nonrtric.sdnc_a1.northbound;
 
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.when;
@@ -32,22 +32,22 @@ import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.internal.util.reflection.Whitebox;
 import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.sdnc.northbound.provider.NonrtRicApiProvider;
-import org.onap.sdnc.northbound.restadapter.RestAdapter;
+import org.o_ran_sc.nonrtric.sdnc_a1.northbound.provider.NonrtRicApiProvider;
+import org.o_ran_sc.nonrtric.sdnc_a1.northbound.restadapter.RestAdapter;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.DeleteA1PolicyInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.DeleteA1PolicyOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyStatusInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyStatusOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyTypeInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.GetA1PolicyTypeOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.PutA1PolicyInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev200122.PutA1PolicyOutput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.DeleteA1PolicyInputBuilder;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.DeleteA1PolicyOutput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyInputBuilder;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyOutput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyStatusInputBuilder;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyStatusOutput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyTypeInputBuilder;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.GetA1PolicyTypeOutput;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.PutA1PolicyInputBuilder;
+import org.opendaylight.yang.gen.v1.org.o_ran_sc.nonrtric.sdnc_a1.northbound.a1.adapter.rev200122.PutA1PolicyOutput;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index b243d71..6e0878c 100644 (file)
@@ -36,8 +36,8 @@
                <relativePath/>
        </parent>
 
-       <groupId>org.onap.sdnc.northbound</groupId>
-       <artifactId>sdnc-northbound</artifactId>
+       <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
+       <artifactId>sdnc-a1-northbound</artifactId>
        <version>1.7.3-SNAPSHOT</version>
        <packaging>pom</packaging>
 
@@ -45,7 +45,7 @@
                <sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
        </properties>
 
-       <name>sdnc-northbound</name>
+       <name>sdnc-a1-northbound</name>
        <description>The SDN-C Northbound APIs repo contains code for northbound API adaptors, typically MD-SAL applications</description>
        <url>https://wiki.onap.org</url>
        <organization>
                <module>nonrt-ric-api</module>
        </modules>
 
-       <scm>
-               <connection>scm:git:ssh://git@${onap.git.host}/sdnc-northbound.git</connection>
-
-               <developerConnection>scm:git:ssh://${onap.git.host}:${onap.git.port}/${onap.git.project}/sdnc-northbound.git</developerConnection>
-               <url>${onap.git.protocol}://${onap.git.host}/projects/${onap.git.project}/repos/sdnc-northbound/browse</url>
-       </scm>
-       <issueManagement>
-               <system>JIRA</system>
-               <url>https://jira.onap.org/</url>
-       </issueManagement>
-       <ciManagement>
-               <system>Jenkins</system>
-               <url>https://jenkins.onap.org/</url>
-       </ciManagement>
-       <distributionManagement>
-               <site>
-                       <id>sdnc-javadoc</id>
-                       <url>dav:https://${onap.nexus.host}:${onap.nexus.port}/repository/sdn-c-javadoc/${project.artifactId}/${project.version}</url>
-               </site>
-       </distributionManagement>
-
        <build>
                <plugins>
                        <plugin>
                </plugins>
        </build>
 
-       <profiles>
-               <profile>
-                       <id>blackduck</id>
-                       <activation>
-                               <property>
-                                       <name>blackduck-scan</name>
-                               </property>
-                       </activation>
-                       <build>
-                                       <plugins>
-                                               <plugin>
-                                                       <groupId>com.blackducksoftware.integration</groupId>
-                                                       <artifactId>hub-maven-plugin</artifactId>
-                                                       <version>1.4.0</version>
-                                                       <inherited>false</inherited>
-                                                       <configuration>
-                                                               <hubProjectName>${project.name}</hubProjectName>
-                                                               <outputDirectory>${project.basedir}</outputDirectory>
-                                                       </configuration>
-                                                       <executions>
-                                                               <execution>
-                                                                       <id>create-bdio-file</id>
-                                                                       <phase>package</phase>
-                                                                       <goals>
-                                                                               <goal>createHubOutput</goal>
-                                                                       </goals>
-                                                               </execution>
-                                                       </executions>
-                                               </plugin>
-                                       </plugins>
-
-
-                       </build>
-
-               </profile>
-
-       </profiles>
 </project>
index 2cabf6b..ce55f56 100644 (file)
@@ -1,15 +1,12 @@
-This source repository contains the code for SDN Controller operations, administration and maintenance utilities. This code depends on the following, which should be downloaded and compiled first:
+This source repository contains the code for SDNC-A1 Controller operations, administration and maintenance utilities.
 
-1. org.openecomp.sdnc/sdnc-core
-2. org.openecomp.sdnc/sdnc-adaptors
-3. org.openecomp.sdnc/sdnc-northbound
-4. org.openecomp.sdnc/sdnc-plugins
+It adds the features from northbound directory and creates the docker image for SDNC-A1 controller.
 
-To compile this code:
+It also contains the keystore, the script to start OpenDaylight, and the healthcheck script.
 
-1. Make sure your local Maven settings file ($HOME/.m2/settings.xml) contains references to the OpenECOMP repositories and OpenDaylight repositories.  See example-settings.xml for an example.
+The docker-compose file is also included in this directory.
 
-2. To compile, run "mvn clean install".
+To compile, run "mvn clean install".
 
 ## License
 
index 9daac31..551eb70 100644 (file)
@@ -21,7 +21,7 @@
  *
  */
 
-package org.onap.sdnc.oam
+package org.o_ran_sc.nonrtric.sdnc_a1.oam
 
 
 def versionArray;
index 76ff884..0b64bca 100644 (file)
 
     <modelVersion>4.0.0</modelVersion>
     <packaging>pom</packaging>
-    <groupId>org.onap.sdnc.oam</groupId>
+    <groupId>org.o-ran-sc.nonrtric.sdnc-a1.oam</groupId>
     <artifactId>installation</artifactId>
     <version>1.7.3-SNAPSHOT</version>
 
-    <name>sdnc-oam :: installation</name>
+    <name>sdnc-a1-oam :: installation</name>
     <description>Installs SDN-C on local file system</description>
 
     <modules>
-        <module>sdnc</module>
+        <module>sdnc-a1</module>
     </modules>
 </project>
 
     <modelVersion>4.0.0</modelVersion>
     <packaging>pom</packaging>
-    <groupId>org.onap.sdnc.oam</groupId>
-    <artifactId>installation-sdnc</artifactId>
+    <groupId>org.o-ran-sc.nonrtric.sdnc-a1.oam</groupId>
+    <artifactId>installation-sdnc-a1</artifactId>
     <version>1.7.3-SNAPSHOT</version>
 
-    <name>sdnc-oam :: installation :: ${project.artifactId}</name>
+    <name>sdnc-a1-oam :: installation :: ${project.artifactId}</name>
     <description>Creates SDN Controller Docker container</description>
 
     <properties>
         <sdnc.build.timestamp>${maven.build.timestamp}</sdnc.build.timestamp>
         <sdnc.northbound.version>1.7.3-SNAPSHOT</sdnc.northbound.version>
         <ccsdk.docker.version>0.6.3</ccsdk.docker.version>
-        <sdnc.keystore>org.onap.sdnc.p12</sdnc.keystore>
-        <sdnc.keypass><![CDATA[ff^G9D]yf&r}Ktum@BJ0YB?N]]></sdnc.keypass>
-        <sdnc.secureport>8443</sdnc.secureport>
         <docker.push.phase>deploy</docker.push.phase>
     </properties>
 
     <dependencies>
         <dependency>
-            <groupId>org.onap.sdnc.northbound</groupId>
+            <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
             <artifactId>nonrt-ric-api-installer</artifactId>
             <version>${sdnc.northbound.version}</version>
             <classifier>repo</classifier>
             <type>zip</type>
         </dependency>
         <dependency>
-            <groupId>org.onap.sdnc.northbound</groupId>
-            <artifactId>sdnc-northbound-features-installer</artifactId>
+            <groupId>org.o-ran-sc.nonrtric.sdnc-a1.northbound</groupId>
+            <artifactId>sdnc-a1-northbound-features-installer</artifactId>
             <version>${sdnc.northbound.version}</version>
             <classifier>repo</classifier>
             <type>zip</type>
                                     <directory>src/main/resources</directory>
                                     <includes>
                                         <include>idmlight.db.mv.db</include>
-                                        <include>truststoreONAPall.jks</include>
+                                        <include>keystore.jks</include>
                                         <include>aaa-app-config.xml</include>
                                     </includes>
                                     <filtering>false</filtering>
                             </resources>
                         </configuration>
                     </execution>
-                    <execution>
-                        <id>copy-keystores</id>
-                        <goals>
-                            <goal>copy-resources</goal>
-                        </goals><!-- here the phase you need -->
-                        <phase>validate</phase>
-                        <configuration>
-                            <outputDirectory>${basedir}/target/docker-stage/opt/onap/sdnc/data/stores</outputDirectory>
-                            <resources>
-                                <resource>
-                                    <directory>../src/main/stores</directory>
-                                    <includes>
-                                        <include>*.jks</include>
-                                        <include>*.keyfile</include>
-                                        <include>*.p12</include>
-                                    </includes>
-                                    <filtering>false</filtering>
-                                </resource>
-                            </resources>
-                        </configuration>
-                    </execution>
                 </executions>
             </plugin>
             <plugin>
@@ -20,18 +20,16 @@ RUN rsync -a /tmp/system $ODL_HOME
 
 FROM nexus3.onap.org:10001/onap/ccsdk-odlsli-alpine-image:${ccsdk.docker.version}
 
-MAINTAINER SDN-C Team (sdnc@lists.onap.org)
+MAINTAINER O-RAN-SC NONRTRIC Team
 
 ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk
 ENV ODL_HOME /opt/opendaylight
 ENV SDNC_CONFIG_DIR /opt/onap/sdnc/data/properties
-ENV SDNC_STORE_DIR /opt/onap/sdnc/data/stores
-ENV SSL_CERTS_DIR /etc/ssl/certs
-ENV JAVA_SECURITY_DIR $SSL_CERTS_DIR/java
-ENV SDNC_NORTHBOUND_REPO mvn:org.onap.sdnc.northbound/sdnc-northbound-all/${sdnc.northbound.version}/xml/features
-ENV SDNC_KEYSTORE ${sdnc.keystore}
-ENV SDNC_KEYPASS ${sdnc.keypass}
-ENV SDNC_SECUREPORT ${sdnc.secureport}
+ENV JAVA_SECURITY_DIR /etc/ssl/certs/java
+ENV SDNC_NORTHBOUND_REPO mvn:org.o-ran-sc.nonrtric.sdnc-a1.northbound/sdnc-a1-northbound-all/${sdnc.northbound.version}/xml/features
+ENV SDNC_KEYSTORE keystore.jks
+ENV SDNC_KEYPASS sdnc-a1-controller
+ENV SDNC_SECUREPORT 8443
 
 USER root
 
@@ -40,18 +38,16 @@ COPY --from=stage0 --chown=odl:odl /opt /opt
 # Add SDNC repositories to boot repositories
 RUN cp $ODL_HOME/etc/org.apache.karaf.features.cfg $ODL_HOME/etc/org.apache.karaf.features.cfg.orig
 RUN sed -i -e "\|featuresRepositories|s|$|,${SDNC_NORTHBOUND_REPO}|"  $ODL_HOME/etc/org.apache.karaf.features.cfg
-RUN sed -i -e "\|featuresBoot[^a-zA-Z]|s|$|,sdnc-northbound-all|"  $ODL_HOME/etc/org.apache.karaf.features.cfg
+RUN sed -i -e "\|featuresBoot[^a-zA-Z]|s|$|,sdnc-a1-northbound-all|"  $ODL_HOME/etc/org.apache.karaf.features.cfg
 RUN sed -i "s/odl-restconf-all/odl-restconf-all,odl-netconf-topology/g"  $ODL_HOME/etc/org.apache.karaf.features.cfg
 
-# Install ssl and java certificates
-COPY truststoreONAPall.jks $JAVA_SECURITY_DIR
-COPY truststoreONAPall.jks $SDNC_STORE_DIR
-RUN keytool -importkeystore -srckeystore $JAVA_SECURITY_DIR/truststoreONAPall.jks -srcstorepass changeit -destkeystore $JAVA_SECURITY_DIR/cacerts  -deststorepass changeit
+# Install java certificate
+COPY $SDNC_KEYSTORE $JAVA_SECURITY_DIR
 
 # Secure with TLS
 RUN echo org.osgi.service.http.secure.enabled=true >> $ODL_HOME/etc/custom.properties
 RUN echo org.osgi.service.http.secure.port=$SDNC_SECUREPORT >> $ODL_HOME/etc/custom.properties
-RUN echo org.ops4j.pax.web.ssl.keystore=$SDNC_STORE_DIR/$SDNC_KEYSTORE >> $ODL_HOME/etc/custom.properties
+RUN echo org.ops4j.pax.web.ssl.keystore=$JAVA_SECURITY_DIR/$SDNC_KEYSTORE >> $ODL_HOME/etc/custom.properties
 RUN echo org.ops4j.pax.web.ssl.password=$SDNC_KEYPASS >> $ODL_HOME/etc/custom.properties
 RUN echo org.ops4j.pax.web.ssl.keypassword=$SDNC_KEYPASS >> $ODL_HOME/etc/custom.properties
 
@@ -60,4 +56,4 @@ RUN chown -R odl:odl /opt
 USER odl
 
 ENTRYPOINT /opt/onap/sdnc/bin/startODL.sh
-EXPOSE 8181
+EXPOSE 8181 $SDNC_SECUREPORT
diff --git a/sdnc-a1-controller/oam/installation/sdnc-a1/src/main/resources/keystore.jks b/sdnc-a1-controller/oam/installation/sdnc-a1/src/main/resources/keystore.jks
new file mode 100644 (file)
index 0000000..705b284
Binary files /dev/null and b/sdnc-a1-controller/oam/installation/sdnc-a1/src/main/resources/keystore.jks differ
diff --git a/sdnc-a1-controller/oam/installation/sdnc-a1/src/main/scripts/healthcheck.py b/sdnc-a1-controller/oam/installation/sdnc-a1/src/main/scripts/healthcheck.py
new file mode 100644 (file)
index 0000000..35a1d4b
--- /dev/null
@@ -0,0 +1,68 @@
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 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=========================================================
+#
+
+
+# coding=utf-8
+import os
+import httplib
+import base64
+import time
+
+username = os.environ['ODL_ADMIN_USERNAME']
+password = os.environ['ODL_ADMIN_PASSWORD']
+TIMEOUT=1000
+INTERVAL=30
+timePassed=0
+
+headers = {'Authorization':'Basic %s' % base64.b64encode(username + ":" + password),
+           'X-FromAppId': 'csit-sdnc',
+           'X-TransactionId': 'csit-sdnc',
+           'Accept':"application/json",
+           'Content-type':"application/json"}
+
+def makeHealthcheckCall(headers, timePassed):
+    connected = False
+    # WAIT 10 minutes maximum and test every 30 seconds if HealthCheck API is returning 200
+    while timePassed < TIMEOUT:
+        try:
+            conn = httplib.HTTPConnection("localhost",8181)
+            req = conn.request("POST", "/restconf/operations/SLI-API:healthcheck",headers=headers)
+            res = conn.getresponse()
+            res.read()
+            if res.status == 200:
+                print ("Healthcheck Passed in %d seconds." %timePassed)
+                connected = True
+                break
+            else:
+                print ("Sleep: %d seconds before testing if Healthcheck worked. Total wait time up now is: %d seconds. Timeout is: %d seconds" %(INTERVAL, timePassed, TIMEOUT))
+        except:
+            print ("Cannot execute REST call. Sleep: %d seconds before testing if Healthcheck worked. Total wait time up now is: %d seconds. Timeout is: %d seconds" %(INTERVAL, timePassed, TIMEOUT))
+        timePassed = timeIncrement(timePassed)
+
+    if timePassed > TIMEOUT:
+        print ("TIME OUT: Healthcheck not passed in  %d seconds... Could cause problems for testing activities..." %TIMEOUT)
+    return connected
+
+
+def timeIncrement(timePassed):
+    time.sleep(INTERVAL)
+    timePassed = timePassed + INTERVAL
+    return timePassed
+
+makeHealthcheckCall(headers, timePassed)
@@ -51,10 +51,8 @@ fi
 
 if [ ! -f ${INSTALLED_DIR}/.installed ]
 then
-       echo "Installing SDN-C database"
+       echo "Installing SDNC-A1 database"
        ${SDNC_HOME}/bin/installSdncDb.sh
-       echo "Installing SDN-C keyStore"
-       ${SDNC_HOME}/bin/addSdncKeyStore.sh
 
        if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
        then
@@ -63,8 +61,6 @@ then
        fi
 fi
 
-cp /opt/opendaylight/current/certs/* /tmp
-
-nohup python ${SDNC_BIN}/installCerts.py &
+nohup python ${SDNC_BIN}/healthcheck.py &
 
 exec ${ODL_HOME}/bin/karaf server
diff --git a/sdnc-a1-controller/oam/installation/sdnc/src/main/resources/truststoreONAPall.jks b/sdnc-a1-controller/oam/installation/sdnc/src/main/resources/truststoreONAPall.jks
deleted file mode 100755 (executable)
index ff844b1..0000000
Binary files a/sdnc-a1-controller/oam/installation/sdnc/src/main/resources/truststoreONAPall.jks and /dev/null differ
diff --git a/sdnc-a1-controller/oam/installation/sdnc/src/main/scripts/addSdncKeyStore.sh b/sdnc-a1-controller/oam/installation/sdnc/src/main/scripts/addSdncKeyStore.sh
deleted file mode 100755 (executable)
index c6f0e5a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc}
-
-keyStoreFile=${SDNC_HOME}/data/stores/sdnc.p12
-
-if [ ! -f ${keyStoreFile} ]
-then
-  keytool -genkeypair -dname "CN=SDNC, OU=ONAP, O=ONAP, L=, S=, C=" -alias sdncKey -keyalg RSA -keysize 1024 -keystore $keyStoreFile -storepass adminadmin -storetype pkcs12
-fi
-
diff --git a/sdnc-a1-controller/oam/installation/sdnc/src/main/scripts/installCerts.py b/sdnc-a1-controller/oam/installation/sdnc/src/main/scripts/installCerts.py
deleted file mode 100644 (file)
index 17ada4c..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-# ============LICENSE_START=======================================================
-#  Copyright (C) 2019 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=========================================================
-#
-
-
-# coding=utf-8
-import os
-import httplib
-import base64
-import time
-import zipfile
-import shutil
-
-Path = "/tmp"
-
-zipFileList = []
-
-username = os.environ['ODL_ADMIN_USERNAME']
-password = os.environ['ODL_ADMIN_PASSWORD']
-TIMEOUT=1000
-INTERVAL=30
-timePassed=0
-
-postKeystore= "/restconf/operations/netconf-keystore:add-keystore-entry"
-postPrivateKey= "/restconf/operations/netconf-keystore:add-private-key"
-postTrustedCertificate= "/restconf/operations/netconf-keystore:add-trusted-certificate"
-
-
-headers = {'Authorization':'Basic %s' % base64.b64encode(username + ":" + password),
-           'X-FromAppId': 'csit-sdnc',
-           'X-TransactionId': 'csit-sdnc',
-           'Accept':"application/json",
-           'Content-type':"application/json"}
-
-def readFile(folder, file):
-    key = open(Path + "/" + folder + "/" + file, "r")
-    fileRead = key.read()
-    key.close()
-    fileRead = "\n".join(fileRead.splitlines()[1:-1])
-    return fileRead
-
-def readTrustedCertificate(folder, file):
-    listCert = list()
-    caPem = ""
-    startCa = False
-    key = open(Path + "/" + folder + "/" + file, "r")
-    lines = key.readlines()
-    for line in lines:
-        if not "BEGIN CERTIFICATE" in line and not "END CERTIFICATE" in line and startCa:
-            caPem += line
-        elif "BEGIN CERTIFICATE" in line:
-            startCa = True
-        elif "END CERTIFICATE" in line:
-            startCa = False
-            listCert.append(caPem)
-            caPem = ""
-    return listCert
-
-def makeKeystoreKey(clientKey, count):
-    odl_private_key="ODL_private_key_%d" %count
-
-    json_keystore_key='{{\"input\": {{ \"key-credential\": {{\"key-id\": \"{odl_private_key}\", \"private-key\" : ' \
-                      '\"{clientKey}\",\"passphrase\" : \"\"}}}}}}'.format(
-        odl_private_key=odl_private_key,
-        clientKey=clientKey)
-
-    return json_keystore_key
-
-
-
-def makePrivateKey(clientKey, clientCrt, certList, count):
-    caPem = ""
-    for cert in certList:
-        caPem += '\"%s\",' % cert
-
-    caPem = caPem.rsplit(',', 1)[0]
-    odl_private_key="ODL_private_key_%d" %count
-
-    json_private_key='{{\"input\": {{ \"private-key\":{{\"name\": \"{odl_private_key}\", \"data\" : ' \
-                     '\"{clientKey}\",\"certificate-chain\":[\"{clientCrt}\",{caPem}]}}}}}}'.format(
-        odl_private_key=odl_private_key,
-        clientKey=clientKey,
-        clientCrt=clientCrt,
-        caPem=caPem)
-
-    return json_private_key
-
-def makeTrustedCertificate(certList, count):
-    number = 0
-    json_cert_format = ""
-    for cert in certList:
-        cert_name = "xNF_CA_certificate_%d_%d" %(count, number)
-        json_cert_format += '{{\"name\": \"{trusted_name}\",\"certificate\":\"{cert}\"}},\n'.format(
-            trusted_name=cert_name,
-            cert=cert.strip())
-        number += 1
-
-    json_cert_format = json_cert_format.rsplit(',', 1)[0]
-    json_trusted_cert='{{\"input\": {{ \"trusted-certificate\": [{certificates}]}}}}'.format(
-        certificates=json_cert_format)
-    return json_trusted_cert
-
-
-def makeRestconfPost(conn, json_file, apiCall):
-    req = conn.request("POST", apiCall, json_file, headers=headers)
-    res = conn.getresponse()
-    res.read()
-    if res.status != 200:
-        print "Error here, response back wasnt 200: Response was : %d , %s" % (res.status, res.reason)
-    else:
-        print res.status, res.reason
-
-def extractZipFiles(zipFileList, count):
-    for zipFolder in zipFileList:
-        with zipfile.ZipFile(Path + "/" + zipFolder.strip(),"r") as zip_ref:
-            zip_ref.extractall(Path)
-        folder = zipFolder.rsplit(".")[0]
-        processFiles(folder, count)
-
-def processFiles(folder, count):
-    conn = httplib.HTTPConnection("localhost",8181)
-    for file in os.listdir(Path + "/" + folder):
-        if os.path.isfile(Path + "/" + folder + "/" + file.strip()):
-            if ".key" in file:
-                clientKey = readFile(folder, file.strip())
-            elif "trustedCertificate" in file:
-                certList = readTrustedCertificate(folder, file.strip())
-            elif ".crt" in file:
-                clientCrt = readFile(folder, file.strip())
-        else:
-            print "Could not find file %s" % file.strip()
-    shutil.rmtree(Path + "/" + folder)
-    json_keystore_key = makeKeystoreKey(clientKey, count)
-    json_private_key = makePrivateKey(clientKey, clientCrt, certList, count)
-    json_trusted_cert = makeTrustedCertificate(certList, count)
-
-    makeRestconfPost(conn, json_keystore_key, postKeystore)
-    makeRestconfPost(conn, json_private_key, postPrivateKey)
-    makeRestconfPost(conn, json_trusted_cert, postTrustedCertificate)
-
-def makeHealthcheckCall(headers, timePassed):
-    connected = False
-    # WAIT 10 minutes maximum and test every 30 seconds if HealthCheck API is returning 200
-    while timePassed < TIMEOUT:
-        try:
-            conn = httplib.HTTPConnection("localhost",8181)
-            req = conn.request("POST", "/restconf/operations/SLI-API:healthcheck",headers=headers)
-            res = conn.getresponse()
-            res.read()
-            if res.status == 200:
-                print ("Healthcheck Passed in %d seconds." %timePassed)
-                connected = True
-                break
-            else:
-                print ("Sleep: %d seconds before testing if Healthcheck worked. Total wait time up now is: %d seconds. Timeout is: %d seconds" %(INTERVAL, timePassed, TIMEOUT))
-        except:
-            print ("Cannot execute REST call. Sleep: %d seconds before testing if Healthcheck worked. Total wait time up now is: %d seconds. Timeout is: %d seconds" %(INTERVAL, timePassed, TIMEOUT))
-        timePassed = timeIncrement(timePassed)
-
-    if timePassed > TIMEOUT:
-        print ("TIME OUT: Healthcheck not passed in  %d seconds... Could cause problems for testing activities..." %TIMEOUT)
-    return connected
-
-
-def timeIncrement(timePassed):
-    time.sleep(INTERVAL)
-    timePassed = timePassed + INTERVAL
-    return timePassed
-
-def readCertProperties():
-    connected = makeHealthcheckCall(headers, timePassed)
-
-    if connected:
-        count = 0
-        if os.path.isfile(Path + "/certs.properties"):
-            with open(Path + "/certs.properties", "r") as f:
-                for line in f:
-                    if not "*****" in line:
-                        zipFileList.append(line)
-                    else:
-                        extractZipFiles(zipFileList, count)
-                        count += 1
-                        del zipFileList[:]
-        else:
-            print "Error: File not found in path entered"
-
-readCertProperties()
diff --git a/sdnc-a1-controller/oam/installation/src/main/properties/org.onap.sdnc.cred.props b/sdnc-a1-controller/oam/installation/src/main/properties/org.onap.sdnc.cred.props
deleted file mode 100644 (file)
index 8898383..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-############################################################
-# Properties Generated by AT&T Certificate Manager
-#   by ubuntu
-#   on 2019-04-26T17:48:02.614+0000
-# @copyright 2019, AT&T
-############################################################
-Challenge=enc:YLFZL0xwmf-22zzHjNwMDus4xQhhjOO_HERh0LisPjGFMODJtM77jjh7EctH-Pme
-cadi_alias=sdnc@sdnc.onap.org
-cadi_key_password=enc:fbgVR_kMh7wuaEfm16VlW84HJR_yiob_CUf3oDXSE0K2yPlp0t55xT335GMh8ZSv
-cadi_keyfile=/opt/sdnc/data/stores/org.onap.sdnc.keyfile
-cadi_keystore=/opt/sdnc/data/stores/org.onap.sdnc.p12
-cadi_keystore_password=enc:xAl_o-JBdI86B4pDUNyrY9IauP54ecsXLUZYl_9p9R4Roybcnppqwwkdp_wJq1Ir
-cadi_keystore_password_jks=enc:Qf5-2ZRKRMYBwvO14qENypmu4A1HNjkdu_KkM0N5i7v7QjC_GmshNrYmmeWLQWIr
-cadi_keystore_password_p12=enc:xAl_o-JBdI86B4pDUNyrY9IauP54ecsXLUZYl_9p9R4Roybcnppqwwkdp_wJq1Ir
-cadi_truststore=/opt/sdnc/data/stores/org.onap.sdnc.trust.jks
-cadi_truststore_password=enc:U-tuJC67-g5WkC4o8aYf-zqxfB-u2ep3NcB9CZt3VfGCP_NhTWFYVx8mCL3S-jhU
-cadi_x509_issuers=CN=intermediateCA_1, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_7, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_9, OU=OSAAF, O=ONAP, C=US
diff --git a/sdnc-a1-controller/oam/installation/src/main/properties/org.onap.sdnc.props b/sdnc-a1-controller/oam/installation/src/main/properties/org.onap.sdnc.props
deleted file mode 100644 (file)
index 5b96b90..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-############################################################
-# Properties Generated by AT&T Certificate Manager
-#   by root
-#   on 2019-02-15T20:08:07.125+0000
-# @copyright 2016, AT&T
-############################################################
-aaf_id=sdnc@sdnc.onap.org
-aaf_locate_url=https://aaf-onap-test.osaaf.org:8095
-aaf_url=https://AAF_LOCATE_URL/AAF_NS.service:2.1
-cadi_etc_dir=/opt/sdnc/data/stores
-cadi_latitude=38.432899
-cadi_longitude=-90.43248
-cadi_prop_files=/opt/sdnc/data/properties/org.onap.sdnc.cred.props
-cm_url=https://AAF_LOCATE_URL/AAF_NS.cm:2.1
-cadi_bath_convert=/opt/sdnc/data/properties/bath_config.csv
diff --git a/sdnc-a1-controller/oam/installation/src/main/stores/keystore.sdnc.p12 b/sdnc-a1-controller/oam/installation/src/main/stores/keystore.sdnc.p12
deleted file mode 100644 (file)
index 8fb4e2c..0000000
Binary files a/sdnc-a1-controller/oam/installation/src/main/stores/keystore.sdnc.p12 and /dev/null differ
diff --git a/sdnc-a1-controller/oam/installation/src/main/stores/org.onap.sdnc.keyfile b/sdnc-a1-controller/oam/installation/src/main/stores/org.onap.sdnc.keyfile
deleted file mode 100644 (file)
index 4bbb0ab..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-ssTXV3XxGHmaZ_tDK60bUUwJMidA6-cMQbn8EVO1HWhwTS3vhftirZkfE-Ymv0xkhB82LT05cTjv
-MnM6E_OU8ZzQtNCb0XTTsOU-xTExWuIJzgfTKDanH14OB83r-pM0Q1z3iOjgIZyKNn7Qtl-7FyJu
-Fr6bmPKFMMSDROwH347eYBpunVPIa1X0NNqJcHDQsWFhW0bgsfRMnP3XZNltqbuAFZocYsY3Tk5N
-Iz52WXz6-nSWYBO0sPuBUZmkck1zKZ9PMn2SAPYx1V3i1-kOBLE6AHj-ad7e_dnJjdSTrjhG5z81
-QtmwAevh2ROCdNXTeyurrGXaLrMluE9csSVIp0YCCuhUCX02oDQBqIY5IDIQtAIXS8_i2bJWwmMv
-tZOTavGZH1_nwyQQ60lWF8w0GtL1m-s1SVH5v8VunYrjdnwFsrwUkKWfmz70OWFy6RwRis4IL434
-ln0RY48K-E_93jw3pbV4vZFTo8-RO59DGr_0pZf7ZhDSNrdy8sMpaSeHjjrVMfD5TI-JWDdzaKhi
-edKGZN_MZLfgPKwXTfXLDQKxowLUoDpEKfAj_KSOAdTCB2piala6Ht3FM5zfXFY7PnYgDho1fe2j
-nSWQhN6BqMr4LVKCLVonIiiAgyEetseUnW5_FCcFJALhfEKG4CHI0TvbRZ9IG7SwEFBovrk3RkBv
--UHxqqUAi9W3Zdm6wmYtSsUaT-lmMomJxHigWn9vCJ6fO0r_KSoGo-u8idP8P989hNdLqKx6sVWa
-en-Kyf0YUvYUk6TblucGVG0UYpjqMAr64tA2_a595QWriVRsxFWTZXBiXWUrOtbXxYZ6vn4jLomF
-KWAOu7ot-SQa9zAAAgIme5VB3I2h9s0mUOsQd-T1fJq_CdAGzyqXmBwt8TO4G8iQCMUtOptxJ220
-dq_unPUWJylDuU_9fTY95PLSIGfTCwOedOJb5A9IvyN_mahSPZqYH3a0P6gOgHPxQfTrUid31u7a
-BqsQdKKMoWCT7ZdX-ja95f3Z3PzHxhlI2dr1nCRBkN89GLyIK70dVN2QTVVWV5B4hLoyrON6QVwy
-1csZ1X6UGO-4YOX3_GUacJSnCenZzJFbn3moCkZ-QfpwU7Cqq2I7DEa8bDKz1sdeNtycOxiQnmnA
-AnVdXfOavctGcpA6tWyj-WAkZvV6yedt6Kb4BPL5_qDsCNa0r1wYNaQqzH1bYQnJu0aVjspTzlj4
-2ik_2i9t36Avoqj_g3e8fvwmF0r__yPpF2oULa4LcIQ8Cs3U9Oq3BmxlNXlEj7dyNOTIlJLcvrzX
-Js_5iv5rA_rIWY7YpOc-UCVrZw3yb8Ih-XI4tNuUn3qE7tHHQclWrrYRVM2Jt_u-73WYqL-iCvwQ
-BU5soWkSK5TwgR1BHfDs5-yNh1MRnr9RbNd8x_p3ohQrFtepgBHodTl98er9XANCy-HycLZhDP3D
-TUQdWVKxAwDFVBB-p6itYB9oVvkQtSosLQUYcAjbMTrFz4zqOj0CHMvquE-Wbznkayo5ZdvKoPXk
-loNtiG4qPx3UXpvfHElps-vPi8y1TlcmwqWEOn2vxKd5IIk2fglHXM9tv2m86XRgvTjppSs1V7NS
-Uoz_C_bW8zH5D-Twmq2DGHxuKbpUpqe0FDFXxoQezGCVhN6bzp-44CBkz9I9QeNVkm3XFu8s2fDn
-PeP2B_hGxkLhJHAJ28_3zZex818zqvFW-flWY43w6Cke8qWns3gxdyvXLUTluoidkFdTEvMBPIos
-itOB1MsLxsZNdAZtn3vxANPm7dTf8YIAJdMYH6yL9G83PxgKZ8uhoIZIsbrV2UWOJMLH8agctEZI
-pFqCipM8RZwuZwq7JmTYPyIjUDVTvAmiLJbG127T9eAfrZa2TYDWaE469v9f-7MdTD4_PK2JSogD
-8dg30EruD1VwQq03M98hL9EQsRNwAZ4MAshE2Kp3jQje2A-ZxGtMKNiw6DV0j3BM42FBitpV-Ley
-UaqWwELwDh7-BFmUeCu_RSP4XwrTUcOV725yIYcGkk06wLahMf2UvFzYS3PAmZLrs4fvLMK5
\ No newline at end of file
diff --git a/sdnc-a1-controller/oam/installation/src/main/stores/org.onap.sdnc.p12 b/sdnc-a1-controller/oam/installation/src/main/stores/org.onap.sdnc.p12
deleted file mode 100644 (file)
index 079ee67..0000000
Binary files a/sdnc-a1-controller/oam/installation/src/main/stores/org.onap.sdnc.p12 and /dev/null differ
diff --git a/sdnc-a1-controller/oam/installation/src/main/stores/org.onap.sdnc.trust.jks b/sdnc-a1-controller/oam/installation/src/main/stores/org.onap.sdnc.trust.jks
deleted file mode 100644 (file)
index e1f2e57..0000000
Binary files a/sdnc-a1-controller/oam/installation/src/main/stores/org.onap.sdnc.trust.jks and /dev/null differ
diff --git a/sdnc-a1-controller/oam/installation/src/main/stores/truststore.onap.client.jks b/sdnc-a1-controller/oam/installation/src/main/stores/truststore.onap.client.jks
deleted file mode 100755 (executable)
index 28afd8f..0000000
Binary files a/sdnc-a1-controller/oam/installation/src/main/stores/truststore.onap.client.jks and /dev/null differ
diff --git a/sdnc-a1-controller/oam/installation/src/main/stores/truststore.openecomp.client.jks b/sdnc-a1-controller/oam/installation/src/main/stores/truststore.openecomp.client.jks
deleted file mode 100644 (file)
index 6c854b4..0000000
Binary files a/sdnc-a1-controller/oam/installation/src/main/stores/truststore.openecomp.client.jks and /dev/null differ
index acf15a1..7051351 100644 (file)
@@ -47,6 +47,7 @@ services:
     entrypoint: ["/opt/onap/sdnc/bin/startODL.sh"]
     ports:
       - "8282:8181"
+      - "8383:8443"
     links:
       - db:dbhost
       - db:sdnctldb01
index 668c5b0..77fb72c 100644 (file)
                <relativePath/>
        </parent>
 
-       <groupId>org.onap.sdnc.oam</groupId>
+       <groupId>org.o-ran-sc.nonrtric.sdnc-a1.oam</groupId>
        <artifactId>platform-logic-installer</artifactId>
        <version>1.7.3-SNAPSHOT</version>
        <packaging>pom</packaging>
 
-       <name>sdnc-oam :: platform-logic :: ${project.artifactId}</name>
+       <name>sdnc-a1-oam :: platform-logic :: ${project.artifactId}</name>
        <description>Contains platform-level service logic installer</description>
 
        <build>
index 2644861..c4f3e8f 100644 (file)
         <relativePath/>
     </parent>
 
-    <groupId>org.onap.sdnc.oam</groupId>
+    <groupId>org.o-ran-sc.nonrtric.sdnc-a1.oam</groupId>
     <artifactId>platform-logic</artifactId>
     <version>1.7.3-SNAPSHOT</version>
     <packaging>pom</packaging>
 
-    <name>sdnc-oam :: platform-logic</name>
+    <name>sdnc-a1-oam :: platform-logic</name>
     <description>Contains platform-level service logic</description>
     <organization>
         <name>ONAP</name>
index 68e506c..4b8b354 100644 (file)
         <relativePath/>
     </parent>
 
-    <groupId>org.onap.sdnc.oam</groupId>
+    <groupId>org.o-ran-sc.nonrtric.sdnc-a1.oam</groupId>
        <artifactId>platform-logic-setup</artifactId>
        <version>1.7.3-SNAPSHOT</version>
        <packaging>pom</packaging>
 
-    <name>sdnc-oam :: platform-logic :: ${project.artifactId}</name>
+    <name>sdnc-a1-oam :: platform-logic :: ${project.artifactId}</name>
        <description>Copies base ONAP platform-logic</description>
 
        <build>
index 6ac9f90..8cc1cab 100755 (executable)
                <version>1.4.3</version>
        </parent>
 
-       <groupId>org.onap.sdnc.oam</groupId>
-       <artifactId>sdnc-oam</artifactId>
+       <groupId>org.o-ran-sc.nonrtric.sdnc-a1.oam</groupId>
+       <artifactId>sdnc-a1-oam</artifactId>
        <version>1.7.3-SNAPSHOT</version>
        <packaging>pom</packaging>
 
-       <name>sdnc-oam</name>
+       <name>sdnc-a1-oam</name>
        <description>The SDN-C OAM component contains the components needed to operate, administer and maintain the SDN-C platform.</description>
        <url>https://wiki.onap.org</url>
        <organization>
                <module>platform-logic</module>
        </modules>
 
-       <scm>
-                <connection>scm:git:ssh://git@${onap.git.host}/sdnc-oam.git</connection>
-                <developerConnection>scm:git:ssh://${onap.git.host}:${onap.git.port}/${onap.git.project}/sdnc-oam.git</developerConnection>
-                <url>${onap.git.protocol}://${onap.git.host}/projects/${onap.git.project}/repos/sdnc-oam/browse</url>
-               <tag>HEAD</tag>
-       </scm>
-       <issueManagement>
-               <system>JIRA</system>
-               <url>https://jira.onap.org/</url>
-       </issueManagement>
-       <ciManagement>
-               <system>Jenkins</system>
-               <url>https://jenkins.onap.org/</url>
-       </ciManagement>
-       <distributionManagement>
-        <site>
-          <id>sdnc-javadoc</id>
-          <url>dav:https://${onap.nexus.host}:${onap.nexus.port}/repository/sdn-c-javadoc/${project.artifactId}/${project.version}</url>
-        </site>
-    </distributionManagement>
-
        <build>
                <plugins>
                        <plugin>
index f2decfd..96ca1a5 100644 (file)
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
 
-       <groupId>org.onap.sdnc</groupId>
-       <artifactId>sdnc</artifactId>
+       <groupId>org.o-ran-sc.nonrtric.sdnc-a1</groupId>
+       <artifactId>sdnc-a1</artifactId>
        <version>1.7.4-SNAPSHOT</version>
        <packaging>pom</packaging>
 
-       <name>sdnc</name>
+       <name>sdnc-a1</name>
 
        <properties>
                <sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>