From: Henrik Andersson Date: Thu, 18 Jun 2020 09:08:04 +0000 (+0000) Subject: Merge "Remove using of DMAAP client from ONAP" X-Git-Tag: 2.0.0~1 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=2466f9d370214b578efedd1d3e38b1de17e6ca1c;hp=4e7db50d7fb3fd2c7101520f00f0f0b4baf9bddc;p=nonrtric.git Merge "Remove using of DMAAP client from ONAP" --- diff --git a/docs/developer-guide.rst b/docs/developer-guide.rst index 6247b6e7..01b84873 100644 --- a/docs/developer-guide.rst +++ b/docs/developer-guide.rst @@ -13,23 +13,23 @@ SDNC A1 Controller Prerequisites ------------- -1. Java development kit (JDK), version 8 -2. Maven dependency-management tool, version 3.4 or later -3. Python, version 2 -4. Docker, version 19.03.1 or later -5. Docker Compose, version 1.24.1 or later +1. Java development kit (JDK), version 11 +2. Maven dependency-management tool, version 3.6 or later +3. Python, version 2 or later +4. Docker, version 19.03.1 or latest +5. Docker Compose, version 1.24.1 or latest Build and run ------------- Go to the northbound directory and run this command :: - mvn clean install + mvn clean install -Dmaven.test.skip=true This will build the project and create artifcats in maven repo Go to oam/installation directory and run this command :: mvn clean install -P docker -This will create the docker images required for the A1 Controller +This will create the docker images required for a1-controller. After this step check for the docker images created by the maven build with this command :: docker images | grep a1-controller @@ -37,10 +37,10 @@ After this step check for the docker images created by the maven build with this Go to oam/installation/src/main/yaml and run this command :: docker-compose up -d a1-controller -This will create the docker containers with the A1 Controller image, you can check the status of the docker container using :: +This will create the docker containers with the a1-controller image, you can check the status of the docker container using :: docker-compose logs -f a1-controller -The SDNC url to access the Northbound API, +The Open Daylight GUI url to access the Northbound API, http://localhost:8282/apidoc/explorer/index.html Credentials: admin/Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U diff --git a/policy-agent/docs/api.yaml b/policy-agent/docs/api.yaml index 5de8b29f..ec9bbce4 100644 --- a/policy-agent/docs/api.yaml +++ b/policy-agent/docs/api.yaml @@ -365,9 +365,10 @@ paths: parameters: - name: managedElementId in: query - description: managedElementId + description: The ID of the Managed Element required: true type: string + allowEmptyValue: false responses: '200': description: RIC is found @@ -393,9 +394,10 @@ paths: parameters: - name: policyType in: query - description: policyType + description: The name of the policy type required: false type: string + allowEmptyValue: false responses: '200': description: OK @@ -460,9 +462,10 @@ paths: parameters: - name: name in: query - description: name + description: The name of the service required: false type: string + allowEmptyValue: false responses: '200': description: OK @@ -489,9 +492,10 @@ paths: parameters: - name: name in: query - description: name + description: The name of the service required: true type: string + allowEmptyValue: false responses: '200': description: OK @@ -523,9 +527,10 @@ paths: parameters: - name: name in: query - description: name + description: The name of the service required: true type: string + allowEmptyValue: false responses: '200': description: 'Service supervision timer refreshed, OK' diff --git a/policy-agent/pom.xml b/policy-agent/pom.xml index 3725af6e..8f56cd64 100644 --- a/policy-agent/pom.xml +++ b/policy-agent/pom.xml @@ -62,6 +62,7 @@ 3.7.0.1746 0.8.5 1.6.0 + true diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java index b75d320d..d2ae0e0d 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java @@ -99,8 +99,9 @@ public class PolicyController { value = { @ApiResponse(code = 200, message = "Policy schemas", response = Object.class, responseContainer = "List"), // @ApiResponse(code = 404, message = "RIC is not found", response = String.class)}) - public ResponseEntity getPolicySchemas(@ApiParam(name = "ric", required = false, value = "The name of " +// - "the Near-RT RIC to get the definitions for.")@RequestParam(name = "ric", required = false) String ricName) { + public ResponseEntity getPolicySchemas( // + @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get the definitions for.") // + @RequestParam(name = "ric", required = false) String ricName) { if (ricName == null) { Collection types = this.policyTypes.getAll(); return new ResponseEntity<>(toPolicyTypeSchemasJson(types), HttpStatus.OK); @@ -120,8 +121,9 @@ public class PolicyController { value = { // @ApiResponse(code = 200, message = "Policy schema", response = Object.class), @ApiResponse(code = 404, message = "RIC is not found", response = String.class)}) - public ResponseEntity getPolicySchema(@ApiParam(name = "id", required = true, value = "The ID of the " +// - "policy type to get the definition for.")@RequestParam(name = "id", required = true) String id) { + public ResponseEntity getPolicySchema( // + @ApiParam(name = "id", required = true, value = "The ID of the policy type to get the definition for.") // + @RequestParam(name = "id", required = true) String id) { try { PolicyType type = policyTypes.getType(id); return new ResponseEntity<>(type.schema(), HttpStatus.OK); @@ -140,8 +142,9 @@ public class PolicyController { response = String.class, responseContainer = "List"), @ApiResponse(code = 404, message = "RIC is not found", response = String.class)}) - public ResponseEntity getPolicyTypes(@ApiParam(name = "ric", required = false, value = "The name of " +// - "the Near-RT RIC to get types for.")@RequestParam(name = "ric", required = false) String ricName) { + public ResponseEntity getPolicyTypes( // + @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get types for.") // + @RequestParam(name = "ric", required = false) String ricName) { if (ricName == null) { Collection types = this.policyTypes.getAll(); return new ResponseEntity<>(toPolicyTypeIdsJson(types), HttpStatus.OK); @@ -163,8 +166,8 @@ public class PolicyController { @ApiResponse(code = 404, message = "Policy is not found")} // ) public ResponseEntity getPolicy( // - @ApiParam(name = "id", required = true, value = "The ID of the policy instance.")@RequestParam(name = "id", // - required = true) String id) { + @ApiParam(name = "id", required = true, value = "The ID of the policy instance.") // + @RequestParam(name = "id", required = true) String id) { try { Policy p = policies.getPolicy(id); return new ResponseEntity<>(p.json(), HttpStatus.OK); @@ -181,8 +184,8 @@ public class PolicyController { @ApiResponse(code = 404, message = "Policy is not found", response = String.class), @ApiResponse(code = 423, message = "RIC is not operational", response = String.class)}) public Mono> deletePolicy( // - @ApiParam(name = "id", required = true, value = "The ID of the policy instance.")@RequestParam(name = "id", // - required = true) String id) { + @ApiParam(name = "id", required = true, value = "The ID of the policy instance.") // + @RequestParam(name = "id", required = true) String id) { try { Policy policy = policies.getPolicy(id); keepServiceAlive(policy.ownerServiceName()); @@ -212,17 +215,18 @@ public class PolicyController { }) public Mono> putPolicy( // @ApiParam(name = "type", required = false, value = "The name of the policy type.") // - @RequestParam(name = "type", required = false, defaultValue = "") String typeName, // - @ApiParam(name = "id", required = true, value = "The ID of the policy instance.")@RequestParam(name = "id", // - required = true) String instanceId, // - @ApiParam(name = "ric", required = true, value = "The name of the Near-RT RIC where the policy will be " +// - "created.")@RequestParam(name = "ric", required = true) String ricName, // + @RequestParam(name = "type", required = false, defaultValue = "") String typeName, // + @ApiParam(name = "id", required = true, value = "The ID of the policy instance.") // + @RequestParam(name = "id", required = true) String instanceId, // + @ApiParam(name = "ric", required = true, value = "The name of the Near-RT RIC where the policy will be " + // + "created.") // + @RequestParam(name = "ric", required = true) String ricName, // @ApiParam(name = "service", required = true, value = "The name of the service creating the policy.") // - @RequestParam(name = "service", required = true) String service, // - @ApiParam(name = "transient", required = false, value = "If the policy is transient or not (boolean " +// - "defaulted to false). A policy is transient if it will be forgotten when the service needs to " +// - "reconnect to the Near-RT RIC.")@RequestParam(name = "transient", required = false, // - defaultValue = "false") boolean isTransient, // + @RequestParam(name = "service", required = true) String service, // + @ApiParam(name = "transient", required = false, value = "If the policy is transient or not (boolean " + // + "defaulted to false). A policy is transient if it will be forgotten when the service needs to " + // + "reconnect to the Near-RT RIC.") // + @RequestParam(name = "transient", required = false, defaultValue = "false") boolean isTransient, // @RequestBody Object jsonBody) { String jsonString = gson.toJson(jsonBody); @@ -317,11 +321,11 @@ public class PolicyController { @ApiResponse(code = 404, message = "RIC or type not found", response = String.class)}) public ResponseEntity getPolicies( // @ApiParam(name = "type", required = false, value = "The name of the policy type to get policies for.") // - @RequestParam(name = "type", required = false) String type, // + @RequestParam(name = "type", required = false) String type, // @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get policies for.") // - @RequestParam(name = "ric", required = false) String ric, // + @RequestParam(name = "ric", required = false) String ric, // @ApiParam(name = "service", required = false, value = "The name of the service to get policies for.") // - @RequestParam(name = "service", required = false) String service) // + @RequestParam(name = "service", required = false) String service) // { if ((type != null && this.policyTypes.get(type) == null)) { return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND); @@ -341,11 +345,11 @@ public class PolicyController { @ApiResponse(code = 404, message = "RIC or type not found", response = String.class)}) public ResponseEntity getPolicyIds( // @ApiParam(name = "type", required = false, value = "The name of the policy type to get policies for.") // - @RequestParam(name = "type", required = false) String type, // + @RequestParam(name = "type", required = false) String type, // @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get policies for.") // - @RequestParam(name = "ric", required = false) String ric, // + @RequestParam(name = "ric", required = false) String ric, // @ApiParam(name = "service", required = false, value = "The name of the service to get policies for.") // - @RequestParam(name = "service", required = false) String service) // + @RequestParam(name = "service", required = false) String service) // { if ((type != null && this.policyTypes.get(type) == null)) { return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND); @@ -366,7 +370,8 @@ public class PolicyController { @ApiResponse(code = 404, message = "Policy is not found", response = String.class)} // ) public Mono> getPolicyStatus( // - @ApiParam(name = "id", required = true, value = "The ID of the policy.")@RequestParam(name = "id", // + @ApiParam(name = "id", required = true, value = "The ID of the policy.") @RequestParam( + name = "id", // required = true) String id) { try { Policy policy = policies.getPolicy(id); diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java index 1064c6f0..c3e58008 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java @@ -25,6 +25,7 @@ import com.google.gson.GsonBuilder; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; @@ -66,9 +67,9 @@ public class RicRepositoryController { @ApiResponse(code = 200, message = "RIC is found", response = String.class), // @ApiResponse(code = 404, message = "RIC is not found", response = String.class) // }) - public ResponseEntity getRic( + public ResponseEntity getRic( // + @ApiParam(name = "managedElementId", required = true, value = "The ID of the Managed Element") // @RequestParam(name = "managedElementId", required = true) String managedElementId) { - Optional ric = this.rics.lookupRicForManagedElement(managedElementId); if (ric.isPresent()) { @@ -87,9 +88,9 @@ public class RicRepositoryController { value = { // @ApiResponse(code = 200, message = "OK", response = RicInfo.class, responseContainer = "List"), // @ApiResponse(code = 404, message = "Policy type is not found", response = String.class)}) - public ResponseEntity getRics( + public ResponseEntity getRics( // + @ApiParam(name = "policyType", required = false, value = "The name of the policy type") // @RequestParam(name = "policyType", required = false) String supportingPolicyType) { - if ((supportingPolicyType != null) && (this.types.get(supportingPolicyType) == null)) { return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND); } diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceController.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceController.java index 922ba3d6..84818304 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceController.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceController.java @@ -25,6 +25,7 @@ import com.google.gson.GsonBuilder; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; @@ -72,8 +73,8 @@ public class ServiceController { @ApiResponse(code = 200, message = "OK", response = ServiceStatus.class, responseContainer = "List"), // @ApiResponse(code = 404, message = "Service is not found", response = String.class)}) public ResponseEntity getServices(// + @ApiParam(name = "name", required = false, value = "The name of the service") // @RequestParam(name = "name", required = false) String name) { - if (name != null && this.services.get(name) == null) { return new ResponseEntity<>("Service not found", HttpStatus.NOT_FOUND); } @@ -133,6 +134,7 @@ public class ServiceController { @ApiResponse(code = 404, message = "Service not found", response = String.class)}) @DeleteMapping("/services") public ResponseEntity deleteService(// + @ApiParam(name = "name", required = true, value = "The name of the service") // @RequestParam(name = "name", required = true) String serviceName) { try { Service service = removeService(serviceName); @@ -152,6 +154,7 @@ public class ServiceController { @ApiResponse(code = 404, message = "The service is not found, needs re-registration")}) @PutMapping("/services/keepalive") public ResponseEntity keepAliveService(// + @ApiParam(name = "name", required = true, value = "The name of the service") // @RequestParam(name = "name", required = true) String serviceName) { try { services.getService(serviceName).keepAlive(); diff --git a/sdnc-a1-controller/northbound/features/sdnc-a1-northbound-all/pom.xml b/sdnc-a1-controller/northbound/features/sdnc-a1-northbound-all/pom.xml index 6365abe6..3a4d11ae 100644 --- a/sdnc-a1-controller/northbound/features/sdnc-a1-northbound-all/pom.xml +++ b/sdnc-a1-controller/northbound/features/sdnc-a1-northbound-all/pom.xml @@ -42,17 +42,6 @@ limitations under the License. feature sdnc-a1-northbound :: features :: ${project.artifactId} - - - - org.onap.ccsdk.sli.core - sli-core-artifacts - ${ccsdk.sli.core.version} - pom - import - - - diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/features/sdnc-nonrt-ric-api/pom.xml b/sdnc-a1-controller/northbound/nonrt-ric-api/features/sdnc-nonrt-ric-api/pom.xml index 83eb53ec..895766d0 100644 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/features/sdnc-nonrt-ric-api/pom.xml +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/features/sdnc-nonrt-ric-api/pom.xml @@ -36,19 +36,6 @@ sdnc-a1-northbound :: nonrt-ric-api :: ${project.artifactId} - - org.opendaylight.controller - odl-mdsal-broker - xml - features - - - org.onap.ccsdk.sli.core - ccsdk-sli - ${ccsdk.sli.core.version} - xml - features - ${project.groupId} nonrt-ric-api-model @@ -59,6 +46,5 @@ nonrt-ric-api-provider ${project.version} - diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/pom.xml b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/pom.xml index 7f38d5b5..8fa19ac0 100644 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/pom.xml +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/pom.xml @@ -80,27 +80,12 @@ - - - - org.onap.ccsdk.sli.core - sli-core-artifacts - ${ccsdk.sli.core.version} - pom - import - - - org.o-ran-sc.nonrtric.sdnc-a1.northbound nonrt-ric-api-model ${project.version} - - com.google.code.gson - gson - org.springframework spring-context @@ -111,39 +96,14 @@ spring-web provided - - org.apache.commons - commons-lang3 - org.apache.httpcomponents httpclient - - org.onap.ccsdk.sli.core - sli-common - - - org.onap.ccsdk.sli.core - sli-provider - - org.opendaylight.controller sal-binding-api - - - org.opendaylight.controller - sal-common-util - - - org.opendaylight.controller - sal-test-model - test - - - org.opendaylight.controller sal-binding-broker-impl @@ -173,9 +133,5 @@ 3.14.6 test - - org.json - json - diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/provider/NonrtRicApiProvider.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/provider/NonrtRicApiProvider.java index 392b1d68..a432d0c4 100644 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/provider/NonrtRicApiProvider.java +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/o_ran_sc/nonrtric/sdnc_a1/northbound/provider/NonrtRicApiProvider.java @@ -31,8 +31,6 @@ 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.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; @@ -86,7 +84,6 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService { protected DataBroker dataBroker; protected NotificationPublishService notificationService; protected RpcProviderRegistry rpcRegistry; - protected BindingAwareBroker.RpcRegistration rpcRegistration; private RestAdapter restAdapter; public NonrtRicApiProvider(DataBroker dataBroker, NotificationPublishService notificationPublishService, @@ -101,20 +98,14 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService { public void initialize() { log.info("Initializing provider for {}", APP_NAME); - createContainers(); restAdapter = new RestAdapterImpl(); log.info("Initialization complete for {}", APP_NAME); } - protected void initializeChild() { - // Override if you have custom initialization intelligence - } - @Override public void close() throws Exception { log.info("Closing provider for {}", APP_NAME); executor.shutdown(); - rpcRegistration.close(); log.info("Successfully closed provider for {}", APP_NAME); } @@ -139,21 +130,6 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService { } } - private void createContainers() { - - final WriteTransaction t = dataBroker.newReadWriteTransaction(); - - try { - CheckedFuture checkedFuture = t.submit(); - checkedFuture.get(); - log.info("Create containers succeeded!"); - - } catch (InterruptedException | ExecutionException e) { - log.error("Create containers failed: ", e); - Thread.currentThread().interrupt(); - } - } - @Override public ListenableFuture> putA1Policy(PutA1PolicyInput input) { log.info("Start of putPolicy");