aboutsummaryrefslogtreecommitdiffstats
path: root/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config
diff options
context:
space:
mode:
authorLathish <lathishbabu.ganesan@est.tech>2019-04-26 08:46:13 +0000
committerLathish <lathishbabu.ganesan@est.tech>2019-04-26 08:46:13 +0000
commitc0b9d01cbc3a3d3b1ce32178394e8fd74a10de65 (patch)
tree816a6baad581f3a7655724662de6616dff74bd0f /vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config
parent0164ebaeecf27e635b3b4097034780dbb8be7c74 (diff)
VNFM simulator implementation for instantiate flow
Issue-ID: SO-1773 Change-Id: I710fe6905d650df29f7550f4eafde2f672301bc4 Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
Diffstat (limited to 'vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config')
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java43
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/SvnfmApplication.java6
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/WebSecurityConfigImpl.java48
3 files changed, 96 insertions, 1 deletions
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
new file mode 100644
index 0000000000..91b79754a5
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/ApplicationConfig.java
@@ -0,0 +1,43 @@
+package org.onap.svnfm.simulator.config;
+
+import java.net.InetAddress;
+import java.util.Arrays;
+import org.onap.svnfm.simulator.constants.Constant;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.cache.Cache;
+import org.springframework.cache.CacheManager;
+import org.springframework.cache.concurrent.ConcurrentMapCache;
+import org.springframework.cache.support.SimpleCacheManager;
+import org.springframework.context.annotation.Bean;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ApplicationConfig implements ApplicationRunner {
+
+ private static final String PORT = "local.server.port";
+
+ @Autowired
+ private Environment environment;
+
+ private String baseUrl;
+
+ @Override
+ public void run(final ApplicationArguments args) throws Exception {
+ baseUrl = "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + environment.getProperty(PORT);
+ }
+
+ public String getBaseUrl() {
+ return baseUrl;
+ }
+
+ @Bean
+ public CacheManager cacheManager() {
+ Cache inlineResponse201 = new ConcurrentMapCache(Constant.IN_LINE_RESPONSE_201_CACHE);
+ SimpleCacheManager manager = new SimpleCacheManager();
+ manager.setCaches(Arrays.asList(inlineResponse201));
+ return manager;
+ }
+}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/SvnfmApplication.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/SvnfmApplication.java
index 84b45d0bac..723ae906e6 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/SvnfmApplication.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/SvnfmApplication.java
@@ -20,6 +20,7 @@
package org.onap.svnfm.simulator.config;
+import org.onap.svnfm.simulator.controller.SvnfmController;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
@@ -27,7 +28,10 @@ import org.springframework.cache.annotation.EnableCaching;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
/**
- *
+ * The spring boot application for the VNF LCM.
+ * <p>
+ * The VNFM receives requests through its REST API {@link SvnfmController}
+ *
* @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
* @author ronan.kenny@est.tech
*/
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/WebSecurityConfigImpl.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/WebSecurityConfigImpl.java
new file mode 100644
index 0000000000..18eadd2fc3
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/config/WebSecurityConfigImpl.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.svnfm.simulator.config;
+
+import org.onap.so.security.MSOSpringFirewall;
+import org.onap.so.security.WebSecurityConfig;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.web.firewall.StrictHttpFirewall;
+
+/**
+ * Configure the web security for the application.
+ */
+@EnableWebSecurity
+public class WebSecurityConfigImpl extends WebSecurityConfig {
+
+ @Override
+ protected void configure(final HttpSecurity http) throws Exception {
+ http.csrf().disable().authorizeRequests().antMatchers("/**").permitAll();
+ }
+
+ @Override
+ public void configure(final WebSecurity web) throws Exception {
+ super.configure(web);
+ final StrictHttpFirewall firewall = new MSOSpringFirewall();
+ web.httpFirewall(firewall);
+ }
+
+}