swagger expose Northbound endpoints
Change-Id: I8c19590e24fdf45655386f4abeee2828cc9cb30a
diff --git a/onap-enabler-be/pom.xml b/onap-enabler-be/pom.xml
index b1ced0a..3939a63 100644
--- a/onap-enabler-be/pom.xml
+++ b/onap-enabler-be/pom.xml
@@ -48,7 +48,8 @@
<releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
<stagingNexusPath>/content/repositories/staging/</stagingNexusPath>
<sitePath>/content/sites/site/org/onap/vid/${project.version}</sitePath>
- </properties>
+ <swagger.version>2.8.0</swagger.version>
+ </properties>
<!-- this should be commented for local debugging -->
@@ -107,7 +108,7 @@
<!-- License plugin should only run once at the start of the project.
For new classes, the header should be added manually by the company which creates it.-->
- <!-- <plugin>
+ <!--plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>1.16</version>
@@ -138,7 +139,7 @@
<phase>process-sources</phase>
</execution>
</executions>
- </plugin>-->
+ </plugin-->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
@@ -631,5 +632,20 @@
<version>3.10.0</version>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <version>${swagger.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ <version>${swagger.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.osam</groupId>
+ <artifactId>osam-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerAccessPodController.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerAccessPodController.java
new file mode 100644
index 0000000..07ad804
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerAccessPodController.java
@@ -0,0 +1,75 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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.onap.osam.controllers;
+
+import io.swagger.annotations.ApiOperation;
+import org.onap.osam.common.dto.AccessPodDTO;
+import org.onap.osam.common.dto.ChassisDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.Arrays;
+import java.util.List;
+
+// TODO log
+@RestController
+@RequestMapping("accessPod")
+public class OnapEnablerAccessPodController extends OnapEnablerController {
+
+ private static final String ACCESS_POD = "accessPod";
+
+ @Autowired
+ public OnapEnablerAccessPodController(RestTemplate restTemplate){
+ this.restTemplate = restTemplate;
+ }
+
+ @ApiOperation(value = "Get all PODs registered in OSAM Core",
+ response = AccessPodDTO.class,
+ responseContainer = "List")
+ @RequestMapping(method = RequestMethod.GET)
+ public List<AccessPodDTO> getAccessPods() {
+ return Arrays.asList(restTemplate.getForObject(buildRequestPath(ACCESS_POD), AccessPodDTO[].class));
+ }
+
+ @ApiOperation(value = "Register a new POD in OSAM Core",
+ response = AccessPodDTO.class)
+ @RequestMapping(method = RequestMethod.POST)
+ public ResponseEntity<AccessPodDTO> postAccessPod(@RequestBody AccessPodDTO accessPodDTO) {
+ return restTemplate.postForEntity(buildRequestPath(ACCESS_POD), new HttpEntity<>(accessPodDTO), AccessPodDTO.class);
+ }
+
+ @ApiOperation(value = "Unregister a POD from OSAM Core by pnfId field")
+ @RequestMapping(method = RequestMethod.DELETE, value = "pnf/{pnfId}")
+ public void deleteAccessPodByPnfId(@PathVariable String pnfId) {
+ restTemplate.delete(buildRequestPath(ACCESS_POD, "pnf", pnfId));
+ }
+
+ @ApiOperation(value = "Unregister a POD from OSAM Core by id field")
+ @RequestMapping(method = RequestMethod.DELETE, value = "{id}")
+ public void deleteAccessPod(@PathVariable Long id) {
+ restTemplate.delete(buildRequestPath(ACCESS_POD, String.valueOf(id)));
+ }
+
+
+
+}
diff --git a/osam-core/web/src/main/java/org/onap/osam/dto/ChassisDTO.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerController.java
similarity index 60%
copy from osam-core/web/src/main/java/org/onap/osam/dto/ChassisDTO.java
copy to onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerController.java
index 96462cf..51efa8e 100644
--- a/osam-core/web/src/main/java/org/onap/osam/dto/ChassisDTO.java
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerController.java
@@ -1,45 +1,39 @@
-/*-
- * ============LICENSE_START=======================================================
- * OSAM Core
- * ================================================================================
- * Copyright (C) 2018 Netsia
- * ================================================================================
- * 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.onap.osam.dto;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.util.List;
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-@JsonRootName("Chassis")
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class ChassisDTO {
- private Long id;
- private String clli;
- private String pnfId;
- private int shelf;
- private int rack;
- private List<OLTChassisDTO> olts;
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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.onap.osam.controllers;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+abstract class OnapEnablerController {
+ private static final String SLASH = "/";
+
+ @Value("${osam.client.url}")
+ private String osamUrl;
+
+ RestTemplate restTemplate;
+
+ String buildRequestPath(String... args){
+ return osamUrl.concat(Stream.of(args).collect(Collectors.joining(SLASH)));
+ }
+}
diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerDeviceController.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerDeviceController.java
new file mode 100644
index 0000000..d57b61f
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerDeviceController.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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.onap.osam.controllers;
+
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.onap.osam.common.dto.ChassisDTO;
+import org.onap.osam.common.dto.OLTChassisDTO;
+import org.onap.osam.common.dto.ONTDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.List;
+import java.util.Map;
+
+// TODO log
+@RestController
+@RequestMapping("device/chassis")
+public class OnapEnablerDeviceController extends OnapEnablerController {
+
+ private static final String DEVICE_CHASSIS = "device/chassis";
+
+ @Autowired
+ public OnapEnablerDeviceController(RestTemplate restTemplate){
+ this.restTemplate = restTemplate;
+ }
+
+ @ApiOperation(value = "Register a chassis on top of a POD",
+ response = ChassisDTO.class)
+ @RequestMapping(method = RequestMethod.POST)
+ public ResponseEntity<ChassisDTO> postChassis(@RequestBody ChassisDTO chassisDTO) {
+ return restTemplate.postForEntity(buildRequestPath(DEVICE_CHASSIS), new HttpEntity<>(chassisDTO), ChassisDTO.class);
+ }
+
+ @ApiOperation(value = "Unregister a chassis from a POD")
+ @RequestMapping(method = RequestMethod.DELETE, value = "{clli}")
+ public void deleteChassisByClli(@PathVariable String clli) {
+ restTemplate.delete(buildRequestPath(DEVICE_CHASSIS, clli));
+ }
+
+ @ApiOperation(value = "Register OLT-specific chassis on top of a chassis",
+ response = OLTChassisDTO.class)
+ @RequestMapping(method = RequestMethod.POST, value = "olt")
+ public ResponseEntity<OLTChassisDTO> postOLTChassis(@RequestBody OLTChassisDTO oltChassisDTO) {
+ return restTemplate.postForEntity(buildRequestPath(DEVICE_CHASSIS, "olt"), new HttpEntity<>(oltChassisDTO), OLTChassisDTO.class);
+ }
+
+ @ApiOperation(value = "Register an ONT device on top of a OLT-specific chassis",
+ response = ONTDTO.class)
+ @RequestMapping(method = RequestMethod.POST, value = "olt/ont")
+ public ResponseEntity<ONTDTO> postONTDevice(@RequestBody ONTDTO ontDTO) {
+ return restTemplate.postForEntity(buildRequestPath(DEVICE_CHASSIS, "olt/ont"), new HttpEntity<>(ontDTO), ONTDTO.class);
+ }
+
+ @ApiOperation(value = "Get all chassis entities from all PODs",
+ response = ChassisDTO.class,
+ responseContainer = "List")
+ @RequestMapping(method = RequestMethod.GET)
+ public ResponseEntity<List<ChassisDTO>> getAllChassis() {
+ return restTemplate.exchange(buildRequestPath(DEVICE_CHASSIS), HttpMethod.GET, HttpEntity.EMPTY, new ParameterizedTypeReference<List<ChassisDTO>>(){});
+ }
+
+
+ @ApiOperation(value = "Get all OLT-specific chassis entities from all PODs, grouped by POD pnfId",
+ response = OLTChassisDTO.class,
+ responseContainer = "Map")
+ @RequestMapping(method = RequestMethod.GET, value = "olt")
+ public ResponseEntity<Map<String, List<OLTChassisDTO>>> getAllOLTDevices(){
+ return restTemplate.exchange(buildRequestPath(DEVICE_CHASSIS, "olt"), HttpMethod.GET, HttpEntity.EMPTY, new ParameterizedTypeReference<Map<String, List<OLTChassisDTO>>>(){});
+ }
+
+ @ApiOperation(value = "Get all ONT devices from all PODs, grouped by POD pnfId",
+ response = ONTDTO.class,
+ responseContainer = "Map")
+ @RequestMapping(method = RequestMethod.GET, value = "olt/ont")
+ public ResponseEntity<Map<String, List<ONTDTO>>> getAllONTDevices(){
+ return restTemplate.exchange(buildRequestPath(DEVICE_CHASSIS, "olt/ont"), HttpMethod.GET, HttpEntity.EMPTY, new ParameterizedTypeReference<Map<String, List<ONTDTO>>>(){});
+ }
+}
diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerServiceController.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerServiceController.java
new file mode 100644
index 0000000..cf6e6cb
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerServiceController.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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.onap.osam.controllers;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.List;
+
+// TODO log
+@RestController
+@RequestMapping("service")
+
+// *** Return and request types should be in osam-common. Types such as SpeedProfile, TechnologyProfile that are under model.dao temporarily reduced to Object *** //
+public class OnapEnablerServiceController extends OnapEnablerController {
+
+ private static final String SERVICE = "service";
+ private static final String SPEED_PROFILE = "speedProfile";
+ private static final String SPEED_PROFILE_ID = "speedProfile/{id}";
+ private static final String TECH_PROFILE = "technologyProfile";
+ private static final String TECH_PROFILE_ID = "technologyProfile/{id}";
+
+ @Autowired
+ public OnapEnablerServiceController(RestTemplate restTemplate){
+ this.restTemplate = restTemplate;
+ }
+
+ @RequestMapping(method = RequestMethod.GET, value = SPEED_PROFILE)
+ public ResponseEntity<List</*SpeedProfile*/Object>> getSpeedProfiles() {
+ return restTemplate.exchange(buildRequestPath(SERVICE, SPEED_PROFILE), HttpMethod.GET, HttpEntity.EMPTY, new ParameterizedTypeReference<List</*SpeedProfile*/Object>>(){});
+ }
+
+ @RequestMapping(method = RequestMethod.GET, value = SPEED_PROFILE_ID)
+ public ResponseEntity</*SpeedProfile*/Object> getSpeedProfile(@PathVariable Long id) {
+ return restTemplate.getForEntity(buildRequestPath(SERVICE, SPEED_PROFILE, String.valueOf(id)), /*SpeedProfile*/Object.class);
+ }
+
+ @RequestMapping(method = RequestMethod.DELETE, value = SPEED_PROFILE_ID)
+ public void deleteSpeedProfile(@PathVariable Long id) {
+ restTemplate.delete(buildRequestPath(SERVICE, SPEED_PROFILE, String.valueOf(id)));
+ }
+
+ @RequestMapping(method = RequestMethod.POST, value = SPEED_PROFILE)
+ public ResponseEntity</*SpeedProfile*/Object> createSpeedProfile(@RequestBody /*SpeedProfile*/ Object speedProfile) {
+ return restTemplate.postForEntity(buildRequestPath(SERVICE, SPEED_PROFILE), speedProfile, /*SpeedProfile*/Object.class);
+ }
+
+ @RequestMapping(method = RequestMethod.GET, value = TECH_PROFILE)
+ public ResponseEntity<List</*TechnologyProfile*/Object>> getTechnologyProfiles() {
+ return restTemplate.exchange(buildRequestPath(SERVICE, TECH_PROFILE), HttpMethod.GET, HttpEntity.EMPTY, new ParameterizedTypeReference<List</*TechnologyProfile*/Object>>(){});
+ }
+
+ @RequestMapping(method = RequestMethod.GET, value = TECH_PROFILE_ID)
+ public ResponseEntity</*TechnologyProfile*/Object> getTechnologyProfile(@PathVariable Long id) {
+ return restTemplate.getForEntity(buildRequestPath(SERVICE, TECH_PROFILE, String.valueOf(id)), /*TechnologyProfile*/Object.class);
+ }
+
+ @RequestMapping(method = RequestMethod.DELETE, value = TECH_PROFILE_ID)
+ public void deleteTechnologyProfile(@PathVariable Long id) {
+ restTemplate.delete(buildRequestPath(SERVICE, TECH_PROFILE, String.valueOf(id)));
+ }
+
+ @RequestMapping(method = RequestMethod.POST, value = TECH_PROFILE)
+ public ResponseEntity</*TechnologyProfile*/Object> createTechnologyProfile(@RequestBody /*TechnologyProfile*/ Object technologyProfile) {
+ return restTemplate.postForEntity(buildRequestPath(SERVICE, TECH_PROFILE), technologyProfile, /*TechnologyProfile*/Object.class);
+ }
+}
diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerTopologyController.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerTopologyController.java
new file mode 100644
index 0000000..d24ac04
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/OnapEnablerTopologyController.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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.onap.osam.controllers;
+
+import org.onap.osam.common.dto.AccessPodDTO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.client.RestTemplate;
+
+// TODO log
+@RestController
+@RequestMapping("topology")
+public class OnapEnablerTopologyController extends OnapEnablerController {
+
+ private static final String TOPOLOGY = "topology";
+
+ @Autowired
+ public OnapEnablerTopologyController(RestTemplate restTemplate) {
+ this.restTemplate = restTemplate;
+ }
+
+ @RequestMapping(method = RequestMethod.GET, value = "accessPod/{pnfId}")
+ public ResponseEntity<AccessPodDTO> getTopologyWithPnfId(@PathVariable String pnfId) {
+ return restTemplate.getForEntity(buildRequestPath(TOPOLOGY, "accessPod", pnfId), AccessPodDTO.class);
+ }
+}
diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/WebConfig.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/WebConfig.java
index 32e0510..d184cb5 100644
--- a/onap-enabler-be/src/main/java/org/onap/osam/controllers/WebConfig.java
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/WebConfig.java
@@ -45,6 +45,7 @@
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
import javax.servlet.ServletContext;
import java.io.File;
@@ -122,4 +123,9 @@
public SchedulerRestInterfaceIfc getSchedulerRestInterface(){
return new SchedulerRestInterface();
}
+
+ @Bean
+ public RestTemplate restTemplate() {
+ return new RestTemplate();
+ }
}
diff --git a/onap-enabler-infra/pom.xml b/onap-enabler-infra/pom.xml
index 35cc6bb..e2d288a 100644
--- a/onap-enabler-infra/pom.xml
+++ b/onap-enabler-infra/pom.xml
@@ -54,6 +54,7 @@
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>
<sonar.projectVersion>${project.version}</sonar.projectVersion>
+ <swagger.version>2.8.0</swagger.version>
</properties>
<repositories>
@@ -491,5 +492,15 @@
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
</dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <version>${swagger.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ <version>${swagger.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/onap-enabler-infra/src/main/java/org/onap/portalapp/config/Swagger2Config.java b/onap-enabler-infra/src/main/java/org/onap/portalapp/config/Swagger2Config.java
new file mode 100644
index 0000000..8ce5b42
--- /dev/null
+++ b/onap-enabler-infra/src/main/java/org/onap/portalapp/config/Swagger2Config.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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.onap.portalapp.config;
+
+import com.google.common.base.Predicate;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+import static com.google.common.base.Predicates.or;
+import static springfox.documentation.builders.PathSelectors.regex;
+
+
+@EnableSwagger2
+@Configuration
+public class Swagger2Config extends WebMvcConfigurationSupport {
+
+ @Bean
+ public Docket onapEnablerApi() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .select()
+ .apis(RequestHandlerSelectors.any())
+ //Expose only device controller
+ .paths(paths())
+ .build();
+ }
+
+
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
+ registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
+ }
+
+ private Predicate<String> paths() {
+ return or(
+ regex("/device.*"),
+ regex("/accessPod.*"));
+ }
+}
diff --git a/onap-enabler-infra/src/main/webapp/WEB-INF/conf/system.properties b/onap-enabler-infra/src/main/webapp/WEB-INF/conf/system.properties
index ac03ffa..e7fe1d8 100644
--- a/onap-enabler-infra/src/main/webapp/WEB-INF/conf/system.properties
+++ b/onap-enabler-infra/src/main/webapp/WEB-INF/conf/system.properties
@@ -207,4 +207,6 @@
scheduler.server.url=http://BYO.scheduler:8989/scheduler
scheduler.submit.new.vnf.change=/v1/ChangeManagement/schedules/{scheduleId}/approvals
-scheduler.get.schedules=/v1/ChangeManagement/schedules/scheduleDetails/
\ No newline at end of file
+scheduler.get.schedules=/v1/ChangeManagement/schedules/scheduleDetails/
+
+osam.client.url=http://localhost:8888/
\ No newline at end of file
diff --git a/osam-common/pom.xml b/osam-common/pom.xml
new file mode 100644
index 0000000..c2311ce
--- /dev/null
+++ b/osam-common/pom.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--/*-
+ * ============LICENSE_START=======================================================
+ * OSAM Core
+ * ================================================================================
+ * Copyright (C) 2018 Netsia
+ * ================================================================================
+ * 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/xsd/maven-4.0.0.xsd">
+
+ <groupId>org.onap.osam</groupId>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>osam-common</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <properties>
+ <swagger.version>2.8.0</swagger.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.9.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.16.22</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <version>${swagger.version}</version>
+ </dependency>
+ </dependencies>
+
+
+</project>
\ No newline at end of file
diff --git a/osam-core/web/src/main/java/org/onap/osam/dto/AccessPodDTO.java b/osam-common/src/main/java/org/onap/osam/common/dto/AccessPodDTO.java
similarity index 76%
rename from osam-core/web/src/main/java/org/onap/osam/dto/AccessPodDTO.java
rename to osam-common/src/main/java/org/onap/osam/common/dto/AccessPodDTO.java
index 52570c7..6041d58 100644
--- a/osam-core/web/src/main/java/org/onap/osam/dto/AccessPodDTO.java
+++ b/osam-common/src/main/java/org/onap/osam/common/dto/AccessPodDTO.java
@@ -1,69 +1,81 @@
-/*-
- * ============LICENSE_START=======================================================
- * OSAM Core
- * ================================================================================
- * Copyright (C) 2018 Netsia
- * ================================================================================
- * 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.onap.osam.dto;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-import java.util.List;
-
-/**
- * Created by cemturker on 01.10.2018.
- */
-@Getter
-@Setter
-@NoArgsConstructor
-@AllArgsConstructor
-@JsonRootName("AccessPod")
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class AccessPodDTO {
- private Long id;
- private String pnfId;
- private String ip;
- private String port;
- private String coreIp;
- private String corePort;
- private String username;
- private String password;
- private List<ChassisDTO> chassises;
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("AccessPodDTO{");
- sb.append("id=").append(id);
- sb.append(", pnfId='").append(pnfId).append('\'');
- sb.append(", ip='").append(ip).append('\'');
- sb.append(", port='").append(port).append('\'');
- sb.append(", coreIp='").append(coreIp).append('\'');
- sb.append(", corePort='").append(corePort).append('\'');
- sb.append(", username='").append(username).append('\'');
- sb.append(", password='").append(password).append('\'');
- sb.append(", chassises=").append(chassises);
- sb.append('}');
- return sb.toString();
- }
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM Core
+ * ================================================================================
+ * Copyright (C) 2018 Netsia
+ * ================================================================================
+ * 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.onap.osam.common.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * Created by cemturker on 01.10.2018.
+ */
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+@JsonRootName("AccessPod")
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@ApiModel
+public class AccessPodDTO {
+ @ApiModelProperty(hidden = true)
+ private Long id;
+ @ApiModelProperty(required = true)
+ private String pnfId;
+ @ApiModelProperty(required = true, value="IP address of Abstract OLT for this POD")
+ private String ip;
+ @ApiModelProperty(required = true, value="GRPC Port of Abstract OLT for this POD")
+ private String port;
+ @ApiModelProperty(required = true, value="IP address of a SEBA POD")
+ private String coreIp;
+ @ApiModelProperty(required = true, value="Port of a SEBA POD")
+ private String corePort;
+ @ApiModelProperty(required = true, value="XOS Username of a SEBA POD")
+ private String username;
+ @ApiModelProperty(required = true, value="XOS Password of a SEBA POD")
+ private String password;
+ @ApiModelProperty(hidden = true)
+ private List<ChassisDTO> chassises;
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("AccessPodDTO{");
+ sb.append("id=").append(id);
+ sb.append(", pnfId='").append(pnfId).append('\'');
+ sb.append(", ip='").append(ip).append('\'');
+ sb.append(", port='").append(port).append('\'');
+ sb.append(", coreIp='").append(coreIp).append('\'');
+ sb.append(", corePort='").append(corePort).append('\'');
+ sb.append(", username='").append(username).append('\'');
+ sb.append(", password='").append(password).append('\'');
+ sb.append(", chassises=").append(chassises);
+ sb.append('}');
+ return sb.toString();
+ }
+}
diff --git a/osam-core/web/src/main/java/org/onap/osam/dto/ChassisDTO.java b/osam-common/src/main/java/org/onap/osam/common/dto/ChassisDTO.java
similarity index 72%
rename from osam-core/web/src/main/java/org/onap/osam/dto/ChassisDTO.java
rename to osam-common/src/main/java/org/onap/osam/common/dto/ChassisDTO.java
index 96462cf..9f7d561 100644
--- a/osam-core/web/src/main/java/org/onap/osam/dto/ChassisDTO.java
+++ b/osam-common/src/main/java/org/onap/osam/common/dto/ChassisDTO.java
@@ -1,45 +1,54 @@
-/*-
- * ============LICENSE_START=======================================================
- * OSAM Core
- * ================================================================================
- * Copyright (C) 2018 Netsia
- * ================================================================================
- * 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.onap.osam.dto;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.util.List;
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-@JsonRootName("Chassis")
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class ChassisDTO {
- private Long id;
- private String clli;
- private String pnfId;
- private int shelf;
- private int rack;
- private List<OLTChassisDTO> olts;
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM Core
+ * ================================================================================
+ * Copyright (C) 2018 Netsia
+ * ================================================================================
+ * 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.onap.osam.common.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@JsonRootName("Chassis")
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@ApiModel
+public class ChassisDTO {
+ @ApiModelProperty(hidden = true)
+ private Long id;
+ @ApiModelProperty(required = true, value="CLLI of the chassis")
+ private String clli;
+ @ApiModelProperty(required = true, value="PNF ID of the POD on top of which this chassis is registered")
+ private String pnfId;
+ @ApiModelProperty(required = true, value="Shelf number for this chassis")
+ private int shelf;
+ @ApiModelProperty(required = true, value="Rack number for this chassis")
+ private int rack;
+ @ApiModelProperty(hidden = true)
+ private List<OLTChassisDTO> olts;
+}
diff --git a/osam-core/web/src/main/java/org/onap/osam/dto/OLTChassisDTO.java b/osam-common/src/main/java/org/onap/osam/common/dto/OLTChassisDTO.java
similarity index 62%
rename from osam-core/web/src/main/java/org/onap/osam/dto/OLTChassisDTO.java
rename to osam-common/src/main/java/org/onap/osam/common/dto/OLTChassisDTO.java
index 1937e35..a7bae08 100644
--- a/osam-core/web/src/main/java/org/onap/osam/dto/OLTChassisDTO.java
+++ b/osam-common/src/main/java/org/onap/osam/common/dto/OLTChassisDTO.java
@@ -1,47 +1,59 @@
-/*-
- * ============LICENSE_START=======================================================
- * OSAM Core
- * ================================================================================
- * Copyright (C) 2018 Netsia
- * ================================================================================
- * 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.onap.osam.dto;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.util.List;
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-@JsonRootName("OLT")
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class OLTChassisDTO {
- private String clli;
- private String oltDriver;
- private String oltType;
- private int portNumber;
- private String ipAddress;
- private String name;
- private List<OLTPortDTO> oltPorts;
- private Long id;
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM Core
+ * ================================================================================
+ * Copyright (C) 2018 Netsia
+ * ================================================================================
+ * 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.onap.osam.common.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.nio.file.AccessMode;
+import java.util.List;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@JsonRootName("OLT")
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@ApiModel
+public class OLTChassisDTO {
+ @ApiModelProperty(hidden = true)
+ private Long id;
+ @ApiModelProperty(required = true, value="CLLI of the chassis on top of which this OLT-specific chassis is registered")
+ private String clli;
+ @ApiModelProperty(required = true, allowableValues = "OPENOLT, ASFVOLT16, ADTRAN, TIBITS", value="OLT Driver for this OLT-specific chassis")
+ private String oltDriver;
+ @ApiModelProperty(required = true, allowableValues = "EDGECORE, ADTRAN, TIBITS", value="OLT Type for this OLT-specific chassis")
+ private String oltType;
+ @ApiModelProperty(required = true, value="Number of ports for this OLT-specific chassis")
+ private int portNumber;
+ @ApiModelProperty(required = true, value="IP address of this OLT-specific chassis")
+ private String ipAddress;
+ @ApiModelProperty(required = true, value="Name of this OLT-specific chassis")
+ private String name;
+ @ApiModelProperty(hidden = true)
+ private List<OLTPortDTO> oltPorts;
+}
diff --git a/osam-core/web/src/main/java/org/onap/osam/dto/OLTPortDTO.java b/osam-common/src/main/java/org/onap/osam/common/dto/OLTPortDTO.java
similarity index 89%
rename from osam-core/web/src/main/java/org/onap/osam/dto/OLTPortDTO.java
rename to osam-common/src/main/java/org/onap/osam/common/dto/OLTPortDTO.java
index 1a376fa..5ad32f6 100644
--- a/osam-core/web/src/main/java/org/onap/osam/dto/OLTPortDTO.java
+++ b/osam-common/src/main/java/org/onap/osam/common/dto/OLTPortDTO.java
@@ -1,63 +1,63 @@
-/*-
- * ============LICENSE_START=======================================================
- * OSAM Core
- * ================================================================================
- * Copyright (C) 2018 Netsia
- * ================================================================================
- * 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.onap.osam.dto;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import org.onap.osam.model.dao.ActivityState;
-import org.onap.osam.model.dao.AdminState;
-
-import java.util.List;
-
-/**
- * Created by cemturker on 03.10.2018.
- */
-@Getter
-@Setter
-@NoArgsConstructor
-@AllArgsConstructor
-@JsonRootName("OLTPort")
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class OLTPortDTO {
- private Long id;
- private Integer portNumber;
- private ActivityState portAuthState;
- private AdminState adminState;
- private List<ONTDTO> ontDevices;
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("OLTPortDTO{");
- sb.append("id=").append(id);
- sb.append(", portNumber=").append(portNumber);
- sb.append(", portAuthState=").append(portAuthState);
- sb.append(", adminState=").append(adminState);
- sb.append(", ontDevices=").append(ontDevices);
- sb.append('}');
- return sb.toString();
- }
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM Core
+ * ================================================================================
+ * Copyright (C) 2018 Netsia
+ * ================================================================================
+ * 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.onap.osam.common.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+//import org.onap.osam.model.dao.ActivityState;
+//import org.onap.osam.model.dao.AdminState;
+
+import java.util.List;
+
+/**
+ * Created by cemturker on 03.10.2018.
+ */
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+@JsonRootName("OLTPort")
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class OLTPortDTO {
+ private Long id;
+ private Integer portNumber;
+ private /*ActivityState*/ String portAuthState;
+ private /*AdminState*/ String adminState;
+ private List<ONTDTO> ontDevices;
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("OLTPortDTO{");
+ sb.append("id=").append(id);
+ sb.append(", portNumber=").append(portNumber);
+ sb.append(", portAuthState=").append(portAuthState);
+ sb.append(", adminState=").append(adminState);
+ sb.append(", ontDevices=").append(ontDevices);
+ sb.append('}');
+ return sb.toString();
+ }
+}
diff --git a/osam-core/web/src/main/java/org/onap/osam/dto/ONTDTO.java b/osam-common/src/main/java/org/onap/osam/common/dto/ONTDTO.java
similarity index 75%
rename from osam-core/web/src/main/java/org/onap/osam/dto/ONTDTO.java
rename to osam-common/src/main/java/org/onap/osam/common/dto/ONTDTO.java
index d6fd982..6800bae 100644
--- a/osam-core/web/src/main/java/org/onap/osam/dto/ONTDTO.java
+++ b/osam-common/src/main/java/org/onap/osam/common/dto/ONTDTO.java
@@ -1,50 +1,57 @@
-/*-
- * ============LICENSE_START=======================================================
- * OSAM Core
- * ================================================================================
- * Copyright (C) 2018 Netsia
- * ================================================================================
- * 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.onap.osam.dto;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-@JsonRootName("ONTDevice")
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class ONTDTO {
-
- private String clli;
- private String serialNumber;
- private int slotNumber;
- private int portNumber;
- private int ontNumber;
- private Long id;
- private int stag;
- private int ctag;
- private String nasPortId;
- private String circuitId;
- private String technologyProfile;
- private String speedProfile;
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM Core
+ * ================================================================================
+ * Copyright (C) 2018 Netsia
+ * ================================================================================
+ * 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.onap.osam.common.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@JsonRootName("ONTDevice")
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@ApiModel
+public class ONTDTO {
+ @ApiModelProperty(hidden = true)
+ private Long id;
+ @ApiModelProperty(required = true, value="CLLI of the chassis on top of which this ONT device is registered")
+ private String clli;
+ @ApiModelProperty(required = true, value="Serial number of this ONT device")
+ private String serialNumber;
+ @ApiModelProperty(required = true, value="OLT Slot number of this ONT device")
+ private int slotNumber;
+ @ApiModelProperty(required = true, value="OLT Port number of this ONT device")
+ private int portNumber;
+ private int ontNumber;
+ private int stag;
+ private int ctag;
+ private String nasPortId;
+ private String circuitId;
+ private String technologyProfile;
+ private String speedProfile;
+}
diff --git a/osam-core/common/pom.xml b/osam-core/common/pom.xml
index 8c0fc70..cdb1e2f 100644
--- a/osam-core/common/pom.xml
+++ b/osam-core/common/pom.xml
@@ -30,5 +30,13 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>common</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>osam-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
</project>
\ No newline at end of file
diff --git a/osam-core/core/src/main/java/org/onap/osam/core/AccessPodServiceImpl.java b/osam-core/core/src/main/java/org/onap/osam/core/AccessPodServiceImpl.java
index 1ba8bad..4113d1b 100644
--- a/osam-core/core/src/main/java/org/onap/osam/core/AccessPodServiceImpl.java
+++ b/osam-core/core/src/main/java/org/onap/osam/core/AccessPodServiceImpl.java
@@ -53,8 +53,9 @@
@Override
public AccessPod addOrUpdate(AccessPod value) {
- PNF pnf = aaiClient.queryPnf(value.getPnfId());
- Optional<AccessPod> accessPodOptional = accessPodRepository.findByPnfId(pnf.getPnfId());
+ //aai logic is commented out, to allow manual registering of SEBA PODs in OSAM Core
+ //PNF pnf = aaiClient.queryPnf(value.getPnfId());
+ Optional<AccessPod> accessPodOptional = accessPodRepository.findByPnfId(value.getPnfId());
if (accessPodOptional.isPresent()) {
AccessPod tmp = accessPodOptional.get();
value.setId(tmp.getId());
diff --git a/osam-core/external/src/main/java/org/onap/osam/external/grpc/AbstractOLTClient.java b/osam-core/external/src/main/java/org/onap/osam/external/grpc/AbstractOLTClient.java
index 27c697d..81f2851 100644
--- a/osam-core/external/src/main/java/org/onap/osam/external/grpc/AbstractOLTClient.java
+++ b/osam-core/external/src/main/java/org/onap/osam/external/grpc/AbstractOLTClient.java
@@ -88,6 +88,7 @@
@PostConstruct
private void init() {
+ log.info("Abstract OLT connection properties - host: {}, port: {}", host, port);
ManagedChannel managedChannel = ManagedChannelBuilder
.forAddress(host, port).usePlaintext().build();
@@ -117,6 +118,8 @@
.setXOSPassword(pass)
.build();
+ log.info("AddChassisMessage message: {}", request);
+
AddChassisReturn response = blockingStub.createChassis(request);
if(!StringUtils.isEmpty(response.getDeviceID())) {
log.info("Chassis created in AbstractOLT with clli : {}",clli);
@@ -146,6 +149,7 @@
.setType(oltType)
.build();
+ log.info("AddOLTChassisMessage message: {}", request);
AddOLTChassisReturn response = blockingStub.createOLTChassis(request);
deviceID = response.getDeviceID();
chassisDeviceId = response.getChassisDeviceID();
@@ -177,14 +181,12 @@
log.error("preProvisionOnt RPC failed", e);
throw new AbstractOLTException("preProvisionOnt failed for ont : {}", ontDevice);
}
-
return result;
}
public boolean provisionONT(ONTDevice ontDevice) {
boolean result = false;
-
try {
AddOntMessage request = OntMessageFactory.getOntMessage(ontDevice);
AddOntReturn response = blockingStub.provisionOnt(request);
diff --git a/osam-core/model/src/main/resources/application.properties b/osam-core/model/src/main/resources/application.properties
index 81ed287..3d2b5cb 100644
--- a/osam-core/model/src/main/resources/application.properties
+++ b/osam-core/model/src/main/resources/application.properties
@@ -4,7 +4,7 @@
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.jpa.hibernate.ddl-auto=update
-
+server.port=8888
logging.level.org.onap.osam=DEBUG
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
#logging.level.org.hibernate.type=TRACE
\ No newline at end of file
diff --git a/osam-core/web/src/main/java/org/onap/osam/controller/AccessPodRestController.java b/osam-core/web/src/main/java/org/onap/osam/controller/AccessPodRestController.java
index ad901c5..46b21f7 100644
--- a/osam-core/web/src/main/java/org/onap/osam/controller/AccessPodRestController.java
+++ b/osam-core/web/src/main/java/org/onap/osam/controller/AccessPodRestController.java
@@ -23,7 +23,7 @@
package org.onap.osam.controller;
import lombok.extern.slf4j.Slf4j;
-import org.onap.osam.dto.AccessPodDTO;
+import org.onap.osam.common.dto.AccessPodDTO;
import org.onap.osam.helper.DTOMapper;
import org.onap.osam.model.dao.AccessPod;
import org.onap.osam.api.service.AccessPodService;
diff --git a/osam-core/web/src/main/java/org/onap/osam/controller/DeviceController.java b/osam-core/web/src/main/java/org/onap/osam/controller/DeviceController.java
index b5b0103..f6c7aec 100644
--- a/osam-core/web/src/main/java/org/onap/osam/controller/DeviceController.java
+++ b/osam-core/web/src/main/java/org/onap/osam/controller/DeviceController.java
@@ -24,9 +24,9 @@
import lombok.extern.slf4j.Slf4j;
import org.onap.osam.api.service.DeviceService;
-import org.onap.osam.dto.ChassisDTO;
-import org.onap.osam.dto.OLTChassisDTO;
-import org.onap.osam.dto.ONTDTO;
+import org.onap.osam.common.dto.ChassisDTO;
+import org.onap.osam.common.dto.OLTChassisDTO;
+import org.onap.osam.common.dto.ONTDTO;
import org.onap.osam.helper.DTOMapper;
import org.onap.osam.model.dao.*;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/osam-core/web/src/main/java/org/onap/osam/controller/TopologyController.java b/osam-core/web/src/main/java/org/onap/osam/controller/TopologyController.java
index 6f760ee..18ea729 100644
--- a/osam-core/web/src/main/java/org/onap/osam/controller/TopologyController.java
+++ b/osam-core/web/src/main/java/org/onap/osam/controller/TopologyController.java
@@ -25,7 +25,7 @@
import lombok.extern.slf4j.Slf4j;
import org.onap.osam.api.service.AccessPodService;
import org.onap.osam.api.service.DeviceService;
-import org.onap.osam.dto.AccessPodDTO;
+import org.onap.osam.common.dto.AccessPodDTO;
import org.onap.osam.helper.DTOMapper;
import org.onap.osam.model.dao.AccessPod;
import org.onap.osam.model.dao.Chassis;
diff --git a/osam-core/web/src/main/java/org/onap/osam/helper/DTOMapper.java b/osam-core/web/src/main/java/org/onap/osam/helper/DTOMapper.java
index 81d14f5..8a941ee 100644
--- a/osam-core/web/src/main/java/org/onap/osam/helper/DTOMapper.java
+++ b/osam-core/web/src/main/java/org/onap/osam/helper/DTOMapper.java
@@ -23,11 +23,11 @@
package org.onap.osam.helper;
import com.google.common.collect.Lists;
-import org.onap.osam.dto.AccessPodDTO;
-import org.onap.osam.dto.ChassisDTO;
-import org.onap.osam.dto.OLTChassisDTO;
-import org.onap.osam.dto.OLTPortDTO;
-import org.onap.osam.dto.ONTDTO;
+import org.onap.osam.common.dto.AccessPodDTO;
+import org.onap.osam.common.dto.ChassisDTO;
+import org.onap.osam.common.dto.OLTChassisDTO;
+import org.onap.osam.common.dto.OLTPortDTO;
+import org.onap.osam.common.dto.ONTDTO;
import org.onap.osam.model.dao.*;
import java.util.ArrayList;
@@ -177,8 +177,8 @@
private static OLTPortDTO convertOLTPortToDTO(OLTPort oltPort) {
OLTPortDTO oltPortDTO = new OLTPortDTO();
oltPortDTO.setId(oltPort.getId());
- oltPortDTO.setAdminState(oltPort.getAdminState());
- oltPortDTO.setPortAuthState(oltPort.getPortAuthState());
+ oltPortDTO.setAdminState(oltPort.getAdminState().name());
+ oltPortDTO.setPortAuthState(oltPort.getPortAuthState().name());
oltPortDTO.setPortNumber(oltPort.getPortNumber());
return oltPortDTO;
}
diff --git a/pom.xml b/pom.xml
index a55fff4..6b10489 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,6 +35,7 @@
<activeByDefault>true</activeByDefault>
</activation>
<modules>
+ <module>osam-common</module>
<module>onap-enabler-be</module>
<module>onap-enabler-infra</module>
<module>osam-core</module>