swagger expose Northbound endpoints
Change-Id: I8c19590e24fdf45655386f4abeee2828cc9cb30a
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