From acdd3f361ff7af58b0276789cc5148180a06e552 Mon Sep 17 00:00:00 2001 From: YongchaoWu Date: Tue, 21 Apr 2020 09:03:42 +0200 Subject: [PATCH] Clean autotest folder remove unused code directory rename autotest folder to "test" Issue-ID: NONRTRIC-148 Signed-off-by: YongchaoWu Change-Id: I484d22d87486d22f9b05a1631812a7f5194d3966 --- near-rt-ric-simulator/nearric-service/.gitignore | 1 - near-rt-ric-simulator/nearric-service/pom.xml | 225 ---------- .../simulator/config/ApplicationConfig.java | 43 -- .../simulator/config/NearRicApplication.java | 42 -- .../simulator/config/SwaggerConfiguration.java | 47 --- .../onap/nearric/simulator/controller/A1PApi.java | 144 ------- .../simulator/controller/A1PApiController.java | 122 ------ .../nearric/simulator/model/PolicyInstance.java | 50 --- .../onap/nearric/simulator/model/PolicyType.java | 76 ---- .../nearric/simulator/service/A1PApiService.java | 53 --- .../simulator/service/A1PApiServiceImpl.java | 460 --------------------- .../src/main/resources/application.properties | 19 - .../nearric-service/test/.gitignore | 1 - .../nearric-service/test/pi-template.json | 4 - .../nearric-service/test/populate.sh | 39 -- .../nearric-service/test/pt-template.json | 49 --- .../nearric-service/test/test-api.sh | 126 ------ near-rt-ric-simulator/pom.xml | 78 ---- pom.xml | 1 - {near-rt-ric-simulator => test}/.gitignore | 0 {near-rt-ric-simulator => test}/LICENSES.txt | 0 .../auto-test/.gitignore | 0 .../auto-test/Dockerize_test.sh | 0 {near-rt-ric-simulator => test}/auto-test/FTC10.sh | 0 .../auto-test/FTC100.sh | 0 .../auto-test/FTC200.sh | 0 .../auto-test/FTC300.sh | 0 .../auto-test/FTC310.sh | 0 .../auto-test/FTC320.sh | 0 .../auto-test/FTC500.sh | 0 .../auto-test/FTC_SDNC.sh | 0 .../auto-test/README.md | 0 .../auto-test/Suite-interfaces.sh | 0 .../auto-test/testdata/OSC/1.json | 0 .../auto-test/testdata/OSC/2.json | 0 .../auto-test/testdata/OSC/pi1_template.json | 0 .../auto-test/testdata/OSC/pi2_template.json | 0 .../auto-test/testdata/OSC/sim_1.json | 0 .../auto-test/testdata/OSC/sim_2.json | 0 .../auto-test/testdata/STD/EMPTYTYPE.json | 0 .../auto-test/testdata/STD/pi1_template.json | 0 .../auto-test/utils/pa-logviewer.sh | 0 {near-rt-ric-simulator => test}/common/README.md | 0 .../common/agent_api_functions.sh | 2 +- .../common/compare_json.py | 0 .../common/controller_api_functions.sh | 0 .../common/count_json_elements.py | 0 .../common/create_rics_json.py | 0 .../common/do_curl_function.sh | 0 .../common/extract_sdnc_reply.py | 0 .../common/ricsimulator_api_functions.sh | 0 {near-rt-ric-simulator => test}/common/test_env.sh | 0 .../common/testcase_common.sh | 0 .../common/testsuite_common.sh | 0 {near-rt-ric-simulator => test}/cr/.gitignore | 0 {near-rt-ric-simulator => test}/cr/Dockerfile | 0 {near-rt-ric-simulator => test}/cr/README.md | 0 {near-rt-ric-simulator => test}/cr/basic_test.sh | 0 .../cr/cr-build-start.sh | 0 {near-rt-ric-simulator => test}/cr/cr.py | 0 .../cr/requirements.txt | 0 {near-rt-ric-simulator => test}/mrstub/.gitignore | 0 {near-rt-ric-simulator => test}/mrstub/Dockerfile | 0 {near-rt-ric-simulator => test}/mrstub/README.md | 0 .../mrstub/basic_test.sh | 0 {near-rt-ric-simulator => test}/mrstub/mr.py | 0 .../mrstub/mrstub-build-start.sh | 0 .../mrstub/requirements.txt | 0 .../simulator-group/.gitignore | 0 .../consul_cbs/consul/cbs_config.hcl | 0 .../consul_cbs/consul/cbs_localhost_config.hcl | 0 .../simulator-group/consul_cbs/docker-compose.yml | 0 .../simulator-group/consul_cbs/start.sh | 0 .../control_panel/docker-compose.yml | 0 .../simulator-group/cr/docker-compose.yml | 0 .../simulator-group/mr/docker-compose.yml | 0 .../policy_agent/docker-compose.yml | 0 .../simulator-group/ric/.gitignore | 0 .../simulator-group/ric/cleanConsul.py | 0 .../simulator-group/ric/docker-compose.yml | 0 .../simulator-group/ric/prepareConsul.py | 0 .../simulator-group/sdnc/docker-compose.yml | 0 .../simulator-group/sim-monitor-start.sh | 0 .../simulator-group/sim-monitor.js | 0 84 files changed, 1 insertion(+), 1581 deletions(-) delete mode 100644 near-rt-ric-simulator/nearric-service/.gitignore delete mode 100644 near-rt-ric-simulator/nearric-service/pom.xml delete mode 100644 near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/config/ApplicationConfig.java delete mode 100644 near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/config/NearRicApplication.java delete mode 100644 near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/config/SwaggerConfiguration.java delete mode 100644 near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/controller/A1PApi.java delete mode 100644 near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/controller/A1PApiController.java delete mode 100644 near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/model/PolicyInstance.java delete mode 100644 near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/model/PolicyType.java delete mode 100644 near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/service/A1PApiService.java delete mode 100644 near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/service/A1PApiServiceImpl.java delete mode 100644 near-rt-ric-simulator/nearric-service/src/main/resources/application.properties delete mode 100644 near-rt-ric-simulator/nearric-service/test/.gitignore delete mode 100644 near-rt-ric-simulator/nearric-service/test/pi-template.json delete mode 100755 near-rt-ric-simulator/nearric-service/test/populate.sh delete mode 100644 near-rt-ric-simulator/nearric-service/test/pt-template.json delete mode 100755 near-rt-ric-simulator/nearric-service/test/test-api.sh delete mode 100644 near-rt-ric-simulator/pom.xml rename {near-rt-ric-simulator => test}/.gitignore (100%) rename {near-rt-ric-simulator => test}/LICENSES.txt (100%) rename {near-rt-ric-simulator => test}/auto-test/.gitignore (100%) rename {near-rt-ric-simulator => test}/auto-test/Dockerize_test.sh (100%) rename {near-rt-ric-simulator => test}/auto-test/FTC10.sh (100%) rename {near-rt-ric-simulator => test}/auto-test/FTC100.sh (100%) rename {near-rt-ric-simulator => test}/auto-test/FTC200.sh (100%) rename {near-rt-ric-simulator => test}/auto-test/FTC300.sh (100%) rename {near-rt-ric-simulator => test}/auto-test/FTC310.sh (100%) rename {near-rt-ric-simulator => test}/auto-test/FTC320.sh (100%) rename {near-rt-ric-simulator => test}/auto-test/FTC500.sh (100%) rename {near-rt-ric-simulator => test}/auto-test/FTC_SDNC.sh (100%) rename {near-rt-ric-simulator => test}/auto-test/README.md (100%) rename {near-rt-ric-simulator => test}/auto-test/Suite-interfaces.sh (100%) rename {near-rt-ric-simulator => test}/auto-test/testdata/OSC/1.json (100%) rename {near-rt-ric-simulator => test}/auto-test/testdata/OSC/2.json (100%) rename {near-rt-ric-simulator => test}/auto-test/testdata/OSC/pi1_template.json (100%) rename {near-rt-ric-simulator => test}/auto-test/testdata/OSC/pi2_template.json (100%) rename {near-rt-ric-simulator => test}/auto-test/testdata/OSC/sim_1.json (100%) rename {near-rt-ric-simulator => test}/auto-test/testdata/OSC/sim_2.json (100%) rename {near-rt-ric-simulator => test}/auto-test/testdata/STD/EMPTYTYPE.json (100%) rename {near-rt-ric-simulator => test}/auto-test/testdata/STD/pi1_template.json (100%) rename {near-rt-ric-simulator => test}/auto-test/utils/pa-logviewer.sh (100%) rename {near-rt-ric-simulator => test}/common/README.md (100%) rename {near-rt-ric-simulator => test}/common/agent_api_functions.sh (99%) rename {near-rt-ric-simulator => test}/common/compare_json.py (100%) rename {near-rt-ric-simulator => test}/common/controller_api_functions.sh (100%) rename {near-rt-ric-simulator => test}/common/count_json_elements.py (100%) rename {near-rt-ric-simulator => test}/common/create_rics_json.py (100%) rename {near-rt-ric-simulator => test}/common/do_curl_function.sh (100%) rename {near-rt-ric-simulator => test}/common/extract_sdnc_reply.py (100%) rename {near-rt-ric-simulator => test}/common/ricsimulator_api_functions.sh (100%) rename {near-rt-ric-simulator => test}/common/test_env.sh (100%) rename {near-rt-ric-simulator => test}/common/testcase_common.sh (100%) rename {near-rt-ric-simulator => test}/common/testsuite_common.sh (100%) rename {near-rt-ric-simulator => test}/cr/.gitignore (100%) rename {near-rt-ric-simulator => test}/cr/Dockerfile (100%) rename {near-rt-ric-simulator => test}/cr/README.md (100%) rename {near-rt-ric-simulator => test}/cr/basic_test.sh (100%) rename {near-rt-ric-simulator => test}/cr/cr-build-start.sh (100%) rename {near-rt-ric-simulator => test}/cr/cr.py (100%) rename {near-rt-ric-simulator => test}/cr/requirements.txt (100%) rename {near-rt-ric-simulator => test}/mrstub/.gitignore (100%) rename {near-rt-ric-simulator => test}/mrstub/Dockerfile (100%) rename {near-rt-ric-simulator => test}/mrstub/README.md (100%) rename {near-rt-ric-simulator => test}/mrstub/basic_test.sh (100%) rename {near-rt-ric-simulator => test}/mrstub/mr.py (100%) rename {near-rt-ric-simulator => test}/mrstub/mrstub-build-start.sh (100%) rename {near-rt-ric-simulator => test}/mrstub/requirements.txt (100%) rename {near-rt-ric-simulator => test}/simulator-group/.gitignore (100%) rename {near-rt-ric-simulator => test}/simulator-group/consul_cbs/consul/cbs_config.hcl (100%) rename {near-rt-ric-simulator => test}/simulator-group/consul_cbs/consul/cbs_localhost_config.hcl (100%) rename {near-rt-ric-simulator => test}/simulator-group/consul_cbs/docker-compose.yml (100%) rename {near-rt-ric-simulator => test}/simulator-group/consul_cbs/start.sh (100%) rename {near-rt-ric-simulator => test}/simulator-group/control_panel/docker-compose.yml (100%) rename {near-rt-ric-simulator => test}/simulator-group/cr/docker-compose.yml (100%) rename {near-rt-ric-simulator => test}/simulator-group/mr/docker-compose.yml (100%) rename {near-rt-ric-simulator => test}/simulator-group/policy_agent/docker-compose.yml (100%) rename {near-rt-ric-simulator => test}/simulator-group/ric/.gitignore (100%) rename {near-rt-ric-simulator => test}/simulator-group/ric/cleanConsul.py (100%) rename {near-rt-ric-simulator => test}/simulator-group/ric/docker-compose.yml (100%) rename {near-rt-ric-simulator => test}/simulator-group/ric/prepareConsul.py (100%) rename {near-rt-ric-simulator => test}/simulator-group/sdnc/docker-compose.yml (100%) rename {near-rt-ric-simulator => test}/simulator-group/sim-monitor-start.sh (100%) rename {near-rt-ric-simulator => test}/simulator-group/sim-monitor.js (100%) diff --git a/near-rt-ric-simulator/nearric-service/.gitignore b/near-rt-ric-simulator/nearric-service/.gitignore deleted file mode 100644 index b83d2226..00000000 --- a/near-rt-ric-simulator/nearric-service/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target/ diff --git a/near-rt-ric-simulator/nearric-service/pom.xml b/near-rt-ric-simulator/nearric-service/pom.xml deleted file mode 100644 index dd21d574..00000000 --- a/near-rt-ric-simulator/nearric-service/pom.xml +++ /dev/null @@ -1,225 +0,0 @@ - - - - 4.0.0 - - org.oran.nearric - nearric-simulator - 1.0.0-SNAPSHOT - - nearric-service - ${project.artifactId} - - - UTF-8 - 2.7.5 - 2.8.1 - 1.4.2 - - - - org.oran.nearric - a1-med-api - 1.0.0-SNAPSHOT - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-logging - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.boot - spring-boot-devtools - runtime - - - junit - junit - test - - - io.swagger - swagger-jaxrs - 1.5.0 - - - org.apache.directory.studio - org.apache.commons.io - 2.4 - - - com.googlecode.json-simple - json-simple - 1.1.1 - - - - io.springfox - springfox-swagger-ui - 2.6.1 - compile - - - io.springfox - springfox-swagger2 - 2.6.1 - compile - - - com.fasterxml.jackson.core - jackson-databind - - - com.h2database - h2 - - - - commons-beanutils - commons-beanutils - 1.9.3 - - - org.modelmapper - modelmapper - 2.3.0 - - - com.squareup.okio - okio - 1.13.0 - - - com.squareup.okhttp - okhttp - ${okhttp-version} - - - com.squareup.okhttp - logging-interceptor - ${okhttp-version} - - - com.google.code.gson - gson - ${gson-version} - - - com.github.java-json-tools - json-schema-validator - 2.2.11 - - - - - - org.springframework.boot - spring-boot-maven-plugin - - org.onap.nearric.simulator.config.NearRicApplication - - - - - repackage - - - - - - io.fabric8 - docker-maven-plugin - 0.30.0 - - true - - ${env.CONTAINER_PUSH_REGISTRY} - - - - - o-ran-sc/nonrtric-nearric-simulator:${project.version} - - openjdk:11-jre-slim - - - ${project.version} - - - artifact - - - - - java - -Xms128m - -Xmx256m - -cp - maven:maven/${project.artifactId}-${project.version}.${project.packaging} - -Dloader.main=org.onap.nearric.simulator.config.NearRicApplication - -Djava.security.egd=file:/dev/./urandom - org.springframework.boot.loader.PropertiesLauncher - - - - - - - - - - - build - push - - - - - - javax.activation - activation - 1.1.1 - - - - - - diff --git a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/config/ApplicationConfig.java b/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/config/ApplicationConfig.java deleted file mode 100644 index 3c634cc4..00000000 --- a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/config/ApplicationConfig.java +++ /dev/null @@ -1,43 +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.nearric.simulator.config; - -import java.util.HashMap; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * This class provides all the configuration for the Spring boot application - * - * @author lathishbabu.ganesan@est.tech - * - */ -@Configuration -public class ApplicationConfig { - - private final HashMap policyTypeCache = new HashMap<>(); - - @Bean - public HashMap getPolicyTypeCache() { - return policyTypeCache; - } - -} diff --git a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/config/NearRicApplication.java b/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/config/NearRicApplication.java deleted file mode 100644 index 5b21d1a7..00000000 --- a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/config/NearRicApplication.java +++ /dev/null @@ -1,42 +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.nearric.simulator.config; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cache.annotation.EnableCaching; -import org.springframework.context.annotation.ComponentScan; - -/** - * This is the Spring Boot Application - * - * @author lathishbabu.ganesan@est.tech - * - */ - -@SpringBootApplication -@ComponentScan({"org.oransc", "org.onap"}) -@EnableCaching -public class NearRicApplication { - public static void main(final String[] args) { - SpringApplication.run(NearRicApplication.class, args); - } -} diff --git a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/config/SwaggerConfiguration.java b/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/config/SwaggerConfiguration.java deleted file mode 100644 index f77c1891..00000000 --- a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/config/SwaggerConfiguration.java +++ /dev/null @@ -1,47 +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.nearric.simulator.config; - -import org.onap.nearric.simulator.controller.A1PApiController; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -/** - * This class provides all the configuration for the Spring boot application - * - * @author lathishbabu.ganesan@est.tech - * - */ -@Configuration -@EnableSwagger2 -public class SwaggerConfiguration { - @Bean - public Docket apiDocket() { - return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.basePackage("org.onap.nearric.simulator")) - .paths(PathSelectors.any()).build(); - } - -} diff --git a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/controller/A1PApi.java b/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/controller/A1PApi.java deleted file mode 100644 index 4f8b31e5..00000000 --- a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/controller/A1PApi.java +++ /dev/null @@ -1,144 +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========================================================= - */ -/** - * NOTE: This class is auto generated by the swagger code generator program (3.0.8). - * https://github.com/swagger-api/swagger-codegen - * Do not edit the class manually. - */ -package org.onap.nearric.simulator.controller; - -import org.oransc.ric.a1med.api.model.InlineResponse200; -import org.oransc.ric.a1med.api.model.PolicyTypeSchema; -import io.swagger.annotations.*; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.util.List; -import java.util.Map; -@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-10-04T13:41:42.802+01:00[Europe/Dublin]") -@Api(value = "a1-p", description = "the a1-p API") -public interface A1PApi { - - @ApiOperation(value = "", nickname = "a1ControllerCreateOrReplacePolicyInstance", notes = "Create or replace a policy instance of type policy_type_id. The schema of the PUT body is defined by the create_schema field of the policy type. ", tags={ "A1 Mediator", }) - @ApiResponses(value = { - @ApiResponse(code = 201, message = "Policy instance created "), - @ApiResponse(code = 400, message = "Bad PUT body for this policy instance "), - @ApiResponse(code = 404, message = "There is no policy type with this policy_type_id ") }) - @RequestMapping(value = "/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}", - consumes = { "application/json" }, - method = RequestMethod.PUT) - ResponseEntity a1ControllerCreateOrReplacePolicyInstance(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId,@ApiParam(value = "",required=true) @PathVariable("policy_instance_id") String policyInstanceId,@ApiParam(value = "" ) @Valid @RequestBody Object body); - - - @ApiOperation(value = "", nickname = "a1ControllerCreatePolicyType", notes = "Create a new policy type . Replace is not currently allowed; to replace, for now do a DELETE and then a PUT again. ", tags={ "A1 Mediator", }) - @ApiResponses(value = { - @ApiResponse(code = 201, message = "policy type successfully created"), - @ApiResponse(code = 400, message = "illegal ID, or object already existed") }) - @RequestMapping(value = "/a1-p/policytypes/{policy_type_id}", - consumes = { "application/json" }, - method = RequestMethod.PUT) - ResponseEntity a1ControllerCreatePolicyType(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId,@ApiParam(value = "" ) @Valid @RequestBody PolicyTypeSchema body); - - - @ApiOperation(value = "", nickname = "a1ControllerDeletePolicyInstance", notes = "Delete this policy instance ", tags={ "A1 Mediator", }) - @ApiResponses(value = { - @ApiResponse(code = 204, message = "policy instance successfully deleted "), - @ApiResponse(code = 404, message = "there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id ") }) - @RequestMapping(value = "/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}", - method = RequestMethod.DELETE) - ResponseEntity a1ControllerDeletePolicyInstance(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId,@ApiParam(value = "",required=true) @PathVariable("policy_instance_id") String policyInstanceId); - - - @ApiOperation(value = "", nickname = "a1ControllerDeletePolicyType", notes = "Delete this policy type. Can only be performed if there are no instances of this type ", tags={ "A1 Mediator", }) - @ApiResponses(value = { - @ApiResponse(code = 204, message = "policy type successfully deleted "), - @ApiResponse(code = 400, message = "Policy type cannot be deleted because there are instances All instances must be removed before a policy type can be deleted "), - @ApiResponse(code = 404, message = "policy type not found ") }) - @RequestMapping(value = "/a1-p/policytypes/{policy_type_id}", - method = RequestMethod.DELETE) - ResponseEntity a1ControllerDeletePolicyType(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId); - - - @ApiOperation(value = "", nickname = "a1ControllerGetAllInstancesForType", notes = "get a list of all policy instance ids for this policy type id", response = String.class, responseContainer = "List", tags={ "A1 Mediator", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "list of all policy instance ids for this policy type id", response = String.class, responseContainer = "List") }) - @RequestMapping(value = "/a1-p/policytypes/{policy_type_id}/policies", - produces = { "application/json" }, - method = RequestMethod.GET) - ResponseEntity> a1ControllerGetAllInstancesForType(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId); - - - @ApiOperation(value = "", nickname = "a1ControllerGetAllPolicyTypes", notes = "Get a list of all registered policy type ids", response = Integer.class, responseContainer = "List", tags={ "A1 Mediator", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "list of all registered policy type ids", response = Integer.class, responseContainer = "List") }) - @RequestMapping(value = "/a1-p/policytypes/", - produces = { "application/json" }, - method = RequestMethod.GET) - ResponseEntity> a1ControllerGetAllPolicyTypes(); - - - @ApiOperation(value = "", nickname = "a1ControllerGetHealthcheck", notes = "Perform a healthcheck on a1 ", tags={ "A1 Mediator", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "A1 is healthy. Anything other than a 200 should be considered a1 as failing ") }) - @RequestMapping(value = "/a1-p/healthcheck", - method = RequestMethod.GET) - ResponseEntity a1ControllerGetHealthcheck(); - - - @ApiOperation(value = "", nickname = "a1ControllerGetPolicyInstance", notes = "Retrieve the policy instance ", response = Object.class, tags={ "A1 Mediator", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "The policy instance. the schema of this object is defined by the create_schema field of the policy type ", response = Object.class), - @ApiResponse(code = 404, message = "there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id ") }) - @RequestMapping(value = "/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}", - produces = { "application/json" }, - method = RequestMethod.GET) - ResponseEntity a1ControllerGetPolicyInstance(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId,@ApiParam(value = "",required=true) @PathVariable("policy_instance_id") String policyInstanceId); - - - @ApiOperation(value = "", nickname = "a1ControllerGetPolicyInstanceStatus", notes = "Retrieve the policy instance status across all handlers of the policy ", response = InlineResponse200.class, responseContainer = "List", tags={ "A1 Mediator", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "The policy instance status. Returns a vector of statuses, where each contains a handler_id (opaque id of a RIC component that implements this policy) and the policy status as returned by that handler ", response = InlineResponse200.class, responseContainer = "List"), - @ApiResponse(code = 404, message = "there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id ") }) - @RequestMapping(value = "/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}/status", - produces = { "application/json" }, - method = RequestMethod.GET) - ResponseEntity> a1ControllerGetPolicyInstanceStatus(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId,@ApiParam(value = "",required=true) @PathVariable("policy_instance_id") String policyInstanceId); - - - @ApiOperation(value = "", nickname = "a1ControllerGetPolicyType", notes = "Get this policy type ", response = PolicyTypeSchema.class, tags={ "A1 Mediator", }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "policy type successfully found", response = PolicyTypeSchema.class), - @ApiResponse(code = 404, message = "policy type not found ") }) - @RequestMapping(value = "/a1-p/policytypes/{policy_type_id}", - produces = { "application/json" }, - method = RequestMethod.GET) - ResponseEntity a1ControllerGetPolicyType(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId); - -} diff --git a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/controller/A1PApiController.java b/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/controller/A1PApiController.java deleted file mode 100644 index d33e6c67..00000000 --- a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/controller/A1PApiController.java +++ /dev/null @@ -1,122 +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.nearric.simulator.controller; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; -import javax.servlet.http.HttpServletRequest; -import javax.validation.Valid; - -import org.apache.commons.beanutils.BeanUtils; -import org.onap.nearric.simulator.model.PolicyType; -import org.onap.nearric.simulator.service.A1PApiServiceImpl; -import org.oransc.ric.a1med.api.model.InlineResponse200; -import org.oransc.ric.a1med.api.model.PolicyTypeSchema; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -import io.swagger.annotations.ApiParam; - -/** - * This class provides all the operation performed by A1 API. - * - * @author lathishbabu.ganesan@est.tech - * - */ -@RestController -public class A1PApiController implements A1PApi { - - private static final Logger log = LoggerFactory.getLogger(A1PApiController.class); - - private final ObjectMapper objectMapper; - - private final HttpServletRequest request; - - //@Autowired - private A1PApiServiceImpl a1pApiService; - //private A1PApiService a1pApiService; - - @Autowired - public A1PApiController(ObjectMapper objectMapper, HttpServletRequest request) { - this.objectMapper = objectMapper; - this.request = request; - a1pApiService = new A1PApiServiceImpl(); - a1pApiService.set(objectMapper, request); - } - - //Reset policy db - @RequestMapping(value = "reset", - method = RequestMethod.GET) - public void reset() { - a1pApiService.reset(); - } - - public ResponseEntity a1ControllerCreateOrReplacePolicyInstance(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId,@ApiParam(value = "",required=true) @PathVariable("policy_instance_id") String policyInstanceId,@ApiParam(value = "" ) @Valid @RequestBody Object body) { - return a1pApiService.createReplaceInstance(policyTypeId, policyInstanceId, body); - } - - public ResponseEntity a1ControllerCreatePolicyType(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId,@ApiParam(value = "" ) @Valid @RequestBody PolicyTypeSchema body) { - return a1pApiService.createReplaceType(policyTypeId, body); - } - - public ResponseEntity a1ControllerDeletePolicyInstance(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId,@ApiParam(value = "",required=true) @PathVariable("policy_instance_id") String policyInstanceId) { - return a1pApiService.deleteInstance(policyTypeId, policyInstanceId); - } - - public ResponseEntity a1ControllerDeletePolicyType(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId) { - return a1pApiService.deleteType(policyTypeId); - } - - public ResponseEntity> a1ControllerGetAllInstancesForType(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId) { - return a1pApiService.getAllInstanceForType(policyTypeId); - } - - public ResponseEntity> a1ControllerGetAllPolicyTypes() { - return a1pApiService.getAllTypes(); - } - - public ResponseEntity a1ControllerGetHealthcheck() { - return new ResponseEntity(HttpStatus.OK); - } - - public ResponseEntity a1ControllerGetPolicyInstance(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId,@ApiParam(value = "",required=true) @PathVariable("policy_instance_id") String policyInstanceId) { - return a1pApiService.getPolicyInstance(policyTypeId, policyInstanceId); - } - - public ResponseEntity> a1ControllerGetPolicyInstanceStatus(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId,@ApiParam(value = "",required=true) @PathVariable("policy_instance_id") String policyInstanceId) { - return a1pApiService.getStatus(policyTypeId, policyInstanceId); - } - - public ResponseEntity a1ControllerGetPolicyType(@ApiParam(value = "",required=true) @PathVariable("policy_type_id") Integer policyTypeId) { - return a1pApiService.getPolicyTypeSchema(policyTypeId); - } - -} diff --git a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/model/PolicyInstance.java b/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/model/PolicyInstance.java deleted file mode 100644 index ca797d45..00000000 --- a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/model/PolicyInstance.java +++ /dev/null @@ -1,50 +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.nearric.simulator.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonProperty; - - - public class PolicyInstance implements Serializable { - /** - * - */ - private static final long serialVersionUID = -4903894058377154039L; - private String policyInstanceId; - private Object jsonObject; - - public PolicyInstance(String policyInstanceId, Object jsonObject) { - this.policyInstanceId = policyInstanceId; - this.jsonObject = jsonObject; - } - - public Object getJson() { - return jsonObject; - } - - public String getInstanceId() { - return policyInstanceId; - } -} diff --git a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/model/PolicyType.java b/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/model/PolicyType.java deleted file mode 100644 index 5429cab1..00000000 --- a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/model/PolicyType.java +++ /dev/null @@ -1,76 +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.nearric.simulator.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Set; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.oransc.ric.a1med.api.model.PolicyTypeSchema; - -public class PolicyType implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 8719589957000170141L; - private Integer policyTypeId; - private PolicyTypeSchema policyTypeSchema; - private HashMap policyInstances = new HashMap(); - - public PolicyType(Integer policyTypeId, PolicyTypeSchema policyTypeSchema) { - this.policyTypeId = policyTypeId; - this.policyTypeSchema = policyTypeSchema; - } - - public int getNumberInstances() { - return policyInstances.size(); - } - - public PolicyInstance getInstance(String policyInstanceId) { - return policyInstances.get(policyInstanceId); - } - - public void delete(String policyInstanceId) { - policyInstances.remove(policyInstanceId); - } - - public PolicyTypeSchema getSchema() { - return policyTypeSchema; - } - - public void createReplaceInstance(String policyTypeId, PolicyInstance policyInstance) { - policyInstances.put(policyTypeId, policyInstance); - } - - public Set getInstances() { - return policyInstances.keySet(); - } - - public Integer getTypeId() { - return policyTypeId; - } - -} \ No newline at end of file diff --git a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/service/A1PApiService.java b/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/service/A1PApiService.java deleted file mode 100644 index b875ec7d..00000000 --- a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/service/A1PApiService.java +++ /dev/null @@ -1,53 +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.nearric.simulator.service; - -import org.onap.nearric.simulator.model.PolicyType; -import org.oransc.ric.a1med.api.model.PolicyTypeSchema; - -/** - * @author lathishbabu.ganesan@est.tech - * - */ - -public interface A1PApiService { - - public void getHealthCheck(); - - public void getPolicyTypes(); - - public PolicyType getPolicyType(Integer policyTypeId); - - public void deletePolicyTypeId(); - - public void putPolicyType(Integer policyTypeId, PolicyTypeSchema policyTypeSchema); - - public void getPolicyInstances(); - - public void getPolicyInstanceId(); - - public void deletePolicyInstanceId(); - - public void putPolicyInstance(Integer policyTypeId, String policyInstanceId, Object body); - - public void getPolicyInstanceIdStatus(); - -} diff --git a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/service/A1PApiServiceImpl.java b/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/service/A1PApiServiceImpl.java deleted file mode 100644 index a79cfa42..00000000 --- a/near-rt-ric-simulator/nearric-service/src/main/java/org/onap/nearric/simulator/service/A1PApiServiceImpl.java +++ /dev/null @@ -1,460 +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.nearric.simulator.service; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import javax.servlet.http.HttpServletRequest; - -import org.onap.nearric.simulator.model.PolicyInstance; -import org.onap.nearric.simulator.model.PolicyType; -import org.oransc.ric.a1med.api.model.InlineResponse200; -import org.oransc.ric.a1med.api.model.PolicyTypeSchema; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.fge.jackson.JsonLoader; -import com.github.fge.jsonschema.core.exceptions.ProcessingException; -import com.github.fge.jsonschema.core.report.ProcessingMessage; -import com.github.fge.jsonschema.core.report.ProcessingReport; -import com.github.fge.jsonschema.main.JsonSchema; -import com.github.fge.jsonschema.main.JsonSchemaFactory; - -/** - * This class provides the service implementation of all the A1 operation - * - * @author lathishbabu.ganesan@est.tech - * - */ - -@Service -public class A1PApiServiceImpl { - - private static final Logger log = LoggerFactory.getLogger(A1PApiServiceImpl.class); - - private HashMap policyTypes = new HashMap(); - - private ObjectMapper objectMapper = null; - - private HttpServletRequest request = null; - - public boolean validateSchema(String jsonData, String jsonSchema) { - ProcessingReport report = null; - boolean result = false; - try { - log.info("Applying schema: @<@<" + jsonSchema + ">@>@ to data: #<#<" + jsonData + ">#>#"); - JsonNode schemaNode = JsonLoader.fromString(jsonSchema); - JsonNode data = JsonLoader.fromString(jsonData); - JsonSchemaFactory factory = JsonSchemaFactory.byDefault(); - JsonSchema schema = factory.getJsonSchema(schemaNode); - report = schema.validate(data); - } catch (JsonParseException jpex) { - log.info("Error. Something went wrong trying to parse json data: #<#<" + jsonData - + ">#># or json schema: @<@<" + jsonSchema + ">@>@. Are the double quotes included? " - + jpex.getMessage()); - } catch (ProcessingException pex) { - log.info("Error. Something went wrong trying to process json data: #<#<" + jsonData - + ">#># with json schema: @<@<" + jsonSchema + ">@>@ " + pex.getMessage()); - } catch (IOException e) { - log.info("Error. Something went wrong trying to read json data: #<#<" + jsonData - + ">#># or json schema: @<@<" + jsonSchema + ">@>@"); - } - if (report != null) { - Iterator iter = report.iterator(); - while (iter.hasNext()) { - ProcessingMessage pm = iter.next(); - log.info("Processing Message: " + pm.getMessage()); - } - result = report.isSuccess(); - } - log.info("Result=" + result); - return result; - } - - public A1PApiServiceImpl() { - } - - public void set(ObjectMapper objectMapper, HttpServletRequest request) { - this.objectMapper = objectMapper; - this.request = request; - } - - public void reset() { - log.info("Resetting db"); - policyTypes.clear(); - } - - public ResponseEntity createReplaceType(Integer policyTypeId, PolicyTypeSchema policyTypeSchema) { - log.info("createReplaceType - policyTypeId: " + policyTypeId); - log.info("createReplaceType - policyTypeSchema: " + policyTypeSchema); - - if (policyTypeId == null || policyTypeSchema == null || policyTypeSchema.getName() == null) { - log.info("createReplaceType - bad parameters"); - return new ResponseEntity(HttpStatus.BAD_REQUEST); - } - - if (policyTypeSchema.getPolicyTypeId().intValue() != policyTypeId.intValue()) { - log.info("createReplaceType - policytype id mismatch between request and policyTypeSchema"); - return new ResponseEntity(HttpStatus.BAD_REQUEST); - } - - if (policyTypes.containsKey(policyTypeId.toString())) { - log.info("createReplaceType - policytype already exists"); - return new ResponseEntity(HttpStatus.BAD_REQUEST); - } - - PolicyType policyType = new PolicyType(policyTypeId, policyTypeSchema); - policyTypes.put(policyTypeId.toString(), policyType); - log.info("createReplaceType - created ok"); - - return new ResponseEntity(HttpStatus.CREATED); - } - - public ResponseEntity deleteType(Integer policyTypeId) { - log.info("deleteType - policyTypeId: " + policyTypeId); - - if (policyTypeId == null) { - log.info("deleteType - bad parameter"); - return new ResponseEntity(HttpStatus.BAD_REQUEST); - } - - PolicyType policyType = policyTypes.get(policyTypeId.toString()); - - if (policyType == null) { - log.info("deleteType - policytype does not exists"); - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - - if (policyType.getNumberInstances() > 0) { - log.info("deleteType - cannot delete, instances exists"); - return new ResponseEntity(HttpStatus.BAD_REQUEST); - } - policyTypes.remove(policyTypeId.toString()); - - log.info("deleteType - deleted ok"); - return new ResponseEntity(HttpStatus.NO_CONTENT); - } - - public ResponseEntity deleteInstance(Integer policyTypeId, String policyInstanceId) { - - log.info("deleteInstance - policyTypeId: " + policyTypeId); - log.info("deleteInstance - policyInstanceId: " + policyInstanceId); - - if (policyTypeId == null || policyInstanceId == null) { - log.info("deleteInstance - bad parameters"); - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - - PolicyType policyType = policyTypes.get(policyTypeId.toString()); - - if (policyType == null) { - log.info("deleteType - policytype does not exists"); - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - PolicyInstance policyInstance = policyType.getInstance(policyInstanceId); - if (policyInstance == null) { - log.info("deleteType - instance does not exists"); - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - policyType.delete(policyInstanceId); - - log.info("deleteInstance - deleted ok"); - return new ResponseEntity(HttpStatus.NO_CONTENT); - - } - - public ResponseEntity getPolicyTypeSchema(Integer policyTypeId) { - log.info("getPolicyTypeSchema - policyTypeId: " + policyTypeId); - - if (policyTypeId == null) { - log.info("getPolicyTypeSchema - bad parameter"); - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - - String accept = request.getHeader("Accept"); - if (accept != null && accept.contains("application/json")) { - String res = null; - try { - PolicyType policyType = policyTypes.get(policyTypeId.toString()); - - if (policyType == null) { - log.info("getPolicyTypeSchema - policytype does not exists"); - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - - String json = null; - PolicyTypeSchema schema = policyType.getSchema(); - String createSchema = "{}"; - try { - // Convert Map to JSON - json = objectMapper.writeValueAsString(schema); - // Print JSON output - log.info("getPolicyTypeSchema - schema: " + json); - - createSchema = objectMapper.writeValueAsString(schema.getCreateSchema()); - log.info("getPolicyTypeSchema - createSchema: " + createSchema); - } catch (Exception e) { - e.printStackTrace(); - log.info("getPolicyTypeSchema - schema corrupt"); - return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); - } - res = "{\n \"name\" : \"" + schema.getName() + "\",\n \"description\" : \"" + schema.getDescription() - + "\",\n \"create_schema\" : " + createSchema + ",\n \"policy_type_id\" : " - + schema.getPolicyTypeId().intValue() + "\n}"; - log.info("getPolicyTypeSchema - json schema: " + res); - return new ResponseEntity(objectMapper.readValue(res, PolicyTypeSchema.class), - HttpStatus.OK); - } catch (Exception e) { - e.printStackTrace(); - log.info("getPolicyTypeSchema - Couldn't serialize response for content type application/json"); - return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); - } - } - log.info("getPolicyTypeSchema - not implemented"); - return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); - } - - public ResponseEntity> getAllTypes() { - log.info("getAllTypes"); - - String accept = request.getHeader("Accept"); - if (accept != null && accept.contains("application/json")) { - try { - Set types = policyTypes.keySet(); - String res = ""; - for (Iterator iterator = types.iterator(); iterator.hasNext();) { - String tid = (String) iterator.next(); - if (res.length() > 0) { - res = res + ","; - } - res = res + tid; - } - return new ResponseEntity>(objectMapper.readValue("[" + res + "]", List.class), - HttpStatus.OK); - } catch (IOException e) { - e.printStackTrace(); - log.info("getAllTypes - Couldn't serialize response for content type application/json"); - return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); - } - } - log.info("getAllTypes - not implemented"); - return new ResponseEntity>(HttpStatus.NOT_IMPLEMENTED); - } - - public ResponseEntity createReplaceInstance(Integer policyTypeId, String policyInstanceId, Object body) { - log.info("createReplaceInstance - policyTypeId:" + policyTypeId); - log.info("createReplaceInstance - policyInstanceId:" + policyInstanceId); - log.info("createReplaceInstance - body:" + body); - - if (policyTypeId == null || policyInstanceId == null || body == null) { - log.info("createReplaceInstance - bad parameter"); - return new ResponseEntity(HttpStatus.BAD_REQUEST); - } - - log.info("createReplaceInstance - bodyclass:" + body.getClass().toString()); - - PolicyType policyType = policyTypes.get(policyTypeId.toString()); - - if (policyType == null) { - log.info("createReplaceInstance - policytype does not exists"); - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - - // Create json string from schema - String createSchema = null; - try { - PolicyTypeSchema schema = policyType.getSchema(); - // Convert Map to JSON - String json = objectMapper.writeValueAsString(schema); - // Print JSON output - log.info("createReplaceInstance - schema - json: " + json); - createSchema = objectMapper.writeValueAsString(schema.getCreateSchema()); - log.info("createReplaceInstance - createSchema - string: " + createSchema); - } catch (Exception e) { - e.printStackTrace(); - log.info("createReplaceInstance - schema corrupt"); - return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); - } - - // Create json string from instance - String jsonInstance = null; - try { - log.info("createReplaceInstance - raw: " + body); - // Convert Map to JSON - jsonInstance = objectMapper.writeValueAsString(body); - // Print JSON output - log.info("createReplaceInstance - instance: " + jsonInstance); - - } catch (Exception e) { - e.printStackTrace(); - log.info("createReplaceInstance - instancce corrupt"); - return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); - } - - if (!validateSchema(jsonInstance, createSchema)) { - log.info("createReplaceInstance - schema validation failed"); - return new ResponseEntity(HttpStatus.BAD_REQUEST); - } - PolicyInstance policyInstance = new PolicyInstance(policyInstanceId, body); - policyType.createReplaceInstance(policyInstanceId, policyInstance); - - log.info("createReplaceInstance - created/replaced ok"); - return new ResponseEntity(HttpStatus.CREATED); - - } - - public ResponseEntity> getAllInstanceForType(Integer policyTypeId) { - log.info("getAllInstanceForType - policyTypeId:" + policyTypeId); - - if (policyTypeId == null) { - log.info("getAllInstanceForType - bad parameter"); - return new ResponseEntity>(HttpStatus.NOT_FOUND); - } - - String accept = request.getHeader("Accept"); - if (accept != null && accept.contains("application/json")) { - try { - PolicyType policyType = policyTypes.get(policyTypeId.toString()); - if (policyType == null) { - log.info("getAllInstanceForType - policytype does not exists"); - return new ResponseEntity>(HttpStatus.NOT_FOUND); - } - Set instances = policyType.getInstances(); - String res = ""; - for (Iterator iterator = instances.iterator(); iterator.hasNext();) { - String iid = (String) iterator.next(); - iid = "\"" + iid + "\""; - if (res.length() > 0) { - res = res + ","; - } - res = res + iid; - } - log.info("getAllInstanceForType - " + res); - return new ResponseEntity>(objectMapper.readValue("[" + res + "]", List.class), - HttpStatus.OK); - } catch (IOException e) { - e.printStackTrace(); - log.info("getAllInstanceForType - Couldn't serialize response for content type application/json"); - return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); - } - } - log.info("getAllInstanceForType - not implemented"); - return new ResponseEntity>(HttpStatus.NOT_IMPLEMENTED); - - } - - public ResponseEntity getPolicyInstance(Integer policyTypeId, String policyInstanceId) { - log.info("getPolicyInstance - policyTypeId:" + policyTypeId); - log.info("getPolicyInstance - policyInstanceId:" + policyInstanceId); - - if (policyTypeId == null || policyInstanceId == null) { - log.info("getPolicyInstance - bad parameter"); - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - - String accept = request.getHeader("Accept"); - if (accept != null && accept.contains("application/json")) { - try { - PolicyType policyType = policyTypes.get(policyTypeId.toString()); - if (policyType == null) { - log.info("getPolicyInstance - policytype does not exists"); - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - PolicyInstance policyInstance = policyType.getInstance(policyInstanceId); - if (policyInstance == null) { - log.info("getPolicyInstance - policyinstance does not exists"); - return new ResponseEntity(HttpStatus.NOT_FOUND); - } - - String json = null; - try { - log.info("getPolicyInstance - rawschema: " + policyInstance.getJson()); - // Convert Map to JSON - json = objectMapper.writeValueAsString(policyInstance.getJson()); - // Print JSON output - log.info("getPolicyInstance - schema: " + json); - - } catch (Exception e) { - e.printStackTrace(); - log.info("getPolicyInstance - schema corrupt"); - return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); - } - - return new ResponseEntity(objectMapper.readValue(json, Object.class), HttpStatus.OK); - } catch (IOException e) { - e.printStackTrace(); - log.info("getPolicyInstance - policyinstance corrupt"); - return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); - } - - public ResponseEntity> getStatus(Integer policyTypeId, String policyInstanceId) { - log.info("getStatus - policyTypeId:" + policyTypeId); - log.info("getStatus - policyInstanceId:" + policyInstanceId); - - if (policyTypeId == null || policyInstanceId == null) { - log.info("getStatus - bad parameters"); - return new ResponseEntity>(HttpStatus.NOT_FOUND); - } - - String accept = request.getHeader("Accept"); - if (accept != null && accept.contains("application/json")) { - try { - PolicyType policyType = policyTypes.get(policyTypeId.toString()); - if (policyType == null) { - log.info("getStatus - policytype does not exists"); - return new ResponseEntity>(HttpStatus.NOT_FOUND); - } - PolicyInstance policyInstance = policyType.getInstance(policyInstanceId); - if (policyInstance == null) { - log.info("getStatus - policyinstance does not exists"); - return new ResponseEntity>(HttpStatus.NOT_FOUND); - } - - return new ResponseEntity>( - objectMapper.readValue("[ {\n \"handler_id\" : \"NearRTRIC-1\",\n \"status\" : \"enforced\"\n} ]", - List.class), - HttpStatus.OK); - } catch (IOException e) { - e.printStackTrace(); - log.info("getStatus - Couldn't serialize response for content type application/json"); - return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); - } - } - - return new ResponseEntity>(HttpStatus.NOT_IMPLEMENTED); - } - -} diff --git a/near-rt-ric-simulator/nearric-service/src/main/resources/application.properties b/near-rt-ric-simulator/nearric-service/src/main/resources/application.properties deleted file mode 100644 index b6c85b58..00000000 --- a/near-rt-ric-simulator/nearric-service/src/main/resources/application.properties +++ /dev/null @@ -1,19 +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. -# ========================LICENSE_END=================================== -spring.security.user.name=admin -spring.security.user.password=admin -spring.jackson.property-naming-strategy=SNAKE_CASE \ No newline at end of file diff --git a/near-rt-ric-simulator/nearric-service/test/.gitignore b/near-rt-ric-simulator/nearric-service/test/.gitignore deleted file mode 100644 index aab4112a..00000000 --- a/near-rt-ric-simulator/nearric-service/test/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.tmp* diff --git a/near-rt-ric-simulator/nearric-service/test/pi-template.json b/near-rt-ric-simulator/nearric-service/test/pi-template.json deleted file mode 100644 index a6c6bdc9..00000000 --- a/near-rt-ric-simulator/nearric-service/test/pi-template.json +++ /dev/null @@ -1,4 +0,0 @@ -{ "scope": {"ue_id": "1","flow_id": "3"}, - "statement" : {"gfbr": "l", "mfbr": "2", "priority_level": "3", "pdb": "4"}, - "policy_id": "pi-XXXX" -} \ No newline at end of file diff --git a/near-rt-ric-simulator/nearric-service/test/populate.sh b/near-rt-ric-simulator/nearric-service/test/populate.sh deleted file mode 100755 index 378fee86..00000000 --- a/near-rt-ric-simulator/nearric-service/test/populate.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -echo "Usage: populate.sh []" - -HOST_PORT="localhost:8080" - -if [ $# == 1 ]; then - echo "Setting host and port from cmd line: "$1 - HOST_PORT=$1 -fi - -echo "=======================================" -echo "Using host and port:" $HOST_PORT -echo "=======================================" - - -PT_MAX=10 -PI_MAX=20 -PI_ID=0 -pt=0 -while [ $pt -lt $PT_MAX ]; do - pi=0 - PATTERN="s/XXXX/${pt}/g" - sed $PATTERN pt-template.json > .tmp.json - curl -v -X PUT --header 'Content-Type: application/json' --header 'Accept: */*' -d @.tmp.json 'http://'$HOST_PORT'/a1-p/policytypes/'$pt - while [ $pi -lt $PI_MAX ]; do - echo $pt"--"$pi"-"$PI_ID - - PATTERN="s/XXXX/${PI_ID}/g" - sed $PATTERN pi-template.json > .tmp.json - curl -v -X PUT --header 'Content-Type: application/json' --header 'Accept: */*' -d @.tmp.json 'http://'$HOST_PORT'/a1-p/policytypes/'$pt'/policies/'$PI_ID - let pi=pi+1 - let PI_ID=PI_ID+1 - done - let pt=pt+1 -done - -curl -v --header 'Accept: application/json' 'http://'$HOST_PORT'/a1-p/policytypes/' -curl -v --header 'Accept: application/json' 'http://'$HOST_PORT'/a1-p/policytypes/1/policies' diff --git a/near-rt-ric-simulator/nearric-service/test/pt-template.json b/near-rt-ric-simulator/nearric-service/test/pt-template.json deleted file mode 100644 index 8fa16b13..00000000 --- a/near-rt-ric-simulator/nearric-service/test/pt-template.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "description": "Policy type XXXX", - "name": "PT XXXX", - "policy_type_id": XXXX, - "create_schema": - - - { - "$id": "https://est.tech/policy-type.schema.json", - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Policy type schema XXXX", - "description": "Policy type schema for qos", - "type": "object", - "properties": { - "policy_id": { - "description": "Identity of the policy", - "type": "string"}, - "scope": { - "type": "object", - "properties": { - "ue_id": { - "description": "User identity", - "type": "string"}, - "flow_id": { - "description": "Identity of the flow", - "type": "string"} - }, "required": ["ue_id", "flow_id"] - }, - "statement": { - "type": "object", - "properties": { - "gfbr": { - "description": "Guaranteed Flow Bit Rate", - "type": "string"}, - "mfbr": { - "description": "Maximum Flow Bit Rate", - "type": "string"}, - "priority_level": { - "description": "Priority Level", - "type": "string"}, - "pdb": { - "description": "Packet Delay Budget", - "type": "string"} - }, "required": ["gfbr", "mfbr", "priority_level", "pdb"] - } - }, "required": ["policy_id", "scope", "statement"] - } - -} diff --git a/near-rt-ric-simulator/nearric-service/test/test-api.sh b/near-rt-ric-simulator/nearric-service/test/test-api.sh deleted file mode 100755 index fd6b1d09..00000000 --- a/near-rt-ric-simulator/nearric-service/test/test-api.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash - -#Script for basic testing of the A1 simulator API -#Note: policy is reset before test - -HOST_PORT="localhost:8080" - -echo "Usage: populate.sh []" - -HOST_PORT="localhost:8080" - -if [ $# == 1 ]; then - echo "Setting host and port from cmd line: "$1 - HOST_PORT=$1 -fi - -echo "=======================================" -echo "Using host and port:" $HOST_PORT -echo "=======================================" - -echo "=======================================" -echo "Resetting db" -curl 'http://'$HOST_PORT'/reset' -echo "=======================================" - -#Create a policy type -create_pt() { - PATTERN="s/XXXX/${1}/g" - sed $PATTERN pt-template.json > .tmp.json - res=$(curl -sw "%{http_code}" -X PUT --header 'Content-Type: application/json' --header 'Accept: */*' -d @.tmp.json 'http://'${HOST_PORT}'/a1-p/policytypes/'$1) - http_code="${res:${#res}-3}" - echo "Response code: " $http_code -} - -get_pt() { - res=$(curl -sw "%{http_code}" --header 'Accept: application/json' 'http://'${HOST_PORT}'/a1-p/policytypes/'$1) - http_code="${res:${#res}-3}" - echo "Response code: " $http_code - echo "Response: " ${res:0:${#res}-3} -} - -get_pts() { - res=$(curl -sw "%{http_code}" --header 'Accept: application/json' 'http://'${HOST_PORT}'/a1-p/policytypes/') - http_code="${res:${#res}-3}" - echo "Response code: " $http_code - echo "Response: " ${res:0:${#res}-3} -} - -del_pt() { - res=$(curl -sw "%{http_code}" -X DELETE --header 'Accept: */*' 'http://'${HOST_PORT}'/a1-p/policytypes/'$1) - http_code="${res:${#res}-3}" - echo "Response code: " $http_code -} - -get_pis() { - res=$(curl -sw "%{http_code}" --header 'Accept: application/json' 'http://'${HOST_PORT}'/a1-p/policytypes/'${1}'/policies') - http_code="${res:${#res}-3}" - echo "Response code: " $http_code - echo "Response: " ${res:0:${#res}-3} -} - -create_pi() { - PATTERN="s/XXXX/${2}/g" - sed $PATTERN pi-template.json > .tmp.json - res=$(curl -sw "%{http_code}" -X PUT --header 'Content-Type: application/json' --header 'Accept: */*' -d @.tmp.json 'http://'${HOST_PORT}'/a1-p/policytypes/'$1'/policies/'$2) - http_code="${res:${#res}-3}" - echo "Response code: " $http_code -} - -get_pi() { - res=$(curl -sw "%{http_code}" --header 'Accept: application/json' 'http://'${HOST_PORT}'/a1-p/policytypes/'${1}'/policies/'$2) - http_code="${res:${#res}-3}" - echo "Response code: " $http_code - echo "Response: " ${res:0:${#res}-3} -} - -del_pi() { - res=$(curl -sw "%{http_code}" -X DELETE --header 'Accept: application/json' 'http://'${HOST_PORT}'/a1-p/policytypes/'${1}'/policies/'$2) - http_code="${res:${#res}-3}" - echo "Response code: " $http_code -} - -stat_pi() { - res=$(curl -sw "%{http_code}" --header 'Accept: application/json' 'http://'${HOST_PORT}'/a1-p/policytypes/'${1}'/policies/'$2'/status') - http_code="${res:${#res}-3}" - echo "Response code: " $http_code - echo "Response: " ${res:0:${#res}-3} -} - - -echo "== Create policy type 23" -create_pt 23 -echo "== Get policy type 23" -get_pt 23 -echo "== Create policy type 23 again" -create_pt 23 -echo "== Create policy type 24" -create_pt 24 -echo "== Get all policy types" -get_pts -echo "== Delete policy type 24" -del_pt 24 -echo "== Delete policy type 24 again" -del_pt 24 -echo "== Get all policy types" -get_pts -echo "== Get all policy instancess for type 23" -get_pis 23 -echo "== Create policy instance 16 for type 23" -create_pi 23 16 -echo "== Create policy instance 16 for type 23 again" -create_pi 23 16 -echo "== Get policy instance 16 for type 23" -get_pi 23 16 -echo "== Get missing policy instance 17 for type 23" -get_pi 23 17 -echo "== Create policy instance 18 for type 23" -create_pi 23 18 -echo "== Get all policy instances for type 23" -get_pis 23 -echo "== Delete policy instance 18 for type 23" -del_pi 23 18 -echo "== Get all policy instances for type 23" -get_pis 23 -echo "== Get status for policy instance 16 for type 23" -stat_pi 23 16 diff --git a/near-rt-ric-simulator/pom.xml b/near-rt-ric-simulator/pom.xml deleted file mode 100644 index 58368535..00000000 --- a/near-rt-ric-simulator/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - 4.0.0 - org.oran.nearric - nearric-simulator - 1.0.1-SNAPSHOT - pom - ${project.artifactId} - - - org.springframework.boot - spring-boot-starter-parent - 2.1.9.RELEASE - - - - - 2.1.9.RELEASE - 11 - 0.30.0 - - - - - - org.springframework.boot - spring-boot-dependencies - ${spring.boot.version} - pom - import - - - - - - - org.springframework - spring-context - - - org.springframework - spring-web - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - - - - - diff --git a/pom.xml b/pom.xml index 840cb0f4..facc920d 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,6 @@ policy-agent sdnc-a1-controller - near-rt-ric-simulator diff --git a/near-rt-ric-simulator/.gitignore b/test/.gitignore similarity index 100% rename from near-rt-ric-simulator/.gitignore rename to test/.gitignore diff --git a/near-rt-ric-simulator/LICENSES.txt b/test/LICENSES.txt similarity index 100% rename from near-rt-ric-simulator/LICENSES.txt rename to test/LICENSES.txt diff --git a/near-rt-ric-simulator/auto-test/.gitignore b/test/auto-test/.gitignore similarity index 100% rename from near-rt-ric-simulator/auto-test/.gitignore rename to test/auto-test/.gitignore diff --git a/near-rt-ric-simulator/auto-test/Dockerize_test.sh b/test/auto-test/Dockerize_test.sh similarity index 100% rename from near-rt-ric-simulator/auto-test/Dockerize_test.sh rename to test/auto-test/Dockerize_test.sh diff --git a/near-rt-ric-simulator/auto-test/FTC10.sh b/test/auto-test/FTC10.sh similarity index 100% rename from near-rt-ric-simulator/auto-test/FTC10.sh rename to test/auto-test/FTC10.sh diff --git a/near-rt-ric-simulator/auto-test/FTC100.sh b/test/auto-test/FTC100.sh similarity index 100% rename from near-rt-ric-simulator/auto-test/FTC100.sh rename to test/auto-test/FTC100.sh diff --git a/near-rt-ric-simulator/auto-test/FTC200.sh b/test/auto-test/FTC200.sh similarity index 100% rename from near-rt-ric-simulator/auto-test/FTC200.sh rename to test/auto-test/FTC200.sh diff --git a/near-rt-ric-simulator/auto-test/FTC300.sh b/test/auto-test/FTC300.sh similarity index 100% rename from near-rt-ric-simulator/auto-test/FTC300.sh rename to test/auto-test/FTC300.sh diff --git a/near-rt-ric-simulator/auto-test/FTC310.sh b/test/auto-test/FTC310.sh similarity index 100% rename from near-rt-ric-simulator/auto-test/FTC310.sh rename to test/auto-test/FTC310.sh diff --git a/near-rt-ric-simulator/auto-test/FTC320.sh b/test/auto-test/FTC320.sh similarity index 100% rename from near-rt-ric-simulator/auto-test/FTC320.sh rename to test/auto-test/FTC320.sh diff --git a/near-rt-ric-simulator/auto-test/FTC500.sh b/test/auto-test/FTC500.sh similarity index 100% rename from near-rt-ric-simulator/auto-test/FTC500.sh rename to test/auto-test/FTC500.sh diff --git a/near-rt-ric-simulator/auto-test/FTC_SDNC.sh b/test/auto-test/FTC_SDNC.sh similarity index 100% rename from near-rt-ric-simulator/auto-test/FTC_SDNC.sh rename to test/auto-test/FTC_SDNC.sh diff --git a/near-rt-ric-simulator/auto-test/README.md b/test/auto-test/README.md similarity index 100% rename from near-rt-ric-simulator/auto-test/README.md rename to test/auto-test/README.md diff --git a/near-rt-ric-simulator/auto-test/Suite-interfaces.sh b/test/auto-test/Suite-interfaces.sh similarity index 100% rename from near-rt-ric-simulator/auto-test/Suite-interfaces.sh rename to test/auto-test/Suite-interfaces.sh diff --git a/near-rt-ric-simulator/auto-test/testdata/OSC/1.json b/test/auto-test/testdata/OSC/1.json similarity index 100% rename from near-rt-ric-simulator/auto-test/testdata/OSC/1.json rename to test/auto-test/testdata/OSC/1.json diff --git a/near-rt-ric-simulator/auto-test/testdata/OSC/2.json b/test/auto-test/testdata/OSC/2.json similarity index 100% rename from near-rt-ric-simulator/auto-test/testdata/OSC/2.json rename to test/auto-test/testdata/OSC/2.json diff --git a/near-rt-ric-simulator/auto-test/testdata/OSC/pi1_template.json b/test/auto-test/testdata/OSC/pi1_template.json similarity index 100% rename from near-rt-ric-simulator/auto-test/testdata/OSC/pi1_template.json rename to test/auto-test/testdata/OSC/pi1_template.json diff --git a/near-rt-ric-simulator/auto-test/testdata/OSC/pi2_template.json b/test/auto-test/testdata/OSC/pi2_template.json similarity index 100% rename from near-rt-ric-simulator/auto-test/testdata/OSC/pi2_template.json rename to test/auto-test/testdata/OSC/pi2_template.json diff --git a/near-rt-ric-simulator/auto-test/testdata/OSC/sim_1.json b/test/auto-test/testdata/OSC/sim_1.json similarity index 100% rename from near-rt-ric-simulator/auto-test/testdata/OSC/sim_1.json rename to test/auto-test/testdata/OSC/sim_1.json diff --git a/near-rt-ric-simulator/auto-test/testdata/OSC/sim_2.json b/test/auto-test/testdata/OSC/sim_2.json similarity index 100% rename from near-rt-ric-simulator/auto-test/testdata/OSC/sim_2.json rename to test/auto-test/testdata/OSC/sim_2.json diff --git a/near-rt-ric-simulator/auto-test/testdata/STD/EMPTYTYPE.json b/test/auto-test/testdata/STD/EMPTYTYPE.json similarity index 100% rename from near-rt-ric-simulator/auto-test/testdata/STD/EMPTYTYPE.json rename to test/auto-test/testdata/STD/EMPTYTYPE.json diff --git a/near-rt-ric-simulator/auto-test/testdata/STD/pi1_template.json b/test/auto-test/testdata/STD/pi1_template.json similarity index 100% rename from near-rt-ric-simulator/auto-test/testdata/STD/pi1_template.json rename to test/auto-test/testdata/STD/pi1_template.json diff --git a/near-rt-ric-simulator/auto-test/utils/pa-logviewer.sh b/test/auto-test/utils/pa-logviewer.sh similarity index 100% rename from near-rt-ric-simulator/auto-test/utils/pa-logviewer.sh rename to test/auto-test/utils/pa-logviewer.sh diff --git a/near-rt-ric-simulator/common/README.md b/test/common/README.md similarity index 100% rename from near-rt-ric-simulator/common/README.md rename to test/common/README.md diff --git a/near-rt-ric-simulator/common/agent_api_functions.sh b/test/common/agent_api_functions.sh similarity index 99% rename from near-rt-ric-simulator/common/agent_api_functions.sh rename to test/common/agent_api_functions.sh index fbcf2402..312eacb5 100644 --- a/near-rt-ric-simulator/common/agent_api_functions.sh +++ b/test/common/agent_api_functions.sh @@ -126,7 +126,7 @@ __do_curl_to_agent() { file=" --data-binary "$payload fi #urlencode the request url since it will be carried by send-request url - requestUrl=$(python -c "import urllib, sys; print urllib.quote(sys.argv[1])" "$2") + requestUrl=$(python -c "from __future__ import print_function; import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$2") url=" "${ADAPTER}"/send-request?url="${requestUrl}"&operation="${oper} curlString="curl -X POST${timeout}${httpcode}${content}${url}${file}" echo " CMD: "$curlString >> $HTTPLOG diff --git a/near-rt-ric-simulator/common/compare_json.py b/test/common/compare_json.py similarity index 100% rename from near-rt-ric-simulator/common/compare_json.py rename to test/common/compare_json.py diff --git a/near-rt-ric-simulator/common/controller_api_functions.sh b/test/common/controller_api_functions.sh similarity index 100% rename from near-rt-ric-simulator/common/controller_api_functions.sh rename to test/common/controller_api_functions.sh diff --git a/near-rt-ric-simulator/common/count_json_elements.py b/test/common/count_json_elements.py similarity index 100% rename from near-rt-ric-simulator/common/count_json_elements.py rename to test/common/count_json_elements.py diff --git a/near-rt-ric-simulator/common/create_rics_json.py b/test/common/create_rics_json.py similarity index 100% rename from near-rt-ric-simulator/common/create_rics_json.py rename to test/common/create_rics_json.py diff --git a/near-rt-ric-simulator/common/do_curl_function.sh b/test/common/do_curl_function.sh similarity index 100% rename from near-rt-ric-simulator/common/do_curl_function.sh rename to test/common/do_curl_function.sh diff --git a/near-rt-ric-simulator/common/extract_sdnc_reply.py b/test/common/extract_sdnc_reply.py similarity index 100% rename from near-rt-ric-simulator/common/extract_sdnc_reply.py rename to test/common/extract_sdnc_reply.py diff --git a/near-rt-ric-simulator/common/ricsimulator_api_functions.sh b/test/common/ricsimulator_api_functions.sh similarity index 100% rename from near-rt-ric-simulator/common/ricsimulator_api_functions.sh rename to test/common/ricsimulator_api_functions.sh diff --git a/near-rt-ric-simulator/common/test_env.sh b/test/common/test_env.sh similarity index 100% rename from near-rt-ric-simulator/common/test_env.sh rename to test/common/test_env.sh diff --git a/near-rt-ric-simulator/common/testcase_common.sh b/test/common/testcase_common.sh similarity index 100% rename from near-rt-ric-simulator/common/testcase_common.sh rename to test/common/testcase_common.sh diff --git a/near-rt-ric-simulator/common/testsuite_common.sh b/test/common/testsuite_common.sh similarity index 100% rename from near-rt-ric-simulator/common/testsuite_common.sh rename to test/common/testsuite_common.sh diff --git a/near-rt-ric-simulator/cr/.gitignore b/test/cr/.gitignore similarity index 100% rename from near-rt-ric-simulator/cr/.gitignore rename to test/cr/.gitignore diff --git a/near-rt-ric-simulator/cr/Dockerfile b/test/cr/Dockerfile similarity index 100% rename from near-rt-ric-simulator/cr/Dockerfile rename to test/cr/Dockerfile diff --git a/near-rt-ric-simulator/cr/README.md b/test/cr/README.md similarity index 100% rename from near-rt-ric-simulator/cr/README.md rename to test/cr/README.md diff --git a/near-rt-ric-simulator/cr/basic_test.sh b/test/cr/basic_test.sh similarity index 100% rename from near-rt-ric-simulator/cr/basic_test.sh rename to test/cr/basic_test.sh diff --git a/near-rt-ric-simulator/cr/cr-build-start.sh b/test/cr/cr-build-start.sh similarity index 100% rename from near-rt-ric-simulator/cr/cr-build-start.sh rename to test/cr/cr-build-start.sh diff --git a/near-rt-ric-simulator/cr/cr.py b/test/cr/cr.py similarity index 100% rename from near-rt-ric-simulator/cr/cr.py rename to test/cr/cr.py diff --git a/near-rt-ric-simulator/cr/requirements.txt b/test/cr/requirements.txt similarity index 100% rename from near-rt-ric-simulator/cr/requirements.txt rename to test/cr/requirements.txt diff --git a/near-rt-ric-simulator/mrstub/.gitignore b/test/mrstub/.gitignore similarity index 100% rename from near-rt-ric-simulator/mrstub/.gitignore rename to test/mrstub/.gitignore diff --git a/near-rt-ric-simulator/mrstub/Dockerfile b/test/mrstub/Dockerfile similarity index 100% rename from near-rt-ric-simulator/mrstub/Dockerfile rename to test/mrstub/Dockerfile diff --git a/near-rt-ric-simulator/mrstub/README.md b/test/mrstub/README.md similarity index 100% rename from near-rt-ric-simulator/mrstub/README.md rename to test/mrstub/README.md diff --git a/near-rt-ric-simulator/mrstub/basic_test.sh b/test/mrstub/basic_test.sh similarity index 100% rename from near-rt-ric-simulator/mrstub/basic_test.sh rename to test/mrstub/basic_test.sh diff --git a/near-rt-ric-simulator/mrstub/mr.py b/test/mrstub/mr.py similarity index 100% rename from near-rt-ric-simulator/mrstub/mr.py rename to test/mrstub/mr.py diff --git a/near-rt-ric-simulator/mrstub/mrstub-build-start.sh b/test/mrstub/mrstub-build-start.sh similarity index 100% rename from near-rt-ric-simulator/mrstub/mrstub-build-start.sh rename to test/mrstub/mrstub-build-start.sh diff --git a/near-rt-ric-simulator/mrstub/requirements.txt b/test/mrstub/requirements.txt similarity index 100% rename from near-rt-ric-simulator/mrstub/requirements.txt rename to test/mrstub/requirements.txt diff --git a/near-rt-ric-simulator/simulator-group/.gitignore b/test/simulator-group/.gitignore similarity index 100% rename from near-rt-ric-simulator/simulator-group/.gitignore rename to test/simulator-group/.gitignore diff --git a/near-rt-ric-simulator/simulator-group/consul_cbs/consul/cbs_config.hcl b/test/simulator-group/consul_cbs/consul/cbs_config.hcl similarity index 100% rename from near-rt-ric-simulator/simulator-group/consul_cbs/consul/cbs_config.hcl rename to test/simulator-group/consul_cbs/consul/cbs_config.hcl diff --git a/near-rt-ric-simulator/simulator-group/consul_cbs/consul/cbs_localhost_config.hcl b/test/simulator-group/consul_cbs/consul/cbs_localhost_config.hcl similarity index 100% rename from near-rt-ric-simulator/simulator-group/consul_cbs/consul/cbs_localhost_config.hcl rename to test/simulator-group/consul_cbs/consul/cbs_localhost_config.hcl diff --git a/near-rt-ric-simulator/simulator-group/consul_cbs/docker-compose.yml b/test/simulator-group/consul_cbs/docker-compose.yml similarity index 100% rename from near-rt-ric-simulator/simulator-group/consul_cbs/docker-compose.yml rename to test/simulator-group/consul_cbs/docker-compose.yml diff --git a/near-rt-ric-simulator/simulator-group/consul_cbs/start.sh b/test/simulator-group/consul_cbs/start.sh similarity index 100% rename from near-rt-ric-simulator/simulator-group/consul_cbs/start.sh rename to test/simulator-group/consul_cbs/start.sh diff --git a/near-rt-ric-simulator/simulator-group/control_panel/docker-compose.yml b/test/simulator-group/control_panel/docker-compose.yml similarity index 100% rename from near-rt-ric-simulator/simulator-group/control_panel/docker-compose.yml rename to test/simulator-group/control_panel/docker-compose.yml diff --git a/near-rt-ric-simulator/simulator-group/cr/docker-compose.yml b/test/simulator-group/cr/docker-compose.yml similarity index 100% rename from near-rt-ric-simulator/simulator-group/cr/docker-compose.yml rename to test/simulator-group/cr/docker-compose.yml diff --git a/near-rt-ric-simulator/simulator-group/mr/docker-compose.yml b/test/simulator-group/mr/docker-compose.yml similarity index 100% rename from near-rt-ric-simulator/simulator-group/mr/docker-compose.yml rename to test/simulator-group/mr/docker-compose.yml diff --git a/near-rt-ric-simulator/simulator-group/policy_agent/docker-compose.yml b/test/simulator-group/policy_agent/docker-compose.yml similarity index 100% rename from near-rt-ric-simulator/simulator-group/policy_agent/docker-compose.yml rename to test/simulator-group/policy_agent/docker-compose.yml diff --git a/near-rt-ric-simulator/simulator-group/ric/.gitignore b/test/simulator-group/ric/.gitignore similarity index 100% rename from near-rt-ric-simulator/simulator-group/ric/.gitignore rename to test/simulator-group/ric/.gitignore diff --git a/near-rt-ric-simulator/simulator-group/ric/cleanConsul.py b/test/simulator-group/ric/cleanConsul.py similarity index 100% rename from near-rt-ric-simulator/simulator-group/ric/cleanConsul.py rename to test/simulator-group/ric/cleanConsul.py diff --git a/near-rt-ric-simulator/simulator-group/ric/docker-compose.yml b/test/simulator-group/ric/docker-compose.yml similarity index 100% rename from near-rt-ric-simulator/simulator-group/ric/docker-compose.yml rename to test/simulator-group/ric/docker-compose.yml diff --git a/near-rt-ric-simulator/simulator-group/ric/prepareConsul.py b/test/simulator-group/ric/prepareConsul.py similarity index 100% rename from near-rt-ric-simulator/simulator-group/ric/prepareConsul.py rename to test/simulator-group/ric/prepareConsul.py diff --git a/near-rt-ric-simulator/simulator-group/sdnc/docker-compose.yml b/test/simulator-group/sdnc/docker-compose.yml similarity index 100% rename from near-rt-ric-simulator/simulator-group/sdnc/docker-compose.yml rename to test/simulator-group/sdnc/docker-compose.yml diff --git a/near-rt-ric-simulator/simulator-group/sim-monitor-start.sh b/test/simulator-group/sim-monitor-start.sh similarity index 100% rename from near-rt-ric-simulator/simulator-group/sim-monitor-start.sh rename to test/simulator-group/sim-monitor-start.sh diff --git a/near-rt-ric-simulator/simulator-group/sim-monitor.js b/test/simulator-group/sim-monitor.js similarity index 100% rename from near-rt-ric-simulator/simulator-group/sim-monitor.js rename to test/simulator-group/sim-monitor.js -- 2.16.6