Group E2 manager API operations with tags 07/107/8
authorLott, Christopher (cl778h) <cl778h@att.com>
Fri, 3 May 2019 16:20:51 +0000 (12:20 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Fri, 3 May 2019 20:39:23 +0000 (16:39 -0400)
Add draft A1 Mediator API client and config
Use nexus3.o-ran-sc.org (not nexus.oranosc.org)
Use CONTAINER_PUSH_REGISTRY in the pom (not bogus NEXUS3_PUSH..)

Change-Id: Ib96aa2c8eef761ffbcbcecf69f3ab34f10bc3cd7
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
16 files changed:
a1-med-client/.gitignore [new file with mode: 0644]
a1-med-client/README.md [new file with mode: 0644]
a1-med-client/pom.xml [new file with mode: 0644]
a1-med-client/src/main/resources/a1_mediator_0.3.0.yaml [new file with mode: 0644]
a1-med-client/src/test/java/org/oransc/ric/portal/dashboard/a1med/client/test/A1MediatorClientTest.java [new file with mode: 0644]
docs/release-notes.rst
e2-mgr-client/pom.xml
e2-mgr-client/src/main/resources/e2_manager_02052019_2.yaml [new file with mode: 0644]
e2-mgr-client/src/test/java/org/oransc/ric/portal/dashboard/e2mgr/client/test/E2ManagerClientTest.java
pom.xml
webapp-backend/pom.xml
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorConfiguration.java [new file with mode: 0644]
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorMockConfiguration.java [new file with mode: 0644]
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerConfiguration.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerMockConfiguration.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java

diff --git a/a1-med-client/.gitignore b/a1-med-client/.gitignore
new file mode 100644 (file)
index 0000000..27fd461
--- /dev/null
@@ -0,0 +1,23 @@
+*.class
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# exclude jar for gradle wrapper
+!gradle/wrapper/*.jar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+# build files
+**/target
+target
+.gradle
+build
+
+logs/
diff --git a/a1-med-client/README.md b/a1-med-client/README.md
new file mode 100644 (file)
index 0000000..d5780ff
--- /dev/null
@@ -0,0 +1,29 @@
+# A1 Mediator Client Generator
+
+This projects generates a REST client library from the OpenAPI specification
+file stored here and packages it in a jar.
+
+## Eclipse and STS Users
+
+The Swagger Codegen maven plugin is not supported in Eclipse/STS. You can
+limp along by taking these steps:
+
+1. Generate the code using maven:
+    mvn install
+2. Add this folder to the project build path:
+    target/generated-sources/swagger/src/main/java
+
+## License
+
+Copyright (C) 2019 AT&T Intellectual Property & Nokia. 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/a1-med-client/pom.xml b/a1-med-client/pom.xml
new file mode 100644 (file)
index 0000000..772c462
--- /dev/null
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--<![CDATA[
+========================LICENSE_START=================================
+ORAN-OSC
+%%
+Copyright (C) 2019 AT&T Intellectual Property and Nokia
+%%
+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===================================
+]]>-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.o-ran-sc.portal.ric-dashboard</groupId>
+               <artifactId>ric-dash-parent</artifactId>
+               <version>1.0.1-SNAPSHOT</version>
+       </parent>
+       <!-- This groupId will NOT allow deployment in LF -->
+       <groupId>org.o-ran-sc.ric.a1med.client</groupId>
+       <artifactId>a1-med-client</artifactId>
+       <name>RIC A1 Mediator client</name>
+       <version>0.3.0-SNAPSHOT</version>
+       <properties>
+               <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+               <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+               <client.base.package.name>org.oransc.ric.a1med.client</client.base.package.name>
+       </properties>
+       <!-- Successful compilation requires generated code dependencies -->
+       <dependencies>
+               <dependency>
+                       <groupId>io.swagger.core.v3</groupId>
+                       <artifactId>swagger-annotations</artifactId>
+                       <version>2.0.8</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework</groupId>
+                       <artifactId>spring-context</artifactId>
+               </dependency>
+               <!-- HTTP client: Spring RestTemplate -->
+               <dependency>
+                       <groupId>org.springframework</groupId>
+                       <artifactId>spring-web</artifactId>
+                       <!-- <version>${spring-web-version}</version> -->
+               </dependency>
+               <!-- JSON processing: jackson -->
+               <dependency>
+                       <groupId>com.fasterxml.jackson.core</groupId>
+                       <artifactId>jackson-core</artifactId>
+                       <!-- <version>${jackson-version}</version> -->
+               </dependency>
+               <dependency>
+                       <groupId>com.fasterxml.jackson.core</groupId>
+                       <artifactId>jackson-annotations</artifactId>
+                       <!-- <version>${jackson-version}</version> -->
+               </dependency>
+               <dependency>
+                       <groupId>com.fasterxml.jackson.core</groupId>
+                       <artifactId>jackson-databind</artifactId>
+                       <!-- <version>${jackson-version}</version> -->
+               </dependency>
+               <dependency>
+                       <groupId>com.fasterxml.jackson.jaxrs</groupId>
+                       <artifactId>jackson-jaxrs-json-provider</artifactId>
+                       <!-- <version>${jackson-version}</version> -->
+               </dependency>
+               <dependency>
+                       <groupId>com.fasterxml.jackson.datatype</groupId>
+                       <artifactId>jackson-datatype-jsr310</artifactId>
+                       <!-- <version>${jackson-version}</version> -->
+               </dependency>
+               <!-- test dependencies -->
+               <dependency>
+                       <groupId>org.junit.jupiter</groupId>
+                       <artifactId>junit-jupiter-api</artifactId>
+                       <!-- spring sets the <version>5.4.2</version> -->
+                       <scope>test</scope>
+               </dependency>
+       </dependencies>
+       <build>
+               <plugins>
+                       <plugin>
+                               <!-- This 2019 version is required for OpenAPI 3 -->
+                               <groupId>io.swagger.codegen.v3</groupId>
+                               <artifactId>swagger-codegen-maven-plugin</artifactId>
+                               <version>3.0.8</version>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>generate</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <inputSpec>${project.basedir}/src/main/resources/a1_mediator_0.3.0.yaml</inputSpec>
+                                                       <language>java</language>
+                                                       <packageName>${client.base.package.name}</packageName>
+                                                       <modelPackage>${client.base.package.name}.model</modelPackage>
+                                                       <apiPackage>${client.base.package.name}.api</apiPackage>
+                                                       <invokerPackage>${client.base.package.name}.invoker</invokerPackage>
+                                                       <configOptions>
+                                                               <groupId>${project.groupId}</groupId>
+                                                               <artifactId>${project.artifactId}</artifactId>
+                                                               <artifactVersion>${project.version}</artifactVersion>
+                                                               <library>resttemplate</library>
+                                                               <java8>true</java8>
+                                                               <dateLibrary>java8</dateLibrary>
+                                                               <licenseName>Apache 2.0</licenseName>
+                                                               <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+                                                       </configOptions>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <!-- Require Java 1.8 -->
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-compiler-plugin</artifactId>
+                               <!-- Spring sets the <version></version> -->
+                               <configuration>
+                                       <source>1.8</source>
+                                       <target>1.8</target>
+                               </configuration>
+                       </plugin>
+                       <!-- Generate javadoc jar; see profile for Java 8 -->
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-javadoc-plugin</artifactId>
+                               <!-- <version>2.10.3</version> -->
+                               <executions>
+                                       <execution>
+                                               <id>attach-javadocs</id>
+                                               <goals>
+                                                       <goal>jar</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <!-- Generate source jar -->
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-source-plugin</artifactId>
+                               <!-- <version>3.0.0</version> -->
+                               <executions>
+                                       <execution>
+                                               <id>attach-sources</id>
+                                               <goals>
+                                                       <goal>jar</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <!-- Skip the deploy-jar-to-nexus step -->
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-deploy-plugin</artifactId>
+                               <!-- Spring sets the <version>2.8</version> -->
+                               <configuration>
+                                       <skip>true</skip>
+                               </configuration>
+                       </plugin>
+               </plugins>
+               <pluginManagement>
+                       <plugins>
+                               <!--This plugin's configuration is used to store Eclipse m2e settings 
+                                       only. It has no influence on the Maven build itself. -->
+                               <plugin>
+                                       <groupId>org.eclipse.m2e</groupId>
+                                       <artifactId>lifecycle-mapping</artifactId>
+                                       <version>1.0.0</version>
+                                       <configuration>
+                                               <lifecycleMappingMetadata>
+                                                       <pluginExecutions>
+                                                               <pluginExecution>
+                                                                       <pluginExecutionFilter>
+                                                                               <groupId>io.swagger.codegen.v3</groupId>
+                                                                               <artifactId>swagger-codegen-maven-plugin</artifactId>
+                                                                               <versionRange>[1.0,)</versionRange>
+                                                                               <goals>
+                                                                                       <goal>generate</goal>
+                                                                               </goals>
+                                                                       </pluginExecutionFilter>
+                                                                       <action>
+                                                                               <ignore />
+                                                                       </action>
+                                                               </pluginExecution>
+                                                       </pluginExecutions>
+                                               </lifecycleMappingMetadata>
+                                       </configuration>
+                               </plugin>
+                       </plugins>
+               </pluginManagement>
+       </build>
+</project>
diff --git a/a1-med-client/src/main/resources/a1_mediator_0.3.0.yaml b/a1-med-client/src/main/resources/a1_mediator_0.3.0.yaml
new file mode 100644 (file)
index 0000000..1fff00a
--- /dev/null
@@ -0,0 +1,85 @@
+# ========================LICENSE_START=================================
+# ORAN-OSC
+# %%
+# Copyright (C) 2019 AT&T Intellectual Property and Nokia
+# %%
+# 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===================================
+openapi: 3.0.0
+info:
+  version: 0.3.0
+  title: RIC A1
+paths:
+  '/ric/policies/{policyname}':
+    parameters:
+      - name: policyname
+        in: path
+        description: the name of the policy to retrieve or replace
+        required: true
+        schema:
+          type: string
+    put:
+      description: >
+          Replace the current operation of policyname with the new parameters (this replaces the current policy with the new one specified here).
+
+
+          Until there are standard policy definitions that are defined OUTSIDE of the scope of xapps, this API will be *very underspecified*.
+          This is a known gap, do not despair.
+          The PUT body is specified, *currently* in the xapp manifest that implements this policy; the caller should refer to the message_receives_payload_schema field to make this request.
+          The return content is also specified as above (in the xapp manifest) in the message_sends_payload_schema field.
+
+
+          Eventually, we need concrete policy defintions that are decoupled from xapp, and then this API description will become more fully specified.
+
+      tags:
+        - A1 Mediator
+      operationId: a1.controller.put_handler
+      requestBody:
+        content:
+          application/json:
+            schema:
+              type: object
+
+      responses:
+        '200':
+          description: >
+            The downstream component responsible for implementing this policy replied with a good response. Check the manifest for response details.
+        '400':
+          description: >
+            Bad PUT body for this policyname
+        '404':
+          description: there is no policy with this name
+        '409':
+          description: >
+            The xapp that implements this policy replied, but the reply was a "failure". This should be interpreted that the policy was NOT updated successfully.
+        '503':
+          description: >
+            the downstream component responsible for handling this policy did not respond appropriately in time
+
+    get:
+      description: Get the current state/value of policyname
+      tags:
+        - A1 Mediator
+      operationId: a1.controller.get_handler
+      responses:
+        '200':
+          description: >
+            policy state successfully retrieved.
+            TODO, what describes the format returned here?
+            content:
+              application/json:
+                schema:
+                  type: object
+        '404':
+          description: there is no policy with this name
+
diff --git a/a1-med-client/src/test/java/org/oransc/ric/portal/dashboard/a1med/client/test/A1MediatorClientTest.java b/a1-med-client/src/test/java/org/oransc/ric/portal/dashboard/a1med/client/test/A1MediatorClientTest.java
new file mode 100644 (file)
index 0000000..d1ffdbf
--- /dev/null
@@ -0,0 +1,46 @@
+/*-
+ * ========================LICENSE_START=================================
+ * ORAN-OSC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.ric.portal.dashboard.a1med.client.test;
+
+import org.junit.jupiter.api.Test;
+import org.oransc.ric.a1med.client.api.A1MediatorApi;
+import org.oransc.ric.a1med.client.invoker.ApiClient;
+import org.springframework.web.client.RestClientException;
+
+/**
+ * Demonstrates use of the generated A1 mediator client.
+ * 
+ * The test fails because no server is available.
+ */
+public class A1MediatorClientTest {
+
+       @Test
+       public void demo() {
+               ApiClient apiClient = new ApiClient();
+               apiClient.setBasePath("http://localhost:30099/");
+               A1MediatorApi a1Api = new A1MediatorApi(apiClient);
+               try {
+                       a1Api.a1ControllerGetHandler("policy");
+                       System.out.println("getPolicy answered: " + apiClient.getStatusCode().toString());
+               } catch (RestClientException e) {
+                       System.err.println("getPolicy failed: " + e.toString());
+               }
+       }
+}
index 5d37d36..363c44c 100644 (file)
 RIC Dashboard Release Notes
 ===========================
 
-Version 1.0.1, 2 May 2019
+Version 1.0.1, 3 May 2019
 -------------------------
-* Use E2 Manager API definition dated 2 May 2019
+* Add draft A1 Mediator API definition
+* Use E2 Manager API definition dated 2 May 2019, with tag modifications
 
 Version 1.0.0, 30 Apr 2019
 --------------------------
index 6e213c7..0a1f67a 100644 (file)
@@ -101,7 +101,7 @@ limitations under the License.
                                                        <goal>generate</goal>
                                                </goals>
                                                <configuration>
-                                                       <inputSpec>${project.basedir}/src/main/resources/e2_manager_02052019.yaml</inputSpec>
+                                                       <inputSpec>${project.basedir}/src/main/resources/e2_manager_02052019_2.yaml</inputSpec>
                                                        <language>java</language>
                                                        <packageName>${client.base.package.name}</packageName>
                                                        <modelPackage>${client.base.package.name}.model</modelPackage>
diff --git a/e2-mgr-client/src/main/resources/e2_manager_02052019_2.yaml b/e2-mgr-client/src/main/resources/e2_manager_02052019_2.yaml
new file mode 100644 (file)
index 0000000..0472162
--- /dev/null
@@ -0,0 +1,147 @@
+# ========================LICENSE_START=================================
+# ORAN-OSC
+# %%
+# Copyright (C) 2019 AT&T Intellectual Property and Nokia
+# %%
+# 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===================================
+openapi: 3.0.0
+info:
+  title: E2 Manager Service
+  description: This is a description of E2 manager service APIs
+  version: 1.0.0
+servers:
+  - url: http://{apiRoot}/nodeb/v1
+    variables:
+      apiRoot:
+        default: localhost:3800
+        description: >-
+           E2 manager
+paths:
+  /setup:
+    post:
+      summary: X2 Setup Request
+      tags:
+        - E2 Manager
+      operationId: setup
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/SetupRequest'
+        required: true
+      responses:
+        '200':
+          description: Request was handled successfuly
+        '400':
+          description: Invalid input
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+        '404':
+          description: Resource not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+        '500':
+          description: Internal server error
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+        default:
+          description: Unexpected error
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+
+  /endcSetup:
+    post:
+      tags:
+        - E2 Manager
+      summary: ENDC Setup Request
+      operationId: endcSetup
+      requestBody:
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/SetupRequest'
+        required: true
+      responses:
+        '200':
+          description: Request was handled successfuly
+        '400':
+          description: Invalid input
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+        '404':
+          description: Resource not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+        '500':
+          description: Internal server error
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+        default:
+          description: Unexpected error
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/ErrorResponse'
+
+  /health:
+    get:
+      tags:
+        - E2 Manager
+      summary: E2 Manager Service Health Check
+      operationId: healthCheck
+      responses:
+        '200':
+          description: OK
+components:
+  schemas:
+    SetupRequest:
+      type: object
+      required:
+        - ranIp
+        - ranPort
+        - ranName
+      properties:
+        ranIp:
+          type: string
+        ranPort:
+          type: integer
+          format: uint16
+        ranName:
+          type: string
+    ErrorResponse:
+      type: object
+      required:
+        - errorCode
+        - errorMessage
+      properties:
+        errorCode:
+          type: string
+          description: 401 - corrupted json, 402 - validation error, 501 - internal problem
+        errorMessage:
+          type: string
+          description: Human readable text
index fa48e69..a740f05 100644 (file)
@@ -20,7 +20,7 @@
 package org.oransc.ric.portal.dashboard.e2mgr.client.test;
 
 import org.junit.jupiter.api.Test;
-import org.oransc.ric.e2mgr.client.api.HealthCheckApi;
+import org.oransc.ric.e2mgr.client.api.E2ManagerApi;
 import org.oransc.ric.e2mgr.client.invoker.ApiClient;
 import org.springframework.web.client.RestClientException;
 
@@ -35,9 +35,9 @@ public class E2ManagerClientTest {
        public void demo() {
                ApiClient apiClient = new ApiClient();
                apiClient.setBasePath("http://localhost:30099/");
-               HealthCheckApi e2Health = new HealthCheckApi(apiClient);
+               E2ManagerApi e2Api = new E2ManagerApi(apiClient);
                try {
-                       e2Health.healthCheck();
+                       e2Api.healthCheck();
                        System.out.println("getHealth answered: " + apiClient.getStatusCode().toString());
                } catch (RestClientException e) {
                        System.err.println("getHealth failed: " + e.toString());
diff --git a/pom.xml b/pom.xml
index 93842b0..8ad5487 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -43,10 +43,11 @@ limitations under the License.
                <lmp.process.end.tag>========================LICENSE_END===================================</lmp.process.end.tag>
        </properties>
        <modules>
+               <module>a1-med-client</module>
+               <module>e2-mgr-client</module>
+               <module>xapp-mgr-client</module>
                <module>webapp-frontend</module>
                <module>webapp-backend</module>
-               <module>xapp-mgr-client</module>
-               <module>e2-mgr-client</module>
        </modules>
        <build>
                <plugins>
index 6f7147c..26d8f8a 100644 (file)
@@ -31,10 +31,16 @@ limitations under the License.
        <name>RIC Dashboard Webapp backend</name>
        <properties>
                <java.version>1.8</java.version>
+               <!-- this is not a library, don't publish javadoc -->
+               <maven.javadoc.skip>true</maven.javadoc.skip>
                <springfox.version>2.9.2</springfox.version>
-               <docker.push.registry>${env.NEXUS3_PUSH_REGISTRY}</docker.push.registry>
        </properties>
        <dependencies>
+               <dependency>
+                       <groupId>org.o-ran-sc.ric.a1med.client</groupId>
+                       <artifactId>a1-med-client</artifactId>
+                       <version>0.3.0-SNAPSHOT</version>
+               </dependency>
                <dependency>
                        <groupId>org.o-ran-sc.ric.e2mgr.client</groupId>
                        <artifactId>e2-mgr-client</artifactId>
@@ -147,9 +153,9 @@ limitations under the License.
                                <version>0.28.0</version>
                                <configuration>
                                        <verbose>true</verbose>
-                                       <!-- Not supplied to all jobs; e.g., Javadoc -->
-                                       <docker.pull.registry>nexus3.oran-osc.org:10001</docker.pull.registry>
-                                       <pushRegistry>${docker.push.registry}</pushRegistry>
+                                       <!-- environment variables supplied by Jenkins -->
+                                       <pullRegistry>${env.CONTAINER_PULL_REGISTRY}</pullRegistry>
+                                       <pushRegistry>${env.CONTAINER_PUSH_REGISTRY}</pushRegistry>
                                        <images>
                                                <image>
                                                        <!-- Specify a tag to avoid default tag "latest" -->
diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorConfiguration.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorConfiguration.java
new file mode 100644 (file)
index 0000000..3cd81ed
--- /dev/null
@@ -0,0 +1,66 @@
+/*-
+ * ========================LICENSE_START=================================
+ * ORAN-OSC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.ric.portal.dashboard.config;
+
+import java.lang.invoke.MethodHandles;
+
+import org.oransc.ric.a1med.client.api.A1MediatorApi;
+import org.oransc.ric.a1med.client.invoker.ApiClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.util.Assert;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * Creates an A1 mediator client as a bean to be managed by the Spring container.
+ */
+@Configuration
+@Profile("!mock")
+public class A1MediatorConfiguration {
+
+       private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+       // Populated by the autowired constructor
+       private final String a1medBasepath;
+
+       @Autowired
+       public A1MediatorConfiguration(@Value("${a1med.basepath}") final String a1medBasepath) {
+               Assert.notNull(a1medBasepath, "base path must not be null");
+               logger.info("Configuring A1 Mediator at base path {}", a1medBasepath);
+               this.a1medBasepath = a1medBasepath;
+       }
+
+       private ApiClient apiClient() {
+               ApiClient apiClient = new ApiClient(new RestTemplate());
+               apiClient.setBasePath(a1medBasepath);
+               return apiClient;
+       }
+
+       @Bean
+       public A1MediatorApi a1MediatorApi() {
+               return new A1MediatorApi(apiClient());
+       }
+
+}
diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorMockConfiguration.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorMockConfiguration.java
new file mode 100644 (file)
index 0000000..d930161
--- /dev/null
@@ -0,0 +1,74 @@
+/*-
+ * ========================LICENSE_START=================================
+ * ORAN-OSC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * %%
+ * 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.ric.portal.dashboard.config;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.lang.invoke.MethodHandles;
+
+import org.oransc.ric.a1med.client.api.A1MediatorApi;
+import org.oransc.ric.a1med.client.invoker.ApiClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.http.HttpStatus;
+
+/**
+ * Creates a mock implementation of the E2 manager client API.
+ */
+@Profile("mock")
+@Configuration
+public class A1MediatorMockConfiguration {
+
+       private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+       public A1MediatorMockConfiguration() {
+               logger.info("Configuring mock A1 Mediator");
+       }
+
+       private ApiClient apiClient() {
+               ApiClient mockClient = mock(ApiClient.class);
+               when(mockClient.getStatusCode()).thenReturn(HttpStatus.OK);
+               return mockClient;
+       }
+
+       @Bean
+       public A1MediatorApi a1MediatorApi() {
+               ApiClient apiClient = apiClient();
+               A1MediatorApi mockApi = mock(A1MediatorApi.class);
+               when(mockApi.getApiClient()).thenReturn(apiClient);
+
+               doAnswer(i -> {
+                       return null;
+               }).when(mockApi).a1ControllerGetHandler(any(String.class));
+
+               doAnswer(i -> {
+                       return null;
+               }).when(mockApi).a1ControllerPutHandler(any(String.class), any(Object.class));
+
+               return mockApi;
+       }
+
+}
index 3b610b5..3026e87 100644 (file)
@@ -21,9 +21,7 @@ package org.oransc.ric.portal.dashboard.config;
 
 import java.lang.invoke.MethodHandles;
 
-import org.oransc.ric.e2mgr.client.api.EndcSetupRequestApi;
-import org.oransc.ric.e2mgr.client.api.HealthCheckApi;
-import org.oransc.ric.e2mgr.client.api.X2SetupRequestApi;
+import org.oransc.ric.e2mgr.client.api.E2ManagerApi;
 import org.oransc.ric.e2mgr.client.invoker.ApiClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,18 +59,8 @@ public class E2ManagerConfiguration {
        }
 
        @Bean
-       public EndcSetupRequestApi endcSetupRequestApi() {
-               return new EndcSetupRequestApi(apiClient());
-       }
-
-       @Bean
-       public HealthCheckApi healthCheckApi() {
-               return new HealthCheckApi(apiClient());
-       }
-
-       @Bean
-       public X2SetupRequestApi x2SetupRequestApi() {
-               return new X2SetupRequestApi(apiClient());
+       public E2ManagerApi e2ManagerApi() {
+               return new E2ManagerApi(apiClient());
        }
 
 }
index 3df6dc7..f5b59d4 100644 (file)
@@ -26,9 +26,7 @@ import static org.mockito.Mockito.when;
 
 import java.lang.invoke.MethodHandles;
 
-import org.oransc.ric.e2mgr.client.api.EndcSetupRequestApi;
-import org.oransc.ric.e2mgr.client.api.HealthCheckApi;
-import org.oransc.ric.e2mgr.client.api.X2SetupRequestApi;
+import org.oransc.ric.e2mgr.client.api.E2ManagerApi;
 import org.oransc.ric.e2mgr.client.invoker.ApiClient;
 import org.oransc.ric.e2mgr.client.model.SetupRequest;
 import org.slf4j.Logger;
@@ -39,8 +37,7 @@ import org.springframework.context.annotation.Profile;
 import org.springframework.http.HttpStatus;
 
 /**
- * Creates an implementation of the E2 manager client that answers requests with
- * mock data.
+ * Creates a mock implementation of the E2 manager client API.
  */
 @Profile("mock")
 @Configuration
@@ -59,32 +56,23 @@ public class E2ManagerMockConfiguration {
        }
 
        @Bean
-       public EndcSetupRequestApi endcSetupRequestApi() {
+       public E2ManagerApi e2ManagerApi() {
                ApiClient apiClient = apiClient();
-               EndcSetupRequestApi mockApi = mock(EndcSetupRequestApi.class);
+               E2ManagerApi mockApi = mock(E2ManagerApi.class);
                when(mockApi.getApiClient()).thenReturn(apiClient);
-               return mockApi;
-       }
 
-       @Bean
-       public HealthCheckApi healthCheckApi() {
-               ApiClient apiClient = apiClient();
-               HealthCheckApi mockApi = mock(HealthCheckApi.class);
-               when(mockApi.getApiClient()).thenReturn(apiClient);
                doAnswer(i -> {
                        return null;
                }).when(mockApi).healthCheck();
-               return mockApi;
-       }
 
-       @Bean
-       public X2SetupRequestApi x2SetupRequestApi() {
-               ApiClient apiClient = apiClient();
-               X2SetupRequestApi mockApi = mock(X2SetupRequestApi.class);
-               when(mockApi.getApiClient()).thenReturn(apiClient);
+               doAnswer(i -> {
+                       return null;
+               }).when(mockApi).endcSetup(any(SetupRequest.class));
+
                doAnswer(i -> {
                        return null;
                }).when(mockApi).setup(any(SetupRequest.class));
+
                return mockApi;
        }
 
index 53593a6..ad6ba79 100644 (file)
@@ -25,8 +25,7 @@ import java.util.Set;
 
 import javax.servlet.http.HttpServletResponse;
 
-import org.oransc.ric.e2mgr.client.api.HealthCheckApi;
-import org.oransc.ric.e2mgr.client.api.X2SetupRequestApi;
+import org.oransc.ric.e2mgr.client.api.E2ManagerApi;
 import org.oransc.ric.e2mgr.client.model.SetupRequest;
 import org.oransc.ric.portal.dashboard.DashboardConstants;
 import org.slf4j.Logger;
@@ -57,18 +56,16 @@ public class E2ManagerController {
        private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
        // Populated by the autowired constructor
-       private final HealthCheckApi healthCheckApi;
-       private final X2SetupRequestApi x2SetupRequestApi;
+       private final E2ManagerApi e2ManagerApi;
 
        // Tracks the requests previously submitted.
        // TODO remove when the E2 manager is extended.
        private Set<SetupRequest> requests = new HashSet<>();
 
        @Autowired
-       public E2ManagerController(final HealthCheckApi healthCheckApi, final X2SetupRequestApi x2SetupRequestApi) {
-               Assert.notNull(healthCheckApi, "API must not be null");
-               this.healthCheckApi = healthCheckApi;
-               this.x2SetupRequestApi = x2SetupRequestApi;
+       public E2ManagerController(final E2ManagerApi e2ManagerApi) {
+               Assert.notNull(e2ManagerApi, "API must not be null");
+               this.e2ManagerApi = e2ManagerApi;
        }
 
        private void assertNotNull(Object o) {
@@ -86,8 +83,8 @@ public class E2ManagerController {
        @RequestMapping(value = "/health", method = RequestMethod.GET)
        public void getHealth(HttpServletResponse response) {
                logger.debug("getHealth");
-               healthCheckApi.healthCheck();
-               response.setStatus(healthCheckApi.getApiClient().getStatusCode().value());
+               e2ManagerApi.healthCheck();
+               response.setStatus(e2ManagerApi.getApiClient().getStatusCode().value());
        }
 
        @ApiOperation(value = "Gets the unique requests submitted to the E2 manager.", response = SetupRequest.class, responseContainer = "List")
@@ -111,7 +108,7 @@ public class E2ManagerController {
                }
                try {
                        requests.add(setupRequest);
-                       x2SetupRequestApi.setup(setupRequest);
+                       e2ManagerApi.setup(setupRequest);
                } catch (Exception ex) {
                        logger.error("Failed", ex);
                        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);