From bccdfae0521c7aa6299b2dee2d887e945ffa3490 Mon Sep 17 00:00:00 2001 From: Lathish Date: Thu, 7 Jan 2021 16:14:03 +0000 Subject: [PATCH] Nonrtric Control Panel Gateway Issue-ID: NONRTRIC-353 Change-Id: Ifced9ebd4f843b8770432c4977310da2526d8092 Signed-off-by: Lathish --- nonrtric-gateway/.gitignore | 33 ++ nonrtric-gateway/Dockerfile | 35 ++ nonrtric-gateway/README.md | 21 ++ nonrtric-gateway/config/application.yaml | 52 +++ nonrtric-gateway/eclipse-formatter.xml | 363 +++++++++++++++++++++ nonrtric-gateway/pom.xml | 181 ++++++++++ .../nonrtric/gateway/GatewayApplication.java | 33 ++ .../nonrtric/gateway/GatewayApplicationTests.java | 32 ++ 8 files changed, 750 insertions(+) create mode 100644 nonrtric-gateway/.gitignore create mode 100644 nonrtric-gateway/Dockerfile create mode 100644 nonrtric-gateway/README.md create mode 100644 nonrtric-gateway/config/application.yaml create mode 100644 nonrtric-gateway/eclipse-formatter.xml create mode 100644 nonrtric-gateway/pom.xml create mode 100644 nonrtric-gateway/src/main/java/org/oransc/nonrtric/gateway/GatewayApplication.java create mode 100644 nonrtric-gateway/src/test/java/org/oransc/nonrtric/gateway/GatewayApplicationTests.java diff --git a/nonrtric-gateway/.gitignore b/nonrtric-gateway/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/nonrtric-gateway/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/nonrtric-gateway/Dockerfile b/nonrtric-gateway/Dockerfile new file mode 100644 index 0000000..9f2a545 --- /dev/null +++ b/nonrtric-gateway/Dockerfile @@ -0,0 +1,35 @@ +# +# ============LICENSE_START======================================================= +# Copyright (C) 2021 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========================================================= +# +FROM openjdk:11-jre-slim + +ARG JAR + +WORKDIR /opt/app/nonrtric-gateway +RUN mkdir -p /var/log/nonrtric-gateway + +EXPOSE 8081 8433 + +ADD /config/application.yaml /opt/app/nonrtric-gateway/config/application.yaml +ADD target/${JAR} /opt/app/nonrtric-gateway/nonrtric-gateway.jar + + +RUN chmod -R 777 /opt/app/nonrtric-gateway/config/ + +CMD ["java", "-jar", "/opt/app/nonrtric-gateway/nonrtric-gateway.jar"] diff --git a/nonrtric-gateway/README.md b/nonrtric-gateway/README.md new file mode 100644 index 0000000..23eec31 --- /dev/null +++ b/nonrtric-gateway/README.md @@ -0,0 +1,21 @@ +# O-RAN-SC Non-RT RIC ControlPanel Gateway + +The O-RAN Non-RT RIC ControlPanel Gateway provides an API Gateway for all the Non-RT-RIC Components + +The application is a spring cloud gateway and all the route configurations are provided in application.yaml. + + +## License + +Copyright (C) 2021 Nordix Foundation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +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. diff --git a/nonrtric-gateway/config/application.yaml b/nonrtric-gateway/config/application.yaml new file mode 100644 index 0000000..57d94d7 --- /dev/null +++ b/nonrtric-gateway/config/application.yaml @@ -0,0 +1,52 @@ +################################################################################ +# Copyright (c) 2021 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. # +################################################################################ + +server: + port: 9090 +spring: + cloud: + gateway: + httpclient: + ssl: + useInsecureTrustManager: true + wiretap: true + httpserver: + wiretap: true + routes: + - id: policytypes + uri: https://localhost:8433 + predicates: + - Path=/v2/policy-types/** + - id: policies + uri: https://localhost:8433 + predicates: + - Path=/v2/policies +management: + endpoint: + gateway: + enabled: true + endpoints: + web: + exposure: + include: "gateway,loggers,logfile,health,info,metrics,threaddump,heapdump" +logging: + level: + ROOT: ERROR + org.springframework: ERROR + org.springframework.cloud.gateway: INFO + reactor.netty: INFO + file: + name: /var/log/nonrtric-gateway/application.log \ No newline at end of file diff --git a/nonrtric-gateway/eclipse-formatter.xml b/nonrtric-gateway/eclipse-formatter.xml new file mode 100644 index 0000000..c5412d9 --- /dev/null +++ b/nonrtric-gateway/eclipse-formatter.xml @@ -0,0 +1,363 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nonrtric-gateway/pom.xml b/nonrtric-gateway/pom.xml new file mode 100644 index 0000000..5917ef5 --- /dev/null +++ b/nonrtric-gateway/pom.xml @@ -0,0 +1,181 @@ + + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.4.1 + + + org.oransc.nonrtric + nonrtric-gateway + 0.0.1-SNAPSHOT + Nonrtric Gateway + Nonrtric Gateway + + + 11 + 2020.0.0 + 2.13.0 + 2.5.0 + 0.30.0 + + + + + org.springframework.cloud + spring-cloud-starter-gateway + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-starter-actuator + runtime + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + net.revelc.code.formatter + formatter-maven-plugin + ${formatter-maven-plugin.version} + + LF + ${project.basedir}/eclipse-formatter.xml + + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless-maven-plugin.version} + + UNIX + + + + com,java,javax,org + + + + + + + + + + docker + + + + io.fabric8 + docker-maven-plugin + ${docker-maven-plugin.version} + false + + + generate-nonrtric-gateway-image + package + + build + + + ${env.CONTAINER_PULL_REGISTRY} + + + o-ran-sc/nonrtric-gateway:${project.version} + + try + ${basedir} + Dockerfile + + ${project.build.finalName}.jar + + + ${project.version} + + + + + + + + push-nonrtric-gateway-image + + build + push + + + ${env.CONTAINER_PULL_REGISTRY} + ${env.CONTAINER_PUSH_REGISTRY} + + + o-ran-sc/nonrtric-gateway:${project.version} + + ${basedir} + Dockerfile + + ${project.build.finalName}.jar + + + ${project.version} + latest + + + + + + + + + + + + + \ No newline at end of file diff --git a/nonrtric-gateway/src/main/java/org/oransc/nonrtric/gateway/GatewayApplication.java b/nonrtric-gateway/src/main/java/org/oransc/nonrtric/gateway/GatewayApplication.java new file mode 100644 index 0000000..992e793 --- /dev/null +++ b/nonrtric-gateway/src/main/java/org/oransc/nonrtric/gateway/GatewayApplication.java @@ -0,0 +1,33 @@ +/*- + * ========================LICENSE_START================================= + * O-RAN-SC + * %% + * Copyright (C) 2021 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=================================== + */ + +package org.oransc.nonrtric.gateway; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class GatewayApplication { + + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class, args); + } + +} diff --git a/nonrtric-gateway/src/test/java/org/oransc/nonrtric/gateway/GatewayApplicationTests.java b/nonrtric-gateway/src/test/java/org/oransc/nonrtric/gateway/GatewayApplicationTests.java new file mode 100644 index 0000000..c2ca7f3 --- /dev/null +++ b/nonrtric-gateway/src/test/java/org/oransc/nonrtric/gateway/GatewayApplicationTests.java @@ -0,0 +1,32 @@ +/*- + * ========================LICENSE_START================================= + * O-RAN-SC + * %% + * Copyright (C) 2021 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=================================== + */ + +package org.oransc.nonrtric.gateway; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class GatewayApplicationTests { + + @Test + void contextLoads() {} + +} -- 2.16.6