Merge "added generic fabric support to SO"
authorRob Daugherty <rd472p@att.com>
Mon, 10 Sep 2018 12:34:33 +0000 (12:34 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 10 Sep 2018 12:34:33 +0000 (12:34 +0000)
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/WebSecurityConfigImpl.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java
adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java
mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java

index de8aedc..2eeed77 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 package org.onap.so.adapters.network;
-
 
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -196,9 +196,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
                                                   copyCreateSubnetIdMap (subnetIdMap),
                                                   copyNrb (networkRollback));
         } catch (Exception e) {
-            error = "Error sending createNetwork notification " + e.getMessage ();
-            LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e);
-            alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
+            error = CREATE_NETWORK_ERROR_MSG + e.getMessage ();
+            LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e);
+            alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error);
         }
         return;
     }
index 6bbdebe..aca16d9 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
  * 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
@@ -17,7 +19,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.so.adapters.openstack;
 
 import org.onap.so.security.MSOSpringFirewall;
@@ -36,7 +38,7 @@ public class WebSecurityConfigImpl extends WebSecurityConfig {
                http.csrf().disable()
                .authorizeRequests()
                .antMatchers("/manage/health","/manage/info").permitAll()
-               .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString())
+               .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),","))
                .and()
                .httpBasic();
        }
index 344895f..30062a0 100644 (file)
@@ -34,11 +34,7 @@ public class GenericValetResponse<T> {
        private String errorMessage;
        private T returnObject;
        
-       @Override
-       public String toString() {
-               return new ToStringBuilder(this).append("statusCode", statusCode).append("errorMessage", errorMessage)
-                               .append("returnObject", returnObject).toString();
-       }
+
        public GenericValetResponse(int statusCode, String errorMessage, T obj) {
                super();
                this.statusCode = statusCode;
@@ -48,6 +44,11 @@ public class GenericValetResponse<T> {
        public GenericValetResponse() {
                this(-1, "not set", null);
        }
+       @Override
+       public String toString() {
+               return new ToStringBuilder(this).append("statusCode", statusCode).append("errorMessage", errorMessage)
+                               .append("returnObject", returnObject).toString();
+       }
        public void setErrorMessage(String errorMessage) {
                this.errorMessage = errorMessage;
        }
index 4f7afa2..5a28f65 100644 (file)
@@ -19,7 +19,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.so.adapters.valet.beans;
 
 import java.io.Serializable;
@@ -46,9 +46,9 @@ public class HeatRequest implements Serializable {
        @JsonProperty("environment")
        private String environment;
        @JsonProperty("files")
-       private Map<String, Object> files = new HashMap<String, Object>();
+       private Map<String, Object> files = new HashMap<>();
        @JsonProperty("parameters")
-       private Map<String, Object> parameters = new HashMap<String, Object>();
+       private Map<String, Object> parameters = new HashMap<>();
        
        public HeatRequest(String stackName, boolean disableRollback, int timeoutMins, String template, String environment, Map<String, Object> files, Map<String, Object> parameters) {
                super();
index b4b5894..e7bf3f7 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
  * 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
@@ -81,7 +83,9 @@ import io.swagger.annotations.ApiResponses;
 public class VolumeAdapterRest {
        private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VolumeAdapterRest.class);
        private static final String TESTING_KEYWORD = "___TESTING___";
-       
+       private static final String EXCEPTION="Exception :";
+       private static final String RESP=", resp=";
+       private static final String VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT="VolumeGroupId in URL does not match content";
        @Autowired
        private MsoVnfAdapterImpl vnfAdapter;
 
@@ -225,7 +229,7 @@ public class VolumeAdapterRest {
                                                rb,
                                                req.getMessageId());
                        } catch (VnfException e) {
-                               LOGGER.debug("Exception :",e);
+                               LOGGER.debug(EXCEPTION,e);
                                eresp = new VolumeGroupExceptionResponse(
                                        e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
                        }
@@ -234,7 +238,7 @@ public class VolumeAdapterRest {
                                BpelRestClient bpelClient = bpelRestClientProvider.get();
                                bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
                        }
-                       LOGGER.debug ("CreateVFModule VolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse());
+                       LOGGER.debug ("CreateVFModule VolumesTask exit: code=" + getStatusCode() + RESP+ getResponse());
                }
        }
 
@@ -261,7 +265,7 @@ public class VolumeAdapterRest {
                        return Response
                                .status(HttpStatus.SC_BAD_REQUEST)
                                .type(MediaType.TEXT_PLAIN)
-                               .entity("VolumeGroupId in URL does not match content")
+                               .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT)
                                .build();
                }
                DeleteVNFVolumesTask task = new DeleteVNFVolumesTask(req);
@@ -322,7 +326,7 @@ public class VolumeAdapterRest {
                                }
                                response = new DeleteVolumeGroupResponse(true, req.getMessageId());
                        } catch (VnfException e) {
-                               LOGGER.debug("Exception :",e);
+                               LOGGER.debug(EXCEPTION,e);
                                eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
                        }
                        if (!req.isSynchronous()) {
@@ -330,7 +334,7 @@ public class VolumeAdapterRest {
                                BpelRestClient bpelClient = bpelRestClientProvider.get();
                                bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
                        }
-                       LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse());
+                       LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse());
                }
        }
 
@@ -357,7 +361,7 @@ public class VolumeAdapterRest {
                        return Response
                                .status(HttpStatus.SC_BAD_REQUEST)
                                .type(MediaType.TEXT_PLAIN)
-                               .entity("VolumeGroupId in URL does not match content")
+                               .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT)
                                .build();
                }
                RollbackVNFVolumesTask task = new RollbackVNFVolumesTask(req);
@@ -420,7 +424,7 @@ public class VolumeAdapterRest {
                                vnfAdapter.rollbackVnf(vrb);
                                response = new RollbackVolumeGroupResponse(true, req.getMessageId());
                        } catch (VnfException e) {
-                               LOGGER.debug("Exception :",e);
+                               LOGGER.debug(EXCEPTION,e);
                                eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
                        }
                        if (!req.isSynchronous()) {
@@ -428,7 +432,7 @@ public class VolumeAdapterRest {
                                BpelRestClient bpelClient = bpelRestClientProvider.get();
                                bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
                        }
-                       LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse());
+                       LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse());
                }
 
        }
@@ -456,7 +460,7 @@ public class VolumeAdapterRest {
                        return Response
                                .status(HttpStatus.SC_BAD_REQUEST)
                                .type(MediaType.TEXT_PLAIN)
-                               .entity("VolumeGroupId in URL does not match content")
+                               .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT)
                                .build();
                }
                UpdateVNFVolumesTask task = new UpdateVNFVolumesTask(req);
@@ -552,7 +556,7 @@ public class VolumeAdapterRest {
                                                req.getVolumeGroupId(), req.getVolumeGroupStackId(),
                                                outputs.value, req.getMessageId());
                        } catch (VnfException e) {
-                               LOGGER.debug("Exception :",e);
+                               LOGGER.debug(EXCEPTION,e);
                                eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
                        }
                        if (!req.isSynchronous()) {
@@ -560,7 +564,7 @@ public class VolumeAdapterRest {
                                BpelRestClient bpelClient = bpelRestClientProvider.get();
                                bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
                        }
-                       LOGGER.debug("UpdateVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse());
+                       LOGGER.debug("UpdateVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse());
                }
        }
 
index 766a48a..543c8e4 100644 (file)
@@ -48,8 +48,6 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
 
 @Configuration("CXFConfiguration")
 public class CXFConfiguration {
-    
-       private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CXFConfiguration.class);
        
        JAXRSServerFactoryBean endpoint;
        
index 5bb83a7..6ff6ec9 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
  * 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
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.so.adapters.vfc;
+package org.onap.so.adapters.vfc; 
 
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.domain.EntityScan;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
 
 
 
index b560690..0f0a14c 100644 (file)
@@ -54,6 +54,7 @@ public class VfcAdapterRest {
 
     private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VfcAdapterRest.class);
     private static final String REQUEST_DEBUG_MSG="body from request is {}";
+    private static final String APPLICATION_EXCEPTION="ApplicationException: ";
     @Autowired
     private VfcManager driverMgr ;
 
@@ -80,7 +81,7 @@ public class VfcAdapterRest {
             RestfulResponse rsp = driverMgr.createNs(nsInput);
             return buildResponse(rsp);
         } catch(ApplicationException e) {
-            LOGGER.debug("ApplicationException: ", e);
+            LOGGER.debug(APPLICATION_EXCEPTION, e);
             return e.buildErrorResponse();
         }
     }
@@ -106,7 +107,7 @@ public class VfcAdapterRest {
             RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId);
             return buildResponse(rsp);
         } catch(ApplicationException e) {
-            LOGGER.debug("ApplicationException: ", e);
+            LOGGER.debug(APPLICATION_EXCEPTION, e);
             return e.buildErrorResponse();
         }
     }
@@ -131,7 +132,7 @@ public class VfcAdapterRest {
             RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId);
             return buildResponse(rsp);
         } catch(ApplicationException e) {
-            LOGGER.debug("ApplicationException: ", e);
+            LOGGER.debug(APPLICATION_EXCEPTION, e);
             return e.buildErrorResponse();
         }
     }
@@ -156,7 +157,7 @@ public class VfcAdapterRest {
             RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput);
             return buildResponse(rsp);
         } catch(ApplicationException e) {
-            LOGGER.debug("ApplicationException: ", e);
+            LOGGER.debug(APPLICATION_EXCEPTION, e);
             return e.buildErrorResponse();
         }
     }
@@ -181,7 +182,7 @@ public class VfcAdapterRest {
             RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId);
             return buildResponse(rsp);
         } catch(ApplicationException e) {
-            LOGGER.debug("ApplicationException: ", e);
+            LOGGER.debug(APPLICATION_EXCEPTION, e);
             return e.buildErrorResponse();
         }
     }
@@ -207,7 +208,7 @@ public class VfcAdapterRest {
                RestfulResponse rsp = driverMgr.scaleNs(nsInstanceId, nsInput);
                return buildResponse(rsp);
        } catch(ApplicationException e) {
-                   LOGGER.debug("ApplicationException: ", e);
+                   LOGGER.debug(APPLICATION_EXCEPTION, e);
                return e.buildErrorResponse();
        }
     }
index 7feb1ae..e9062ef 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
  * 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
@@ -110,7 +112,7 @@ public class CamundaClient extends RequestClient{
        public HttpResponse post(RequestClientParameter parameterObject)
                                        throws ClientProtocolException, IOException{
                HttpPost post = new HttpPost(url);
-               msoLogger.debug("Camunda url is: "+ url);
+               msoLogger.debug(CAMUNDA_URL_MESAGE+ url);
                String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(), parameterObject.getRecipeTimeout(), parameterObject.getRequestAction(),
                                parameterObject.getServiceInstanceId(), parameterObject.getCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(),
                                parameterObject.getServiceType(), parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(), parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(), parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd());