From 5a6a6de6f1a26a1897e4917a0df613e25a24eb70 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 30 Jul 2018 15:56:09 -0400 Subject: Containerization feature of SO Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) --- .../onap/so/adapters/sdnc/AsyncConfiguration.java | 31 ++ .../onap/so/adapters/sdnc/CXFConfiguration.java | 107 +++++++ .../org/onap/so/adapters/sdnc/ObjectFactory.java | 77 +++++ .../org/onap/so/adapters/sdnc/RequestHeader.java | 219 +++++++++++++ .../so/adapters/sdnc/SDNCAdapterApplication.java | 73 +++++ .../onap/so/adapters/sdnc/SDNCAdapterPortType.java | 53 ++++ .../onap/so/adapters/sdnc/SDNCAdapterRequest.java | 128 ++++++++ .../onap/so/adapters/sdnc/SDNCAdapterResponse.java | 53 ++++ .../onap/so/adapters/sdnc/SDNCAdapterService.java | 126 ++++++++ .../onap/so/adapters/sdnc/SyncConfiguration.java | 28 ++ .../so/adapters/sdnc/WebSecurityConfigImpl.java | 51 +++ .../so/adapters/sdnc/client/CallbackHeader.java | 155 +++++++++ .../so/adapters/sdnc/client/ObjectFactory.java | 68 ++++ .../sdnc/client/SDNCAdapterCallbackRequest.java | 137 ++++++++ .../sdnc/client/SDNCCallbackAdapterPortType.java | 53 ++++ .../sdnc/client/SDNCCallbackAdapterService.java | 126 ++++++++ .../onap/so/adapters/sdnc/client/package-info.java | 23 ++ .../sdnc/exception/SDNCAdapterException.java | 30 ++ .../org/onap/so/adapters/sdnc/impl/Constants.java | 48 +++ .../so/adapters/sdnc/impl/MapRequestTunables.java | 102 ++++++ .../so/adapters/sdnc/impl/RequestTunables.java | 161 ++++++++++ .../sdnc/impl/SDNCAdapterPortTypeImpl.java | 84 +++++ .../onap/so/adapters/sdnc/impl/SDNCResponse.java | 73 +++++ .../onap/so/adapters/sdnc/impl/SDNCRestClient.java | 333 ++++++++++++++++++++ .../java/org/onap/so/adapters/sdnc/impl/Utils.java | 199 ++++++++++++ .../org/onap/so/adapters/sdnc/package-info.java | 23 ++ .../so/adapters/sdnc/sdncrest/BPRestCallback.java | 174 +++++++++++ .../sdnc/sdncrest/MapTypedRequestTunablesData.java | 109 +++++++ .../adapters/sdnc/sdncrest/SDNCAdapterUtils.java | 75 +++++ .../so/adapters/sdnc/sdncrest/SDNCConnector.java | 329 +++++++++++++++++++ .../sdnc/sdncrest/SDNCServiceRequestConnector.java | 207 ++++++++++++ .../sdnc/sdncrest/SDNCServiceRequestTask.java | 230 ++++++++++++++ .../so/adapters/sdnc/sdncrest/SNIROResponse.java | 92 ++++++ .../sdnc/sdncrest/TypedRequestTunables.java | 180 +++++++++++ .../so/adapters/sdnc/util/SDNCRequestIdUtil.java | 39 +++ .../openecomp/mso/adapters/sdnc/ObjectFactory.java | 77 ----- .../openecomp/mso/adapters/sdnc/RequestHeader.java | 219 ------------- .../mso/adapters/sdnc/SDNCAdapterPortType.java | 53 ---- .../mso/adapters/sdnc/SDNCAdapterRequest.java | 129 -------- .../mso/adapters/sdnc/SDNCAdapterResponse.java | 53 ---- .../mso/adapters/sdnc/SDNCAdapterService.java | 127 -------- .../mso/adapters/sdnc/client/CallbackHeader.java | 155 --------- .../mso/adapters/sdnc/client/ObjectFactory.java | 68 ---- .../sdnc/client/SDNCAdapterCallbackRequest.java | 136 -------- .../sdnc/client/SDNCCallbackAdapterPortType.java | 52 --- .../sdnc/client/SDNCCallbackAdapterService.java | 125 -------- .../mso/adapters/sdnc/client/package-info.java | 23 -- .../mso/adapters/sdnc/impl/Constants.java | 48 --- .../mso/adapters/sdnc/impl/RequestTunables.java | 223 ------------- .../sdnc/impl/SDNCAdapterPortTypeImpl.java | 102 ------ .../adapters/sdnc/impl/SDNCAdapterRestImpl.java | 191 ------------ .../mso/adapters/sdnc/impl/SDNCResponse.java | 73 ----- .../mso/adapters/sdnc/impl/SDNCRestClient.java | 347 --------------------- .../openecomp/mso/adapters/sdnc/impl/Utils.java | 198 ------------ .../adapters/sdnc/notify/SDNCNotifyResource.java | 192 ------------ .../openecomp/mso/adapters/sdnc/package-info.java | 23 -- .../mso/adapters/sdnc/sdncrest/BPRestCallback.java | 170 ---------- .../sdnc/sdncrest/SDNCAdapterProperties.java | 85 ----- .../adapters/sdnc/sdncrest/SDNCAdapterRest.java | 239 -------------- .../adapters/sdnc/sdncrest/SDNCAdapterUtils.java | 74 ----- .../mso/adapters/sdnc/sdncrest/SDNCConnector.java | 317 ------------------- .../adapters/sdnc/sdncrest/SDNCEventParser.java | 161 ---------- .../sdnc/sdncrest/SDNCServiceRequestConnector.java | 199 ------------ .../sdnc/sdncrest/SDNCServiceRequestTask.java | 213 ------------- .../mso/adapters/sdnc/sdncrest/SNIROResponse.java | 78 ----- .../sdnc/sdncrest/TypedRequestTunables.java | 224 ------------- .../mso/adapters/sdnc/util/SDNCRequestIdUtil.java | 39 --- .../src/main/resources/SDNCAdapter.wsdl | 10 +- .../src/main/resources/SDNCAdapterSchema.xsd | 6 +- .../src/main/resources/SDNCCallbackAdapter.wsdl | 10 +- .../src/main/resources/application-local.yaml | 131 ++++++++ .../src/main/resources/application.yaml | 22 ++ .../src/main/resources/static/index.html | 41 +++ .../src/main/resources/static/readme/index.html | 53 ++++ .../src/main/resources/static/readme/install.html | 34 ++ .../src/main/resources/static/readme/jars.html | 34 ++ .../src/main/resources/static/readme/layout.html | 34 ++ .../src/main/resources/static/readme/logging.html | 34 ++ .../src/main/resources/static/readme/onaplogo.png | Bin 0 -> 21360 bytes .../main/resources/static/readme/packaging.html | 34 ++ .../src/main/resources/static/readme/page.html | 67 ++++ .../src/main/resources/static/readme/readme.css | 114 +++++++ .../src/main/resources/static/readme/spring.html | 34 ++ .../src/main/resources/static/readme/tools.html | 34 ++ .../resources/static/swagger/favicon-16x16.png | Bin 0 -> 445 bytes .../resources/static/swagger/favicon-32x32.png | Bin 0 -> 1141 bytes .../src/main/resources/static/swagger/index.html | 95 ++++++ .../resources/static/swagger/oauth2-redirect.html | 60 ++++ .../resources/static/swagger/swagger-ui-bundle.js | 99 ++++++ .../static/swagger/swagger-ui-standalone-preset.js | 13 + .../main/resources/static/swagger/swagger-ui.css | 2 + .../resources/static/swagger/swagger-ui.css.map | 1 + .../main/resources/static/swagger/swagger-ui.js | 8 + 93 files changed, 4953 insertions(+), 4426 deletions(-) create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/AsyncConfiguration.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/ObjectFactory.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/RequestHeader.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterPortType.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterRequest.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterResponse.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SyncConfiguration.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/CallbackHeader.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/ObjectFactory.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterPortType.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/package-info.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/exception/SDNCAdapterException.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCResponse.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/package-info.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtil.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/RequestHeader.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterPortType.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequest.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterResponse.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterService.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/ObjectFactory.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequest.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/package-info.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Constants.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponse.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/package-info.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SNIROResponse.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtil.java create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/application.yaml create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/index.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/index.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/install.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/jars.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/layout.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/logging.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/onaplogo.png create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/packaging.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/page.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/readme.css create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/spring.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/tools.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-16x16.png create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-32x32.png create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/index.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/oauth2-redirect.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui-bundle.js create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui-standalone-preset.js create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui.css create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui.css.map create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui.js (limited to 'adapters/mso-sdnc-adapter/src/main') diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/AsyncConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/AsyncConfiguration.java new file mode 100644 index 0000000000..db5f682f6b --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/AsyncConfiguration.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc; + +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableAsync; + + +@Configuration +@EnableAsync +public class AsyncConfiguration { + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java new file mode 100644 index 0000000000..4a50fb32e3 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java @@ -0,0 +1,107 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc; + +import java.util.Arrays; + +import javax.xml.ws.Endpoint; + +import org.apache.cxf.Bus; +import org.apache.cxf.endpoint.Server; +import org.apache.cxf.feature.LoggingFeature; +import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; +import org.apache.cxf.jaxrs.swagger.Swagger2Feature; +import org.apache.cxf.jaxws.EndpointImpl; +import org.apache.cxf.transport.servlet.CXFServlet; +import org.onap.so.adapters.sdnc.sdncrest.SNIROResponse; +import org.onap.so.logger.MsoLogger; +import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +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; + + @Autowired + private Bus bus; + + @Autowired + private JaxRsFilterLogging jaxRsFilterLogging; + + @Autowired + private SDNCAdapterPortType sdncAdapterPortImpl; + + @Autowired + private SNIROResponse sniroResponse; + + + @Autowired + private ObjectMapper mapper; + @Bean + public Server rsServer() { + endpoint = new JAXRSServerFactoryBean(); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + endpoint.setBus(bus); + endpoint.setServiceBeans(Arrays.asList(sniroResponse)); + endpoint.setAddress("/rest"); + endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature())); + endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper),jaxRsFilterLogging)); + return endpoint.create(); + } + + @Bean + public ServletRegistrationBean cxfServlet() { + return new ServletRegistrationBean(new CXFServlet(), "/adapters/*"); + } + + @Bean + public Endpoint sndcAdapter() { + EndpointImpl endpoint = new EndpointImpl(bus, sdncAdapterPortImpl); + endpoint.publish("/SDNCAdapter"); + return endpoint; + } + + + @Bean + public Swagger2Feature createSwaggerFeature() { + Swagger2Feature swagger2Feature= new Swagger2Feature(); + swagger2Feature.setBasePath("/services/rest"); + swagger2Feature.setPrettyPrint(true); + swagger2Feature.setTitle("SO Orchestration Application"); + swagger2Feature.setContact("The ONAP SO team"); + swagger2Feature.setDescription("This project is the SO Orchestration Engine"); + swagger2Feature.setVersion("1.0.0"); + swagger2Feature.setResourcePackage("org.onap.so.adapters.sdnc"); + swagger2Feature.setScan(true); + return swagger2Feature; + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/ObjectFactory.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/ObjectFactory.java new file mode 100644 index 0000000000..eab7d5bf6f --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/ObjectFactory.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc; + + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.onap.so.adapters.sdnc package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.onap.so.adapters.sdnc + * + */ + public ObjectFactory() { + /* Empty constructor */ + } + + /** + * Create an instance of {@link RequestHeader } + * + */ + public RequestHeader createRequestHeader() { + return new RequestHeader(); + } + + /** + * Create an instance of {@link SDNCAdapterResponse } + * + */ + public SDNCAdapterResponse createSDNCAdapterResponse() { + return new SDNCAdapterResponse(); + } + + /** + * Create an instance of {@link SDNCAdapterRequest } + * + */ + public SDNCAdapterRequest createSDNCAdapterRequest() { + return new SDNCAdapterRequest(); + } + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/RequestHeader.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/RequestHeader.java new file mode 100644 index 0000000000..1f1b85f34b --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/RequestHeader.java @@ -0,0 +1,219 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc; + + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +//BPEL to SDNCAdapter request header +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestId", + "svcInstanceId", + "svcAction", + "svcOperation", + "callbackUrl", + "msoAction" +}) +@XmlRootElement(name = "RequestHeader") +public class RequestHeader { + + @XmlElement(name = "RequestId", required = true) + protected String requestId; + @XmlElement(name = "SvcInstanceId") + protected String svcInstanceId; + @XmlElement(name = "SvcAction", required = true) + protected String svcAction; + @XmlElement(name = "SvcOperation", required = true) + protected String svcOperation; + @XmlElement(name = "CallbackUrl", required = true) + protected String callbackUrl; + @XmlElement(name = "MsoAction") + protected String msoAction; + + /** + * Gets the value of the requestId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRequestId() { + return requestId; + } + + /** + * Sets the value of the requestId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRequestId(String value) { + this.requestId = value; + } + + public String getSvcInstanceId() { + return svcInstanceId; + } + + public void setSvcInstanceId(String svcInstanceId) { + this.svcInstanceId = svcInstanceId; + } + + /** + * Gets the value of the svcAction property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSvcAction() { + return svcAction; + } + + /** + * Sets the value of the svcAction property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSvcAction(String value) { + this.svcAction = value; + } + + /** + * Gets the value of the svcOperation property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSvcOperation() { + return svcOperation; + } + + /** + * Sets the value of the svcOperation property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSvcOperation(String value) { + this.svcOperation = value; + } + + /** + * Gets the value of the callbackUrl property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCallbackUrl() { + return callbackUrl; + } + + /** + * Sets the value of the callbackUrl property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCallbackUrl(String value) { + this.callbackUrl = value; + } + + /** + * Gets the value of the callbackUrl property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMsoAction() { + return msoAction; + } + + /** + * Sets the value of the callbackUrl property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMsoAction(String value) { + this.msoAction = value; + } + + + @Override + public String toString() { + return "RequestHeader [requestId=" + requestId + + ", svcInstanceId=" + svcInstanceId + + ", svcAction=" + svcAction + + ", svcOperation=" + svcOperation + + ", callbackUrl=" + callbackUrl + + ", msoAction=" + msoAction + "]"; + } + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java new file mode 100644 index 0000000000..3d88a1467a --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc; + +import java.util.concurrent.Executor; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.context.annotation.Bean; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +@SpringBootApplication(scanBasePackages = { "org.onap" }) +@EnableJpaRepositories({"org.onap.so.db.request.data.repository"}) +@EntityScan({ "org.onap.so.db.request.beans"}) +public class SDNCAdapterApplication { + + @Value("${mso.async.core-pool-size}") + private int corePoolSize; + + @Value("${mso.async.max-pool-size}") + private int maxPoolSize; + + @Value("${mso.async.queue-capacity}") + private int queueCapacity; + + private static final String LOGS_DIR = "logs_dir"; + + private static void setLogsDir() { + if (System.getProperty(LOGS_DIR) == null) { + System.getProperties().setProperty(LOGS_DIR, "./logs/sdnc/"); + } + } + + public static void main(String[] args) { + SpringApplication.run(SDNCAdapterApplication.class, args); + System.getProperties().setProperty("server.name", "Springboot"); + setLogsDir(); + } + + @Bean + public Executor asyncExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + + executor.setCorePoolSize(corePoolSize); + executor.setMaxPoolSize(maxPoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setThreadNamePrefix("SDNCAdapter-"); + executor.initialize(); + return executor; + } + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterPortType.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterPortType.java new file mode 100644 index 0000000000..66f93ab87f --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterPortType.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc; + + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; +import javax.xml.bind.annotation.XmlSeeAlso; + + +/** + * This class was generated by Apache CXF 2.7.11.redhat-3 + * 2015-01-27T18:25:50.914-05:00 + * Generated source version: 2.7.11.redhat-3 + * + */ +//BPEL SDNCAdapter SOAP WebService - impl class in impl pkg +@WebService(targetNamespace = "http://org.onap/workflow/sdnc/adapter/wsdl/v1", name = "SDNCAdapterPortType") +@XmlSeeAlso({ObjectFactory.class}) +@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) +public interface SDNCAdapterPortType { + + @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterResponse") + @WebMethod(operationName = "SDNCAdapter") + public SDNCAdapterResponse sdncAdapter( + @WebParam(partName = "SDNCAdapterRequest", name = "SDNCAdapterRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1") + SDNCAdapterRequest sdncAdapterRequest + ); + + @WebMethod + public void healthCheck(); +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterRequest.java new file mode 100644 index 0000000000..d204f0c2dd --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterRequest.java @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc; + + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import org.onap.so.adapters.sdnc.impl.Utils; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element ref="{http://org.onap/workflow/sdnc/adapter/schema/v1}RequestHeader"/>
+ *         <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +//BPEL to SDNCAdapter request +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestHeader", + "requestData" +}) +@XmlRootElement(name = "SDNCAdapterRequest") +public class SDNCAdapterRequest { + + @XmlElement(name = "RequestHeader", required = true) + protected RequestHeader requestHeader; + @XmlElement(name = "RequestData", required = true) + protected Object requestData; + + /** + * Gets the value of the requestHeader property. + * + * @return + * possible object is + * {@link RequestHeader } + * + */ + public RequestHeader getRequestHeader() { + return requestHeader; + } + + /** + * Sets the value of the requestHeader property. + * + * @param value + * allowed object is + * {@link RequestHeader } + * + */ + public void setRequestHeader(RequestHeader value) { + this.requestHeader = value; + } + + /** + * Gets the value of the requestData property. + * + * @return + * possible object is + * {@link Object } + * + */ + public Object getRequestData() { + return requestData; + } + + /** + * Sets the value of the requestData property. + * + * @param value + * allowed object is + * {@link Object } + * + */ + public void setRequestData(Object value) { + this.requestData = value; + } + + @Override + public String toString() { + + String rd = ""; + if (requestData != null) + { + Node node = (Node) requestData; + Document doc = node.getOwnerDocument(); + rd = Utils.domToStr(doc); + } + return "SDNCAdapterRequest [requestHeader=" + requestHeader.toString() + + ", requestData=" + rd + "]"; + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterResponse.java new file mode 100644 index 0000000000..c67fbc0ae0 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterResponse.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc; + + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +//SDNCAdapter to BPEL Sync Response(ACK) - async response(s) follow +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "SDNCAdapterResponse") +public class SDNCAdapterResponse { + + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java new file mode 100644 index 0000000000..a648aa5fd8 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java @@ -0,0 +1,126 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc; + + +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; + +/** + * This class was generated by Apache CXF 2.7.11.redhat-3 + * 2015-01-27T18:25:50.994-05:00 + * Generated source version: 2.7.11.redhat-3 + * + */ +//BPEL SDNCAdapter SOAP WebService +@WebServiceClient(name = "SDNCAdapterService", + wsdlLocation = "main/resources/SDNCAdapter.wsdl", + targetNamespace = "http://org.onap/workflow/sdnc/adapter/wsdl/v1") +public class SDNCAdapterService extends Service { + + private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCAdapterService.class); + + public static final URL WSDL_LOCATION; + + public static final QName SERVICE = new QName("http://org.onap/workflow/sdnc/adapter/wsdl/v1", "SDNCAdapterService"); + public static final QName SDNCAdapterSoapHttpPort = new QName("http://org.onap/workflow/sdnc/adapter/wsdl/v1", "SDNCAdapterSoapHttpPort"); + static { + URL wsdlUrl = null; + try { + wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCAdapter.wsdl"); + } catch (Exception e) { + logger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCAdapter.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e); + } + if(wsdlUrl == null) { + logger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCAdapter.wsdl", "", "", MsoLogger.ErrorCode.DataError, "WSDL not found"); + } else { + try { + logger.info(MessageEnum.RA_PRINT_URL, "SDNCAdpater.wsdl", wsdlUrl.toURI().toString(), ""); + } catch (Exception e) { + logger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "SDNCAdapter.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - print URL", e); + } + } + WSDL_LOCATION = wsdlUrl; + } + + public SDNCAdapterService(URL wsdlLocation) { + super(wsdlLocation, SERVICE); + } + + public SDNCAdapterService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public SDNCAdapterService() { + super(WSDL_LOCATION, SERVICE); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public SDNCAdapterService(WebServiceFeature ... features) { + super(WSDL_LOCATION, SERVICE, features); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public SDNCAdapterService(URL wsdlLocation, WebServiceFeature ... features) { + super(wsdlLocation, SERVICE, features); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public SDNCAdapterService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns SDNCAdapterPortType + */ + @WebEndpoint(name = "SDNCAdapterSoapHttpPort") + public SDNCAdapterPortType getSDNCAdapterSoapHttpPort() { + return super.getPort(SDNCAdapterSoapHttpPort, SDNCAdapterPortType.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns SDNCAdapterPortType + */ + @WebEndpoint(name = "SDNCAdapterSoapHttpPort") + public SDNCAdapterPortType getSDNCAdapterSoapHttpPort(WebServiceFeature... features) { + return super.getPort(SDNCAdapterSoapHttpPort, SDNCAdapterPortType.class, features); + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SyncConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SyncConfiguration.java new file mode 100644 index 0000000000..0755b9ea3f --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SyncConfiguration.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc; + +import org.springframework.context.annotation.Profile; + +@Profile("non-async") +public class SyncConfiguration { + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java new file mode 100644 index 0000000000..60e37294b1 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc; + +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; +import org.springframework.util.StringUtils; + +@EnableWebSecurity +public class WebSecurityConfigImpl extends WebSecurityConfig { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.csrf().disable() + .authorizeRequests() + .antMatchers("/manage/health","/manage/info","/services").permitAll() + .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString()) + .and() + .httpBasic(); + } + + @Override + public void configure(WebSecurity web) throws Exception { + super.configure(web); + StrictHttpFirewall firewall = new MSOSpringFirewall(); + web.httpFirewall(firewall); + } + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/CallbackHeader.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/CallbackHeader.java new file mode 100644 index 0000000000..67f5516daa --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/CallbackHeader.java @@ -0,0 +1,155 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.client; + + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +//SDNCAdapter to BPEL Async response header +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "requestId", + "responseCode", + "responseMessage" +}) +@XmlRootElement(name = "CallbackHeader") +public class CallbackHeader { + + @XmlElement(name = "RequestId", required = true) + protected String requestId; + @XmlElement(name = "ResponseCode", required = true) + protected String responseCode; + @XmlElement(name = "ResponseMessage", required = true) + protected String responseMessage; + + public CallbackHeader() { + /* Empty constructor */ + } + + public CallbackHeader(String reqId, String respCode, String respMsg) { + this.requestId = reqId; + this.responseCode = respCode; + this.responseMessage = respMsg; + } + + /** + * Gets the value of the requestId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRequestId() { + return requestId; + } + + /** + * Sets the value of the requestId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRequestId(String value) { + this.requestId = value; + } + + /** + * Gets the value of the responseCode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResponseCode() { + return responseCode; + } + + /** + * Sets the value of the responseCode property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResponseCode(String value) { + this.responseCode = value; + } + + /** + * Gets the value of the responseMessage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResponseMessage() { + return responseMessage; + } + + /** + * Sets the value of the responseMessage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResponseMessage(String value) { + this.responseMessage = value; + } + + @Override + public String toString() { + return "CallbackHeader [requestId=" + requestId + ", responseCode=" + + responseCode + ", responseMessage=" + responseMessage + "]"; + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/ObjectFactory.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/ObjectFactory.java new file mode 100644 index 0000000000..238b6a7b1c --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/ObjectFactory.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.client; + + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.onap.so.adapters.sdnc.client package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.onap.so.adapters.sdnc.client + * + */ + public ObjectFactory() { + } + + + /** + * Create an instance of {@link SDNCAdapterCallbackRequest } + * + */ + public SDNCAdapterCallbackRequest createSDNCAdapterCallbackRequest() { + return new SDNCAdapterCallbackRequest(); + } + + /** + * Create an instance of {@link CallbackHeader } + * + */ + public CallbackHeader createCallbackHeader() { + return new CallbackHeader(); + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java new file mode 100644 index 0000000000..7ec20afffd --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java @@ -0,0 +1,137 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.client; + + +import java.io.StringWriter; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element ref="{http://org.onap/workflow/sdnc/adapter/schema/v1}CallbackHeader"/>
+ *         <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +//SDNCAdapter to BPEL Async response +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "callbackHeader", + "requestData" +}) +@XmlRootElement(name = "SDNCAdapterCallbackRequest") +public class SDNCAdapterCallbackRequest { + + @XmlElement(name = "CallbackHeader", required = true) + protected CallbackHeader callbackHeader; + @XmlElement(name = "RequestData") + protected Object requestData; + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCAdapterCallbackRequest.class); + + /** + * Gets the value of the callbackHeader property. + * + * @return + * possible object is + * {@link CallbackHeader } + * + */ + public CallbackHeader getCallbackHeader() { + return callbackHeader; + } + + /** + * Sets the value of the callbackHeader property. + * + * @param value + * allowed object is + * {@link CallbackHeader } + * + */ + public void setCallbackHeader(CallbackHeader value) { + this.callbackHeader = value; + } + + /** + * Gets the value of the requestData property. + * + * @return + * possible object is + * {@link Object } + * + */ + public Object getRequestData() { + return requestData; + } + + /** + * Sets the value of the requestData property. + * + * @param value + * allowed object is + * {@link Object } + * + */ + public void setRequestData(Object value) { + this.requestData = value; + } + + @Override + public String toString() { + try { + JAXBContext ctx = JAXBContext.newInstance("org.onap.so.adapters.sdnc.client"); + Marshaller m = ctx.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); + StringWriter w = new StringWriter(); + m.marshal(this, w); + return w.toString(); + } + catch (Exception e) + { + msoLogger.error(MessageEnum.RA_MARSHING_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception - MARSHING_ERROR", e); + } + return ""; + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterPortType.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterPortType.java new file mode 100644 index 0000000000..369610ce0f --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterPortType.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.client; + + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; +import javax.xml.bind.annotation.XmlSeeAlso; + +import org.onap.so.adapters.sdnc.SDNCAdapterResponse; + + +/** + * This class was generated by Apache CXF 2.7.11.redhat-3 + * 2015-01-28T11:07:01.997-05:00 + * Generated source version: 2.7.11.redhat-3 + * + */ +//SDNCAdapter to BPEL Async response WEB Service +@WebService(targetNamespace = "http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1", name = "SDNCCallbackAdapterPortType") +@XmlSeeAlso({ObjectFactory.class}) +@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) +@FunctionalInterface +public interface SDNCCallbackAdapterPortType { + + @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") + @WebMethod(operationName = "SDNCAdapterCallback") + public SDNCAdapterResponse sdncAdapterCallback( + @WebParam(partName = "SDNCAdapterCallbackRequest", name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1") + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest + ); +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java new file mode 100644 index 0000000000..e68bac4178 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java @@ -0,0 +1,126 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.client; + + +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; + +/** + * This class was generated by Apache CXF 2.7.11.redhat-3 + * 2015-01-28T11:07:02.074-05:00 + * Generated source version: 2.7.11.redhat-3 + * + */ +//SDNCAdapter to BPEL Async response WEB Service +@WebServiceClient(name = "SDNCCallbackAdapterService", + wsdlLocation = "main/resources/SDNCCallbackAdapter.wsdl", + targetNamespace = "http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1") +public class SDNCCallbackAdapterService extends Service { + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCCallbackAdapterService.class); + + public static final URL WSDL_LOCATION; + public static final QName SERVICE = new QName("http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService"); + public static final QName SDNCCallbackAdapterSoapHttpPort = new QName("http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort"); + static { + URL wsdlUrl = null; + try { + wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCCallbackAdapter.wsdl"); + } catch (Exception e) { + msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e); + } + if(wsdlUrl == null) { + msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "WSDL not found"); + } else { + try { + msoLogger.info(MessageEnum.RA_PRINT_URL, "SDNCCallbackAdapter.wsdl", wsdlUrl.toURI().toString(), "SDNC"); + } catch (Exception e) { + msoLogger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - URL convention problem", e); + } + } + WSDL_LOCATION = wsdlUrl; + } + + public SDNCCallbackAdapterService(URL wsdlLocation) { + super(wsdlLocation, SERVICE); + } + + public SDNCCallbackAdapterService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public SDNCCallbackAdapterService() { + super(WSDL_LOCATION, SERVICE); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public SDNCCallbackAdapterService(WebServiceFeature ... features) { + super(WSDL_LOCATION, SERVICE, features); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public SDNCCallbackAdapterService(URL wsdlLocation, WebServiceFeature ... features) { + super(wsdlLocation, SERVICE, features); + } + + //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 + //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 + //compliant code instead. + public SDNCCallbackAdapterService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns SDNCCallbackAdapterPortType + */ + @WebEndpoint(name = "SDNCCallbackAdapterSoapHttpPort") + public SDNCCallbackAdapterPortType getSDNCCallbackAdapterSoapHttpPort() { + return super.getPort(SDNCCallbackAdapterSoapHttpPort, SDNCCallbackAdapterPortType.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns SDNCCallbackAdapterPortType + */ + @WebEndpoint(name = "SDNCCallbackAdapterSoapHttpPort") + public SDNCCallbackAdapterPortType getSDNCCallbackAdapterSoapHttpPort(WebServiceFeature... features) { + return super.getPort(SDNCCallbackAdapterSoapHttpPort, SDNCCallbackAdapterPortType.class, features); + } + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/package-info.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/package-info.java new file mode 100644 index 0000000000..368c824caa --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/package-info.java @@ -0,0 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.onap.so.adapters.sdnc.client; + diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/exception/SDNCAdapterException.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/exception/SDNCAdapterException.java new file mode 100644 index 0000000000..e45c4ce569 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/exception/SDNCAdapterException.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.exception; + +public class SDNCAdapterException extends Exception { + + private static final long serialVersionUID = -7913634772004514998L; + + public SDNCAdapterException(String message) { + super(message); + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java new file mode 100644 index 0000000000..d114788267 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.impl; + + +public interface Constants { + + public static final String BPEL_REST_URL_PROP = "org.onap.so.adapters.sdnc.rest.bpelurl"; + public static final String BPEL_URL_PROP = "org.onap.so.adapters.sdnc.bpelurl"; + public static final String DEFAULT_BPEL_URL = "http://localhost:8080//active-bpel/services/SDNCAdapterCallbackV1"; + + public static final String MY_URL_PROP = "org.onap.so.adapters.sdnc.myurl"; + public static final String DEFAULT_MY_URL = "https://localhost:8443/adapters/rest/SDNCNotify"; + + public static final String SDNC_AUTH_PROP = "org.onap.so.adapters.sdnc.sdncauth"; + public static final String DEFAULT_SDNC_AUTH = "406B2AE613211B6FB52466DE6E1769AC"; + + public static final String DEFAULT_BPEL_AUTH = "05FDA034C27D1CA51AAB8FAE512EDE45241E16FC8C137D292AA3A964431C82DB"; + public static final String BPEL_AUTH_PROP = "org.onap.so.adapters.sdnc.bpelauth"; + + + public static final String SDNC_SVCCFGRESP_ROOT = "input"; + public static final String SDNC_REQ_ID = "/svc-request-id"; + public static final String SDNC_RESP_CODE = "/response-code"; + public static final String SDNC_RESP_MSG = "/response-message"; + public static final String SDNC_CONNECTTIME_PROP = "org.onap.so.adapters.sdnc.sdncconnecttime"; + public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + + public static final String REQUEST_TUNABLES = "org.onap.so.adapters.sdnc"; +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java new file mode 100644 index 0000000000..b456fb2336 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java @@ -0,0 +1,102 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.impl; + +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public class MapRequestTunables { + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,MapRequestTunables.class); + public static final String GENERATED_KEY = "Generated key: "; + + @Autowired + private Environment env; + + public RequestTunables setTunables(RequestTunables reqTunableOriginal) + { + RequestTunables reqTunable = new RequestTunables(reqTunableOriginal); + String error = null; + String key; + if ("query".equals(reqTunable.getAction())) { //due to variable format for reqTunable.getOperation() eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9 + key = Constants.REQUEST_TUNABLES + "." + reqTunable.getMsoAction() + ".." + reqTunable.getAction(); + msoLogger.debug(GENERATED_KEY + key); + } + else if ("put".equals(reqTunable.getAction()) || "restdelete".equals(reqTunable.getAction())) { //due to variable format for reqTunable.getOperation() eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9 + key = Constants.REQUEST_TUNABLES + "..." + reqTunable.getAction(); + msoLogger.debug(GENERATED_KEY + key); + } else { + key = Constants.REQUEST_TUNABLES + "." + reqTunable.getMsoAction() + "." + reqTunable.getOperation() +"." + reqTunable.getAction(); + msoLogger.debug(GENERATED_KEY + key); + } + + String value; + value = env.getProperty(key, ""); + + if (value != null && value.length() > 0) { + + String[] parts = value.split("\\|"); //escape pipe + if (parts.length < 3) { + msoLogger.warn(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config"); + } + + for (int i = 0; i < parts.length; i++) { + if (i == 0) { + reqTunable.setReqMethod(parts[i]) ; + msoLogger.debug("Request Method is set to: " + reqTunable.getReqMethod()); + } else if (i == 1) { + reqTunable.setTimeout( parts[i]); + msoLogger.debug("Timeout is set to: " + reqTunable.getTimeout()); + } else if (i == 2) { + reqTunable.setSdncUrl(env.getProperty(Constants.REQUEST_TUNABLES + "." + parts[i],"")); + if (reqTunable.getOperation() != null && reqTunable.getSdncUrl() != null) { + reqTunable.setSdncUrl(reqTunable.getSdncUrl() + reqTunable.getOperation()); + } + msoLogger.debug("SDNC Url is set to: " + reqTunable.getSdncUrl()); + } else if (i == 3) { + reqTunable.setHeaderName(parts[i]); + msoLogger.debug("HeaderName is set to: " + reqTunable.getHeaderName()); + } else if (i == 4) { + reqTunable.setNamespace(parts[i]); + msoLogger.debug("NameSpace is set to: " + reqTunable.getNamespace()); + } else if (i == 5) { + reqTunable.setAsyncInd(parts[i]); + msoLogger.debug("AsyncInd is set to: " + reqTunable.getAsyncInd()); + } + } + + if (reqTunable.getSdncUrl() == null || reqTunable.getSdncUrl().equals("")) { + error = "Invalid configuration, sdncUrl required for:" + key + " value:" + value; + } + } else { + error = "Missing configuration for:" + key; + } + if (error != null) { + msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); + } + msoLogger.debug ("RequestTunables Key:" + key + " Value:" + value + " Tunables:" + this.toString()); + return reqTunable; + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java new file mode 100644 index 0000000000..5ed9763b71 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java @@ -0,0 +1,161 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.impl; + + + +import org.onap.so.logger.MsoLogger; +public class RequestTunables { + + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,RequestTunables.class); + + public static final String GENERATED_KEY = "Generated key: "; + + //criteria + private String reqId = ""; + private String msoAction = ""; + private String operation = ""; + private String action = ""; + + //tunables + private String reqMethod = "POST"; + private String sdncUrl = null; + private String timeout = "60000"; + private String headerName = "sdnc-request-header"; + private String namespace = ""; + private String asyncInd = "N"; //future use + + private String sdncaNotificationUrl = null; + + public RequestTunables(String reqId, String msoAction, String operation, String action) { + super(); + if (reqId != null) { + this.reqId = reqId; + } + if (msoAction != null) { + this.msoAction = msoAction; + } + if (operation != null) { + this.operation = operation; + } + if (action != null) { + this.action = action; + } + } + + public RequestTunables(RequestTunables original) { + this.reqId = original.reqId; + this.action = original.action; + this.msoAction = original.msoAction; + this.operation = original.operation; + this.reqMethod = original.reqMethod; + this.sdncUrl = original.sdncUrl; + this.timeout = original.timeout; + this.headerName = original.headerName; + this.namespace = original.namespace; + this.asyncInd = original.asyncInd; + this.sdncaNotificationUrl = original.sdncaNotificationUrl; + } + + public String getReqId() { + return reqId; + } + public void setReqId(String reqId) { + this.reqId = reqId; + } + public String getReqMethod() { + return reqMethod; + } + public void setReqMethod(String reqMethod) { + this.reqMethod = reqMethod; + } + public String getMsoAction() { + return msoAction; + } + public void setMsoAction(String msoAction) { + this.msoAction = msoAction; + } + public String getAction() { + return action; + } + public void setAction(String action) { + this.action = action; + } + public String getOperation() { + return operation; + } + public void setOperation(String operation) { + this.operation = operation; + } + public String getSdncUrl() { + return sdncUrl; + } + public void setSdncUrl(String sdncUrl) { + this.sdncUrl = sdncUrl; + } + public String getTimeout() { + return timeout; + } + public void setTimeout(String timeout) { + this.timeout = timeout; + } + public String getAsyncInd() { + return asyncInd; + } + public void setAsyncInd(String asyncInd) { + this.asyncInd = asyncInd; + } + public String getHeaderName() { + return headerName; + } + public void setHeaderName(String headerName) { + this.headerName = headerName; + } + + + public String getSdncaNotificationUrl() { + return sdncaNotificationUrl; + } + + public void setSdncaNotificationUrl(String sdncaNotificationUrl) { + this.sdncaNotificationUrl = sdncaNotificationUrl; + } + + public String getNamespace() { + return namespace; + } + + public void setNamespace(String namespace) { + this.namespace = namespace; + } + + @Override + public String toString() { + return "RequestTunables [reqId=" + reqId + ", msoAction=" + msoAction + + ", operation=" + operation + ", action=" + action + + ", reqMethod=" + reqMethod + ", sdncUrl=" + sdncUrl + + ", timeout=" + timeout + ", headerName=" + headerName + + ", sdncaNotificationUrl=" + sdncaNotificationUrl + + ", namespace=" + namespace + "]"; + } + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java new file mode 100644 index 0000000000..8000e3ab8e --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.impl; + +import javax.annotation.PostConstruct; +import javax.jws.WebService; +import javax.servlet.http.HttpServletResponse; + +import org.onap.so.adapters.sdnc.SDNCAdapterPortType; +import org.onap.so.adapters.sdnc.SDNCAdapterRequest; +import org.onap.so.adapters.sdnc.SDNCAdapterResponse; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +//BPEL SDNCAdapter SOAP Web Service implementation +@WebService(serviceName = "SDNCAdapterService", endpointInterface = "org.onap.so.adapters.sdnc.SDNCAdapterPortType", targetNamespace = "http://org.onap/workflow/sdnc/adapter/wsdl/v1") +@Component +public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { + + + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCAdapterPortTypeImpl.class); + private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + + @Autowired + private SDNCRestClient sdncClient; + + @PostConstruct + public void init () { + msoLogger.info(MessageEnum.RA_INIT_SDNC_ADAPTER, "SDNC", "SDNCAdapterPortType", ""); + } + + /** + * Health Check web method. Does nothing but return to show the adapter is deployed. + */ + @Override + public void healthCheck () + { + msoLogger.debug("Health check call in SDNC Adapter"); + } + + + @Override + public SDNCAdapterResponse sdncAdapter(SDNCAdapterRequest bpelRequest) { + String bpelReqId = bpelRequest.getRequestHeader().getRequestId(); + String callbackUrl = bpelRequest.getRequestHeader().getCallbackUrl(); + try { + sdncClient.executeRequest(bpelRequest); + } + catch (Exception e){ + String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage(); + msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, respMsg, e); + alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); + SDNCResponse sdncResp = new SDNCResponse(bpelReqId); + sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + sdncResp.setRespMsg(respMsg); + sdncClient.sendRespToBpel(callbackUrl, sdncResp); + } + + SDNCAdapterResponse wsResp = new SDNCAdapterResponse(); + return wsResp; + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCResponse.java new file mode 100644 index 0000000000..c0a737cf78 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCResponse.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.impl; + + +import java.io.Serializable; + +public class SDNCResponse implements Serializable { + + private static final long serialVersionUID = 1L; + private String reqId = null; + private int respCode = 0; + private String respMsg = null; + private String sdncRespXml = null; + + public SDNCResponse(String reqId) { + this.reqId = reqId; + } + public SDNCResponse(String reqId, int respCode, String respMsg) { + this.reqId = reqId; + this.respCode = respCode; + this.respMsg = respMsg; + } + + public String getReqId() { + return reqId; + } + public void setReqId(String reqId) { + this.reqId = reqId; + } + public int getRespCode() { + return respCode; + } + public void setRespCode(int respCode) { + this.respCode = respCode; + } + public String getRespMsg() { + return respMsg; + } + public void setRespMsg(String respMsg) { + this.respMsg = respMsg; + } + public String getSdncRespXml() { + return sdncRespXml; + } + public void setSdncRespXml(String sdncRespXml) { + this.sdncRespXml = sdncRespXml; + } + + @Override + public String toString() { + return "SDNCResponse [reqId=" + reqId + ", respCode=" + respCode + + ", respMsg=" + respMsg + ", sdncRespXml=" + sdncRespXml + "]"; + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java new file mode 100644 index 0000000000..58feaac0e7 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java @@ -0,0 +1,333 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.impl; + + +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.XMLConstants; +import javax.xml.bind.DatatypeConverter; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.ws.BindingProvider; +import javax.xml.ws.handler.MessageContext; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathFactory; +import org.onap.so.utils.CryptoUtils; +import org.onap.so.adapters.sdnc.SDNCAdapterRequest; +import org.onap.so.adapters.sdnc.client.CallbackHeader; +import org.onap.so.adapters.sdnc.client.SDNCAdapterCallbackRequest; +import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterPortType; +import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterService; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + + +@Component +public class SDNCRestClient{ + + @Autowired + private Environment env; + + @Autowired + private MapRequestTunables tunablesMapper; + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCRestClient.class); + private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + + @Async + public void executeRequest(SDNCAdapterRequest bpelRequest) + { + + msoLogger.debug("BPEL Request:" + bpelRequest.toString()); + + String action = bpelRequest.getRequestHeader().getSvcAction(); + String operation = bpelRequest.getRequestHeader().getSvcOperation(); + String bpelReqId = bpelRequest.getRequestHeader().getRequestId(); + String callbackUrl = bpelRequest.getRequestHeader().getCallbackUrl(); + + String sdncReqBody = null; + + + + RequestTunables rt = new RequestTunables(bpelReqId, + bpelRequest.getRequestHeader().getMsoAction(), + bpelRequest.getRequestHeader().getSvcOperation(), + bpelRequest.getRequestHeader().getSvcAction()); + rt = tunablesMapper.setTunables(rt); + rt.setSdncaNotificationUrl(env.getProperty(Constants.MY_URL_PROP)); + + + if ("POST".equals(rt.getReqMethod())) + { + Node node = (Node) bpelRequest.getRequestData(); + Document reqDoc = node.getOwnerDocument(); + sdncReqBody = Utils.genSdncReq(reqDoc, rt); + } + else if("PUT".equals(rt.getReqMethod())){ + Node node = (Node) bpelRequest.getRequestData(); + Document reqDoc = node.getOwnerDocument(); + sdncReqBody = Utils.genSdncPutReq(reqDoc, rt); + } + long sdncStartTime = System.currentTimeMillis(); + SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt); + msoLogger.recordMetricEvent (sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from SDNC", "SDNC", action + "." + operation, null); + msoLogger.debug ("Got the SDNC Response: " + sdncResp.getSdncRespXml()); + long bpelStartTime = System.currentTimeMillis(); + sendRespToBpel(callbackUrl, sdncResp); + msoLogger.recordMetricEvent (bpelStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully send reauest to BPEL", "BPMN", callbackUrl, null); + return; + } + + public SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt) + { + + URL url; + HttpURLConnection con = null; + DataOutputStream out = null; + BufferedReader in = null; + SDNCResponse sdncResp = new SDNCResponse(rt.getReqId()); + StringBuilder response = new StringBuilder(); + + msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC.name() + ":\n" + rt.toString(), "SDNC", ""); + msoLogger.trace("SDNC Request Body:\n" + sdncReqBody); + + try { + + url = new URL(rt.getSdncUrl()); + + con = (HttpURLConnection) url.openConnection(); + con.setConnectTimeout(Integer.parseInt(env.getProperty(Constants.SDNC_CONNECTTIME_PROP))); + con.setReadTimeout(Integer.parseInt(rt.getTimeout())); + con.setRequestProperty("Accept", "application/yang.data+xml"); //for response in xml + String userCredentials = CryptoUtils.decryptProperty(env.getProperty(Constants.SDNC_AUTH_PROP), Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); + + String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); + con.setRequestProperty ("Authorization", basicAuth); + con.setRequestMethod(rt.getReqMethod()); + + // Add request headers + if ("POST".equals(rt.getReqMethod()) || "PUT".equals(rt.getReqMethod())) + { + con.setRequestProperty("Content-type", "application/xml"); + con.setRequestProperty("Content-length",String.valueOf(sdncReqBody.length())); + con.setDoOutput(true); + out = new DataOutputStream(con.getOutputStream()); + out.writeBytes(sdncReqBody); + out.flush(); + out.close(); + } + + //Get response + sdncResp.setRespCode(con.getResponseCode()); + sdncResp.setRespMsg(con.getResponseMessage()); + + if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) { + in = new BufferedReader(new InputStreamReader(con.getInputStream())); + String inputLine; + //Not parsing the response -it contains a responseHdr section and data section + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + } + + sdncResp.setSdncRespXml(response.toString()); + msoLogger.info(MessageEnum.RA_RESPONSE_FROM_SDNC.name() + ":\n" + sdncResp.toString(), "SDNC", ""); + return(sdncResp); + } + catch (Exception e) + { + msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception processing request to SDNC", e); + //default + sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR); + String respMsg = "Error processing request to SDNC. "; + StringBuilder sdncErrMsg = new StringBuilder(); + + if (e instanceof java.net.SocketTimeoutException ) + { + sdncResp.setRespCode(HttpURLConnection.HTTP_CLIENT_TIMEOUT); + respMsg = "Request to SDNC timed out. "; + } + if (con != null) + { + try { //e1 + if (con.getResponseCode() != HttpURLConnection.HTTP_OK) //seen in SocketException connection reset + sdncResp.setRespCode(con.getResponseCode()); + respMsg = respMsg + con.getResponseMessage() + ". "; + InputStream is = con.getErrorStream(); + if (is != null) + { + XPathFactory xpathFactory = XPathFactory.newInstance(); + XPath xpath = xpathFactory.newXPath(); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); + dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); + dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + DocumentBuilder db; + Document doc = null; + try { //e2 + db = dbf.newDocumentBuilder(); + doc = db.parse(is); + NodeList errors = (NodeList)xpath.evaluate("errors/error", doc, XPathConstants.NODESET); + for (int i = 0; i < errors.getLength(); i++) + { + Element error = (Element) errors.item(i); + String eType = null; + try { + eType = xpath.evaluate("error-type", error); + sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType); + } catch (Exception e3) { + msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); + } + + String eTag = null; + try { + eTag = xpath.evaluate( "error-tag", error); + sdncErrMsg.append(", error-tag:").append(eTag); + } catch (Exception e3) { + msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); + } + + String eMsg = null; + try { + eMsg = xpath.evaluate("error-message", error); + sdncErrMsg.append(", error-message:").append(eMsg).append("]"); + } catch (Exception e3) { + msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); + } + } + } catch (Exception e2) { + msoLogger.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while analyse error", e2); + } + } //is != null + } catch (Exception e1) { + msoLogger.error (MessageEnum.RA_ERROR_GET_RESPONSE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while get SDNC response", e1); + } + } //con != null + + if (e.getMessage() != null) { + respMsg = respMsg + e.getMessage(); + } + respMsg = respMsg + sdncErrMsg; + + sdncResp.setRespMsg(respMsg); + + msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e); + alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); + return sdncResp; + } + finally + { + if (con != null) { + con.disconnect(); + } + } + } + + public void sendRespToBpel(String bpelUrl, SDNCResponse sdncResp) + { + String error; + try + { + SDNCAdapterCallbackRequest cbReq = new SDNCAdapterCallbackRequest(); + cbReq.setCallbackHeader(new CallbackHeader(sdncResp.getReqId(), Integer.toString(sdncResp.getRespCode()), sdncResp.getRespMsg())); + if (sdncResp.getSdncRespXml() != null) + { + cbReq.setRequestData(sdncResp.getSdncRespXml()); + } + msoLogger.info(MessageEnum.RA_CALLBACK_BPEL.name() + ":\n" + cbReq.toString(), "Camunda", ""); + + URL wsdlUrl = null; + try { + wsdlUrl = new URL (bpelUrl); + } catch (MalformedURLException e1) { + error = "Caught exception initializing Callback wsdl " + e1.getMessage(); + msoLogger.error(MessageEnum.RA_INIT_CALLBACK_WSDL_ERR, "Camunda", "", MsoLogger.ErrorCode.DataError, "Exception initializing Callback wsdl", e1); + alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } + + SDNCCallbackAdapterService cbSvc = new SDNCCallbackAdapterService(); + + SDNCCallbackAdapterPortType cbPort = cbSvc.getSDNCCallbackAdapterSoapHttpPort(); + + BindingProvider bp = (BindingProvider)cbPort; + + if(null != wsdlUrl) { + bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsdlUrl.toExternalForm()); + } + else { + msoLogger.debug("wsdlUrl is NULL:"); + } + + //authentication + try + { + Map reqCtx = bp.getRequestContext(); + Map> headers = new HashMap<>(); + String userCredentials = CryptoUtils.decryptProperty(env.getProperty(Constants.BPEL_AUTH_PROP), Constants.DEFAULT_BPEL_AUTH, Constants.ENCRYPTION_KEY); + + String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); + reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers); + headers.put ("Authorization", Collections.singletonList(basicAuth)); + } + catch (Exception e2) { + error = "Unable to set authorization in callback request " + e2.getMessage(); + msoLogger.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e2); + alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } + + msoLogger.debug("Invoking Bpel Callback. BpelCallbackUrl:" + bpelUrl); + cbPort.sdncAdapterCallback(cbReq); + + } + catch (Exception e) + { + error = "Error sending BpelCallback request" + e.getMessage(); + msoLogger.error("Error " + MsoLogger.ErrorCode.BusinessProcesssError + " - " + MessageEnum.RA_CALLBACK_BPEL_EXC + " - " + error, e); + alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + } + msoLogger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), "Camunda", ""); + return; + } + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java new file mode 100644 index 0000000000..55af0d7cad --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java @@ -0,0 +1,199 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.impl; + + +import java.io.StringWriter; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +public class Utils { + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, Utils.class); + + private Utils() { + } + + public static String genSdncReq(Document reqDoc, RequestTunables rt) { + try { + + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + + //NewDoc for output + //Root + Document newdoc = db.newDocument(); + Element root = newdoc.createElementNS(rt.getNamespace(), "input"); + newdoc.appendChild(root); + + //Header + Element hdr = newdoc.createElement(rt.getHeaderName()); + root.appendChild(hdr); + + String elemData = rt.getReqId(); + Element hdrChild; + if (elemData != null && elemData.length() > 0) + { + hdrChild = newdoc.createElement("svc-request-id"); + hdrChild.appendChild(newdoc.createTextNode(elemData)); + hdr.appendChild(hdrChild); + } + + elemData = rt.getAction(); + if (elemData != null && elemData.length() > 0) + { + hdrChild = newdoc.createElement("svc-action"); + hdrChild.appendChild(newdoc.createTextNode(elemData)); + hdr.appendChild(hdrChild); + } + + elemData = rt.getSdncaNotificationUrl(); + if (elemData != null && elemData.length() > 0) + { + hdrChild = newdoc.createElement("svc-notification-url"); + hdrChild.appendChild(newdoc.createTextNode(elemData)); + hdr.appendChild(hdrChild); + } + + //RequestData + NodeList nodes = reqDoc.getDocumentElement().getChildNodes(); + for (int i = 0; i < nodes.getLength(); i++) { + Node n = nodes.item(i); + Node newNode = newdoc.importNode(n, true); + root.appendChild(newNode); + } + + String s = domToStr(newdoc); + msoLogger.debug("Formatted SdncReq:\n" + s); + return s; + + } catch (Exception e) { + msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e); + } + return null; + } + + public static String genSdncPutReq(Document reqDoc, RequestTunables rt) { + try { + + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + + //NewDoc for output + //Root + Document newdoc = db.newDocument(); + + //RequestData + NodeList nodes = reqDoc.getDocumentElement().getChildNodes(); + + Element root = newdoc.createElementNS(nodes.item(0).getNamespaceURI(), nodes.item(0).getNodeName()); + newdoc.appendChild(root); + + NodeList childNodes = nodes.item(0).getChildNodes(); + for (int i = 0; i < childNodes.getLength(); i++) { + Node n = childNodes.item(i); + Node newNode = newdoc.importNode(n, true); + root.appendChild(newNode); + } + + String s = domToStr(newdoc); + msoLogger.debug("Formatted SdncPutReq:\n" + s); + return s; + + } catch (Exception e) { + msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genSdncPutReq", e); + } + return null; + } + + public static String genMsoFailResp(SDNCResponse resp) { + try { + + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + + //NewDoc for output + //Root + Document newdoc = db.newDocument(); + Element root = newdoc.createElement("output"); + newdoc.appendChild(root); + + Element elem1 = newdoc.createElement("svc-request-id"); + elem1.appendChild(newdoc.createTextNode(resp.getReqId())); + root.appendChild(elem1); + + Element elem2 = newdoc.createElement("response-code"); + elem2.appendChild(newdoc.createTextNode(String.valueOf(resp.getRespCode()))); + root.appendChild(elem2); + + Element elem3 = newdoc.createElement("response-message"); + elem3.appendChild(newdoc.createTextNode(String.valueOf(resp.getRespMsg()))); + root.appendChild(elem3); + + String s = domToStr(newdoc); + msoLogger.debug("Formatted SdncReq:" + s); + return s; + + } catch (Exception e) { + msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genMsoFailResp", e); + } + return null; + } + + + public static String domToStr(Document doc) + { + if (doc != null) + { + try { + DOMSource ds = new DOMSource(doc); + StringWriter sw = new StringWriter(); + StreamResult sr = new StreamResult(sw); + TransformerFactory tf = TransformerFactory.newInstance(); + tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); + tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, ""); + Transformer t = tf.newTransformer(); + //t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");// + t.transform(ds, sr); + String s = sw.toString(); + + // This is an awful fix for now but we don't want that xmlns="" to be generated + s = s.replaceAll("xmlns=\"\"", ""); + return s; + } catch (Exception e) { + msoLogger.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "", MsoLogger.ErrorCode.DataError, "Exception - domToStr", e); + } + } + return null; + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/package-info.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/package-info.java new file mode 100644 index 0000000000..bd1f34eadd --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/package-info.java @@ -0,0 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.onap.so.adapters.sdnc; + diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java new file mode 100644 index 0000000000..576d7846cd --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java @@ -0,0 +1,174 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.sdncrest; + +import javax.xml.bind.DatatypeConverter; + +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.onap.so.adapters.sdnc.impl.Constants; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.onap.so.utils.CryptoUtils; +import org.springframework.core.env.Environment; + +/** + * Sends asynchronous messages to the BPMN WorkflowMessage service. + */ +@Component +public class BPRestCallback { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,BPRestCallback.class); + private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + + @Autowired + private Environment env; + + /** + * Sends a message to the BPMN workflow message service. The URL path is + * constructed using the specified message type and correlator. + * @param workflowMessageUrl the base BPMN WorkflowMessage URL + * @param messageType the message type + * @param correlator the message correlator + * @param message the JSON content + * @return true if the message was consumed successfully by the endpoint + */ + public boolean send(String workflowMessageUrl, String messageType, String correlator, String message) { + LOGGER.debug(getClass().getSimpleName() + ".send(" + + "workflowMessageUrl=" + workflowMessageUrl + + " messageType=" + messageType + + " correlator=" + correlator + + " message=" + message + + ")"); + + while (workflowMessageUrl.endsWith("/")) { + workflowMessageUrl = workflowMessageUrl.substring(0, workflowMessageUrl.length()-1); + } + + String endpoint = workflowMessageUrl + "/" + SDNCAdapterUtils.encodeURLPathSegment(messageType) + + "/" + SDNCAdapterUtils.encodeURLPathSegment(correlator); + + return send(endpoint, message); + } + + /** + * Sends a message to the BPMN workflow message service. The specified URL + * must have the message type and correlator already embedded in it. + * @param url the endpoint URL + * @param message the JSON content + * @return true if the message was consumed successfully by the endpoint + */ + public boolean send(String url, String message) { + LOGGER.debug(getClass().getSimpleName() + ".send(" + + "url=" + url + + " message=" + message + + ")"); + + LOGGER.info(MessageEnum.RA_CALLBACK_BPEL, message == null ? "[no content]" : message, "Camunda", ""); + + HttpPost method = null; + HttpResponse httpResponse = null; + + try { + int timeout = 60 * 1000; + + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(timeout) + .setConnectTimeout(timeout) + .setConnectionRequestTimeout(timeout) + .build(); + + HttpClient client = HttpClientBuilder.create().build(); + method = new HttpPost(url); + method.setConfig(requestConfig); + + if (message != null) { + method.setEntity(new StringEntity(message, ContentType.APPLICATION_JSON)); + } + + boolean error = false; + + try { + String userCredentials = CryptoUtils.decryptProperty(env.getProperty(Constants.BPEL_AUTH_PROP), + Constants.DEFAULT_BPEL_AUTH, Constants.ENCRYPTION_KEY); + String authorization = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); + method.setHeader("Authorization", authorization); + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, + "Unable to set authorization in callback request", e); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, + "Unable to set authorization in callback request: " + e.getMessage()); + error = true; + } + + if (!error) { + httpResponse = client.execute(method); + + @SuppressWarnings("unused") + String responseContent = null; + + if (httpResponse.getEntity() != null) { + responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + } + + if (httpResponse.getStatusLine().getStatusCode() >= 300) { + String msg = "Received error response to callback request: " + httpResponse.getStatusLine(); + LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, msg); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, msg); + } + } + return true; + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, + "Error sending callback request", e); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, + "Error sending callback request: " + e.getMessage()); + return false; + } finally { + if (httpResponse != null) { + try { + EntityUtils.consume(httpResponse.getEntity()); + httpResponse = null; + } catch (Exception e) { + LOGGER.debug("Exception:", e); + } + } + + if (method != null) { + try { + method.reset(); + } catch (Exception e) { + LOGGER.debug("Exception:", e); + } + } + LOGGER.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE, "Camunda", "",""); + } + } +} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java new file mode 100644 index 0000000000..8541889d8e --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.sdncrest; + +import org.onap.so.adapters.sdnc.exception.SDNCAdapterException; +import org.onap.so.adapters.sdnc.impl.Constants; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public class MapTypedRequestTunablesData { + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,MapTypedRequestTunablesData.class); + + private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + + @Autowired + private Environment env; + + + public TypedRequestTunables setTunables(TypedRequestTunables reqTunableOriginal) throws SDNCAdapterException { + TypedRequestTunables reqTunable = new TypedRequestTunables(reqTunableOriginal); + + String error; + String value = env.getProperty(reqTunable.getKey().toLowerCase(), ""); + + if ("".equals(value)) { + error= "Missing configuration for: " + reqTunable.getKey(); + msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, reqTunable.getKey(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); + alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, reqTunable.getError()); + throw new SDNCAdapterException(error); + } + + String[] parts = value.split("\\|"); + + if (parts.length != 5) { + error="Invalid configuration for: " + reqTunable.getKey(); + msoLogger.error(MessageEnum.RA_SDNC_INVALID_CONFIG, reqTunable.getKey(), value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config"); + alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, reqTunable.getError()); + throw new SDNCAdapterException(error); + } + + reqTunable.setReqMethod(parts[0]); + msoLogger.trace("Request Method is set to: " + reqTunable.getReqMethod()); + + reqTunable.setTimeout(parts[1]); + msoLogger.trace("Timeout is set to: " + reqTunable.getTimeout()); + + String urlPropKey = Constants.REQUEST_TUNABLES + "." + parts[2]; + reqTunable.setSdncUrl(env.getProperty(urlPropKey, "")); + + if ("".equals(reqTunable.getSdncUrl())) { + error="Missing configuration for: " + urlPropKey; + msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, urlPropKey, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); + alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, reqTunable.getError()); + throw new SDNCAdapterException(error); + } + + msoLogger.trace("SDNC Url is set to: " + reqTunable.getSdncUrl()); + + reqTunable.setHeaderName(parts[3]); + msoLogger.trace("Header Name is set to: " + reqTunable.getHeaderName()); + + reqTunable.setNamespace(parts[4]); + msoLogger.trace("Namespace is set to: " + reqTunable.getNamespace()); + + reqTunable.setMyUrl(env.getProperty(Constants.MY_URL_PROP, "")); + + if ("".equals(reqTunable.getMyUrl())) { + error="Missing configuration for: " + Constants.MY_URL_PROP; + msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.MY_URL_PROP, "SDNC", "", + MsoLogger.ErrorCode.DataError, "Missing config param"); + alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, reqTunable.getError()); + throw new SDNCAdapterException(error); + } + + while (reqTunable.getMyUrl().endsWith("/")) { + reqTunable.setMyUrl(reqTunable.getMyUrl().substring(0, reqTunable.getMyUrl().length()-1)); + } + + reqTunable.setMyUrl(reqTunable.getMyUrl().concat(reqTunable.getMyUrlSuffix())); + + msoLogger.debug(reqTunable.toString()); + return reqTunable; + } + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java new file mode 100644 index 0000000000..05e272f867 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.sdncrest; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; + +import org.onap.so.logger.MsoLogger; +import org.springframework.web.util.UriUtils; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * Utility methods used by SDNCAdapterRest. + */ +public final class SDNCAdapterUtils { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, SDNCAdapterUtils.class); + /** + * Instantiation is not allowed. + */ + private SDNCAdapterUtils() { + } + + /** + * Returns a node's child elements in a list. + */ + public static List childElements(Node node) { + List elements = new ArrayList<>(); + + NodeList nodeList = node.getChildNodes(); + for (int i = 0; i < nodeList.getLength(); i++) { + Node child = nodeList.item(i); + if (child.getNodeType() == Node.ELEMENT_NODE) { + elements.add((Element) child); + } + } + + return elements; + } + + /** + * Encodes a URL path segment according to RFC 3986 Section 2. + * @param pathSegment the path segment to encode + * @return the encoded path segment + */ + public static String encodeURLPathSegment(String pathSegment) { + try { + return UriUtils.encodePathSegment(pathSegment, "UTF-8"); + } catch (UnsupportedEncodingException e) { + LOGGER.debug("Exception:", e); + throw new RuntimeException("UTF-8 encoding is not supported"); + } + } +} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java new file mode 100644 index 0000000000..6bd7037ca1 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java @@ -0,0 +1,329 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.sdncrest; + +import java.io.StringReader; +import java.net.HttpURLConnection; +import java.net.SocketTimeoutException; + +import javax.xml.XMLConstants; +import javax.xml.bind.DatatypeConverter; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; + +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.onap.so.adapters.sdnc.impl.Constants; +import org.onap.so.adapters.sdncrest.SDNCErrorCommon; +import org.onap.so.adapters.sdncrest.SDNCResponseCommon; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.onap.so.utils.CryptoUtils; +import org.springframework.core.env.Environment; + +/** + * Sends requests to SDNC and processes the responses. + */ +@Component +public abstract class SDNCConnector { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCConnector.class); + private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + + @Autowired + private Environment env; + + public SDNCResponseCommon send(String content, TypedRequestTunables rt) { + LOGGER.debug("SDNC URL: " + rt.getSdncUrl()); + LOGGER.debug("SDNC Request Body:\n" + content); + + HttpRequestBase method = null; + HttpResponse httpResponse = null; + + try { + int timeout = Integer.parseInt(rt.getTimeout()); + + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(timeout) + .setConnectTimeout(timeout) + .setConnectionRequestTimeout(timeout) + .build(); + + HttpClient client = HttpClientBuilder.create().build(); + + if ("POST".equals(rt.getReqMethod())) { + HttpPost httpPost = new HttpPost(rt.getSdncUrl()); + httpPost.setConfig(requestConfig); + httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_XML)); + method = httpPost; + } else if ("PUT".equals(rt.getReqMethod())) { + HttpPut httpPut = new HttpPut(rt.getSdncUrl()); + httpPut.setConfig(requestConfig); + httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_XML)); + method = httpPut; + } else if ("GET".equals(rt.getReqMethod())) { + HttpGet httpGet = new HttpGet(rt.getSdncUrl()); + httpGet.setConfig(requestConfig); + method = httpGet; + } else if ("DELETE".equals(rt.getReqMethod())) { + HttpDelete httpDelete = new HttpDelete(rt.getSdncUrl()); + httpDelete.setConfig(requestConfig); + method = httpDelete; + } + + + String userCredentials = CryptoUtils.decryptProperty(env.getProperty(Constants.SDNC_AUTH_PROP), + Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); + String authorization = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); + if(null != method) { + method.setHeader("Authorization", authorization); + method.setHeader("Accept", "application/yang.data+xml"); + } + else { + LOGGER.debug("method is NULL:"); + } + + + + httpResponse = client.execute(method); + + String responseContent = null; + if (httpResponse.getEntity() != null) { + responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + } + + int statusCode = httpResponse.getStatusLine().getStatusCode(); + String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); + + LOGGER.debug("SDNC Response: " + statusCode + " " + statusMessage + + (responseContent == null ? "" : System.lineSeparator() + responseContent)); + + if (httpResponse.getStatusLine().getStatusCode() >= 300) { + String errMsg = "SDNC returned " + statusCode + " " + statusMessage; + + String errors = analyzeErrors(responseContent); + if (errors != null) { + errMsg += " " + errors; + } + + logError(errMsg); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); + return createErrorResponse(statusCode, errMsg, rt); + } + + httpResponse = null; + + if(null != method) { + method.reset(); + } + else { + LOGGER.debug("method is NULL:"); + } + + method = null; + + LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", ""); + return createResponseFromContent(statusCode, statusMessage, responseContent, rt); + + } catch (SocketTimeoutException | ConnectTimeoutException e) { + String errMsg = "Request to SDNC timed out"; + logError(errMsg, e); + return createErrorResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg, rt); + + } catch (Exception e) { + String errMsg = "Error processing request to SDNC"; + logError(errMsg, e); + return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg, rt); + + } finally { + if (httpResponse != null) { + try { + EntityUtils.consume(httpResponse.getEntity()); + } catch (Exception e) { + LOGGER.debug("Exception:", e); + } + } + + if (method != null) { + try { + method.reset(); + } catch (Exception e) { + LOGGER.debug("Exception:", e); + } + } + } + } + + protected void logError(String errMsg) { + LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", + MsoLogger.ErrorCode.AvailabilityError, errMsg); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); + } + + protected void logError(String errMsg, Throwable t) { + LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", + MsoLogger.ErrorCode.AvailabilityError, errMsg, t); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); + } + + /** + * Generates a response object from content received from SDNC. The response + * object may be a success response object or an error response object. This + * method must be overridden by the subclass to return the correct object type. + * @param statusCode the response status code from SDNC (e.g. 200) + * @param statusMessage the response status message from SDNC (e.g. "OK") + * @param responseContent the body of the response from SDNC (possibly null) + * @param rt request tunables + * @return a response object + */ + protected abstract SDNCResponseCommon createResponseFromContent(int statusCode, + String statusMessage, String responseContent, TypedRequestTunables rt); + + /** + * Generates an error response object. This method must be overridden by the + * subclass to return the correct object type. + * @param statusCode the response status code (from SDNC, or internally generated) + * @param errMsg the error message (normally a verbose explanation of the error) + * @param rt request tunables + * @return an error response object + */ + protected abstract SDNCErrorCommon createErrorResponse(int statusCode, + String errMsg, TypedRequestTunables rt); + + /** + * Called by the send() method to analyze errors that may be encoded in the + * content of non-2XX responses. By default, this method tries to parse the + * content as a restconf error. + *
+	 *     xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"
+	 * 
+ * If an error (or errors) can be obtained from the content, then the result + * is a string in this format: + *
+	 * [error-type:TYPE, error-tag:TAG, error-message:MESSAGE] ...
+	 * 
+ * If no error could be obtained from the content, then the result is null. + *

+ * The subclass can override this method to provide another implementation. + */ + protected String analyzeErrors(String content) { + if (content == null || content.isEmpty()) { + return null; + } + + // Confirmed with Andrew Shen on 11/1/16 that SDNC will send content like + // this in error responses (non-2XX response codes) to "agnostic" service + // requests. + // + // + // + // protocol + // malformed-message + // Error parsing input: The element type "input" must be terminated by the matching end-tag "</input>". + // + // + + StringBuilder output = null; + + try { + XPathFactory xpathFactory = XPathFactory.newInstance(); + XPath xpath = xpathFactory.newXPath(); + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false); + documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + InputSource source = new InputSource(new StringReader(content)); + Document doc = documentBuilderFactory.newDocumentBuilder().parse(source); + NodeList errors = (NodeList) xpath.evaluate("errors/error", doc, XPathConstants.NODESET); + + for (int i = 0; i < errors.getLength(); i++) + { + Element error = (Element) errors.item(i); + + String info = ""; + + try { + String errorType = xpath.evaluate("error-type", error); + info += "error-type:" + errorType; + } catch (XPathExpressionException e) { + LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", + MsoLogger.ErrorCode.DataError, "XPath Exception", e); + } + + try { + String errorTag = xpath.evaluate( "error-tag", error); + if (!info.isEmpty()) { + info += ", "; + } + info += "error-tag:" + errorTag; + } catch (XPathExpressionException e) { + LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", + MsoLogger.ErrorCode.DataError, "XPath Exception", e); + } + + try { + String errorMessage = xpath.evaluate("error-message", error); + if (!info.isEmpty()) { + info += ", "; + } + info += "error-message:" + errorMessage; + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", + MsoLogger.ErrorCode.DataError, "XPath Exception", e); + } + + if (!info.isEmpty()) { + if (output == null) { + output = new StringBuilder("[" + info + "]"); + } else { + output.append(" [").append(info).append("]"); + } + } + } + } catch (Exception e) { + LOGGER.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "", + MsoLogger.ErrorCode.DataError, "Exception while analyzing errors", e); + } + + return output.toString(); + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java new file mode 100644 index 0000000000..2fd39df4e9 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java @@ -0,0 +1,207 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.sdncrest; + +import java.io.IOException; +import java.io.StringReader; +import java.net.HttpURLConnection; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.onap.so.adapters.sdncrest.SDNCErrorCommon; +import org.onap.so.adapters.sdncrest.SDNCResponseCommon; +import org.onap.so.adapters.sdncrest.SDNCServiceError; +import org.onap.so.adapters.sdncrest.SDNCServiceResponse; +import org.onap.so.logger.MsoLogger; +import org.springframework.stereotype.Component; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * SDNCConnector for "agnostic" API services. + */ + +@Component +public class SDNCServiceRequestConnector extends SDNCConnector { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,SDNCServiceRequestConnector.class); + @Override + protected SDNCResponseCommon createResponseFromContent(int statusCode, String statusMessage, + String responseContent, TypedRequestTunables rt) { + try { + return parseResponseContent(responseContent); + } catch (ParseException e) { + LOGGER.error(e); + return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt); + }catch (Exception e) { + LOGGER.error(e); + return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt); + } + } + + @Override + protected SDNCErrorCommon createErrorResponse(int statusCode, String errMsg, + TypedRequestTunables rt) { + return new SDNCServiceError(rt.getReqId(), String.valueOf(statusCode), errMsg, "Y"); + } + + /** + * Parses SDNC synchronous service response content or service notification content. + * If the content can be parsed and contains all required elements, then an object + * is returned. The type of the returned object depends on the response code + * contained in the content. For 2XX response codes, an SDNCServiceResponse is + * returned. Otherwise, an SDNCServiceError is returned. If the content cannot + * be parsed, or if the content does not contain all required elements, a parse + * exception is thrown. This method performs no logging or alarming. + * @throws ParseException on error + */ + public static SDNCResponseCommon parseResponseContent(String responseContent) + throws ParseException,ParserConfigurationException, SAXException, IOException{ + + // Note: this document builder is not namespace-aware, so namespaces are ignored. + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false); + documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + InputSource source = new InputSource(new StringReader(responseContent)); + Document doc = documentBuilderFactory.newDocumentBuilder().parse(source); + + // Find the configuration-response-common child under the root element. + // The root element is expected to be an "output" element, but we don't really care. + + Element root = doc.getDocumentElement(); + Element configurationResponseCommon = null; + + for (Element child : SDNCAdapterUtils.childElements(root)) { + if ("configuration-response-common".equals(child.getNodeName())) { + configurationResponseCommon = child; + break; + } + } + + if (configurationResponseCommon == null) { + throw new ParseException("No configuration-response-common element in SDNC response", 0); + } + + // Process the children of configuration-response-common. + + String responseCode = null; + String responseMessage = null; + String svcRequestId = null; + String ackFinalIndicator = null; + List responseParameters = new ArrayList<>(); + + for (Element child : SDNCAdapterUtils.childElements(configurationResponseCommon)) { + if ("response-code".equals(child.getNodeName())) { + responseCode = child.getTextContent(); + } else if ("response-message".equals(child.getNodeName())) { + responseMessage = child.getTextContent(); + } else if ("svc-request-id".equals(child.getNodeName())) { + svcRequestId = child.getTextContent(); + } else if ("ack-final-indicator".equals(child.getNodeName())) { + ackFinalIndicator = child.getTextContent(); + } else if ("response-parameters".equals(child.getNodeName())) { + responseParameters.add(child); + } + } + + // svc-request-id is mandatory. + + if (svcRequestId == null || svcRequestId.isEmpty()) { + throw new ParseException("No svc-request-id in SDNC response", 0); + } + + // response-code is mandatory. + + if (responseCode == null || responseCode.isEmpty()) { + throw new ParseException("No response-code in SDNC response", 0); + } + + // ack-final-indicator is optional: default to "Y". + + if (ackFinalIndicator == null || ackFinalIndicator.trim().isEmpty()) { + ackFinalIndicator = "Y"; + } + + if (!ackFinalIndicator.equals("Y") && !"N".equals(ackFinalIndicator)) { + throw new ParseException("Invalid ack-final-indicator in SDNC response: '" + ackFinalIndicator + "'", 0); + } + + // response-message is optional. If the value is empty, omit it from the response object. + + if (responseMessage != null && responseMessage.isEmpty()) { + responseMessage = null; + } + + // If the response code in the message from SDNC was not 2XX, return SDNCServiceError. + + if (!responseCode.matches("2[0-9][0-9]") && !responseCode.equals("0")) { + // Not a 2XX response. Return SDNCServiceError. + return new SDNCServiceError(svcRequestId, responseCode, responseMessage, ackFinalIndicator); + } + + // Create a success response object. + + SDNCServiceResponse response = new SDNCServiceResponse(svcRequestId, + responseCode, responseMessage, ackFinalIndicator); + + // Process any response-parameters that might be present. + + for (Element element : responseParameters) { + String tagName = null; + String tagValue = null; + + for (Element child : SDNCAdapterUtils.childElements(element)) { + if ("tag-name".equals(child.getNodeName())) { + tagName = child.getTextContent(); + } else if ("tag-value".equals(child.getNodeName())) { + tagValue = child.getTextContent(); + } + } + + // tag-name is mandatory + + if (tagName == null) { + throw new ParseException("Missing tag-name in SDNC response parameter", 0); + } + + // tag-value is optional. If absent, make it an empty string so we don't + // end up with null values in the parameter map. + + if (tagValue == null) { + tagValue = ""; + } + + response.addParam(tagName, tagValue); + } + + return response; + + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java new file mode 100644 index 0000000000..270b1bd99c --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java @@ -0,0 +1,230 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.sdncrest; + +import java.io.StringWriter; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.http.HttpStatus; +import org.onap.so.adapters.sdnc.exception.SDNCAdapterException; +import org.onap.so.adapters.sdncrest.RequestInformation; +import org.onap.so.adapters.sdncrest.SDNCErrorCommon; +import org.onap.so.adapters.sdncrest.SDNCResponseCommon; +import org.onap.so.adapters.sdncrest.SDNCServiceError; +import org.onap.so.adapters.sdncrest.SDNCServiceRequest; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +@Component +public class SDNCServiceRequestTask { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCServiceRequestTask.class); + + @Autowired + private SDNCServiceRequestConnector connector; + + @Autowired + MapTypedRequestTunablesData mapTunables; + + @Autowired + private BPRestCallback bpRestCallback; + + @Async + public void runRequest(SDNCServiceRequest request,String msoRequestId,String msoServiceInstanceId,String myUrlSuffix) throws SDNCAdapterException + { + MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId); + MsoLogger.setServiceName(getClass().getSimpleName()); + + String sdncRequestId = request.getSdncRequestId(); + String sdncService = request.getSdncService(); + String sdncOperation = request.getSdncOperation(); + + TypedRequestTunables rt = new TypedRequestTunables(sdncRequestId, myUrlSuffix); + rt.setServiceKey(sdncService, sdncOperation); + TypedRequestTunables mappedTunables = mapTunables.setTunables(rt); + if (!mappedTunables.getError().isEmpty()) { + // Note that the error was logged and alarmed by setTunables() + SDNCServiceError error = new SDNCServiceError(request.getSdncRequestId(), + String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), mappedTunables.getError(), "Y"); + bpRestCallback.send(request.getBPNotificationUrl(), error.toJson()); + return; + } + + String xml = genSdncReq(request, mappedTunables); + + long sdncStartTime = System.currentTimeMillis(); + SDNCResponseCommon response = connector.send(xml, mappedTunables); + + if (response instanceof SDNCErrorCommon) { + LOGGER.recordMetricEvent(sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Received success response from SDNC", "SDNC", sdncService + "." + sdncOperation, null); + } else { + LOGGER.recordMetricEvent(sdncStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, + "Received error response from SDNC", "SDNC", sdncService + "." + sdncOperation, null); + } + + long bpStartTime = System.currentTimeMillis(); + boolean callbackSuccess = bpRestCallback.send(request.getBPNotificationUrl(), response.toJson()); + + if (callbackSuccess) { + LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Sent notification", "BPMN", request.getBPNotificationUrl(), null); + } else { + LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, + "Failed to send notification", "BPMN", request.getBPNotificationUrl(), null); + } + } + + private Element addChild(Element parent, String tag) { + Element child = parent.getOwnerDocument().createElement(tag); + parent.appendChild(child); + return child; + } + + private void addTextChild(Element parent, String tag, String text) { + if (text != null) { + Element child = parent.getOwnerDocument().createElement(tag); + child.setTextContent(text); + parent.appendChild(child); + } + } + + private String genSdncReq(SDNCServiceRequest request, TypedRequestTunables rt) { + Document doc; + + try { + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + + doc = documentBuilder.newDocument(); + Element root = doc.createElementNS(rt.getNamespace(), "input"); + doc.appendChild(root); + + Element hdr = addChild(root, rt.getHeaderName()); + addTextChild(hdr, "svc-request-id", rt.getReqId()); + addTextChild(hdr, "svc-notification-url", rt.getMyUrl()); + + RequestInformation requestInfo = request.getRequestInformation(); + Element requestInformation = addChild(root, "request-information"); + addTextChild(requestInformation, "request-id", requestInfo.getRequestId()); + + + if(requestInfo.getRequestAction()!= null) { + addTextChild(requestInformation, "request-action", + requestInfo.getRequestAction()); + } + if(requestInfo.getRequestSubAction()!= null) { + addTextChild(requestInformation, "request-sub-action", + requestInfo.getRequestSubAction()); + } + if(requestInfo.getOrderNumber() != null && + !requestInfo.getOrderNumber().isEmpty() ) { + addTextChild(requestInformation, "order-number", + requestInfo.getOrderNumber()); + } + + if(requestInfo.getOrderVersion() != null && + !requestInfo.getOrderVersion().isEmpty() ) { + addTextChild(requestInformation, "order-version", + requestInfo.getOrderVersion()); + } + + + addTextChild(requestInformation, "source", requestInfo.getSource()); + addTextChild(requestInformation, "notification-url", requestInfo.getNotificationUrl()); + + Element serviceInformation = addChild(root, "service-information"); + addTextChild(serviceInformation, "service-type", request.getServiceInformation().getServiceType()); + addTextChild(serviceInformation, "service-instance-id", request.getServiceInformation().getServiceInstanceId()); + addTextChild(serviceInformation, "subscriber-name", request.getServiceInformation().getSubscriberName()); + addTextChild(serviceInformation, "subscriber-global-id", request.getServiceInformation().getSubscriberGlobalId()); + + Element agnosticServiceInformation = addChild(root, "agnostic-service-information"); + addTextChild(agnosticServiceInformation, "operation", request.getSdncOperation()); + addTextChild(agnosticServiceInformation, "service", request.getSdncService()); + + // anydata is mandatory in the SDNC schema, so if the data we got is null, + // set use an empty string instead to ensure we generate an empty element. + + String anydata = request.getSdncServiceData(); + if (anydata == null) { + anydata = ""; + } + + // content-type is also mandatory. + + String contentType = request.getSdncServiceDataType(); + + if (contentType == null || contentType.isEmpty()) { + if (anydata.isEmpty()) { + contentType = "XML"; + } else { + if (anydata.startsWith("<")) { + contentType = "XML"; + } else { + contentType = "JSON"; + } + } + } + + addTextChild(agnosticServiceInformation, "content-type", contentType); + addTextChild(agnosticServiceInformation, "anydata", anydata); + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", + MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e); + return null; + } + + String xml; + + try { + StringWriter writer = new StringWriter(); + TransformerFactory factory = TransformerFactory.newInstance(); + factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD,""); + factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET,""); + Transformer transformer = factory.newTransformer(); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); + transformer.transform(new DOMSource(doc), new StreamResult(writer)); + xml = writer.toString(); + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "", + MsoLogger.ErrorCode.DataError, "Exception - domToStr", e); + return null; + } + + LOGGER.trace("Formatted SDNC service request XML:\n" + xml); + return xml; + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java new file mode 100644 index 0000000000..72a23282d9 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.sdncrest; + +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.onap.so.adapters.sdnc.impl.Constants; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +/** + * A temporary interface to support notifications from SNIRO to BPMN. + * We added this to the SDNC adapter because we didn't have time to + * develop a SNIRO adapter in 1702. + */ +@Path("/") +@Component +public class SNIROResponse { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SNIROResponse.class); + private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + + @Autowired + private Environment env; + + @Autowired + private BPRestCallback callback; + + @POST + @Path("/SDNCNotify/SNIROResponse/{correlator}") + @Consumes("*/*") + @Produces({MediaType.TEXT_PLAIN}) + public Response serviceNotification(@PathParam("correlator") String correlator, String content) { + LOGGER.info(MessageEnum.RA_RECEIVE_SDNC_NOTIF, content, "SDNC", "SDNCNotify/SNIROResponse"); + + long startTime = System.currentTimeMillis(); + + String bpUrl = env.getProperty(Constants.BPEL_REST_URL_PROP, ""); + + if (bpUrl == null || bpUrl.equals("")) { + String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; + LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "", + MsoLogger.ErrorCode.DataError, "Missing config param"); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build(); + } + + long bpStartTime = System.currentTimeMillis(); + boolean callbackSuccess = callback.send(bpUrl, "SNIROResponse", correlator, content); + + if (callbackSuccess) { + LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Sent notification", "BPMN", bpUrl, null); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); + } else { + LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, + "Failed to send notification", "BPMN", bpUrl, null); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, + "Failed to send notification"); + } + + return Response.status(204).build(); + } +} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java new file mode 100644 index 0000000000..6331d6aaae --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java @@ -0,0 +1,180 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.sdncrest; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.onap.so.adapters.sdnc.impl.Constants; +import org.onap.so.logger.MsoLogger; + +/** + * Typed Request Tunables. Each entry is identified by a TYPE in the property name. + * Different types can have different keys. + *

+ * General format: + *

+ * org.onap.so.adapters.sdnc.TYPE.KEY1[.KEY2...]=METHOD|TIMEOUT|URL|HEADER|NAMESPACE
+ * 
+ * Currently supported type(s): service + *
+ * org.onap.so.adapters.sdnc.service.SERVICE.OPERATION=METHOD|TIMEOUT|URL|HEADER|NAMESPACE
+ * 
+ */ +public class TypedRequestTunables { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, TypedRequestTunables.class); + + private String reqId; + private String myUrlSuffix; + private String key = null; + private String error = ""; + + // tunables (all are required) + private String reqMethod = null; + private String timeout = null; + private String sdncUrl = null; + private String headerName = null; + private String namespace = null; + private String myUrl = null; + + public TypedRequestTunables(TypedRequestTunables reqTunableOriginal) { + this.reqId = reqTunableOriginal.getReqId(); + this.myUrlSuffix = reqTunableOriginal.getMyUrlSuffix(); + this.key = reqTunableOriginal.getKey(); + this.error = reqTunableOriginal.getError(); + this.reqMethod = reqTunableOriginal.getReqMethod(); + this.timeout = reqTunableOriginal.getTimeout(); + this.sdncUrl = reqTunableOriginal.getSdncUrl(); + this.headerName = reqTunableOriginal.getHeaderName(); + this.namespace = reqTunableOriginal.getNamespace(); + this.myUrl = reqTunableOriginal.getMyUrl(); + } + + public TypedRequestTunables(String reqId, String myUrlSuffix) { + this.reqId = reqId; + this.myUrlSuffix = myUrlSuffix; + } + + /** + * Sets the key for a service request: + *
+	 * org.onap.so.adapters.sdnc.service.SERVICE.OPERATION
+	 * 
+ * @param service the sdncService + * @param operation the sdncOperation + */ + public void setServiceKey(String service, String operation) { + key = Constants.REQUEST_TUNABLES + ".service." + service + "." + operation; + LOGGER.debug("Generated " + getClass().getSimpleName() + " key: " + key); + } + + /** + * Gets the SDNC request ID. + */ + public String getReqId() { + return reqId; + } + + /** + * Gets the generated key. + */ + public String getKey() { + return key; + } + + /** + * Gets the most recent error, or null if there was no error. + */ + public String getError() { + return error; + } + + public String getReqMethod() { + return reqMethod; + } + + public String getTimeout() { + return timeout; + } + + public String getSdncUrl() { + return sdncUrl; + } + + public String getHeaderName() { + return headerName; + } + + public String getNamespace() { + return namespace; + } + + /** + * Gets the SDNC adapter notification URL, trimmed of trailing '/' characters. + */ + public String getMyUrl() { + return myUrl; + } + + public String getMyUrlSuffix() { + return myUrlSuffix; + } + + public void setKey(String key) { + this.key = key; + } + + public void setError(String error) { + this.error = error; + } + + public void setReqMethod(String reqMethod) { + this.reqMethod = reqMethod; + } + + public void setTimeout(String timeout) { + this.timeout = timeout; + } + + public void setSdncUrl(String sdncUrl) { + this.sdncUrl = sdncUrl; + } + + public void setHeaderName(String headerName) { + this.headerName = headerName; + } + + public void setNamespace(String namespace) { + this.namespace = namespace; + } + + public void setMyUrl(String myUrl) { + this.myUrl = myUrl; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("reqId", reqId).append("myUrlSuffix", myUrlSuffix).append("key", key) + .append("error", error).append("reqMethod", reqMethod).append("timeout", timeout) + .append("sdncUrl", sdncUrl).append("headerName", headerName).append("namespace", namespace) + .append("myUrl", myUrl).toString(); + } + +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtil.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtil.java new file mode 100644 index 0000000000..991126f868 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtil.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdnc.util; + + +public class SDNCRequestIdUtil { + // Add private constructor to prevent instance creation. + private SDNCRequestIdUtil () {} + + public static String getSDNCOriginalRequestId (String newRequestId) { + + // Camunda scripts will add postfix, such as -1, -2, on the original requestID, to make sure requestID is unique while sending request to SDNC + // In order to use the unique requestID in logging, need to remove the postfix added by the Camunda scripts + // Verify whether the requestId is a valid UUID with postfix (-1, -2). If yes, it should contain 5 times char '-', since valid UUID contains 4 times '-' + // If the requestId is not a valid UUID with postfix, we do nothing + if (newRequestId.split("-").length == 6) { + return newRequestId.substring(0, newRequestId.lastIndexOf('-')); + } + return newRequestId; + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java deleted file mode 100644 index ff30e0d241..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc; - - -import javax.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the org.openecomp.mso.adapters.sdnc package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.sdnc - * - */ - public ObjectFactory() { - /* Empty constructor */ - } - - /** - * Create an instance of {@link RequestHeader } - * - */ - public RequestHeader createRequestHeader() { - return new RequestHeader(); - } - - /** - * Create an instance of {@link SDNCAdapterResponse } - * - */ - public SDNCAdapterResponse createSDNCAdapterResponse() { - return new SDNCAdapterResponse(); - } - - /** - * Create an instance of {@link SDNCAdapterRequest } - * - */ - public SDNCAdapterRequest createSDNCAdapterRequest() { - return new SDNCAdapterRequest(); - } - -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/RequestHeader.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/RequestHeader.java deleted file mode 100644 index f7b5596f16..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/RequestHeader.java +++ /dev/null @@ -1,219 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -//BPEL to SDNCAdapter request header -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "svcInstanceId", - "svcAction", - "svcOperation", - "callbackUrl", - "msoAction" -}) -@XmlRootElement(name = "RequestHeader") -public class RequestHeader { - - @XmlElement(name = "RequestId", required = true) - protected String requestId; - @XmlElement(name = "SvcInstanceId") - protected String svcInstanceId; - @XmlElement(name = "SvcAction", required = true) - protected String svcAction; - @XmlElement(name = "SvcOperation", required = true) - protected String svcOperation; - @XmlElement(name = "CallbackUrl", required = true) - protected String callbackUrl; - @XmlElement(name = "MsoAction") - protected String msoAction; - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - public String getSvcInstanceId() { - return svcInstanceId; - } - - public void setSvcInstanceId(String svcInstanceId) { - this.svcInstanceId = svcInstanceId; - } - - /** - * Gets the value of the svcAction property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcAction() { - return svcAction; - } - - /** - * Sets the value of the svcAction property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcAction(String value) { - this.svcAction = value; - } - - /** - * Gets the value of the svcOperation property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getSvcOperation() { - return svcOperation; - } - - /** - * Sets the value of the svcOperation property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setSvcOperation(String value) { - this.svcOperation = value; - } - - /** - * Gets the value of the callbackUrl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCallbackUrl() { - return callbackUrl; - } - - /** - * Sets the value of the callbackUrl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCallbackUrl(String value) { - this.callbackUrl = value; - } - - /** - * Gets the value of the callbackUrl property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMsoAction() { - return msoAction; - } - - /** - * Sets the value of the callbackUrl property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMsoAction(String value) { - this.msoAction = value; - } - - - @Override - public String toString() { - return "RequestHeader [requestId=" + requestId + - ", svcInstanceId=" + svcInstanceId + - ", svcAction=" + svcAction + - ", svcOperation=" + svcOperation + - ", callbackUrl=" + callbackUrl + - ", msoAction=" + msoAction + "]"; - } - -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterPortType.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterPortType.java deleted file mode 100644 index cd464923fc..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterPortType.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc; - - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; - - -/** - * This class was generated by Apache CXF 2.7.11.redhat-3 - * 2015-01-27T18:25:50.914-05:00 - * Generated source version: 2.7.11.redhat-3 - * - */ -//BPEL SDNCAdapter SOAP WebService - impl class in impl pkg -@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", name = "SDNCAdapterPortType") -@XmlSeeAlso({ObjectFactory.class}) -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -public interface SDNCAdapterPortType { - - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterResponse") - @WebMethod(operationName = "SDNCAdapter") - public SDNCAdapterResponse sdncAdapter( - @WebParam(partName = "SDNCAdapterRequest", name = "SDNCAdapterRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1") - SDNCAdapterRequest sdncAdapterRequest - ); - - @WebMethod - public void healthCheck(); -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequest.java deleted file mode 100644 index 02998bf9df..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequest.java +++ /dev/null @@ -1,129 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -import org.openecomp.mso.adapters.sdnc.impl.Utils; -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}RequestHeader"/>
- *         <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -//BPEL to SDNCAdapter request -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterRequest") -public class SDNCAdapterRequest { - - @XmlElement(name = "RequestHeader", required = true) - protected RequestHeader requestHeader; - @XmlElement(name = "RequestData", required = true) - protected Object requestData; - - /** - * Gets the value of the requestHeader property. - * - * @return - * possible object is - * {@link RequestHeader } - * - */ - public RequestHeader getRequestHeader() { - return requestHeader; - } - - /** - * Sets the value of the requestHeader property. - * - * @param value - * allowed object is - * {@link RequestHeader } - * - */ - public void setRequestHeader(RequestHeader value) { - this.requestHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - - String rd = ""; - if (requestData != null) - { - Node node = (Node) requestData; - Document doc = node.getOwnerDocument(); - rd = Utils.domToStr(doc); - } - return "SDNCAdapterRequest [requestHeader=" + requestHeader.toString() - + ", requestData=" + rd + "]"; - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterResponse.java deleted file mode 100644 index 1b2f3b824d..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -//SDNCAdapter to BPEL Sync Response(ACK) - async response(s) follow -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "SDNCAdapterResponse") -public class SDNCAdapterResponse { - - -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterService.java deleted file mode 100644 index 93d99846ef..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterService.java +++ /dev/null @@ -1,127 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc; - - -import java.net.URL; - -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceFeature; - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; - -/** - * This class was generated by Apache CXF 2.7.11.redhat-3 - * 2015-01-27T18:25:50.994-05:00 - * Generated source version: 2.7.11.redhat-3 - * - */ -//BPEL SDNCAdapter SOAP WebService -@WebServiceClient(name = "SDNCAdapterService", - wsdlLocation = "main/resources/SDNCAdapter.wsdl", - targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1") -public class SDNCAdapterService extends Service { - - private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - public static final URL WSDL_LOCATION; - - public static final QName SERVICE = new QName("http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", "SDNCAdapterService"); - public static final QName SDNCAdapterSoapHttpPort = new QName("http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", "SDNCAdapterSoapHttpPort"); - static { - URL wsdlUrl = null; - try { - wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCAdapter.wsdl"); - - } catch (Exception e) { - logger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCAdapter.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e); - } - if(wsdlUrl == null) { - logger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCAdapter.wsdl", "", "", MsoLogger.ErrorCode.DataError, "WSDL not found"); - } else { - try { - logger.info(MessageEnum.RA_PRINT_URL, "SDNCAdpater.wsdl", wsdlUrl.toURI().toString(), "", ""); - } catch (Exception e) { - logger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "SDNCAdapter.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - print URL", e); - } - } - WSDL_LOCATION = wsdlUrl; - } - - public SDNCAdapterService(URL wsdlLocation) { - super(wsdlLocation, SERVICE); - } - - public SDNCAdapterService(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public SDNCAdapterService() { - super(WSDL_LOCATION, SERVICE); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCAdapterService(WebServiceFeature ... features) { - super(WSDL_LOCATION, SERVICE, features); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCAdapterService(URL wsdlLocation, WebServiceFeature ... features) { - super(wsdlLocation, SERVICE, features); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCAdapterService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { - super(wsdlLocation, serviceName, features); - } - - /** - * - * @return - * returns SDNCAdapterPortType - */ - @WebEndpoint(name = "SDNCAdapterSoapHttpPort") - public SDNCAdapterPortType getSDNCAdapterSoapHttpPort() { - return super.getPort(SDNCAdapterSoapHttpPort, SDNCAdapterPortType.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. - * @return - * returns SDNCAdapterPortType - */ - @WebEndpoint(name = "SDNCAdapterSoapHttpPort") - public SDNCAdapterPortType getSDNCAdapterSoapHttpPort(WebServiceFeature... features) { - return super.getPort(SDNCAdapterSoapHttpPort, SDNCAdapterPortType.class, features); - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java deleted file mode 100644 index 2ce452e51c..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java +++ /dev/null @@ -1,155 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.client; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -//SDNCAdapter to BPEL Async response header -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "requestId", - "responseCode", - "responseMessage" -}) -@XmlRootElement(name = "CallbackHeader") -public class CallbackHeader { - - @XmlElement(name = "RequestId", required = true) - protected String requestId; - @XmlElement(name = "ResponseCode", required = true) - protected String responseCode; - @XmlElement(name = "ResponseMessage", required = true) - protected String responseMessage; - - public CallbackHeader() { - /* Empty constructor */ - } - - public CallbackHeader(String reqId, String respCode, String respMsg) { - this.requestId = reqId; - this.responseCode = respCode; - this.responseMessage = respMsg; - } - - /** - * Gets the value of the requestId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - /** - * Gets the value of the responseCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseCode() { - return responseCode; - } - - /** - * Sets the value of the responseCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseCode(String value) { - this.responseCode = value; - } - - /** - * Gets the value of the responseMessage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponseMessage() { - return responseMessage; - } - - /** - * Sets the value of the responseMessage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponseMessage(String value) { - this.responseMessage = value; - } - - @Override - public String toString() { - return "CallbackHeader [requestId=" + requestId + ", responseCode=" - + responseCode + ", responseMessage=" + responseMessage + "]"; - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/ObjectFactory.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/ObjectFactory.java deleted file mode 100644 index 3d4039c702..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/ObjectFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.client; - - -import javax.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the org.openecomp.mso.adapters.sdnc.client package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.sdnc.client - * - */ - public ObjectFactory() { - } - - - /** - * Create an instance of {@link SDNCAdapterCallbackRequest } - * - */ - public SDNCAdapterCallbackRequest createSDNCAdapterCallbackRequest() { - return new SDNCAdapterCallbackRequest(); - } - - /** - * Create an instance of {@link CallbackHeader } - * - */ - public CallbackHeader createCallbackHeader() { - return new CallbackHeader(); - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequest.java deleted file mode 100644 index 06c2c83f4d..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequest.java +++ /dev/null @@ -1,136 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.client; - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import java.io.StringWriter; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}CallbackHeader"/>
- *         <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -//SDNCAdapter to BPEL Async response -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "callbackHeader", - "requestData" -}) -@XmlRootElement(name = "SDNCAdapterCallbackRequest") -public class SDNCAdapterCallbackRequest { - - @XmlElement(name = "CallbackHeader", required = true) - protected CallbackHeader callbackHeader; - @XmlElement(name = "RequestData") - protected Object requestData; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - /** - * Gets the value of the callbackHeader property. - * - * @return - * possible object is - * {@link CallbackHeader } - * - */ - public CallbackHeader getCallbackHeader() { - return callbackHeader; - } - - /** - * Sets the value of the callbackHeader property. - * - * @param value - * allowed object is - * {@link CallbackHeader } - * - */ - public void setCallbackHeader(CallbackHeader value) { - this.callbackHeader = value; - } - - /** - * Gets the value of the requestData property. - * - * @return - * possible object is - * {@link Object } - * - */ - public Object getRequestData() { - return requestData; - } - - /** - * Sets the value of the requestData property. - * - * @param value - * allowed object is - * {@link Object } - * - */ - public void setRequestData(Object value) { - this.requestData = value; - } - - @Override - public String toString() { - try { - JAXBContext ctx = JAXBContext.newInstance("org.openecomp.mso.adapters.sdnc.client"); - Marshaller m = ctx.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); - StringWriter w = new StringWriter(); - m.marshal(this, w); - return w.toString(); - } - catch (Exception e) - { - msoLogger.error(MessageEnum.RA_MARSHING_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception - MARSHING_ERROR", e); - } - return ""; - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java deleted file mode 100644 index 1b717b483a..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.client; - - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; -import org.openecomp.mso.adapters.sdnc.SDNCAdapterResponse; - - -/** - * This class was generated by Apache CXF 2.7.11.redhat-3 - * 2015-01-28T11:07:01.997-05:00 - * Generated source version: 2.7.11.redhat-3 - * - */ -//SDNCAdapter to BPEL Async response WEB Service -@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", name = "SDNCCallbackAdapterPortType") -@XmlSeeAlso({ObjectFactory.class}) -@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) -@FunctionalInterface -public interface SDNCCallbackAdapterPortType { - - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") - @WebMethod(operationName = "SDNCAdapterCallback") - public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(partName = "SDNCAdapterCallbackRequest", name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1") - SDNCAdapterCallbackRequest sdncAdapterCallbackRequest - ); -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java deleted file mode 100644 index d63e852258..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java +++ /dev/null @@ -1,125 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.client; - - -import java.net.URL; - -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceFeature; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * This class was generated by Apache CXF 2.7.11.redhat-3 - * 2015-01-28T11:07:02.074-05:00 - * Generated source version: 2.7.11.redhat-3 - * - */ -//SDNCAdapter to BPEL Async response WEB Service -@WebServiceClient(name = "SDNCCallbackAdapterService", - wsdlLocation = "main/resources/SDNCCallbackAdapter.wsdl", - targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1") -public class SDNCCallbackAdapterService extends Service { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - public static final URL WSDL_LOCATION; - public static final QName SERVICE = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService"); - public static final QName SDNCCallbackAdapterSoapHttpPort = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort"); - static { - URL wsdlUrl = null; - try { - wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCCallbackAdapter.wsdl"); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e); - } - if(wsdlUrl == null) { - msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "WSDL not found"); - } else { - try { - msoLogger.info(MessageEnum.RA_PRINT_URL, "SDNCCallbackAdapter.wsdl", wsdlUrl.toURI().toString(), "SDNC", ""); - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - URL convention problem", e); - } - } - WSDL_LOCATION = wsdlUrl; - } - - public SDNCCallbackAdapterService(URL wsdlLocation) { - super(wsdlLocation, SERVICE); - } - - public SDNCCallbackAdapterService(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public SDNCCallbackAdapterService() { - super(WSDL_LOCATION, SERVICE); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(WebServiceFeature ... features) { - super(WSDL_LOCATION, SERVICE, features); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(URL wsdlLocation, WebServiceFeature ... features) { - super(wsdlLocation, SERVICE, features); - } - - //This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2 - //API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1 - //compliant code instead. - public SDNCCallbackAdapterService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) { - super(wsdlLocation, serviceName, features); - } - - /** - * - * @return - * returns SDNCCallbackAdapterPortType - */ - @WebEndpoint(name = "SDNCCallbackAdapterSoapHttpPort") - public SDNCCallbackAdapterPortType getSDNCCallbackAdapterSoapHttpPort() { - return super.getPort(SDNCCallbackAdapterSoapHttpPort, SDNCCallbackAdapterPortType.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. - * @return - * returns SDNCCallbackAdapterPortType - */ - @WebEndpoint(name = "SDNCCallbackAdapterSoapHttpPort") - public SDNCCallbackAdapterPortType getSDNCCallbackAdapterSoapHttpPort(WebServiceFeature... features) { - return super.getPort(SDNCCallbackAdapterSoapHttpPort, SDNCCallbackAdapterPortType.class, features); - } - -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/package-info.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/package-info.java deleted file mode 100644 index 614bdbb18c..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package org.openecomp.mso.adapters.sdnc.client; - diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Constants.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Constants.java deleted file mode 100644 index a60f60aab2..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Constants.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.impl; - - -public interface Constants { - - public static final String BPEL_REST_URL_PROP = "org.openecomp.mso.adapters.sdnc.rest.bpelurl"; - public static final String BPEL_URL_PROP = "org.openecomp.mso.adapters.sdnc.bpelurl"; - public static final String DEFAULT_BPEL_URL = "http://localhost:8080//active-bpel/services/SDNCAdapterCallbackV1"; - - public static final String MY_URL_PROP = "org.openecomp.mso.adapters.sdnc.myurl"; - public static final String DEFAULT_MY_URL = "https://localhost:8443/adapters/rest/SDNCNotify"; - - public static final String SDNC_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.sdncauth"; - public static final String DEFAULT_SDNC_AUTH = "406B2AE613211B6FB52466DE6E1769AC"; - - public static final String DEFAULT_BPEL_AUTH = "05FDA034C27D1CA51AAB8FAE512EDE45241E16FC8C137D292AA3A964431C82DB"; - public static final String BPEL_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.bpelauth"; - - - public static final String SDNC_SVCCFGRESP_ROOT = "input"; - public static final String SDNC_REQ_ID = "/svc-request-id"; - public static final String SDNC_RESP_CODE = "/response-code"; - public static final String SDNC_RESP_MSG = "/response-message"; - public static final String SDNC_CONNECTTIME_PROP = "org.openecomp.mso.adapters.sdnc.sdncconnecttime"; - public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; - - public static final String REQUEST_TUNABLES = "org.openecomp.mso.adapters.sdnc"; -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java deleted file mode 100644 index 830ac7c917..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java +++ /dev/null @@ -1,223 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.impl; - - -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -import org.openecomp.mso.logger.MessageEnum; -public class RequestTunables { - - private MsoPropertiesFactory msoPropertiesFactory; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - public static final String GENERATED_KEY = "Generated key: "; - - //criteria - private String reqId = ""; - private String msoAction = ""; - private String operation = ""; - private String action = ""; - - //tunables - private String reqMethod = "POST"; - private String sdncUrl = null; - private String timeout = "60000"; - private String headerName = "sdnc-request-header"; - private String namespace = ""; - private String asyncInd = "N"; //future use - - private String sdncaNotificationUrl = null; - - public RequestTunables(String reqId, String msoAction, String operation, String action, MsoPropertiesFactory msoPropFactory) { - super(); - msoPropertiesFactory = msoPropFactory; - if (reqId != null) { - this.reqId = reqId; - } - if (msoAction != null) { - this.msoAction = msoAction; - } - if (operation != null) { - this.operation = operation; - } - if (action != null) { - this.action = action; - } - } - - public String getReqId() { - return reqId; - } - public void setReqId(String reqId) { - this.reqId = reqId; - } - public String getReqMethod() { - return reqMethod; - } - public void setReqMethod(String reqMethod) { - this.reqMethod = reqMethod; - } - public String getMsoAction() { - return msoAction; - } - public void setMsoAction(String msoAction) { - this.msoAction = msoAction; - } - public String getAction() { - return action; - } - public void setAction(String action) { - this.action = action; - } - public String getOperation() { - return operation; - } - public void setOperation(String operation) { - this.operation = operation; - } - public String getSdncUrl() { - return sdncUrl; - } - public void setSdncUrl(String sdncUrl) { - this.sdncUrl = sdncUrl; - } - public String getTimeout() { - return timeout; - } - public void setTimeout(String timeout) { - this.timeout = timeout; - } - public String getAsyncInd() { - return asyncInd; - } - public void setAsyncInd(String asyncInd) { - this.asyncInd = asyncInd; - } - public String getHeaderName() { - return headerName; - } - public void setHeaderName(String headerName) { - this.headerName = headerName; - } - - - public String getSdncaNotificationUrl() { - return sdncaNotificationUrl; - } - - public void setSdncaNotificationUrl(String sdncaNotificationUrl) { - this.sdncaNotificationUrl = sdncaNotificationUrl; - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - @Override - public String toString() { - return "RequestTunables [reqId=" + reqId + ", msoAction=" + msoAction - + ", operation=" + operation + ", action=" + action - + ", reqMethod=" + reqMethod + ", sdncUrl=" + sdncUrl - + ", timeout=" + timeout + ", headerName=" + headerName - + ", sdncaNotificationUrl=" + sdncaNotificationUrl - + ", namespace=" + namespace + "]"; - } - - public void setTunables() - { - String error = null; - String key; - if ("query".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9 - key = Constants.REQUEST_TUNABLES + "." + msoAction + ".." + action; - msoLogger.debug(GENERATED_KEY + key); - } - else if ("put".equals(action) || "restdelete".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9 - key = Constants.REQUEST_TUNABLES + "..." + action; - msoLogger.debug(GENERATED_KEY + key); - } else { - key = Constants.REQUEST_TUNABLES + "." + msoAction + "." + operation +"." + action; - msoLogger.debug(GENERATED_KEY + key); - } - - String value; - try { - value = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, ""); - } catch (MsoPropertiesException e) { - msoLogger.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - value=""; - } - - if (value != null && value.length() > 0) { - - String[] parts = value.split("\\|"); //escape pipe - if (parts.length < 3) { - msoLogger.warn(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config"); - } - - for (int i = 0; i < parts.length; i++) { - if (i == 0) { - reqMethod = parts[i]; - msoLogger.debug("Request Method is set to: " + reqMethod); - } else if (i == 1) { - timeout = parts[i]; - msoLogger.debug("Timeout is set to: " + timeout); - } else if (i == 2) { - sdncUrl = SDNCAdapterPortTypeImpl.getProperty(Constants.REQUEST_TUNABLES + "." + parts[i], "",msoPropertiesFactory); - if (operation != null && sdncUrl != null) { - sdncUrl = sdncUrl + operation; - } - msoLogger.debug("SDNC Url is set to: " + sdncUrl); - } else if (i == 3) { - headerName = parts[i]; - msoLogger.debug("HeaderName is set to: " + headerName); - } else if (i == 4) { - namespace = parts[i]; - msoLogger.debug("NameSpace is set to: " + namespace); - } else if (i == 5) { - asyncInd = parts[i]; - msoLogger.debug("AsyncInd is set to: " + asyncInd); - } - } - - if (sdncUrl == null) { - error = "Invalid configuration, sdncUrl required for:" + key + " value:" + value; - } - } else { - error = "Missing configuration for:" + key; - } - if (error != null) { - msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - } - msoLogger.debug ("RequestTunables Key:" + key + " Value:" + value + " Tunables:" + this.toString()); - return; - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java deleted file mode 100644 index c9c75d89fa..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.impl; - -import javax.annotation.PostConstruct; -import javax.jws.WebService; -import javax.servlet.http.HttpServletResponse; - -import org.openecomp.mso.adapters.sdnc.SDNCAdapterPortType; -import org.openecomp.mso.adapters.sdnc.SDNCAdapterRequest; -import org.openecomp.mso.adapters.sdnc.SDNCAdapterResponse; -import org.openecomp.mso.adapters.sdnc.util.SDNCRequestIdUtil; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -//BPEL SDNCAdapter SOAP Web Service implementation -@WebService(serviceName = "SDNCAdapterService", endpointInterface = "org.openecomp.mso.adapters.sdnc.SDNCAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1") -public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { - - private MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory(); - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - @PostConstruct - public void init () { - msoLogger.info(MessageEnum.RA_INIT_SDNC_ADAPTER, "SDNC", "SDNCAdapterPortType"); - } - - /** - * Health Check web method. Does nothing but return to show the adapter is deployed. - */ - @Override - public void healthCheck () - { - msoLogger.debug("Health check call in SDNC Adapter"); - } - - public static String getProperty(String key, String defaultValue, MsoPropertiesFactory msoPropertiesFactoryp) { - String value; - try { - value = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, defaultValue); - } catch (MsoPropertiesException e) { - msoLogger.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - return null; - } - msoLogger.debug("Config read for " + MSO_PROP_SDNC_ADAPTER + " - key:" + key + " value:" + value); - return value; - } - - @Override - public SDNCAdapterResponse sdncAdapter(SDNCAdapterRequest bpelRequest) { - String bpelReqId = bpelRequest.getRequestHeader().getRequestId(); - String callbackUrl = bpelRequest.getRequestHeader().getCallbackUrl(); - long startTime = System.currentTimeMillis (); - MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getRequestHeader().getSvcInstanceId()); - MsoLogger.setServiceName (bpelRequest.getRequestHeader().getSvcAction()); - msoLogger.info(MessageEnum.RA_RECEIVE_BPEL_REQUEST, bpelReqId, callbackUrl, "SDNC", ""); - - SDNCRestClient sdncClient = new SDNCRestClient(bpelRequest,msoPropertiesFactory); - try { - Thread sdncClientThread = new Thread(sdncClient); - sdncClientThread.start(); - } - catch (Exception e){ - String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage(); - msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception sending request to SDNC. Failed to start SDNC Client thread", e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); - SDNCResponse sdncResp = new SDNCResponse(bpelReqId); - sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - sdncResp.setRespMsg(respMsg); - SDNCRestClient.sendRespToBpel(callbackUrl, sdncResp, msoPropertiesFactory); - } - - msoLogger.debug("Sending synchronous response to BPEL"); - SDNCAdapterResponse wsResp = new SDNCAdapterResponse(); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - return wsResp; - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java deleted file mode 100644 index f6a3e36a71..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java +++ /dev/null @@ -1,191 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.impl; - - -import java.io.StringReader; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import javax.ws.rs.GET; -import javax.ws.rs.HEAD; -import javax.ws.rs.POST; -import javax.ws.rs.Consumes; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.Response; -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.openecomp.mso.HealthCheckUtils; -import org.openecomp.mso.utils.UUIDChecker; -import org.w3c.dom.Document; -import org.xml.sax.InputSource; - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoPropertiesFactory; -import org.openecomp.mso.logger.MessageEnum; -@Path("/") -public class SDNCAdapterRestImpl { - - private MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); - public static final String MSO_PROP_ADAPTER = "MSO_PROP_SDNC_ADAPTER"; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - @Context - private HttpHeaders headers; - @Context HttpServletRequest request; - - @POST - @Path("/MSORequest") - @Consumes("application/xml") - @Produces("application/xml") - public Response MSORequest(String reqXML) { - msoLogger.debug("***Received MSO Rest Request. XML:" + reqXML); - - Document reqDoc = null; - SDNCResponse sdncResp = null; - RequestTunables rt = null; - String reqId = ""; - long startTime = System.currentTimeMillis(); - MsoLogger.setServiceName("UNKNOWN"); - String action = ""; - String operation = ""; - try { - - reqId = headers.getRequestHeader("mso-request-id").get(0); - action = headers.getRequestHeader("mso-request-action").get(0); - operation = headers.getRequestHeader("mso-request-operation").get(0); - - MsoLogger.setLogContext(reqId, ""); - - msoLogger.debug ("Received MSO Rest Request XML: " + reqXML); - rt = new RequestTunables(reqId, "", operation, action, msoPropertiesFactory); - rt.setTunables(); - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); - DocumentBuilder db = dbf.newDocumentBuilder(); - - InputSource source = new InputSource(new StringReader(reqXML)); - - reqDoc = db.parse(source); - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_PARSING_REQUEST_ERROR, reqXML, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Invalid XML request format", e); - sdncResp = new SDNCResponse(reqId, HttpServletResponse.SC_BAD_REQUEST, "Invalid XML request format"); - } - - if (reqDoc != null) { - msoLogger.debug("***Getting response from sdnc***"); - long subStartTime = System.currentTimeMillis (); - sdncResp = SDNCRestClient.getSdncResp(Utils.genSdncReq(reqDoc, rt), rt,msoPropertiesFactory); - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from SDNC", "SDNC", action + "." + operation, null); - } - - if (sdncResp == null) { - msoLogger.debug("An Internal Server error has occurred in SDNC Adapter"); - sdncResp = new SDNCResponse(reqId, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "MSO - SDNCA Internal Error"); - } - - if (sdncResp.getSdncRespXml() == null) { - sdncResp.setSdncRespXml(Utils.genMsoFailResp(sdncResp)); - } - - msoLogger.debug("***Completed MSO Rest Request." + sdncResp.toString()); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - return Response.status(sdncResp.getRespCode()).entity(sdncResp.getSdncRespXml()).build(); - } - - @HEAD - @GET - @Path("/healthcheck") - @Produces("text/html") - public Response healthcheck (@QueryParam("requestId") String requestId) { - long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("Healthcheck"); - UUIDChecker.verifyOldUUID(requestId, msoLogger); - HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck(msoLogger)) { - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - - if (!healthCheck.configFileCheck(msoLogger, startTime, MSO_PROP_ADAPTER)) { - return HealthCheckUtils.NOT_STARTED_RESPONSE; - } - msoLogger.debug("healthcheck - Successful"); - return HealthCheckUtils.HEALTH_CHECK_RESPONSE; - } - - @HEAD - @GET - @Path("/globalhealthcheck") - @Produces("text/html") - public Response globalHealthcheck (@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn) { - long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("GlobalHealthcheck"); - // Generate a Request Id - String requestId = UUIDChecker.generateUUID(msoLogger); - HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck (msoLogger)) { - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - - if (healthCheck.verifyGlobalHealthCheck(enableBpmn, requestId)) { - msoLogger.debug("globalHealthcheck - Successful"); - return HealthCheckUtils.HEALTH_CHECK_RESPONSE; - } else { - msoLogger.debug("globalHealthcheck - At leaset one of the sub-modules is not available."); - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - } - - @HEAD - @GET - @Path("/nodehealthcheck") - @Produces("text/html") - public Response nodeHealthcheck () { - long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("NodeHealthcheck"); - // Generate a Request Id - String requestId = UUIDChecker.generateUUID(msoLogger); - HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck (msoLogger)) { - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - - if (healthCheck.verifyNodeHealthCheck(HealthCheckUtils.NodeType.RA, requestId)) { - msoLogger.debug("nodeHealthcheck - Successful"); - return HealthCheckUtils.HEALTH_CHECK_RESPONSE; - } else { - msoLogger.debug("nodeHealthcheck - At leaset one of the sub-modules is not available."); - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - } - -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponse.java deleted file mode 100644 index 9bd850a3b4..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.impl; - - -import java.io.Serializable; - -public class SDNCResponse implements Serializable { - - private static final long serialVersionUID = 1L; - private String reqId = null; - private int respCode = 0; - private String respMsg = null; - private String sdncRespXml = null; - - public SDNCResponse(String reqId) { - this.reqId = reqId; - } - public SDNCResponse(String reqId, int respCode, String respMsg) { - this.reqId = reqId; - this.respCode = respCode; - this.respMsg = respMsg; - } - - public String getReqId() { - return reqId; - } - public void setReqId(String reqId) { - this.reqId = reqId; - } - public int getRespCode() { - return respCode; - } - public void setRespCode(int respCode) { - this.respCode = respCode; - } - public String getRespMsg() { - return respMsg; - } - public void setRespMsg(String respMsg) { - this.respMsg = respMsg; - } - public String getSdncRespXml() { - return sdncRespXml; - } - public void setSdncRespXml(String sdncRespXml) { - this.sdncRespXml = sdncRespXml; - } - - @Override - public String toString() { - return "SDNCResponse [reqId=" + reqId + ", respCode=" + respCode - + ", respMsg=" + respMsg + ", sdncRespXml=" + sdncRespXml + "]"; - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java deleted file mode 100644 index 55a2156c50..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java +++ /dev/null @@ -1,347 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.impl; - - -import java.io.BufferedReader; -import java.io.DataOutputStream; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.XMLConstants; -import javax.xml.bind.DatatypeConverter; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.ws.BindingProvider; -import javax.xml.ws.handler.MessageContext; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.openecomp.mso.adapters.sdnc.SDNCAdapterRequest; -import org.openecomp.mso.adapters.sdnc.client.CallbackHeader; -import org.openecomp.mso.adapters.sdnc.client.SDNCAdapterCallbackRequest; -import org.openecomp.mso.adapters.sdnc.client.SDNCCallbackAdapterPortType; -import org.openecomp.mso.adapters.sdnc.client.SDNCCallbackAdapterService; -import org.openecomp.mso.adapters.sdnc.util.SDNCRequestIdUtil; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -//SDNCAdapter to SDNC Rest Client -public class SDNCRestClient implements Runnable { - - private MsoPropertiesFactory msoPropertiesFactory; - - private SDNCAdapterRequest bpelRequest; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER"; - - - public SDNCRestClient(SDNCAdapterRequest bpelRequest,MsoPropertiesFactory msoPropFactory) { - this.bpelRequest = bpelRequest; - msoPropertiesFactory = msoPropFactory; - } - - @Override - public void run() - { - - String action = bpelRequest.getRequestHeader().getSvcAction(); - String operation = bpelRequest.getRequestHeader().getSvcOperation(); - String bpelReqId = bpelRequest.getRequestHeader().getRequestId(); - String callbackUrl = bpelRequest.getRequestHeader().getCallbackUrl(); - MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getRequestHeader().getSvcInstanceId()); - MsoLogger.setServiceName("SDNCRestClient"); - - String sdncReqBody = null; - - msoLogger.debug("BPEL Request:" + bpelRequest.toString()); - - RequestTunables rt = new RequestTunables(bpelReqId, - bpelRequest.getRequestHeader().getMsoAction(), - bpelRequest.getRequestHeader().getSvcOperation(), - bpelRequest.getRequestHeader().getSvcAction(),msoPropertiesFactory); - rt.setTunables(); - rt.setSdncaNotificationUrl(SDNCAdapterPortTypeImpl.getProperty(Constants.MY_URL_PROP, Constants.DEFAULT_MY_URL,msoPropertiesFactory)); - - - if ("POST".equals(rt.getReqMethod())) - { - /* TODO Hibernate - try { - RequestsDatabase.updateBpelUrl(bpelReqId, callbackUrl); - } - catch (Exception e1) - { - logger.error("Failed to update DB ActiveRequests with SDNC_CALLBACK_BPEL_URL. Default CallbackUrl will be used for SDNC async notifications", e1); - } - */ - - Node node = (Node) bpelRequest.getRequestData(); - Document reqDoc = node.getOwnerDocument(); - sdncReqBody = Utils.genSdncReq(reqDoc, rt); - - } - //should be more generic if we do RPC then we add the input tags etc, if it is pure REST this is not needed - else if("PUT".equals(rt.getReqMethod())){ - Node node = (Node) bpelRequest.getRequestData(); - Document reqDoc = node.getOwnerDocument(); - sdncReqBody = Utils.genSdncPutReq(reqDoc, rt); - } - long sdncStartTime = System.currentTimeMillis(); - SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt, msoPropertiesFactory); - msoLogger.recordMetricEvent (sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from SDNC", "SDNC", action + "." + operation, null); - - msoLogger.debug ("Got the SDNC Response: " + sdncResp.getSdncRespXml()); - msoLogger.debug("Sending reponse to bpel from SDNC rest client"); - long bpelStartTime = System.currentTimeMillis(); - sendRespToBpel(callbackUrl, sdncResp,msoPropertiesFactory); - msoLogger.recordMetricEvent (bpelStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully send reauest to BPEL", "BPMN", callbackUrl, null); - return; - } - - public static SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt, MsoPropertiesFactory msoPropertiesFactoryp) - { - - URL url; - HttpURLConnection con = null; - DataOutputStream out = null; - BufferedReader in = null; - SDNCResponse sdncResp = new SDNCResponse(rt.getReqId()); - StringBuilder response = new StringBuilder(); - - msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, rt.toString(), "SDNC", ""); - msoLogger.debug("SDNC Request Body:\n" + sdncReqBody); - - try { - - url = new URL(rt.getSdncUrl()); - - con = (HttpURLConnection) url.openConnection(); - con.setConnectTimeout(Integer.parseInt(SDNCAdapterPortTypeImpl.getProperty(Constants.SDNC_CONNECTTIME_PROP, "2000",msoPropertiesFactoryp))); - con.setReadTimeout(Integer.parseInt(rt.getTimeout())); - con.setRequestProperty("Accept", "application/yang.data+xml"); //for response in xml - String userCredentials = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getEncryptedProperty(Constants.SDNC_AUTH_PROP, Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); - - String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - con.setRequestProperty ("Authorization", basicAuth); - con.setRequestMethod(rt.getReqMethod()); - - // Add request headers - if ("POST".equals(rt.getReqMethod()) || "PUT".equals(rt.getReqMethod())) - { - con.setRequestProperty("Content-type", "application/xml"); - con.setRequestProperty("Content-length",String.valueOf(sdncReqBody.length())); - con.setDoOutput(true); - out = new DataOutputStream(con.getOutputStream()); - out.writeBytes(sdncReqBody); - out.flush(); - out.close(); - } - - //Get response - sdncResp.setRespCode(con.getResponseCode()); - sdncResp.setRespMsg(con.getResponseMessage()); - - if (con.getResponseCode()>= 200 && con.getResponseCode()<=299) { - in = new BufferedReader(new InputStreamReader(con.getInputStream())); - String inputLine; - //Not parsing the response -it contains a responseHdr section and data section - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - } - - sdncResp.setSdncRespXml(response.toString()); - msoLogger.info(MessageEnum.RA_RESPONSE_FROM_SDNC, sdncResp.toString(), "SDNC", ""); - return(sdncResp); - } - catch (Exception e) - { - msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception processing request to SDNC", e); - //default - sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR); - String respMsg = "Error processing request to SDNC. "; - StringBuilder sdncErrMsg = new StringBuilder(); - - if (e instanceof java.net.SocketTimeoutException ) - { - sdncResp.setRespCode(HttpURLConnection.HTTP_CLIENT_TIMEOUT); - respMsg = "Request to SDNC timed out. "; - } - if (con != null) - { - try { //e1 - if (con.getResponseCode() != HttpURLConnection.HTTP_OK) //seen in SocketException connection reset - sdncResp.setRespCode(con.getResponseCode()); - respMsg = respMsg + con.getResponseMessage() + ". "; - InputStream is = con.getErrorStream(); - if (is != null) - { - XPathFactory xpathFactory = XPathFactory.newInstance(); - XPath xpath = xpathFactory.newXPath(); - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); - DocumentBuilder db; - Document doc = null; - try { //e2 - db = dbf.newDocumentBuilder(); - doc = db.parse(is); - NodeList errors = (NodeList)xpath.evaluate("errors/error", doc, XPathConstants.NODESET); - for (int i = 0; i < errors.getLength(); i++) - { - Element error = (Element) errors.item(i); - String eType = null; - try { - eType = xpath.evaluate("error-type", error); - sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType); - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - - String eTag = null; - try { - eTag = xpath.evaluate( "error-tag", error); - sdncErrMsg.append(", error-tag:").append(eTag); - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - - String eMsg = null; - try { - eMsg = xpath.evaluate("error-message", error); - sdncErrMsg.append(", error-message:").append(eMsg).append("]"); - } catch (Exception e3) { - msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); - } - } - } catch (Exception e2) { - msoLogger.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while analyse error", e2); - } - } //is != null - } catch (Exception e1) { - msoLogger.error (MessageEnum.RA_ERROR_GET_RESPONSE_SDNC, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception while get SDNC response", e1); - } - } //con != null - - if (e.getMessage() != null) { - respMsg = respMsg + e.getMessage(); - } - respMsg = respMsg + sdncErrMsg; - - sdncResp.setRespMsg(respMsg); - - msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg); - return sdncResp; - } - finally - { - if (con != null) { - con.disconnect(); - } - } - } - - public static void sendRespToBpel(String bpelUrl, SDNCResponse sdncResp,MsoPropertiesFactory msoPropertiesFactoryp) - { - String error; - try - { - SDNCAdapterCallbackRequest cbReq = new SDNCAdapterCallbackRequest(); - cbReq.setCallbackHeader(new CallbackHeader(sdncResp.getReqId(), Integer.toString(sdncResp.getRespCode()), sdncResp.getRespMsg())); - if (sdncResp.getSdncRespXml() != null) - { - cbReq.setRequestData(sdncResp.getSdncRespXml()); - } - msoLogger.info(MessageEnum.RA_CALLBACK_BPEL, cbReq.toString(), "Camunda", ""); - - URL wsdlUrl = null; - try { - wsdlUrl = new URL (bpelUrl); - } catch (MalformedURLException e1) { - error = "Caught exception initializing Callback wsdl " + e1.getMessage(); - msoLogger.error(MessageEnum.RA_INIT_CALLBACK_WSDL_ERR, "Camunda", "", MsoLogger.ErrorCode.DataError, "Exception initializing Callback wsdl", e1); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - } - - SDNCCallbackAdapterService cbSvc = new SDNCCallbackAdapterService(); - - SDNCCallbackAdapterPortType cbPort = cbSvc.getSDNCCallbackAdapterSoapHttpPort(); - - BindingProvider bp = (BindingProvider)cbPort; - - if(null != wsdlUrl) { - bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsdlUrl.toExternalForm()); - } - else { - msoLogger.debug("wsdlUrl is NULL:"); - } - - //authentication - try - { - Map reqCtx = bp.getRequestContext(); - Map> headers = new HashMap<>(); - String userCredentials = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getEncryptedProperty(Constants.BPEL_AUTH_PROP, Constants.DEFAULT_BPEL_AUTH, Constants.ENCRYPTION_KEY); - - String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers); - headers.put ("Authorization", Collections.singletonList(basicAuth)); - } - catch (Exception e2) { - error = "Unable to set authorization in callback request " + e2.getMessage(); - msoLogger.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e2); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - } - - msoLogger.debug("Invoking Bpel Callback. BpelCallbackUrl:" + bpelUrl); - cbPort.sdncAdapterCallback(cbReq); - - } - catch (Exception e) - { - error = "Error sending BpelCallback request" + e.getMessage(); - msoLogger.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending BpelCallback request", e); - alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - } - msoLogger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE, "Camunda", ""); - return; - } - -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java deleted file mode 100644 index 6ab9ade143..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java +++ /dev/null @@ -1,198 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.impl; - - -import java.io.StringWriter; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -public class Utils { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - private Utils() { - } - - public static String genSdncReq(Document reqDoc, RequestTunables rt) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - Element root = newdoc.createElementNS(rt.getNamespace(), "input"); - newdoc.appendChild(root); - - //Header - Element hdr = newdoc.createElement(rt.getHeaderName()); - root.appendChild(hdr); - - String elemData = rt.getReqId(); - Element hdrChild; - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-request-id"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - elemData = rt.getAction(); - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-action"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - elemData = rt.getSdncaNotificationUrl(); - if (elemData != null && elemData.length() > 0) - { - hdrChild = newdoc.createElement("svc-notification-url"); - hdrChild.appendChild(newdoc.createTextNode(elemData)); - hdr.appendChild(hdrChild); - } - - //RequestData - NodeList nodes = reqDoc.getDocumentElement().getChildNodes(); - for (int i = 0; i < nodes.getLength(); i++) { - Node n = nodes.item(i); - Node newNode = newdoc.importNode(n, true); - root.appendChild(newNode); - } - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncReq:\n" + s); - return s; - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e); - } - return null; - } - - public static String genSdncPutReq(Document reqDoc, RequestTunables rt) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - - //RequestData - NodeList nodes = reqDoc.getDocumentElement().getChildNodes(); - - - Element root = newdoc.createElement(nodes.item(0).getNodeName()); - newdoc.appendChild(root); - - NodeList childNodes = nodes.item(0).getChildNodes(); - for (int i = 0; i < childNodes.getLength(); i++) { - Node n = childNodes.item(i); - Node newNode = newdoc.importNode(n, true); - root.appendChild(newNode); - } - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncPutReq:\n" + s); - return s; - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genSdncPutReq", e); - } - return null; - } - - public static String genMsoFailResp(SDNCResponse resp) { - try { - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - - //NewDoc for output - //Root - Document newdoc = db.newDocument(); - Element root = newdoc.createElement("output"); - newdoc.appendChild(root); - - Element elem1 = newdoc.createElement("svc-request-id"); - elem1.appendChild(newdoc.createTextNode(resp.getReqId())); - root.appendChild(elem1); - - Element elem2 = newdoc.createElement("response-code"); - elem2.appendChild(newdoc.createTextNode(String.valueOf(resp.getRespCode()))); - root.appendChild(elem2); - - Element elem3 = newdoc.createElement("response-message"); - elem3.appendChild(newdoc.createTextNode(String.valueOf(resp.getRespMsg()))); - root.appendChild(elem3); - - String s = domToStr(newdoc); - msoLogger.debug("Formatted SdncReq:" + s); - return s; - - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception in genMsoFailResp", e); - } - return null; - } - - - public static String domToStr(Document doc) - { - if (doc != null) - { - try { - DOMSource ds = new DOMSource(doc); - StringWriter sw = new StringWriter(); - StreamResult sr = new StreamResult(sw); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer t = tf.newTransformer(); - //t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");// - t.transform(ds, sr); - String s = sw.toString(); - - // This is an awful fix for now but we don't want that xmlns="" to be generated - s = s.replaceAll("xmlns=\"\"", ""); - return s; - } catch (Exception e) { - msoLogger.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "", MsoLogger.ErrorCode.DataError, "Exception - domToStr", e); - } - } - return null; - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java deleted file mode 100644 index 871b132d15..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java +++ /dev/null @@ -1,192 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.notify; - - -import java.io.StringReader; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathFactory; - -import org.openecomp.mso.utils.UUIDChecker; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; - -import org.openecomp.mso.adapters.sdnc.impl.Constants; -import org.openecomp.mso.adapters.sdnc.impl.SDNCAdapterPortTypeImpl; -import org.openecomp.mso.adapters.sdnc.impl.SDNCResponse; -import org.openecomp.mso.adapters.sdnc.impl.SDNCRestClient; -import org.openecomp.mso.adapters.sdnc.util.SDNCRequestIdUtil; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoPropertiesFactory; -import org.openecomp.mso.logger.MessageEnum; - -//SDNC to SDNC Async Notifcations -@Path("/") -public class SDNCNotifyResource { - - private MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory(); - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - @GET() - public Response printMessage () { - long startTime = System.currentTimeMillis (); - UUIDChecker.generateUUID (msoLogger); - String result = "SDNCAdapter Rest services"; - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - return Response.status (HttpServletResponse.SC_OK).entity (result).build (); - - } - - @GET() - @Path("/{param}") - public Response printMessageParam (@PathParam("param") String msg) { - long startTime = System.currentTimeMillis (); - UUIDChecker.generateUUID (msoLogger); - String result = "SDNCAdapter Rest services : " + msg; - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - return Response.status (HttpServletResponse.SC_OK).entity (result).build (); - - } - - @POST - @Path("/SDNCNotify") - @Consumes("application/xml") - @Produces("application/xml") - public Response SDNCNotify (String reqXML, @Context HttpServletRequest request) { - - XPathFactory xpathFactory = XPathFactory.newInstance (); - XPath xpath = xpathFactory.newXPath (); - long startTime = System.currentTimeMillis (); - - msoLogger.info (MessageEnum.RA_RECEIVE_SDNC_NOTIF, reqXML, "SDNC", "SDNCNotify"); - - InputSource source = new InputSource (new StringReader (reqXML)); - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance (); - - DocumentBuilder db; - - try { - dbf.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); - db = dbf.newDocumentBuilder (); - } catch (ParserConfigurationException e) { - msoLogger.error (MessageEnum.RA_PARSING_REQUEST_ERROR, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.SchemaError, "Exception - Invalid XML request format", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Invalid XML request format"); - return Response.status (HttpServletResponse.SC_BAD_REQUEST).entity ("Invalid XML request format").build (); - } - - Document doc = null; - try { - doc = db.parse (source); - } catch (Exception e) { - msoLogger.error (MessageEnum.RA_PARSING_REQUEST_ERROR, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.SchemaError, "Exception - Invalid XML request format", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Invalid XML request format"); - return Response.status (HttpServletResponse.SC_BAD_REQUEST).entity ("Invalid XML request format").build (); - } - - try { - NodeList nl = (NodeList) xpath.evaluate (Constants.SDNC_SVCCFGRESP_ROOT, doc, XPathConstants.NODESET); - if (nl.getLength () <= 0) { - msoLogger.error (MessageEnum.RA_MISSING_PARAM, Constants.SDNC_SVCCFGRESP_ROOT, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.DataError, "Missing param"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Missing" + Constants.SDNC_SVCCFGRESP_ROOT); - return Response.status (HttpServletResponse.SC_BAD_REQUEST) - .entity ("Missing " + Constants.SDNC_SVCCFGRESP_ROOT) - .build (); - } - } catch (Exception e) { - msoLogger.error (MessageEnum.RA_MISSING_PARAM, Constants.SDNC_SVCCFGRESP_ROOT, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.DataError, "Exception - Missing param", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Missing" + Constants.SDNC_SVCCFGRESP_ROOT); - return Response.status (HttpServletResponse.SC_BAD_REQUEST) - .entity ("Missing " + Constants.SDNC_SVCCFGRESP_ROOT) - .build (); - } - - String reqId; - try { - reqId = xpath.evaluate (Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_REQ_ID, doc); - } catch (Exception e) { - msoLogger.error (MessageEnum.RA_MISSING_PARAM, Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_REQ_ID, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.DataError, "Exception - Missing param", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Missing" + Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_REQ_ID); - return Response.status (HttpServletResponse.SC_BAD_REQUEST) - .entity ("Missing " + Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_REQ_ID) - .build (); - } - - MsoLogger.setLogContext (SDNCRequestIdUtil.getSDNCOriginalRequestId (reqId), ""); - - String respCode; - try { - respCode = xpath.evaluate (Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_CODE, doc); - } catch (Exception e) { - msoLogger.error (MessageEnum.RA_MISSING_PARAM, - Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_CODE, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.DataError, "Exception - Missing param", - e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Missing" + Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_CODE); - return Response.status (HttpServletResponse.SC_BAD_REQUEST) - .entity ("Missing" + Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_CODE) - .build (); - } - - String respMsg = ""; - try { - respMsg = xpath.evaluate (Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_MSG, doc); - } catch (Exception e) { - msoLogger.error (MessageEnum.RA_MISSING_PARAM, Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_MSG, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.DataError, "Exception - Missing param", e); - } - - String bpelUrl; - - bpelUrl = SDNCAdapterPortTypeImpl.getProperty (Constants.BPEL_URL_PROP, Constants.DEFAULT_BPEL_URL,msoPropertiesFactory); - if (bpelUrl == null) { - msoLogger.debug("bpelUrl is NULL:"); - } - - SDNCResponse sdncResp = new SDNCResponse (reqId); - sdncResp.setRespCode (Integer.parseInt (respCode)); - sdncResp.setRespMsg (respMsg); - sdncResp.setSdncRespXml (reqXML); - long subStartTime = System.currentTimeMillis (); - SDNCRestClient.sendRespToBpel (bpelUrl, sdncResp,msoPropertiesFactory); - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully send request to BPMN", "BPMN", bpelUrl, null); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - return Response.ok ().build (); - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/package-info.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/package-info.java deleted file mode 100644 index fa06b000d6..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package org.openecomp.mso.adapters.sdnc; - diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java deleted file mode 100644 index f6708a2586..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java +++ /dev/null @@ -1,170 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.sdnc.sdncrest; - -import org.openecomp.mso.adapters.sdnc.impl.Constants; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; - -import javax.xml.bind.DatatypeConverter; - -/** - * Sends asynchronous messages to the BPMN WorkflowMessage service. - */ -public class BPRestCallback { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); - - /** - * Sends a message to the BPMN workflow message service. The URL path is - * constructed using the specified message type and correlator. - * @param workflowMessageUrl the base BPMN WorkflowMessage URL - * @param messageType the message type - * @param correlator the message correlator - * @param message the JSON content - * @return true if the message was consumed successfully by the endpoint - */ - public boolean send(String workflowMessageUrl, String messageType, String correlator, String message) { - LOGGER.debug(getClass().getSimpleName() + ".send(" - + "workflowMessageUrl=" + workflowMessageUrl - + " messageType=" + messageType - + " correlator=" + correlator - + " message=" + message - + ")"); - - while (workflowMessageUrl.endsWith("/")) { - workflowMessageUrl = workflowMessageUrl.substring(0, workflowMessageUrl.length()-1); - } - - String endpoint = workflowMessageUrl + "/" + SDNCAdapterUtils.encodeURLPathSegment(messageType) - + "/" + SDNCAdapterUtils.encodeURLPathSegment(correlator); - - return send(endpoint, message); - } - - /** - * Sends a message to the BPMN workflow message service. The specified URL - * must have the message type and correlator already embedded in it. - * @param url the endpoint URL - * @param message the JSON content - * @return true if the message was consumed successfully by the endpoint - */ - public boolean send(String url, String message) { - LOGGER.debug(getClass().getSimpleName() + ".send(" - + "url=" + url - + " message=" + message - + ")"); - - LOGGER.info(MessageEnum.RA_CALLBACK_BPEL, message == null ? "[no content]" : message, "Camunda", ""); - - HttpPost method = null; - HttpResponse httpResponse = null; - - try { - // TODO: configurable timeout? - int timeout = 60 * 1000; - - RequestConfig requestConfig = RequestConfig.custom() - .setSocketTimeout(timeout) - .setConnectTimeout(timeout) - .setConnectionRequestTimeout(timeout) - .build(); - - HttpClient client = HttpClientBuilder.create().build(); - method = new HttpPost(url); - method.setConfig(requestConfig); - - if (message != null) { - method.setEntity(new StringEntity(message, ContentType.APPLICATION_JSON)); - } - - boolean error = false; - - try { - // AAF Integration, disabled for now due to the constrains from other party - // String userCredentials = CredentialConstants.getDecryptedCredential(Constants.DEFAULT_BPEL_AUTH); - // Once AAF enabled, the credential shall be get by triggering the CredentialConstants.getDecryptedCredential -- remove line - String userCredentials = SDNCAdapterProperties.getEncryptedProperty(Constants.BPEL_AUTH_PROP, - Constants.DEFAULT_BPEL_AUTH, Constants.ENCRYPTION_KEY); - String authorization = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - method.setHeader("Authorization", authorization); - } catch (Exception e) { - LOGGER.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, - "Unable to set authorization in callback request", e); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, - "Unable to set authorization in callback request: " + e.getMessage()); - error = true; - } - - if (!error) { - httpResponse = client.execute(method); - - @SuppressWarnings("unused") - String responseContent = null; - - if (httpResponse.getEntity() != null) { - responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); - } - - if (httpResponse.getStatusLine().getStatusCode() >= 300) { - String msg = "Received error response to callback request: " + httpResponse.getStatusLine(); - LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, msg); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, msg); - } - } - return true; - } catch (Exception e) { - LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, - "Error sending callback request", e); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, - "Error sending callback request: " + e.getMessage()); - return false; - } finally { - if (httpResponse != null) { - try { - EntityUtils.consume(httpResponse.getEntity()); - httpResponse = null; - } catch (Exception e) { - LOGGER.debug("Exception:", e); - } - } - - if (method != null) { - try { - method.reset(); - } catch (Exception e) { - LOGGER.debug("Exception:", e); - } - } - - LOGGER.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE, "Camunda", ""); - } - } -} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java deleted file mode 100644 index 4d0190243b..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.sdnc.sdncrest; - -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -/** - * Static methods to access SDNC adapter properties. - */ -public final class SDNCAdapterProperties { - private static final String MSO_PROPERTIES_ID = "MSO_PROP_SDNC_ADAPTER"; - private static final MsoPropertiesFactory MSO_PROPERTIES_FACTORY = new MsoPropertiesFactory(); - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - /** - * Gets the value of an SDNC adapter property. - * @param key the property key - * @param defaultValue the default value to use if the property does not - * exist or if an error occurs - */ - public static String getProperty(String key, String defaultValue) { - MsoJavaProperties properties; - - try { - properties = MSO_PROPERTIES_FACTORY.getMsoJavaProperties(MSO_PROPERTIES_ID); - } catch (MsoPropertiesException e) { - LOGGER.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROPERTIES_ID, - "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - return defaultValue; - } - - String value = properties.getProperty(key, defaultValue); - LOGGER.debug("Config read for " + MSO_PROPERTIES_ID + " - key:" + key + " value:" + value); - return value; - } - - /** - * Gets the value of an SDNC adapter property. - * @param key the property key - * @param defaultValue the default value to use if the property does not - * exist or if an error occurs - */ - public static String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { - MsoJavaProperties properties; - - try { - properties = MSO_PROPERTIES_FACTORY.getMsoJavaProperties(MSO_PROPERTIES_ID); - } catch (MsoPropertiesException e) { - LOGGER.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROPERTIES_ID, - "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - return defaultValue; - } - - String value = properties.getEncryptedProperty(key, defaultValue, encryptionKey); - LOGGER.debug("Config read for " + MSO_PROPERTIES_ID + " - key:" + key); - return value; - } - - /** - * Instantiation is not allowed. - */ - private SDNCAdapterProperties() { - } -} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java deleted file mode 100644 index f7a37fc202..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java +++ /dev/null @@ -1,239 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.sdnc.sdncrest; - -import org.openecomp.mso.HealthCheckUtils; -import org.openecomp.mso.adapters.sdnc.impl.Constants; -import org.openecomp.mso.adapters.sdncrest.SDNCEvent; -import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon; -import org.openecomp.mso.adapters.sdncrest.SDNCServiceError; -import org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.utils.UUIDChecker; -import org.apache.http.HttpStatus; - -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.*; -import javax.ws.rs.core.GenericEntity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.text.ParseException; - -/** - * SDNC REST adapter interface added in 1702 to support the SDNC "agnostic" API. - */ -@Path("/") -public class SDNCAdapterRest { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); - - private static final String MSO_PROPERTIES_ID = "MSO_PROP_SDNC_ADAPTER"; - - @HEAD - @GET - @Path("/v1/sdnc/healthcheck") - @Produces(MediaType.TEXT_HTML) - public Response healthcheck(@QueryParam("requestId") String requestId) { - long startTime = System.currentTimeMillis(); - MsoLogger.setServiceName("Healthcheck"); - UUIDChecker.verifyOldUUID(requestId, LOGGER); - HealthCheckUtils healthCheck = new HealthCheckUtils(); - - if (!healthCheck.siteStatusCheck(LOGGER)) { - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - - if (!healthCheck.configFileCheck(LOGGER, startTime, MSO_PROPERTIES_ID)) { - return HealthCheckUtils.NOT_STARTED_RESPONSE; - } - - LOGGER.debug("healthcheck - Successful"); - return HealthCheckUtils.HEALTH_CHECK_RESPONSE; - } - - /** - * Processes an SDNCServiceRequest (a request for "agnostic" API services) from BP. - * @param request the request - * @param msoRequestId the request ID for the top-level MSO flow (used for logging only) - * @param msoServiceInstanceId the top-level service-instance-id (used for logging only) - */ - @POST - @Path("/v1/sdnc/services") - @Consumes({MediaType.APPLICATION_JSON}) - @Produces({MediaType.APPLICATION_JSON}) - public Response service( - SDNCServiceRequest request, - @HeaderParam(value="mso-request-id") String msoRequestId, - @HeaderParam(value="mso-service-instance-id") String msoServiceInstanceId) { - - MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId); - - try { - LOGGER.debug(getClass().getSimpleName() + ".service(request)" - + " entered with request: " + request.toJson()); - - SDNCServiceRequestTask task = new SDNCServiceRequestTask(request, msoRequestId, - msoServiceInstanceId, "/services"); - - try { - Thread thread = new Thread(task); - thread.start(); - } catch (Exception e) { - String msg = "Failed to start thread to run SDNCServiceTask"; - LOGGER.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, msg, e); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, msg); - SDNCServiceError error = new SDNCServiceError(request.getSDNCRequestId(), - String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), e.toString(), "Y"); - LOGGER.debug(getClass().getSimpleName() + ".service(request)" - + " exited with error: " + msg); - return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity(error){}) - .build(); - } - - // Send sync response to caller - LOGGER.debug(getClass().getSimpleName() + ".service(request)" - + " exited successfully"); - return Response.status(HttpStatus.SC_ACCEPTED).build(); - } catch (Exception e) { - String msg = "Caught " + e.getClass().getSimpleName() + " in 'service' method"; - LOGGER.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, msg, e); - LOGGER.debug(getClass().getSimpleName() + ".service(request)" - + " exited with error: " + msg); - SDNCServiceError error = new SDNCServiceError(request.getSDNCRequestId(), - String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), e.toString(), "Y"); - return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity(error){}) - .build(); - } - } - - /** - * Processes a notification from SDNC for "agnostic" API services. - * Note that the "myurl" configuration property specifies the path - * up to and including /SDNCNotify. The /services part of the path - * is added by this class. - * @param content the notification content - */ - @POST - @Path("/SDNCNotify/services") - @Consumes({MediaType.APPLICATION_XML}) - @Produces({MediaType.APPLICATION_XML}) - public Response serviceNotification(String content) { - LOGGER.info(MessageEnum.RA_RECEIVE_SDNC_NOTIF, content, "SDNC", "SDNCNotify/services"); - - long startTime = System.currentTimeMillis(); - - try { - // Because the format of a notification is exactly the same as that of - // a synchronous response, we can use the same code to parse it. - SDNCResponseCommon response = SDNCServiceRequestConnector.parseResponseContent(content); - - String bpUrl = SDNCAdapterProperties.getProperty(Constants.BPEL_REST_URL_PROP, null); - - if (bpUrl == null) { - String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; - LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "", - MsoLogger.ErrorCode.DataError, "Missing config param"); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build(); - } - - long bpStartTime = System.currentTimeMillis(); - BPRestCallback callback = new BPRestCallback(); - boolean callbackSuccess = callback.send(bpUrl, "SDNCAResponse", response.getSDNCRequestId(), response.toJson()); - - if (callbackSuccess) { - LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Sent notification", "BPMN", bpUrl, null); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - } else { - LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Failed to send notification", "BPMN", bpUrl, null); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Failed to send notification"); - } - - return Response.ok().build(); - } catch (ParseException e) { - LOGGER.error(MessageEnum.RA_PARSING_REQUEST_ERROR, "SDNC", "SDNCNotify/services", - MsoLogger.ErrorCode.SchemaError, e.getMessage()); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.SchemaError, e.getMessage()); - return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(e.getMessage()).build(); - } - } - - /** - * Processes an event notification from SDNC. - * Note that the "myurl" configuration property specifies the path - * up to and including /SDNCNotify. The /activate part of the path - * is added by this class. - * @param content the notification content - */ - @POST - @Path("/SDNCNotify/event") - @Consumes({MediaType.APPLICATION_XML}) - @Produces({MediaType.APPLICATION_XML}) - public Response eventNotification(String content) { - LOGGER.info(MessageEnum.RA_RECEIVE_SDNC_NOTIF, content, "SDNC", "SDNCNotify/event"); - - long startTime = System.currentTimeMillis(); - - try { - SDNCEvent event = SDNCEventParser.parse(content); - - String bpUrl = SDNCAdapterProperties.getProperty(Constants.BPEL_REST_URL_PROP, null); - - if (bpUrl == null) { - String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; - LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "", - MsoLogger.ErrorCode.DataError, "Missing config param"); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build(); - } - - long bpStartTime = System.currentTimeMillis(); - BPRestCallback callback = new BPRestCallback(); - boolean callbackSuccess = callback.send(bpUrl, "SDNCAEvent", event.getEventCorrelator(), event.toJson()); - - if (callbackSuccess) { - LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Sent notification", "BPMN", bpUrl, null); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - } else { - LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Failed to send notification", "BPMN", bpUrl, null); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Failed to send notification"); - } - - return Response.ok().build(); - } catch (ParseException e) { - LOGGER.error(MessageEnum.RA_PARSING_REQUEST_ERROR, "SDNC", "SDNCNotify/event", - MsoLogger.ErrorCode.SchemaError, e.getMessage()); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.SchemaError, e.getMessage()); - return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(e.getMessage()).build(); - } - } -} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java deleted file mode 100644 index 893ff82f11..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.sdnc.sdncrest; - -import org.springframework.web.util.UriUtils; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; -import org.openecomp.mso.logger.MsoLogger; - -/** - * Utility methods used by SDNCAdapterRest. - */ -public final class SDNCAdapterUtils { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - /** - * Instantiation is not allowed. - */ - private SDNCAdapterUtils() { - } - - /** - * Returns a node's child elements in a list. - */ - public static List childElements(Node node) { - List elements = new ArrayList<>(); - - NodeList nodeList = node.getChildNodes(); - for (int i = 0; i < nodeList.getLength(); i++) { - Node child = nodeList.item(i); - if (child.getNodeType() == Node.ELEMENT_NODE) { - elements.add((Element) child); - } - } - - return elements; - } - - /** - * Encodes a URL path segment according to RFC 3986 Section 2. - * @param pathSegment the path segment to encode - * @return the encoded path segment - */ - public static String encodeURLPathSegment(String pathSegment) { - try { - return UriUtils.encodePathSegment(pathSegment, "UTF-8"); - } catch (UnsupportedEncodingException e) { - LOGGER.debug("Exception:", e); - throw new RuntimeException("UTF-8 encoding is not supported"); - } - } -} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java deleted file mode 100644 index fa257164cf..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java +++ /dev/null @@ -1,317 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.sdnc.sdncrest; - -import org.openecomp.mso.adapters.sdnc.impl.Constants; -import org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon; -import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.*; -import org.apache.http.conn.ConnectTimeoutException; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; - -import javax.xml.XMLConstants; -import javax.xml.bind.DatatypeConverter; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; -import java.io.StringReader; -import java.net.HttpURLConnection; -import java.net.SocketTimeoutException; - -/** - * Sends requests to SDNC and processes the responses. - */ -public abstract class SDNCConnector { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); - - public SDNCResponseCommon send(String content, TypedRequestTunables rt) { - LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, rt.toString(), "SDNC", ""); - LOGGER.debug("SDNC Request Body:\n" + content); - - HttpRequestBase method = null; - HttpResponse httpResponse = null; - - try { - int timeout = Integer.parseInt(rt.getTimeout()); - - RequestConfig requestConfig = RequestConfig.custom() - .setSocketTimeout(timeout) - .setConnectTimeout(timeout) - .setConnectionRequestTimeout(timeout) - .build(); - - HttpClient client = HttpClientBuilder.create().build(); - - if ("POST".equals(rt.getReqMethod())) { - HttpPost httpPost = new HttpPost(rt.getSdncUrl()); - httpPost.setConfig(requestConfig); - httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_XML)); - method = httpPost; - } else if ("PUT".equals(rt.getReqMethod())) { - HttpPut httpPut = new HttpPut(rt.getSdncUrl()); - httpPut.setConfig(requestConfig); - httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_XML)); - method = httpPut; - } else if ("GET".equals(rt.getReqMethod())) { - HttpGet httpGet = new HttpGet(rt.getSdncUrl()); - httpGet.setConfig(requestConfig); - method = httpGet; - } else if ("DELETE".equals(rt.getReqMethod())) { - HttpDelete httpDelete = new HttpDelete(rt.getSdncUrl()); - httpDelete.setConfig(requestConfig); - method = httpDelete; - } - - // AAF Integration, disabled for now due to the constrains from other party - // String userCredentials = CredentialConstants.getSecurityProperties().getEncryptedProperty(CredentialConstants.DEFAULT_AUTH, "", CredentialConstants.getEncryptionKey()); - // if (userCredentials == null) { - // userCredentials = ""; - //} - String userCredentials = SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP, - Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); - String authorization = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - if(null != method) { - method.setHeader("Authorization", authorization); - method.setHeader("Accept", "application/yang.data+xml"); - } - else { - LOGGER.debug("method is NULL:"); - } - - - - httpResponse = client.execute(method); - - String responseContent = null; - if (httpResponse.getEntity() != null) { - responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); - } - - int statusCode = httpResponse.getStatusLine().getStatusCode(); - String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); - - LOGGER.debug("SDNC Response: " + statusCode + " " + statusMessage - + (responseContent == null ? "" : System.lineSeparator() + responseContent)); - - if (httpResponse.getStatusLine().getStatusCode() >= 300) { - String errMsg = "SDNC returned " + statusCode + " " + statusMessage; - - String errors = analyzeErrors(responseContent); - if (errors != null) { - errMsg += " " + errors; - } - - logError(errMsg); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); - return createErrorResponse(statusCode, errMsg, rt); - } - - httpResponse = null; - - if(null != method) { - method.reset(); - } - else { - LOGGER.debug("method is NULL:"); - } - - method = null; - - LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", ""); - return createResponseFromContent(statusCode, statusMessage, responseContent, rt); - - } catch (SocketTimeoutException | ConnectTimeoutException e) { - String errMsg = "Request to SDNC timed out"; - logError(errMsg, e); - return createErrorResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg, rt); - - } catch (Exception e) { - String errMsg = "Error processing request to SDNC"; - logError(errMsg, e); - return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg, rt); - - } finally { - if (httpResponse != null) { - try { - EntityUtils.consume(httpResponse.getEntity()); - } catch (Exception e) { - LOGGER.debug("Exception:", e); - } - } - - if (method != null) { - try { - method.reset(); - } catch (Exception e) { - LOGGER.debug("Exception:", e); - } - } - } - } - - protected void logError(String errMsg) { - LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", - MsoLogger.ErrorCode.AvailabilityError, errMsg); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); - } - - protected void logError(String errMsg, Throwable t) { - LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", - MsoLogger.ErrorCode.AvailabilityError, errMsg, t); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); - } - - /** - * Generates a response object from content received from SDNC. The response - * object may be a success response object or an error response object. This - * method must be overridden by the subclass to return the correct object type. - * @param statusCode the response status code from SDNC (e.g. 200) - * @param statusMessage the response status message from SDNC (e.g. "OK") - * @param responseContent the body of the response from SDNC (possibly null) - * @param rt request tunables - * @return a response object - */ - protected abstract SDNCResponseCommon createResponseFromContent(int statusCode, - String statusMessage, String responseContent, TypedRequestTunables rt); - - /** - * Generates an error response object. This method must be overridden by the - * subclass to return the correct object type. - * @param statusCode the response status code (from SDNC, or internally generated) - * @param errMsg the error message (normally a verbose explanation of the error) - * @param rt request tunables - * @return an error response object - */ - protected abstract SDNCErrorCommon createErrorResponse(int statusCode, - String errMsg, TypedRequestTunables rt); - - /** - * Called by the send() method to analyze errors that may be encoded in the - * content of non-2XX responses. By default, this method tries to parse the - * content as a restconf error. - *
-	 *     xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"
-	 * 
- * If an error (or errors) can be obtained from the content, then the result - * is a string in this format: - *
-	 * [error-type:TYPE, error-tag:TAG, error-message:MESSAGE] ...
-	 * 
- * If no error could be obtained from the content, then the result is null. - *

- * The subclass can override this method to provide another implementation. - */ - protected String analyzeErrors(String content) { - if (content == null || content.isEmpty()) { - return null; - } - - // Confirmed with Andrew Shen on 11/1/16 that SDNC will send content like - // this in error responses (non-2XX response codes) to "agnostic" service - // requests. - // - // - // - // protocol - // malformed-message - // Error parsing input: The element type "input" must be terminated by the matching end-tag "</input>". - // - // - - StringBuilder output = null; - - try { - XPathFactory xpathFactory = XPathFactory.newInstance(); - XPath xpath = xpathFactory.newXPath(); - DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); - documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - InputSource source = new InputSource(new StringReader(content)); - Document doc = documentBuilderFactory.newDocumentBuilder().parse(source); - NodeList errors = (NodeList) xpath.evaluate("errors/error", doc, XPathConstants.NODESET); - - for (int i = 0; i < errors.getLength(); i++) - { - Element error = (Element) errors.item(i); - - String info = ""; - - try { - String errorType = xpath.evaluate("error-type", error); - info += "error-type:" + errorType; - } catch (XPathExpressionException e) { - LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", - MsoLogger.ErrorCode.DataError, "XPath Exception", e); - } - - try { - String errorTag = xpath.evaluate( "error-tag", error); - if (!info.isEmpty()) { - info += ", "; - } - info += "error-tag:" + errorTag; - } catch (XPathExpressionException e) { - LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", - MsoLogger.ErrorCode.DataError, "XPath Exception", e); - } - - try { - String errorMessage = xpath.evaluate("error-message", error); - if (!info.isEmpty()) { - info += ", "; - } - info += "error-message:" + errorMessage; - } catch (Exception e) { - LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", - MsoLogger.ErrorCode.DataError, "XPath Exception", e); - } - - if (!info.isEmpty()) { - if (output == null) { - output = new StringBuilder("[" + info + "]"); - } else { - output.append(" [").append(info).append("]"); - } - } - } - } catch (Exception e) { - LOGGER.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "", - MsoLogger.ErrorCode.DataError, "Exception while analyzing errors", e); - } - - return output.toString(); - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java deleted file mode 100644 index 2263ab74df..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java +++ /dev/null @@ -1,161 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.sdnc.sdncrest; - -import org.openecomp.mso.adapters.sdncrest.SDNCEvent; -import org.openecomp.mso.logger.MsoLogger; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.xml.sax.InputSource; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.StringReader; -import java.text.ParseException; - -/** - * SDNCConnector for "agnostic" API services. - */ -public class SDNCEventParser { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - // Instantiation is not allowed. - private SDNCEventParser() { - } - - /** - * Parses SDNC event XML. If the content can be parsed and contains all required - * elements, then an object is returned. Otherwise, a ParseException is thrown. - * This method performs no logging or alarming. - * @throws ParseException on error - */ - public static SDNCEvent parse(String content) throws ParseException { - try { - // Note: this document builder is not namespace-aware, so namespaces are ignored. - DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); - documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - InputSource source = new InputSource(new StringReader(content)); - Document doc = documentBuilderFactory.newDocumentBuilder().parse(source); - - // Find the configuration-event child under the root element. - // The root element is expected to be an "output" element, but we don't really care. - - Element root = doc.getDocumentElement(); - Element configurationEvent = null; - - for (Element child : SDNCAdapterUtils.childElements(root)) { - if ("configuration-event".equals(child.getNodeName())) { - configurationEvent = child; - break; - } - } - - if (configurationEvent == null) { - throw new ParseException("No configuration-event element in SDNC event", 0); - } - - // Process the children of configuration-event - - String eventType = null; - String eventCorrelatorType = null; - String eventCorrelator = null; - Element eventParameters = null; - - for (Element child : SDNCAdapterUtils.childElements(configurationEvent)) { - if ("event-type".equals(child.getNodeName())) { - eventType = child.getTextContent(); - } else if ("event-correlator-type".equals(child.getNodeName())) { - eventCorrelatorType = child.getTextContent(); - } else if ("event-correlator".equals(child.getNodeName())) { - eventCorrelator = child.getTextContent(); - } else if ("event-parameters".equals(child.getNodeName())) { - eventParameters = child; - } - } - - // event-type is mandatory. - - if (eventType == null || eventType.isEmpty()) { - throw new ParseException("No event-type in SDNC event", 0); - } - - // event-correlator-type is mandatory. - - if (eventCorrelatorType == null || eventCorrelatorType.isEmpty()) { - throw new ParseException("No event-correlator-type in SDNC event", 0); - } - - // event-correlator is mandatory. - - if (eventCorrelator == null || eventCorrelator.isEmpty()) { - throw new ParseException("No event-correlator in SDNC event", 0); - } - - // Create an event object. - - SDNCEvent event = new SDNCEvent(eventType, eventCorrelatorType, eventCorrelator); - - // event-parameters is an optional container element. If present, - // process its children, adding values to the event object. - - if (eventParameters != null) { - for (Element element : SDNCAdapterUtils.childElements(eventParameters)) { - if (!"event-parameter".equals(element.getNodeName())) { - continue; - } - - String tagName = null; - String tagValue = null; - - for (Element child : SDNCAdapterUtils.childElements(element)) { - if ("tag-name".equals(child.getNodeName())) { - tagName = child.getTextContent(); - } else if ("tag-value".equals(child.getNodeName())) { - tagValue = child.getTextContent(); - } - } - - // tag-name is mandatory - - if (tagName == null) { - throw new ParseException("Missing tag-name in SDNC event parameter", 0); - } - - // tag-value is optional. If absent, make it an empty string so we don't - // end up with null values in the parameter map. - - if (tagValue == null) { - tagValue = ""; - } - - event.addParam(tagName, tagValue); - } - } - - return event; - } catch (ParseException e) { - throw e; - } catch (Exception e) { - LOGGER.debug("Exception:", e); - throw new ParseException("Failed to parse SDNC event:", 0 ); - } - } -} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java deleted file mode 100644 index 10175d83b5..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java +++ /dev/null @@ -1,199 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.sdnc.sdncrest; - -import org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon; -import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon; -import org.openecomp.mso.adapters.sdncrest.SDNCServiceError; -import org.openecomp.mso.adapters.sdncrest.SDNCServiceResponse; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.xml.sax.InputSource; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.StringReader; -import java.net.HttpURLConnection; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.List; -import org.openecomp.mso.logger.MsoLogger; - -/** - * SDNCConnector for "agnostic" API services. - */ -public class SDNCServiceRequestConnector extends SDNCConnector { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - @Override - protected SDNCResponseCommon createResponseFromContent(int statusCode, String statusMessage, - String responseContent, TypedRequestTunables rt) { - try { - return parseResponseContent(responseContent); - } catch (ParseException e) { - logError(e.getMessage()); - return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt); - } - } - - @Override - protected SDNCErrorCommon createErrorResponse(int statusCode, String errMsg, - TypedRequestTunables rt) { - return new SDNCServiceError(rt.getReqId(), String.valueOf(statusCode), errMsg, "Y"); - } - - /** - * Parses SDNC synchronous service response content or service notification content. - * If the content can be parsed and contains all required elements, then an object - * is returned. The type of the returned object depends on the response code - * contained in the content. For 2XX response codes, an SDNCServiceResponse is - * returned. Otherwise, an SDNCServiceError is returned. If the content cannot - * be parsed, or if the content does not contain all required elements, a parse - * exception is thrown. This method performs no logging or alarming. - * @throws ParseException on error - */ - public static SDNCResponseCommon parseResponseContent(String responseContent) - throws ParseException { - try { - // Note: this document builder is not namespace-aware, so namespaces are ignored. - DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); - documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - InputSource source = new InputSource(new StringReader(responseContent)); - Document doc = documentBuilderFactory.newDocumentBuilder().parse(source); - - // Find the configuration-response-common child under the root element. - // The root element is expected to be an "output" element, but we don't really care. - - Element root = doc.getDocumentElement(); - Element configurationResponseCommon = null; - - for (Element child : SDNCAdapterUtils.childElements(root)) { - if ("configuration-response-common".equals(child.getNodeName())) { - configurationResponseCommon = child; - break; - } - } - - if (configurationResponseCommon == null) { - throw new ParseException("No configuration-response-common element in SDNC response", 0); - } - - // Process the children of configuration-response-common. - - String responseCode = null; - String responseMessage = null; - String svcRequestId = null; - String ackFinalIndicator = null; - List responseParameters = new ArrayList<>(); - - for (Element child : SDNCAdapterUtils.childElements(configurationResponseCommon)) { - if ("response-code".equals(child.getNodeName())) { - responseCode = child.getTextContent(); - } else if ("response-message".equals(child.getNodeName())) { - responseMessage = child.getTextContent(); - } else if ("svc-request-id".equals(child.getNodeName())) { - svcRequestId = child.getTextContent(); - } else if ("ack-final-indicator".equals(child.getNodeName())) { - ackFinalIndicator = child.getTextContent(); - } else if ("response-parameters".equals(child.getNodeName())) { - responseParameters.add(child); - } - } - - // svc-request-id is mandatory. - - if (svcRequestId == null || svcRequestId.isEmpty()) { - throw new ParseException("No svc-request-id in SDNC response", 0); - } - - // response-code is mandatory. - - if (responseCode == null || responseCode.isEmpty()) { - throw new ParseException("No response-code in SDNC response", 0); - } - - // ack-final-indicator is optional: default to "Y". - - if (ackFinalIndicator == null || ackFinalIndicator.trim().isEmpty()) { - ackFinalIndicator = "Y"; - } - - if (!ackFinalIndicator.equals("Y") && !"N".equals(ackFinalIndicator)) { - throw new ParseException("Invalid ack-final-indicator in SDNC response: '" + ackFinalIndicator + "'", 0); - } - - // response-message is optional. If the value is empty, omit it from the response object. - - if (responseMessage != null && responseMessage.isEmpty()) { - responseMessage = null; - } - - // If the response code in the message from SDNC was not 2XX, return SDNCServiceError. - - if (!responseCode.matches("2[0-9][0-9]") && !responseCode.equals("0")) { - // Not a 2XX response. Return SDNCServiceError. - return new SDNCServiceError(svcRequestId, responseCode, responseMessage, ackFinalIndicator); - } - - // Create a success response object. - - SDNCServiceResponse response = new SDNCServiceResponse(svcRequestId, - responseCode, responseMessage, ackFinalIndicator); - - // Process any response-parameters that might be present. - - for (Element element : responseParameters) { - String tagName = null; - String tagValue = null; - - for (Element child : SDNCAdapterUtils.childElements(element)) { - if ("tag-name".equals(child.getNodeName())) { - tagName = child.getTextContent(); - } else if ("tag-value".equals(child.getNodeName())) { - tagValue = child.getTextContent(); - } - } - - // tag-name is mandatory - - if (tagName == null) { - throw new ParseException("Missing tag-name in SDNC response parameter", 0); - } - - // tag-value is optional. If absent, make it an empty string so we don't - // end up with null values in the parameter map. - - if (tagValue == null) { - tagValue = ""; - } - - response.addParam(tagName, tagValue); - } - - return response; - } catch (ParseException e) { - throw e; - } catch (Exception e) { - LOGGER.debug("Exception:", e); - throw new ParseException("Failed to parse SDNC response", 0); - } - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java deleted file mode 100644 index f3ae6d62f7..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java +++ /dev/null @@ -1,213 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.sdnc.sdncrest; - -import org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon; -import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon; -import org.openecomp.mso.adapters.sdncrest.SDNCServiceError; -import org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.apache.http.HttpStatus; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.io.StringWriter; - -public class SDNCServiceRequestTask implements Runnable { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - private final SDNCServiceRequest request; - private final String msoRequestId; - private final String msoServiceInstanceId; - private final String myUrlSuffix; - - public SDNCServiceRequestTask(SDNCServiceRequest request, - String msoRequestId, String msoServiceInstanceId, - String myUrlSuffix) { - this.request = request; - this.msoRequestId = msoRequestId; - this.msoServiceInstanceId = msoServiceInstanceId; - this.myUrlSuffix = myUrlSuffix; - } - - @Override - public void run() - { - MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId); - MsoLogger.setServiceName(getClass().getSimpleName()); - - LOGGER.debug(getClass().getSimpleName() + ".run()" - + " entered with request: " + request.toJson()); - - String sdncRequestId = request.getSDNCRequestId(); - String sdncService = request.getSDNCService(); - String sdncOperation = request.getSDNCOperation(); - - TypedRequestTunables rt = new TypedRequestTunables(sdncRequestId, myUrlSuffix); - rt.setServiceKey(sdncService, sdncOperation); - - if (!rt.setTunables()) { - // Note that the error was logged and alarmed by setTunables() - SDNCServiceError error = new SDNCServiceError(request.getSDNCRequestId(), - String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), rt.getError(), "Y"); - BPRestCallback callback = new BPRestCallback(); - callback.send(request.getBPNotificationUrl(), error.toJson()); - return; - } - - String xml = genSdncReq(request, rt); - - long sdncStartTime = System.currentTimeMillis(); - SDNCConnector connector = new SDNCServiceRequestConnector(); - SDNCResponseCommon response = connector.send(xml, rt); - - if (response instanceof SDNCErrorCommon) { - LOGGER.recordMetricEvent(sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Received success response from SDNC", "SDNC", sdncService + "." + sdncOperation, null); - } else { - LOGGER.recordMetricEvent(sdncStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Received error response from SDNC", "SDNC", sdncService + "." + sdncOperation, null); - } - - long bpStartTime = System.currentTimeMillis(); - BPRestCallback callback = new BPRestCallback(); - boolean callbackSuccess = callback.send(request.getBPNotificationUrl(), response.toJson()); - - if (callbackSuccess) { - LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Sent notification", "BPMN", request.getBPNotificationUrl(), null); - } else { - LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Failed to send notification", "BPMN", request.getBPNotificationUrl(), null); - } - } - - private Element addChild(Element parent, String tag) { - Element child = parent.getOwnerDocument().createElement(tag); - parent.appendChild(child); - return child; - } - - private void addTextChild(Element parent, String tag, String text) { - if (text != null) { - Element child = parent.getOwnerDocument().createElement(tag); - child.setTextContent(text); - parent.appendChild(child); - } - } - - private String genSdncReq(SDNCServiceRequest request, TypedRequestTunables rt) { - Document doc; - - try { - DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); - - doc = documentBuilder.newDocument(); - Element root = doc.createElementNS(rt.getNamespace(), "input"); - doc.appendChild(root); - - Element hdr = addChild(root, rt.getHeaderName()); - addTextChild(hdr, "svc-request-id", rt.getReqId()); - addTextChild(hdr, "svc-notification-url", rt.getMyUrl()); - - Element requestInformation = addChild(root, "request-information"); - addTextChild(requestInformation, "request-id", request.getRequestInformation().getRequestId()); - if(request.getRequestInformation().getRequestAction()!= null) { - addTextChild(requestInformation, "request-action", - request.getRequestInformation().getRequestAction()); - } - if(request.getRequestInformation().getRequestSubAction()!= null) { - addTextChild(requestInformation, "request-sub-action", - request.getRequestInformation().getRequestSubAction()); - } - addTextChild(requestInformation, "source", request.getRequestInformation().getSource()); - addTextChild(requestInformation, "notification-url", request.getRequestInformation().getNotificationUrl()); - - Element serviceInformation = addChild(root, "service-information"); - addTextChild(serviceInformation, "service-type", request.getServiceInformation().getServiceType()); - addTextChild(serviceInformation, "service-instance-id", request.getServiceInformation().getServiceInstanceId()); - addTextChild(serviceInformation, "subscriber-name", request.getServiceInformation().getSubscriberName()); - addTextChild(serviceInformation, "subscriber-global-id", request.getServiceInformation().getSubscriberGlobalId()); - - Element agnosticServiceInformation = addChild(root, "agnostic-service-information"); - addTextChild(agnosticServiceInformation, "operation", request.getSDNCOperation()); - addTextChild(agnosticServiceInformation, "service", request.getSDNCService()); - - // anydata is mandatory in the SDNC schema, so if the data we got is null, - // set use an empty string instead to ensure we generate an empty element. - - String anydata = request.getSDNCServiceData(); - if (anydata == null) { - anydata = ""; - } - - // content-type is also mandatory. - - String contentType = request.getSDNCServiceDataType(); - - if (contentType == null || contentType.isEmpty()) { - if (anydata.isEmpty()) { - contentType = "XML"; - } else { - if (anydata.startsWith("<")) { - contentType = "XML"; - } else { - contentType = "JSON"; - } - } - } - - addTextChild(agnosticServiceInformation, "content-type", contentType); - addTextChild(agnosticServiceInformation, "anydata", anydata); - } catch (Exception e) { - LOGGER.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", - MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e); - return null; - } - - String xml; - - try { - StringWriter writer = new StringWriter(); - Transformer transformer = TransformerFactory.newInstance().newTransformer(); - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); - transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); - transformer.transform(new DOMSource(doc), new StreamResult(writer)); - xml = writer.toString(); - } catch (Exception e) { - LOGGER.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "", - MsoLogger.ErrorCode.DataError, "Exception - domToStr", e); - return null; - } - - LOGGER.debug("Formatted SDNC service request XML:\n" + xml); - return xml; - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SNIROResponse.java deleted file mode 100644 index aa17bac5c7..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SNIROResponse.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.sdnc.sdncrest; - -import org.openecomp.mso.adapters.sdnc.impl.Constants; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; - -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -/** - * A temporary interface to support notifications from SNIRO to BPMN. - * We added this to the SDNC adapter because we didn't have time to - * develop a SNIRO adapter in 1702. - */ -@Path("/") -public class SNIROResponse { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); - - @POST - @Path("/SDNCNotify/SNIROResponse/{correlator}") - @Consumes("*/*") - @Produces({MediaType.TEXT_PLAIN}) - public Response serviceNotification(@PathParam("correlator") String correlator, String content) { - LOGGER.info(MessageEnum.RA_RECEIVE_SDNC_NOTIF, content, "SDNC", "SDNCNotify/SNIROResponse"); - - long startTime = System.currentTimeMillis(); - - String bpUrl = SDNCAdapterProperties.getProperty(Constants.BPEL_REST_URL_PROP, null); - - if (bpUrl == null) { - String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; - LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "", - MsoLogger.ErrorCode.DataError, "Missing config param"); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build(); - } - - long bpStartTime = System.currentTimeMillis(); - BPRestCallback callback = new BPRestCallback(); - boolean callbackSuccess = callback.send(bpUrl, "SNIROResponse", correlator, content); - - if (callbackSuccess) { - LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Sent notification", "BPMN", bpUrl, null); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); - } else { - LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Failed to send notification", "BPMN", bpUrl, null); - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Failed to send notification"); - } - - return Response.status(204).build(); - } -} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java deleted file mode 100644 index 72fca989f6..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java +++ /dev/null @@ -1,224 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.sdnc.sdncrest; - -import org.openecomp.mso.adapters.sdnc.impl.Constants; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -/** - * Typed Request Tunables. Each entry is identified by a TYPE in the property name. - * Different types can have different keys. - *

- * General format: - *

- * org.openecomp.mso.adapters.sdnc.TYPE.KEY1[.KEY2...]=METHOD|TIMEOUT|URL|HEADER|NAMESPACE
- * 
- * Currently supported type(s): service - *
- * org.openecomp.mso.adapters.sdnc.service.SERVICE.OPERATION=METHOD|TIMEOUT|URL|HEADER|NAMESPACE
- * 
- */ -public class TypedRequestTunables { - - private static final String MSO_PROPERTIES_ID = "MSO_PROP_SDNC_ADAPTER"; - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); - - private final MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); - - private final String reqId; - private final String myUrlSuffix; - private String key = null; - private String error = null; - - // tunables (all are required) - private String reqMethod = null; - private String timeout = null; - private String sdncUrl = null; - private String headerName = null; - private String namespace = null; - private String myUrl = null; - - public TypedRequestTunables(String reqId, String myUrlSuffix) { - this.reqId = reqId; - this.myUrlSuffix = myUrlSuffix; - } - - /** - * Sets the key for a service request: - *
-	 * org.openecomp.mso.adapters.sdnc.service.SERVICE.OPERATION
-	 * 
- * @param service the sdncService - * @param operation the sdncOperation - */ - public void setServiceKey(String service, String operation) { - key = Constants.REQUEST_TUNABLES + ".service." + service + "." + operation; - LOGGER.debug("Generated " + getClass().getSimpleName() + " key: " + key); - } - - /** - * Gets the SDNC request ID. - */ - public String getReqId() { - return reqId; - } - - /** - * Gets the generated key. - */ - public String getKey() { - return key; - } - - /** - * Gets the most recent error, or null if there was no error. - */ - public String getError() { - return error; - } - - public String getReqMethod() { - return reqMethod; - } - - public String getTimeout() { - return timeout; - } - - public String getSdncUrl() { - return sdncUrl; - } - - public String getHeaderName() { - return headerName; - } - - public String getNamespace() { - return namespace; - } - - /** - * Gets the SDNC adapter notification URL, trimmed of trailing '/' characters. - */ - public String getMyUrl() { - return myUrl; - } - - /** - * Returns true if successful. If there is an error, it is logged and alarmed. - * The error description may be retrieved by calling getError(). - */ - public boolean setTunables() { - error = null; - MsoJavaProperties properties; - - try { - properties = msoPropertiesFactory.getMsoJavaProperties(MSO_PROPERTIES_ID); - } catch (MsoPropertiesException e) { - error = "Mso Properties ID not found in cache: " + MSO_PROPERTIES_ID; - LOGGER.error(MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. " + error, "SDNC", "", - MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - return false; - } - - String value = properties.getProperty(key, ""); - - if ("".equals(value)) { - error = "Missing configuration for: " + key; - LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - return false; - } - - String[] parts = value.split("\\|"); - - if (parts.length != 5) { - error = "Invalid configuration for: " + key; - LOGGER.error(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config"); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - return false; - } - - reqMethod = parts[0]; - LOGGER.debug("Request Method is set to: " + reqMethod); - - timeout = parts[1]; - LOGGER.debug("Timeout is set to: " + timeout); - - String urlPropKey = Constants.REQUEST_TUNABLES + "." + parts[2]; - sdncUrl = properties.getProperty(urlPropKey, ""); - - if ("".equals(sdncUrl)) { - error = "Missing configuration for: " + urlPropKey; - LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, urlPropKey, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - return false; - } - - LOGGER.debug("SDNC Url is set to: " + sdncUrl); - - headerName = parts[3]; - LOGGER.debug("Header Name is set to: " + headerName); - - namespace = parts[4]; - LOGGER.debug("Namespace is set to: " + namespace); - - myUrl = properties.getProperty(Constants.MY_URL_PROP, ""); - - if ("".equals(myUrl)) { - error = "Missing configuration for: " + Constants.MY_URL_PROP; - LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.MY_URL_PROP, "SDNC", "", - MsoLogger.ErrorCode.DataError, "Missing config param"); - ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); - return false; - } - - while (myUrl.endsWith("/")) { - myUrl = myUrl.substring(0, myUrl.length()-1); - } - - myUrl += myUrlSuffix; - - LOGGER.debug(toString()); - return true; - } - - @Override - public String toString() { - return getClass().getSimpleName() + "[" - + "reqId=" + reqId - + (key == null ? "" : ", key=" + key) - + (reqMethod == null ? "" : ", reqMethod=" + reqMethod) - + (sdncUrl == null ? "" : ", sdncUrl=" + sdncUrl) - + (timeout == null ? "" : ", timeout=" + timeout) - + (headerName == null ? "" : ", headerName=" + headerName) - + (namespace == null ? "" : ", namespace=" + namespace) - + (myUrl == null ? "" : ", myUrl=" + myUrl) - + "]"; - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtil.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtil.java deleted file mode 100644 index f109b43ea2..0000000000 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtil.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapters.sdnc.util; - - -public class SDNCRequestIdUtil { - // Add private constructor to prevent instance creation. - private SDNCRequestIdUtil () {} - - public static String getSDNCOriginalRequestId (String newRequestId) { - - // Camunda scripts will add postfix, such as -1, -2, on the original requestID, to make sure requestID is unique while sending request to SDNC - // In order to use the unique requestID in logging, need to remove the postfix added by the Camunda scripts - // Verify whether the requestId is a valid UUID with postfix (-1, -2). If yes, it should contain 5 times char '-', since valid UUID contains 4 times '-' - // If the requestId is not a valid UUID with postfix, we do nothing - if (newRequestId.split("-").length == 6) { - return newRequestId.substring(0, newRequestId.lastIndexOf('-')); - } - return newRequestId; - } -} diff --git a/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapter.wsdl b/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapter.wsdl index 7a66cd418b..44ce00bf45 100644 --- a/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapter.wsdl +++ b/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapter.wsdl @@ -1,16 +1,16 @@ + targetNamespace="http://org.onap/workflow/sdnc/adapter/wsdl/v1"> - + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapterSchema.xsd b/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapterSchema.xsd index ed904d4a2e..ea45521dd7 100644 --- a/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapterSchema.xsd +++ b/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapterSchema.xsd @@ -1,8 +1,8 @@ - diff --git a/adapters/mso-sdnc-adapter/src/main/resources/SDNCCallbackAdapter.wsdl b/adapters/mso-sdnc-adapter/src/main/resources/SDNCCallbackAdapter.wsdl index 0a106752fb..2ba21ce029 100644 --- a/adapters/mso-sdnc-adapter/src/main/resources/SDNCCallbackAdapter.wsdl +++ b/adapters/mso-sdnc-adapter/src/main/resources/SDNCCallbackAdapter.wsdl @@ -1,16 +1,16 @@ + targetNamespace="http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1"> - + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml b/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml new file mode 100644 index 0000000000..44f295e425 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml @@ -0,0 +1,131 @@ +management: + context-path: /manage +mso: + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + logPath: /app/logs/sdnc + catalog: + db: + spring: + endpoint: "http://localhost:8080" + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + site-name: local +org: + onap: + so: + adapters: + sdnc: + '.': + put: PUT|60000|sdncurl5| + query: GET|60000|sdncurl2| + restdelete: DELETE|60000|sdncurl5| + '': + contrail-route-topology-operation: + activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + create: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + network-topology-operation: + activate: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + assign: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + changeassign: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + changedelete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + delete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + reserve: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + rollback: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + security-zone-topology-operation: + activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + create: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + service-topology-operation: + assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + rollback: POST|270000|sdncur10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + vnf-topology-operation: + activate: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + assign: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + changeassign: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + changedelete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + delete: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + rollback: POST|270000|sdncurl6|sdnc-request-header|org:onap:sdnctl:vnf + bpelauth: 9997930a04f74e8dfd3acedf6be6f8c2ec4fb3720521304f64a468ba54ef1e14 + bpelurl: http://localhost:8080/mso/SDNCAdapterCallbackService + generic-resource: + network-topology-operation: + activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + vf-module-topology-operation: + activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + changeassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + changedelete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + rollback: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + vnf-topology-operation: + activate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + assign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + changeassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + changedelete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + deactivate: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + delete: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + rollback: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + unassign: POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + infra: + '': + query: GET|60000|sdncurl5| + mobility: + '': + query: GET|60000|sdncurl5| + myurl: http://localhost:8080/adapters/rest/SDNCNotify + rest: + bpelurl: http://localhost:8080/mso/WorkflowMessage + sdncauth: 406B2AE613211B6FB52466DE6E1769AC + sdncconnecttime: 5000 + sdncurl10: 'https://localhost:8443/restconf/operations/GENERIC-RESOURCE-API:' + sdncurl12: https://localhost:8443/ + sdncurl5: https://localhost:8443/restconf/config + sdncurl6: 'https://localhost:8443/restconf/operations/VNF-API:' + vfmodule: + '': + query: GET|60000|sdncurl12| +spring: + security: + usercredentials: + - + username: sdnc + password: '$2a$12$mukkC6IvLikKGBdwqGnev.H0ccvV6K13TFeLvyNhJoCuNkRjWhqi6' + role: SDNC-Client + - + username: sitecontrol + password: '$2a$12$VBUF.qBmeK1FNyO2MqTpD.P2M1tvlesZlhCkAjjHvF9hmYNVdMDmu' + role: SiteControl-Client + - + username: bpel + password: '$2a$12$/GW0/AVAUooTag.7GDc9a.jW7XH3nq/.QsJJJFZJ0N24iXB2W9ksO' + role: BPEL-Client + - + username: sniro + password: '$2a$12$lbOQWS1iDmdQPxW2Mb6OiuTzGaPUrkrvoKVn2zwpFWb6n5Y86Lf1y' + role: SNIRO-Client + - + username: apih + password: '$2a$12$e1BGJ7qknMN/b7bqsQvU2OT9iGunt9IlfQclKlCs6n240oHBfcO5y' + role: MSO-Client + - + username: mso_admin + password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' + role: ACTUATOR +ssl-enable: false diff --git a/adapters/mso-sdnc-adapter/src/main/resources/application.yaml b/adapters/mso-sdnc-adapter/src/main/resources/application.yaml new file mode 100644 index 0000000000..185bc5cbd1 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/application.yaml @@ -0,0 +1,22 @@ +server: + port: 8080 + tomcat: + max-threads: 50 + +mso: + logPath: ./logs/sdnc + site-name: sdncenv + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + +#Actuator +management: + context-path: /manage + metrics: + se-global-registry: false + export: + prometheus: + enabled: true # Whether exporting of metrics to Prometheus is enabled. + step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/index.html b/adapters/mso-sdnc-adapter/src/main/resources/static/index.html new file mode 100644 index 0000000000..a78644ebf7 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/index.html @@ -0,0 +1,41 @@ + + + + SO SDNC Adapters + + + +
+ + + + + + + + + + + + + + + + + +
+ Visit our Swagger UI +
+ CatalogDB Read me +
+ View Current Properties +
+ View Health +
+ View Metrics +
+ H2 Console +
+
+ + \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/index.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/index.html new file mode 100644 index 0000000000..b6ff8f3991 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/index.html @@ -0,0 +1,53 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Introduction

    +
  • +
  • +

    SO API Handler

    +
  • +
  • +

    SO API Handler utilizes RESTful interfaces to interact with consumer applications. The SO interface + is used to orchestrate VNFs, allow for manual task completion, and send vnf replace requests. + It contains both the SOServiceInstantiation API and SOManualTasks API.

    +
  • +
  • +

    SOServiceInstantiation API

    +
  • +
  • +

    The SOServiceInstantiation API handles service instance requests, and supports both macro and aLaCarte + orchestrations. Change management operations, activation and deactivation of service instances, and new + requests for configuration resources are handled by this API. This API is currently + set for version 6 ("v6") while also supporting versions 4 and 5 ("v4", "v5") minus additional "v6" features.

    +
  • +
  • +

    SOManualTasks API

    +
  • +
  • +

    The SOManualTasks API handles queries about open manual tasks. This API also accepts POST requests + containing information about how SO should proceed with handling the open tasks, and resolving the + errors. SOManualTasks API currently supports version 1 ("v1").

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/install.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/install.html new file mode 100644 index 0000000000..297a32074f --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/install.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Install

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/jars.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/jars.html new file mode 100644 index 0000000000..8d5c12bda7 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/jars.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Jars

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/layout.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/layout.html new file mode 100644 index 0000000000..cf47ed6a52 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/layout.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Layout

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/logging.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/logging.html new file mode 100644 index 0000000000..af68c7c634 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/logging.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Logging

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/onaplogo.png b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/onaplogo.png new file mode 100644 index 0000000000..c6f6857a58 Binary files /dev/null and b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/onaplogo.png differ diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/packaging.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/packaging.html new file mode 100644 index 0000000000..a72542c968 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/packaging.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Packaging

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/page.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/page.html new file mode 100644 index 0000000000..baee81bd83 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/page.html @@ -0,0 +1,67 @@ + + + + + + + \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/readme.css b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/readme.css new file mode 100644 index 0000000000..68963ba3ad --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/readme.css @@ -0,0 +1,114 @@ +html, body{ + margin:0; + padding:0; + height:100%; +} +div#page-wrapper{ + width: 991px; + min-height: 100%; + margin: auto; + border-style: solid; + border-width: thin; + border-color: #d0d6e0; + position: relative; +} +body{ + display:none; +} +nav#header{ + padding: 10px; + width: 972px; + height: 101.8px; + border-bottom: 1px solid #d0d6e0; + text-align: left; +} +nav#header ul{ + padding-left: 0px; + list-style-type: none; +} +nav#header a{ + color: #008080; + text-decoration: none; +} +nav#header a:hover{ + text-decoration: underline; +} +nav#left-col{ + position: absolute; + left: 0; + width: 248px; + padding-bottom: 35px; +} +nav#left-col ul{ + padding-left: 10px; + list-style-type: none; +} +.pages { + color: #008080; + text-decoration: none; + text-align: left; + font-size: 18px; +} +.sub-bullet a{ + text-decoration: none; + text-align: left; + font-size: 14px; + color: black; +} +.sub-bullet a:hover{ + text-decoration: underline; +} +div#right-col{ + padding-left: 150px; + padding-bottom: 35px; + padding-right: 50px; +} +.title{ + color: #008080; + font-size: 24px; + list-style-type: none; +} +.info-title{ + color: black; + font-size: 18px; + list-style-type: none; +} +.info{ + color: grey; + font-size: 14px; + list-style-type: none; +} +.info-list{ + list-style-position:inside; + font-size: 14px; + color: grey; + position: relative; + padding-bottom: 5px; +} +.info-sublist{ + list-style-position:inside; + font-size: 14px; + color: grey; + position: relative; + padding-bottom: 5px; + padding-left: 45px; +} +div#footer-wrapper{ + position: absolute; + bottom: 0; + width: 981px; + height: 35px; + background-color: #008080; + color: white; + font-size:15px; + text-align:right; + padding-right:10px; +} +div#footer-wrapper a{ + color: white; + text-align:right; + text-decoration:none; +} +div#footer-wrapper a:hover{ + text-decoration: underline; +} diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/spring.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/spring.html new file mode 100644 index 0000000000..c6e2b46710 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/spring.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Spring

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/tools.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/tools.html new file mode 100644 index 0000000000..b1813db387 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/tools.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Tools

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-16x16.png b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-16x16.png new file mode 100644 index 0000000000..0f7e13b0d9 Binary files /dev/null and b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-16x16.png differ diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-32x32.png b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-32x32.png new file mode 100644 index 0000000000..b0a3352ffd Binary files /dev/null and b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-32x32.png differ diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/index.html b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/index.html new file mode 100644 index 0000000000..37bd587752 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/index.html @@ -0,0 +1,95 @@ + + + + + + Swagger UI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/oauth2-redirect.html b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/oauth2-redirect.html new file mode 100644 index 0000000000..eb00dc686a --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/oauth2-redirect.html @@ -0,0 +1,60 @@ + + + + + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui-bundle.js b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui-bundle.js new file mode 100644 index 0000000000..50ac4c2e40 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui-bundle.js @@ -0,0 +1,99 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SwaggerUIBundle=t():e.SwaggerUIBundle=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist",t(t.s=1139)}([function(e,t,n){"use strict";e.exports=n(86)},function(e,t,n){e.exports=n(923)()},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(312),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(){function e(e,t){for(var n=0;n>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?d(e)+t:t}function v(){return!0}function g(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function y(e,t){return b(e,t,0)}function _(e,t){return b(e,t,t)}function b(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}function x(e){this.next=e}function k(e,t,n,r){var i=0===e?t:1===e?n:[t,n];return r?r.value=i:r={value:i,done:!1},r}function w(){return{value:void 0,done:!0}}function E(e){return!!A(e)}function S(e){return e&&"function"==typeof e.next}function C(e){var t=A(e);return t&&t.call(e)}function A(e){var t=e&&(kn&&e[kn]||e[wn]);if("function"==typeof t)return t}function D(e){return e&&"number"==typeof e.length}function O(e){return null===e||void 0===e?j():o(e)?e.toSeq():z(e)}function T(e){return null===e||void 0===e?j().toKeyedSeq():o(e)?a(e)?e.toSeq():e.fromEntrySeq():L(e)}function M(e){return null===e||void 0===e?j():o(e)?a(e)?e.entrySeq():e.toIndexedSeq():q(e)}function P(e){return(null===e||void 0===e?j():o(e)?a(e)?e.entrySeq():e:q(e)).toSetSeq()}function I(e){this._array=e,this.size=e.length}function F(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function N(e){this._iterable=e,this.size=e.length||e.size}function R(e){this._iterator=e,this._iteratorCache=[]}function B(e){return!(!e||!e[Sn])}function j(){return Cn||(Cn=new I([]))}function L(e){var t=Array.isArray(e)?new I(e).fromEntrySeq():S(e)?new R(e).fromEntrySeq():E(e)?new N(e).fromEntrySeq():"object"==typeof e?new F(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function q(e){var t=U(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function z(e){var t=U(e)||"object"==typeof e&&new F(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}function U(e){return D(e)?new I(e):S(e)?new R(e):E(e)?new N(e):void 0}function W(e,t,n,r){var i=e._cache;if(i){for(var o=i.length-1,a=0;a<=o;a++){var s=i[n?o-a:a];if(!1===t(s[1],r?s[0]:a,e))return a+1}return a}return e.__iterateUncached(t,n)}function V(e,t,n,r){var i=e._cache;if(i){var o=i.length-1,a=0;return new x(function(){var e=i[n?o-a:a];return a++>o?w():k(t,r?e[0]:a-1,e[1])})}return e.__iteratorUncached(t,n)}function H(e,t){return t?G(t,e,"",{"":e}):J(e)}function G(e,t,n,r){return Array.isArray(t)?e.call(r,n,M(t).map(function(n,r){return G(e,n,r,t)})):X(t)?e.call(r,n,T(t).map(function(n,r){return G(e,n,r,t)})):t}function J(e){return Array.isArray(e)?M(e).map(J).toList():X(e)?T(e).map(J).toMap():e}function X(e){return e&&(e.constructor===Object||void 0===e.constructor)}function K(e,t){if(e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if(e=e.valueOf(),t=t.valueOf(),e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function Y(e,t){if(e===t)return!0;if(!o(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||a(e)!==a(t)||s(e)!==s(t)||l(e)!==l(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!u(e);if(l(e)){var r=e.entries();return t.every(function(e,t){var i=r.next().value;return i&&K(i[1],e)&&(n||K(i[0],t))})&&r.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{i=!0;var c=e;e=t,t=c}var p=!0,f=t.__iterate(function(t,r){if(n?!e.has(t):i?!K(t,e.get(r,vn)):!K(e.get(r,vn),t))return p=!1,!1});return p&&e.size===f}function $(e,t){if(!(this instanceof $))return new $(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(An)return An;An=this}}function Z(e,t){if(!e)throw new Error(t)}function Q(e,t,n){if(!(this instanceof Q))return new Q(e,t,n);if(Z(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),t>>1&1073741824|3221225471&e}function oe(e){if(!1===e||null===e||void 0===e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null===e||void 0===e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!==e||e===1/0)return 0;var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)e/=4294967295,n^=e;return ie(n)}if("string"===t)return e.length>Rn?ae(e):se(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return ue(e);if("function"==typeof e.toString)return se(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function ae(e){var t=Ln[e];return void 0===t&&(t=se(e),jn===Bn&&(jn=0,Ln={}),jn++,Ln[e]=t),t}function se(e){for(var t=0,n=0;n0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}function ce(e){Z(e!==1/0,"Cannot perform this action with an infinite size.")}function pe(e){return null===e||void 0===e?ke():fe(e)&&!l(e)?e:ke().withMutations(function(t){var r=n(e);ce(r.size),r.forEach(function(e,n){return t.set(n,e)})})}function fe(e){return!(!e||!e[qn])}function he(e,t){this.ownerID=e,this.entries=t}function de(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function me(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function ve(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function ge(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function ye(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&be(e._root)}function _e(e,t){return k(e,t[0],t[1])}function be(e,t){return{node:e,index:0,__prev:t}}function xe(e,t,n,r){var i=Object.create(zn);return i.size=e,i._root=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function ke(){return Un||(Un=xe(0))}function we(e,t,n){var r,i;if(e._root){var o=c(gn),a=c(yn);if(r=Ee(e._root,e.__ownerID,0,void 0,t,n,o,a),!a.value)return e;i=e.size+(o.value?n===vn?-1:1:0)}else{if(n===vn)return e;i=1,r=new he(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=i,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?xe(i,r):ke()}function Ee(e,t,n,r,i,o,a,s){return e?e.update(t,n,r,i,o,a,s):o===vn?e:(p(s),p(a),new ge(t,r,[i,o]))}function Se(e){return e.constructor===ge||e.constructor===ve}function Ce(e,t,n,r,i){if(e.keyHash===r)return new ve(t,r,[e.entry,i]);var o,a=(0===n?e.keyHash:e.keyHash>>>n)&mn,s=(0===n?r:r>>>n)&mn;return new de(t,1<>>=1)a[s]=1&n?t[o++]:void 0;return a[r]=i,new me(e,o+1,a)}function Te(e,t,r){for(var i=[],a=0;a>1&1431655765,e=(858993459&e)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function Re(e,t,n,r){var i=r?e:h(e);return i[t]=n,i}function Be(e,t,n,r){var i=e.length+1;if(r&&t+1===i)return e[t]=n,e;for(var o=new Array(i),a=0,s=0;s0&&io?0:o-n,l=a-n;return l>dn&&(l=dn),function(){if(i===l)return Kn;var e=t?--l:i++;return r&&r[e]}}function i(e,r,i){var s,u=e&&e.array,l=i>o?0:o-i>>r,c=1+(a-i>>r);return c>dn&&(c=dn),function(){for(;;){if(s){var e=s();if(e!==Kn)return e;s=null}if(l===c)return Kn;var o=t?--c:l++;s=n(u&&u[o],r-hn,i+(o<=e.size||t<0)return e.withMutations(function(e){t<0?Ke(e,t).set(0,n):Ke(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,i=e._root,o=c(yn);return t>=$e(e._capacity)?r=Ge(r,e.__ownerID,0,t,n,o):i=Ge(i,e.__ownerID,e._level,t,n,o),o.value?e.__ownerID?(e._root=i,e._tail=r,e.__hash=void 0,e.__altered=!0,e):We(e._origin,e._capacity,e._level,i,r):e}function Ge(e,t,n,r,i,o){var a=r>>>n&mn,s=e&&a0){var l=e&&e.array[a],c=Ge(l,t,n-hn,r,i,o);return c===l?e:(u=Je(e,t),u.array[a]=c,u)}return s&&e.array[a]===i?e:(p(o),u=Je(e,t),void 0===i&&a===u.array.length-1?u.array.pop():u.array[a]=i,u)}function Je(e,t){return t&&e&&t===e.ownerID?e:new ze(e?e.array.slice():[],t)}function Xe(e,t){if(t>=$e(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&mn],r-=hn;return n}}function Ke(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new f,i=e._origin,o=e._capacity,a=i+t,s=void 0===n?o:n<0?o+n:i+n;if(a===i&&s===o)return e;if(a>=s)return e.clear();for(var u=e._level,l=e._root,c=0;a+c<0;)l=new ze(l&&l.array.length?[void 0,l]:[],r),u+=hn,c+=1<=1<p?new ze([],r):d;if(d&&h>p&&ahn;g-=hn){var y=p>>>g&mn;v=v.array[y]=Je(v.array[y],r)}v.array[p>>>hn&mn]=d}if(s=h)a-=h,s-=h,u=hn,l=null,m=m&&m.removeBefore(r,0,a);else if(a>i||h>>u&mn;if(_!==h>>>u&mn)break;_&&(c+=(1<i&&(l=l.removeBefore(r,u,a-c)),l&&ha&&(a=l.size),o(u)||(l=l.map(function(e){return H(e)})),i.push(l)}return a>e.size&&(e=e.setSize(a)),Ie(e,t,i)}function $e(e){return e>>hn<=dn&&a.size>=2*o.size?(i=a.filter(function(e,t){return void 0!==e&&s!==t}),r=i.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=i.__ownerID=e.__ownerID)):(r=o.remove(t),i=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(n===a.get(s)[1])return e;r=o,i=a.set(s,[t,n])}else r=o.set(t,a.size),i=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=i,e.__hash=void 0,e):et(r,i)}function rt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function it(e){this._iter=e,this.size=e.size}function ot(e){this._iter=e,this.size=e.size}function at(e){this._iter=e,this.size=e.size}function st(e){var t=Dt(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Ot,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return!1!==t(n,e,r)},n)},t.__iteratorUncached=function(t,n){if(t===xn){var r=e.__iterator(t,n);return new x(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===bn?_n:bn,n)},t}function ut(e,t,n){var r=Dt(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,i){var o=e.get(r,vn);return o===vn?i:t.call(n,o,r,e)},r.__iterateUncached=function(r,i){var o=this;return e.__iterate(function(e,i,a){return!1!==r(t.call(n,e,i,a),i,o)},i)},r.__iteratorUncached=function(r,i){var o=e.__iterator(xn,i);return new x(function(){var i=o.next();if(i.done)return i;var a=i.value,s=a[0];return k(r,s,t.call(n,a[1],s,e),i)})},r}function lt(e,t){var n=Dt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=st(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=Ot,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function ct(e,t,n,r){var i=Dt(e);return r&&(i.has=function(r){var i=e.get(r,vn);return i!==vn&&!!t.call(n,i,r,e)},i.get=function(r,i){var o=e.get(r,vn);return o!==vn&&t.call(n,o,r,e)?o:i}),i.__iterateUncached=function(i,o){var a=this,s=0;return e.__iterate(function(e,o,u){if(t.call(n,e,o,u))return s++,i(e,r?o:s-1,a)},o),s},i.__iteratorUncached=function(i,o){var a=e.__iterator(xn,o),s=0;return new x(function(){for(;;){var o=a.next();if(o.done)return o;var u=o.value,l=u[0],c=u[1];if(t.call(n,c,l,e))return k(i,r?l:s++,c,o)}})},i}function pt(e,t,n){var r=pe().asMutable();return e.__iterate(function(i,o){r.update(t.call(n,i,o,e),0,function(e){return e+1})}),r.asImmutable()}function ft(e,t,n){var r=a(e),i=(l(e)?Ze():pe()).asMutable();e.__iterate(function(o,a){i.update(t.call(n,o,a,e),function(e){return e=e||[],e.push(r?[a,o]:o),e})});var o=At(e);return i.map(function(t){return Et(e,o(t))})}function ht(e,t,n,r){var i=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n===1/0?n=i:n|=0),g(t,n,i))return e;var o=y(t,i),a=_(n,i);if(o!==o||a!==a)return ht(e.toSeq().cacheResult(),t,n,r);var s,u=a-o;u===u&&(s=u<0?0:u);var l=Dt(e);return l.size=0===s?s:e.size&&s||void 0,!r&&B(e)&&s>=0&&(l.get=function(t,n){return t=m(this,t),t>=0&&ts)return w();var e=i.next();return r||t===bn?e:t===_n?k(t,u-1,void 0,e):k(t,u-1,e.value[1],e)})},l}function dt(e,t,n){var r=Dt(e);return r.__iterateUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterate(r,i);var a=0;return e.__iterate(function(e,i,s){return t.call(n,e,i,s)&&++a&&r(e,i,o)}),a},r.__iteratorUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterator(r,i);var a=e.__iterator(xn,i),s=!0;return new x(function(){if(!s)return w();var e=a.next();if(e.done)return e;var i=e.value,u=i[0],l=i[1];return t.call(n,l,u,o)?r===xn?e:k(r,u,l,e):(s=!1,w())})},r}function mt(e,t,n,r){var i=Dt(e);return i.__iterateUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterate(i,o);var s=!0,u=0;return e.__iterate(function(e,o,l){if(!s||!(s=t.call(n,e,o,l)))return u++,i(e,r?o:u-1,a)}),u},i.__iteratorUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterator(i,o);var s=e.__iterator(xn,o),u=!0,l=0;return new x(function(){var e,o,c;do{if(e=s.next(),e.done)return r||i===bn?e:i===_n?k(i,l++,void 0,e):k(i,l++,e.value[1],e);var p=e.value;o=p[0],c=p[1],u&&(u=t.call(n,c,o,a))}while(u);return i===xn?e:k(i,o,c,e)})},i}function vt(e,t){var r=a(e),i=[e].concat(t).map(function(e){return o(e)?r&&(e=n(e)):e=r?L(e):q(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===i.length)return e;if(1===i.length){var u=i[0];if(u===e||r&&a(u)||s(e)&&s(u))return u}var l=new I(i);return r?l=l.toKeyedSeq():s(e)||(l=l.toSetSeq()),l=l.flatten(!0),l.size=i.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),l}function gt(e,t,n){var r=Dt(e);return r.__iterateUncached=function(r,i){function a(e,l){var c=this;e.__iterate(function(e,i){return(!t||l0}function wt(e,n,r){var i=Dt(e);return i.size=new I(r).map(function(e){return e.size}).min(),i.__iterate=function(e,t){for(var n,r=this.__iterator(bn,t),i=0;!(n=r.next()).done&&!1!==e(n.value,i++,this););return i},i.__iteratorUncached=function(e,i){var o=r.map(function(e){return e=t(e),C(i?e.reverse():e)}),a=0,s=!1;return new x(function(){var t;return s||(t=o.map(function(e){return e.next()}),s=t.some(function(e){return e.done})),s?w():k(e,a++,n.apply(null,t.map(function(e){return e.value})))})},i}function Et(e,t){return B(e)?t:e.constructor(t)}function St(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Ct(e){return ce(e.size),d(e)}function At(e){return a(e)?n:s(e)?r:i}function Dt(e){return Object.create((a(e)?T:s(e)?M:P).prototype)}function Ot(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):O.prototype.cacheResult.call(this)}function Tt(e,t){return e>t?1:et?-1:0}function on(e){if(e.size===1/0)return 0;var t=l(e),n=a(e),r=t?1:0;return an(e.__iterate(n?t?function(e,t){r=31*r+sn(oe(e),oe(t))|0}:function(e,t){r=r+sn(oe(e),oe(t))|0}:t?function(e){r=31*r+oe(e)|0}:function(e){r=r+oe(e)|0}),r)}function an(e,t){return t=Tn(t,3432918353),t=Tn(t<<15|t>>>-15,461845907),t=Tn(t<<13|t>>>-13,5),t=(t+3864292196|0)^e,t=Tn(t^t>>>16,2246822507),t=Tn(t^t>>>13,3266489909),t=ie(t^t>>>16)}function sn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}var un=Array.prototype.slice;e(n,t),e(r,t),e(i,t),t.isIterable=o,t.isKeyed=a,t.isIndexed=s,t.isAssociative=u,t.isOrdered=l,t.Keyed=n,t.Indexed=r,t.Set=i;var ln="@@__IMMUTABLE_ITERABLE__@@",cn="@@__IMMUTABLE_KEYED__@@",pn="@@__IMMUTABLE_INDEXED__@@",fn="@@__IMMUTABLE_ORDERED__@@",hn=5,dn=1<r?w():k(e,i,n[t?r-i++:i++])})},e(F,T),F.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},F.prototype.has=function(e){return this._object.hasOwnProperty(e)},F.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,i=r.length-1,o=0;o<=i;o++){var a=r[t?i-o:o];if(!1===e(n[a],a,this))return o+1}return o},F.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,i=r.length-1,o=0;return new x(function(){var a=r[t?i-o:o];return o++>i?w():k(e,a,n[a])})},F.prototype[fn]=!0,e(N,M),N.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=C(n),i=0;if(S(r))for(var o;!(o=r.next()).done&&!1!==e(o.value,i++,this););return i},N.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterable,r=C(n);if(!S(r))return new x(w);var i=0;return new x(function(){var t=r.next();return t.done?t:k(e,i++,t.value)})},e(R,M),R.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n=this._iterator,r=this._iteratorCache,i=0;i=r.length){var t=n.next();if(t.done)return t;r[i]=t.value}return k(e,i,r[i++])})};var Cn;e($,M),$.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},$.prototype.get=function(e,t){return this.has(e)?this._value:t},$.prototype.includes=function(e){return K(this._value,e)},$.prototype.slice=function(e,t){var n=this.size;return g(e,t,n)?this:new $(this._value,_(t,n)-y(e,n))},$.prototype.reverse=function(){return this},$.prototype.indexOf=function(e){return K(this._value,e)?0:-1},$.prototype.lastIndexOf=function(e){return K(this._value,e)?this.size:-1},$.prototype.__iterate=function(e,t){for(var n=0;n=0&&t=0&&nn?w():k(e,o++,a)})},Q.prototype.equals=function(e){return e instanceof Q?this._start===e._start&&this._end===e._end&&this._step===e._step:Y(this,e)};var Dn;e(ee,t),e(te,ee),e(ne,ee),e(re,ee),ee.Keyed=te,ee.Indexed=ne,ee.Set=re;var On,Tn="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){e|=0,t|=0;var n=65535&e,r=65535&t;return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0},Mn=Object.isExtensible,Pn=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}(),In="function"==typeof WeakMap;In&&(On=new WeakMap);var Fn=0,Nn="__immutablehash__";"function"==typeof Symbol&&(Nn=Symbol(Nn));var Rn=16,Bn=255,jn=0,Ln={};e(pe,te),pe.of=function(){var e=un.call(arguments,0);return ke().withMutations(function(t){for(var n=0;n=e.length)throw new Error("Missing value for key: "+e[n]);t.set(e[n],e[n+1])}})},pe.prototype.toString=function(){return this.__toString("Map {","}")},pe.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},pe.prototype.set=function(e,t){return we(this,e,t)},pe.prototype.setIn=function(e,t){return this.updateIn(e,vn,function(){return t})},pe.prototype.remove=function(e){return we(this,e,vn)},pe.prototype.deleteIn=function(e){return this.updateIn(e,function(){return vn})},pe.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},pe.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=Fe(this,Mt(e),t,n);return r===vn?void 0:r},pe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):ke()},pe.prototype.merge=function(){return Te(this,void 0,arguments)},pe.prototype.mergeWith=function(e){return Te(this,e,un.call(arguments,1))},pe.prototype.mergeIn=function(e){var t=un.call(arguments,1);return this.updateIn(e,ke(),function(e){return"function"==typeof e.merge?e.merge.apply(e,t):t[t.length-1]})},pe.prototype.mergeDeep=function(){return Te(this,Me,arguments)},pe.prototype.mergeDeepWith=function(e){var t=un.call(arguments,1);return Te(this,Pe(e),t)},pe.prototype.mergeDeepIn=function(e){var t=un.call(arguments,1);return this.updateIn(e,ke(),function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,t):t[t.length-1]})},pe.prototype.sort=function(e){return Ze(bt(this,e))},pe.prototype.sortBy=function(e,t){return Ze(bt(this,t,e))},pe.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},pe.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new f)},pe.prototype.asImmutable=function(){return this.__ensureOwner()},pe.prototype.wasAltered=function(){return this.__altered},pe.prototype.__iterator=function(e,t){return new ye(this,e,t)},pe.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate(function(t){return r++,e(t[1],t[0],n)},t),r},pe.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?xe(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},pe.isMap=fe;var qn="@@__IMMUTABLE_MAP__@@",zn=pe.prototype;zn[qn]=!0,zn.delete=zn.remove,zn.removeIn=zn.deleteIn,he.prototype.get=function(e,t,n,r){for(var i=this.entries,o=0,a=i.length;o=Wn)return Ae(e,u,r,i);var d=e&&e===this.ownerID,m=d?u:h(u);return f?s?l===c-1?m.pop():m[l]=m.pop():m[l]=[r,i]:m.push([r,i]),d?(this.entries=m,this):new he(e,m)}},de.prototype.get=function(e,t,n,r){void 0===t&&(t=oe(n));var i=1<<((0===e?t:t>>>e)&mn),o=this.bitmap;return 0==(o&i)?r:this.nodes[Ne(o&i-1)].get(e+hn,t,n,r)},de.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=oe(r));var s=(0===t?n:n>>>t)&mn,u=1<=Vn)return Oe(e,f,l,s,d);if(c&&!d&&2===f.length&&Se(f[1^p]))return f[1^p];if(c&&d&&1===f.length&&Se(d))return d;var m=e&&e===this.ownerID,v=c?d?l:l^u:l|u,g=c?d?Re(f,p,d,m):je(f,p,m):Be(f,p,d,m);return m?(this.bitmap=v,this.nodes=g,this):new de(e,v,g)},me.prototype.get=function(e,t,n,r){void 0===t&&(t=oe(n));var i=(0===e?t:t>>>e)&mn,o=this.nodes[i];return o?o.get(e+hn,t,n,r):r},me.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=oe(r));var s=(0===t?n:n>>>t)&mn,u=i===vn,l=this.nodes,c=l[s];if(u&&!c)return this;var p=Ee(c,e,t+hn,n,r,i,o,a);if(p===c)return this;var f=this.count;if(c){if(!p&&--f=0&&e>>t&mn;if(r>=this.array.length)return new ze([],e);var i,o=0===r;if(t>0){var a=this.array[r];if((i=a&&a.removeBefore(e,t-hn,n))===a&&o)return this}if(o&&!i)return this;var s=Je(this,e);if(!o)for(var u=0;u>>t&mn;if(r>=this.array.length)return this;var i;if(t>0){var o=this.array[r];if((i=o&&o.removeAfter(e,t-hn,n))===o&&r===this.array.length-1)return this}var a=Je(this,e);return a.array.splice(r+1),i&&(a.array[r]=i),a};var Xn,Kn={};e(Ze,pe),Ze.of=function(){return this(arguments)},Ze.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ze.prototype.get=function(e,t){var n=this._map.get(e);return void 0!==n?this._list.get(n)[1]:t},Ze.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):tt()},Ze.prototype.set=function(e,t){return nt(this,e,t)},Ze.prototype.remove=function(e){return nt(this,e,vn)},Ze.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ze.prototype.__iterate=function(e,t){var n=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],n)},t)},Ze.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},Ze.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),n=this._list.__ensureOwner(e);return e?et(t,n,e,this.__hash):(this.__ownerID=e,this._map=t,this._list=n,this)},Ze.isOrderedMap=Qe,Ze.prototype[fn]=!0,Ze.prototype.delete=Ze.prototype.remove;var Yn;e(rt,T),rt.prototype.get=function(e,t){return this._iter.get(e,t)},rt.prototype.has=function(e){return this._iter.has(e)},rt.prototype.valueSeq=function(){return this._iter.valueSeq()},rt.prototype.reverse=function(){var e=this,t=lt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},rt.prototype.map=function(e,t){var n=this,r=ut(this,e,t);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(e,t)}),r},rt.prototype.__iterate=function(e,t){var n,r=this;return this._iter.__iterate(this._useKeys?function(t,n){return e(t,n,r)}:(n=t?Ct(this):0,function(i){return e(i,t?--n:n++,r)}),t)},rt.prototype.__iterator=function(e,t){if(this._useKeys)return this._iter.__iterator(e,t);var n=this._iter.__iterator(bn,t),r=t?Ct(this):0;return new x(function(){var i=n.next();return i.done?i:k(e,t?--r:r++,i.value,i)})},rt.prototype[fn]=!0,e(it,M),it.prototype.includes=function(e){return this._iter.includes(e)},it.prototype.__iterate=function(e,t){var n=this,r=0;return this._iter.__iterate(function(t){return e(t,r++,n)},t)},it.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t),r=0;return new x(function(){var t=n.next();return t.done?t:k(e,r++,t.value,t)})},e(ot,P),ot.prototype.has=function(e){return this._iter.includes(e)},ot.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){return e(t,t,n)},t)},ot.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t);return new x(function(){var t=n.next();return t.done?t:k(e,t.value,t.value,t)})},e(at,T),at.prototype.entrySeq=function(){return this._iter.toSeq()},at.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){if(t){St(t);var r=o(t);return e(r?t.get(1):t[1],r?t.get(0):t[0],n)}},t)},at.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t);return new x(function(){for(;;){var t=n.next();if(t.done)return t;var r=t.value;if(r){St(r);var i=o(r);return k(e,i?r.get(0):r[0],i?r.get(1):r[1],t)}}})},it.prototype.cacheResult=rt.prototype.cacheResult=ot.prototype.cacheResult=at.prototype.cacheResult=Ot,e(Pt,te),Pt.prototype.toString=function(){return this.__toString(Ft(this)+" {","}")},Pt.prototype.has=function(e){return this._defaultValues.hasOwnProperty(e)},Pt.prototype.get=function(e,t){if(!this.has(e))return t;var n=this._defaultValues[e];return this._map?this._map.get(e,n):n},Pt.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var e=this.constructor;return e._empty||(e._empty=It(this,ke()))},Pt.prototype.set=function(e,t){if(!this.has(e))throw new Error('Cannot set unknown key "'+e+'" on '+Ft(this));if(this._map&&!this._map.has(e)){if(t===this._defaultValues[e])return this}var n=this._map&&this._map.set(e,t);return this.__ownerID||n===this._map?this:It(this,n)},Pt.prototype.remove=function(e){if(!this.has(e))return this;var t=this._map&&this._map.remove(e);return this.__ownerID||t===this._map?this:It(this,t)},Pt.prototype.wasAltered=function(){return this._map.wasAltered()},Pt.prototype.__iterator=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterator(e,t)},Pt.prototype.__iterate=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterate(e,t)},Pt.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map&&this._map.__ensureOwner(e);return e?It(this,t,e):(this.__ownerID=e,this._map=t,this)};var $n=Pt.prototype;$n.delete=$n.remove,$n.deleteIn=$n.removeIn=zn.removeIn,$n.merge=zn.merge,$n.mergeWith=zn.mergeWith,$n.mergeIn=zn.mergeIn,$n.mergeDeep=zn.mergeDeep,$n.mergeDeepWith=zn.mergeDeepWith,$n.mergeDeepIn=zn.mergeDeepIn,$n.setIn=zn.setIn,$n.update=zn.update,$n.updateIn=zn.updateIn,$n.withMutations=zn.withMutations,$n.asMutable=zn.asMutable,$n.asImmutable=zn.asImmutable,e(Bt,re),Bt.of=function(){return this(arguments)},Bt.fromKeys=function(e){return this(n(e).keySeq())},Bt.prototype.toString=function(){return this.__toString("Set {","}")},Bt.prototype.has=function(e){return this._map.has(e)},Bt.prototype.add=function(e){return Lt(this,this._map.set(e,!0))},Bt.prototype.remove=function(e){return Lt(this,this._map.remove(e))},Bt.prototype.clear=function(){return Lt(this,this._map.clear())},Bt.prototype.union=function(){var e=un.call(arguments,0);return e=e.filter(function(e){return 0!==e.size}),0===e.length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations(function(t){for(var n=0;n=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Xt(e,t)},Gt.prototype.pushAll=function(e){if(e=r(e),0===e.size)return this;ce(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):Xt(t,n)},Gt.prototype.pop=function(){return this.slice(1)},Gt.prototype.unshift=function(){return this.push.apply(this,arguments)},Gt.prototype.unshiftAll=function(e){return this.pushAll(e)},Gt.prototype.shift=function(){return this.pop.apply(this,arguments)},Gt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Kt()},Gt.prototype.slice=function(e,t){if(g(e,t,this.size))return this;var n=y(e,this.size);if(_(t,this.size)!==this.size)return ne.prototype.slice.call(this,e,t);for(var r=this.size-n,i=this._head;n--;)i=i.next;return this.__ownerID?(this.size=r,this._head=i,this.__hash=void 0,this.__altered=!0,this):Xt(r,i)},Gt.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Xt(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},Gt.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},Gt.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new x(function(){if(r){var t=r.value;return r=r.next,k(e,n++,t)}return w()})},Gt.isStack=Jt;var rr="@@__IMMUTABLE_STACK__@@",ir=Gt.prototype;ir[rr]=!0,ir.withMutations=zn.withMutations,ir.asMutable=zn.asMutable,ir.asImmutable=zn.asImmutable,ir.wasAltered=zn.wasAltered;var or;t.Iterator=x,Yt(t,{toArray:function(){ce(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new it(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new rt(this,!0)},toMap:function(){return pe(this.toKeyedSeq())},toObject:function(){ce(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return Ze(this.toKeyedSeq())},toOrderedSet:function(){return Ut(a(this)?this.valueSeq():this)},toSet:function(){return Bt(a(this)?this.valueSeq():this)},toSetSeq:function(){return new ot(this)},toSeq:function(){return s(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Gt(a(this)?this.valueSeq():this)},toList:function(){return Le(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){return Et(this,vt(this,un.call(arguments,0)))},includes:function(e){return this.some(function(t){return K(t,e)})},entries:function(){return this.__iterator(xn)},every:function(e,t){ce(this.size);var n=!0;return this.__iterate(function(r,i,o){if(!e.call(t,r,i,o))return n=!1,!1}),n},filter:function(e,t){return Et(this,ct(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},forEach:function(e,t){return ce(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){ce(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=null!==r&&void 0!==r?r.toString():""}),t},keys:function(){return this.__iterator(_n)},map:function(e,t){return Et(this,ut(this,e,t))},reduce:function(e,t,n){ce(this.size);var r,i;return arguments.length<2?i=!0:r=t,this.__iterate(function(t,o,a){i?(i=!1,r=t):r=e.call(n,r,t,o,a)}),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return Et(this,lt(this,!0))},slice:function(e,t){return Et(this,ht(this,e,t,!0))},some:function(e,t){return!this.every(Qt(e),t)},sort:function(e){return Et(this,bt(this,e))},values:function(){return this.__iterator(bn)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(e,t){return d(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return pt(this,e,t)},equals:function(e){return Y(this,e)},entrySeq:function(){var e=this;if(e._cache)return new I(e._cache);var t=e.toSeq().map(Zt).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Qt(e),t)},findEntry:function(e,t,n){var r=n;return this.__iterate(function(n,i,o){if(e.call(t,n,i,o))return r=[i,n],!1}),r},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},findLastEntry:function(e,t,n){return this.toKeyedSeq().reverse().findEntry(e,t,n)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(v)},flatMap:function(e,t){return Et(this,yt(this,e,t))},flatten:function(e){return Et(this,gt(this,e,!0))},fromEntrySeq:function(){return new at(this)},get:function(e,t){return this.find(function(t,n){return K(n,e)},void 0,t)},getIn:function(e,t){for(var n,r=this,i=Mt(e);!(n=i.next()).done;){var o=n.value;if((r=r&&r.get?r.get(o,vn):vn)===vn)return t}return r},groupBy:function(e,t){return ft(this,e,t)},has:function(e){return this.get(e,vn)!==vn},hasIn:function(e){return this.getIn(e,vn)!==vn},isSubset:function(e){return e="function"==typeof e.includes?e:t(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e="function"==typeof e.isSubset?e:t(e),e.isSubset(this)},keyOf:function(e){return this.findKey(function(t){return K(t,e)})},keySeq:function(){return this.toSeq().map($t).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return xt(this,e)},maxBy:function(e,t){return xt(this,t,e)},min:function(e){return xt(this,e?en(e):rn)},minBy:function(e,t){return xt(this,t?en(t):rn,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return Et(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return Et(this,mt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Qt(e),t)},sortBy:function(e,t){return Et(this,bt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return Et(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return Et(this,dt(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Qt(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=on(this))}});var ar=t.prototype;ar[ln]=!0,ar[En]=ar.values,ar.__toJS=ar.toArray,ar.__toStringMapper=tn,ar.inspect=ar.toSource=function(){return this.toString()},ar.chain=ar.flatMap,ar.contains=ar.includes,Yt(n,{flip:function(){return Et(this,st(this))},mapEntries:function(e,t){var n=this,r=0;return Et(this,this.toSeq().map(function(i,o){return e.call(t,[o,i],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return Et(this,this.toSeq().flip().map(function(r,i){return e.call(t,r,i,n)}).flip())}});var sr=n.prototype;return sr[cn]=!0,sr[En]=ar.entries,sr.__toJS=ar.toObject,sr.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+tn(e)},Yt(r,{toKeyedSeq:function(){return new rt(this,!1)},filter:function(e,t){return Et(this,ct(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return Et(this,lt(this,!1))},slice:function(e,t){return Et(this,ht(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=y(e,e<0?this.count():this.size);var r=this.slice(0,e);return Et(this,1===n?r:r.concat(h(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.findLastEntry(e,t);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(e){return Et(this,gt(this,e,!1))},get:function(e,t){return e=m(this,e),e<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,n){return n===e},void 0,t)},has:function(e){return(e=m(this,e))>=0&&(void 0!==this.size?this.size===1/0||e5e3)return e.textContent;return function(e){for(var n,r,i,o,a,s=e.textContent,u=0,l=s[0],c=1,p=e.innerHTML="",f=0;r=n,n=f<7&&"\\"==n?1:c;){if(c=l,l=s[++u],o=p.length>1,!c||f>8&&"\n"==c||[/\S/.test(c),1,1,!/[$\w]/.test(c),("/"==n||"\n"==n)&&o,'"'==n&&o,"'"==n&&o,s[u-4]+r+n=="--\x3e",r+n=="*/"][f])for(p&&(e.appendChild(a=t.createElement("span")).setAttribute("style",["color: #555; font-weight: bold;","","","color: #555;",""][f?f<3?2:f>6?4:f>3?3:+/^(a(bstract|lias|nd|rguments|rray|s(m|sert)?|uto)|b(ase|egin|ool(ean)?|reak|yte)|c(ase|atch|har|hecked|lass|lone|ompl|onst|ontinue)|de(bugger|cimal|clare|f(ault|er)?|init|l(egate|ete)?)|do|double|e(cho|ls?if|lse(if)?|nd|nsure|num|vent|x(cept|ec|p(licit|ort)|te(nds|nsion|rn)))|f(allthrough|alse|inal(ly)?|ixed|loat|or(each)?|riend|rom|unc(tion)?)|global|goto|guard|i(f|mp(lements|licit|ort)|n(it|clude(_once)?|line|out|stanceof|t(erface|ernal)?)?|s)|l(ambda|et|ock|ong)|m(icrolight|odule|utable)|NaN|n(amespace|ative|ext|ew|il|ot|ull)|o(bject|perator|r|ut|verride)|p(ackage|arams|rivate|rotected|rotocol|ublic)|r(aise|e(adonly|do|f|gister|peat|quire(_once)?|scue|strict|try|turn))|s(byte|ealed|elf|hort|igned|izeof|tatic|tring|truct|ubscript|uper|ynchronized|witch)|t(emplate|hen|his|hrows?|ransient|rue|ry|ype(alias|def|id|name|of))|u(n(checked|def(ined)?|ion|less|signed|til)|se|sing)|v(ar|irtual|oid|olatile)|w(char_t|hen|here|hile|ith)|xor|yield)$/.test(p):0]),a.appendChild(t.createTextNode(p))),i=f&&f<7?f:i,p="",f=11;![1,/[\/{}[(\-+*=<>:;|\\.,?!&@~]/.test(c),/[\])]/.test(c),/[$\w]/.test(c),"/"==c&&i<2&&"<"!=n,'"'==c,"'"==c,c+l+s[u+1]+s[u+2]=="\x3c!--",c+l=="/*",c+l=="//","#"==c][--f];);p+=c}}(e)}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:j.default.Map();if(!j.default.Map.isMap(e)||!e.size)return j.default.List();if(Array.isArray(t)||(t=[t]),t.length<1)return e.merge(n);var r=j.default.List(),i=t[0],o=!0,a=!1,s=void 0;try{for(var u,l=(0,T.default)(e.entries());!(o=(u=l.next()).done);o=!0){var c=u.value,p=(0,D.default)(c,2),f=p[0],h=p[1],d=b(h,t.slice(1),n.set(i,f));r=j.default.List.isList(d)?r.concat(d):r.push(d)}}catch(e){a=!0,s=e}finally{try{!o&&l.return&&l.return()}finally{if(a)throw s}}return r}function x(e){return(0,W.default)((0,z.default)(e))}function k(e){return x(e.replace(/\.[^.\/]*$/,""))}function w(e){return"string"!=typeof e||""===e?"":(0,L.sanitizeUrl)(e)}function E(e){if(!j.default.OrderedMap.isOrderedMap(e))return null;if(!e.size)return null;var t=e.find(function(e,t){return t.startsWith("2")&&(0,F.default)(e.get("content")||{}).length>0}),n=e.get("default")||j.default.OrderedMap(),r=(n.get("content")||j.default.OrderedMap()).keySeq().toJS(),i=r.length?n:null;return t||i}Object.defineProperty(t,"__esModule",{value:!0}),t.escapeDeepLinkPath=t.createDeepLinkPath=t.shallowEqualKeys=t.buildFormData=t.sorters=t.btoa=t.parseSearch=t.getSampleSchema=t.validateParam=t.validatePattern=t.validateMinLength=t.validateMaxLength=t.validateGuid=t.validateDateTime=t.validateString=t.validateBoolean=t.validateFile=t.validateInteger=t.validateNumber=t.validateMinimum=t.validateMaximum=t.propChecker=t.errorLog=t.memoize=t.isImmutable=void 0;var S=n(42),C=r(S),A=n(16),D=r(A),O=n(89),T=r(O),M=n(31),P=r(M),I=n(49),F=r(I),N=n(43),R=r(N);t.isJSONObject=i,t.objectify=o,t.arrayify=a,t.fromJSOrdered=s,t.bindToState=u,t.normalizeArray=l,t.isFn=c,t.isObject=p,t.isFunc=f,t.isArray=h,t.objMap=d,t.objReduce=m,t.systemThunkMiddleware=v,t.defaultStatusCode=g,t.getList=y,t.highlight=_,t.mapToList=b,t.pascalCase=x,t.pascalCaseFilename=k,t.sanitizeUrl=w,t.getAcceptControllingResponse=E;var B=n(8),j=r(B),L=n(471),q=n(881),z=r(q),U=n(406),W=r(U),V=n(403),H=r(V),G=n(215),J=r(G),X=n(897),K=r(X),Y=n(113),$=r(Y),Z=n(161),Q=n(48),ee=r(Q),te=n(639),ne=r(te),re="default",ie=t.isImmutable=function(e){return j.default.Iterable.isIterable(e)},oe=(t.memoize=H.default,t.errorLog=function(e){return function(){return function(t){return function(n){try{t(n)}catch(t){e().errActions.newThrownErr(t,n)}}}}},t.propChecker=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return(0,F.default)(e).length!==(0,F.default)(t).length||((0,K.default)(e,function(e,n){if(r.includes(n))return!1;var i=t[n];return j.default.Iterable.isIterable(e)?!j.default.is(e,i):("object"!==(void 0===e?"undefined":(0,R.default)(e))||"object"!==(void 0===i?"undefined":(0,R.default)(i)))&&e!==i})||n.some(function(n){return!(0,$.default)(e[n],t[n])}))},t.validateMaximum=function(e,t){if(e>t)return"Value must be less than Maximum"}),ae=t.validateMinimum=function(e,t){if(et)return"Value must be less than MaxLength"},me=t.validateMinLength=function(e,t){if(e.length2&&void 0!==arguments[2]&&arguments[2],r=[],i=t&&"body"===e.get("in")?e.get("value_xml"):e.get("value"),o=e.get("required"),a=n?e.get("schema"):e,s=a.get("maximum"),u=a.get("minimum"),l=a.get("type"),c=a.get("format"),p=a.get("maxLength"),f=a.get("minLength"),h=a.get("pattern");if(l&&(o||i)){var d="string"===l&&i,m="array"===l&&Array.isArray(i)&&i.length,v="array"===l&&j.default.List.isList(i)&&i.count(),g="file"===l&&i instanceof ee.default.File,y="boolean"===l&&(i||!1===i),_="number"===l&&(i||0===i),b="integer"===l&&(i||0===i);if(o&&!(d||m||v||g||y||_||b))return r.push("Required field is not provided"),r;if(h){var x=ve(i,h);x&&r.push(x)}if(p||0===p){var k=de(i,p);k&&r.push(k)}if(f){var w=me(i,f);w&&r.push(w)}if(s||0===s){var E=oe(i,s);E&&r.push(E)}if(u||0===u){var S=ae(i,u);S&&r.push(S)}if("string"===l){var C=void 0;if(!(C="date-time"===c?fe(i):"uuid"===c?he(i):pe(i)))return r;r.push(C)}else if("boolean"===l){var A=ce(i);if(!A)return r;r.push(A)}else if("number"===l){var D=se(i);if(!D)return r;r.push(D)}else if("integer"===l){var O=ue(i);if(!O)return r;r.push(O)}else if("array"===l){var T=void 0;if(!i.count())return r;T=a.getIn(["items","type"]),i.forEach(function(e,t){var n=void 0;"number"===T?n=se(e):"integer"===T?n=ue(e):"string"===T&&(n=pe(e)),n&&r.push({index:t,error:n})})}else if("file"===l){var M=le(i);if(!M)return r;r.push(M)}}return r},t.getSampleSchema=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(/xml/.test(t)){if(!e.xml||!e.xml.name){if(e.xml=e.xml||{},!e.$$ref)return e.type||e.items||e.properties||e.additionalProperties?'\n\x3c!-- XML example cannot be generated --\x3e':null;var r=e.$$ref.match(/\S*\/(\S+)$/);e.xml.name=r[1]}return(0,Z.memoizedCreateXMLExample)(e,n)}return(0,C.default)((0,Z.memoizedSampleFromSchema)(e,n),null,2)},t.parseSearch=function(){var e={},t=window.location.search;if(""!=t){var n=t.substr(1).split("&");for(var r in n)r=n[r].split("="),e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e},t.btoa=function(t){var n=void 0;return n=t instanceof e?t:new e(t.toString(),"utf-8"),n.toString("base64")},t.sorters={operationsSorter:{alpha:function(e,t){return e.get("path").localeCompare(t.get("path"))},method:function(e,t){return e.get("method").localeCompare(t.get("method"))}},tagsSorter:{alpha:function(e,t){return e.localeCompare(t)}}},t.buildFormData=function(e){var t=[];for(var n in e){var r=e[n];void 0!==r&&""!==r&&t.push([n,"=",encodeURIComponent(r).replace(/%20/g,"+")].join(""))}return t.join("&")},t.shallowEqualKeys=function(e,t,n){return!!(0,J.default)(n,function(n){return(0,$.default)(e[n],t[n])})},t.createDeepLinkPath=function(e){return"string"==typeof e||e instanceof String?e.trim().replace(/\s/g,"_"):""});t.escapeDeepLinkPath=function(e){return(0,ne.default)(ge(e))}}).call(t,n(50).Buffer)},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ +var i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,u=r(e),l=1;l=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(65535!=(65535&e)&&65534!=(65535&e)&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function l(e){if(e>65535){e-=65536;var t=55296+(e>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function c(e,t){var n=0;return o(y,t)?y[t]:35===t.charCodeAt(0)&&g.test(t)&&(n="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10),u(n))?l(n):e}function p(e){return e.indexOf("&")<0?e:e.replace(v,c)}function f(e){return x[e]}function h(e){return _.test(e)?e.replace(b,f):e}var d=Object.prototype.hasOwnProperty,m=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g,v=/&([a-z#][a-z0-9]{1,31});/gi,g=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,y=n(455),_=/[&<>"]/,b=/[&<>"]/g,x={"&":"&","<":"<",">":">",'"':"""};t.assign=a,t.isString=i,t.has=o,t.unescapeMd=s,t.isValidEntityCode=u,t.fromCodePoint=l,t.replaceEntities=p,t.escapeHtml=h},function(e,t,n){var r=n(342)("wks"),i=n(194),o=n(28).Symbol,a="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=a&&o[e]||(a?o:i)("Symbol."+e))}).store=r},function(e,t,n){"use strict";function r(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":e instanceof b.Iterable?"Immutable."+e.toSource().split(" ")[0]:t}function i(e){function t(t,n,r,i,o,a){for(var s=arguments.length,u=Array(s>6?s-6:0),l=6;l5?l-5:0),p=5;p5?a-5:0),u=5;u key("+c[p]+")"].concat(s));if(h instanceof Error)return h}}return i(t)}function u(e){return a(e,"List",b.List.isList)}function l(e,t,n,r){function o(){for(var i=arguments.length,o=Array(i),u=0;u5?s-5:0),l=5;l5?l-5:0),p=5;p>",k={listOf:u,mapOf:c,orderedMapOf:p,setOf:f,orderedSetOf:h,stackOf:d,iterableOf:m,recordOf:v,shape:y,contains:y,mapContains:_,list:o("List",b.List.isList),map:o("Map",b.Map.isMap),orderedMap:o("OrderedMap",b.OrderedMap.isOrderedMap),set:o("Set",b.Set.isSet),orderedSet:o("OrderedSet",b.OrderedSet.isOrderedSet),stack:o("Stack",b.Stack.isStack),seq:o("Seq",b.Seq.isSeq),record:o("Record",function(e){return e instanceof b.Record}),iterable:o("Iterable",b.Iterable.isIterable)};e.exports=k},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";function r(e){return function(){return e}}var i=function(){};i.thatReturns=r,i.thatReturnsFalse=r(!1),i.thatReturnsTrue=r(!0),i.thatReturnsNull=r(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e},e.exports=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.get("openapi");return!!t&&t.startsWith("3.0.0")}function o(e){var t=e.get("swagger");return!!t&&t.startsWith("2")}function a(e){return function(t,n){return function(r){if(n&&n.specSelectors&&n.specSelectors.specJson){return i(n.specSelectors.specJson())?c.default.createElement(e,(0,u.default)({},r,n,{Ori:t})):c.default.createElement(t,r)}return console.warn("OAS3 wrapper: couldn't get spec"),null}}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(20),u=r(s);t.isOAS3=i,t.isSwagger2=o,t.OAS3ComponentWrapFactory=a;var l=n(0),c=r(l)},function(e,t,n){e.exports={default:n(556),__esModule:!0}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(312),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e,t,n){return t in e?(0,i.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){var r=n(27);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){function n(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=n},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function o(e){if(p===clearTimeout)return clearTimeout(e);if((p===r||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function a(){m&&h&&(m=!1,h.length?d=h.concat(d):v=-1,d.length&&s())}function s(){if(!m){var e=i(a);m=!0;for(var t=d.length;t;){for(h=d,d=[];++v1)for(var n=1;n0&&(a=this.buffer[u-1],e.call(r,a)<0);)if(u--,this.pointer-u>n/2-1){o=" ... ",u+=5;break}for(l="",i=this.pointer;in/2-1){l=" ... ",i-=5;break}return""+new Array(t).join(" ")+o+this.buffer.slice(u,i)+l+"\n"+new Array(t+this.pointer-u+o.length).join(" ")+"^"},t.prototype.toString=function(){var e,t;return e=this.get_snippet(),t=" on line "+(this.line+1)+", column "+(this.column+1),e?t:t+":\n"+e},t}(),this.YAMLError=function(e){function n(e){this.message=e,n.__super__.constructor.call(this),this.stack=this.toString()+"\n"+(new Error).stack.split("\n").slice(1).join("\n")}return t(n,e),n.prototype.toString=function(){return this.message},n}(Error),this.MarkedYAMLError=function(e){function n(e,t,r,i,o){this.context=e,this.context_mark=t,this.problem=r,this.problem_mark=i,this.note=o,n.__super__.constructor.call(this)}return t(n,e),n.prototype.toString=function(){var e;return e=[],null!=this.context&&e.push(this.context),null==this.context_mark||null!=this.problem&&null!=this.problem_mark&&this.context_mark.line===this.problem_mark.line&&this.context_mark.column===this.problem_mark.column||e.push(this.context_mark.toString()),null!=this.problem&&e.push(this.problem),null!=this.problem_mark&&e.push(this.problem_mark.toString()),null!=this.note&&e.push(this.note),e.join("\n")},n}(this.YAMLError)}).call(this)},function(e,t,n){e.exports={default:n(555),__esModule:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(531),o=r(i),a=n(530),s=r(a),u="function"==typeof s.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":typeof e};t.default="function"==typeof s.default&&"symbol"===u(o.default)?function(e){return void 0===e?"undefined":u(e)}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":void 0===e?"undefined":u(e)}},function(e,t,n){e.exports=!n(52)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";function r(e,t,n){return n?[e,t]:e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var i=this.constructor.Interface;for(var o in i)if(i.hasOwnProperty(o)){var s=i[o];s?this[o]=s(n):"target"===o?this.target=r:this[o]=n[o]}var u=null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue;return this.isDefaultPrevented=u?a.thatReturnsTrue:a.thatReturnsFalse,this.isPropagationStopped=a.thatReturnsFalse,this}var i=n(12),o=n(65),a=n(29),s=(n(9),["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:a.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};i(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=a.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=a.thatReturnsTrue)},persist:function(){this.isPersistent=a.thatReturnsTrue},isPersistent:a.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function m(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(e).length;default:if(r)return V(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return D(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return M(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function _(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var l;if(i){var c=-1;for(l=n;ls&&(n=s-u),l=n;l>=0;l--){for(var p=!0,f=0;fi&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var u,l,c,p;switch(s){case 1:o<128&&(a=o);break;case 2:u=e[i+1],128==(192&u)&&(p=(31&o)<<6|63&u)>127&&(a=p);break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(p=(15&o)<<12|(63&u)<<6|63&l)>2047&&(p<55296||p>57343)&&(a=p);break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(p=(15&o)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&p<1114112&&(a=p)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return O(r)}function O(e){var t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function R(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function B(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function j(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,r,i){return i||j(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(e,t,n,r,23,4),n+4}function q(e,t,n,r,i){return i||j(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(e,t,n,r,52,8),n+8}function z(e){if(e=U(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function U(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function W(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function J(e){return Y.toByteArray(z(e))}function X(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function K(e){return e!==e}/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var Y=n(534),$=n(707),Z=n(366);t.Buffer=o,t.SlowBuffer=m,t.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=r(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,n){return a(null,e,t,n)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,n){return u(null,e,t,n)},o.allocUnsafe=function(e){return l(null,e)},o.allocUnsafeSlow=function(e){return l(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},o.prototype.compare=function(e,t,n,r,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,s=n-t,u=Math.min(a,s),l=this.slice(r,i),c=e.slice(t,n),p=0;pi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;o.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUInt8=function(e,t){return t||F(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||F(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||F(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||F(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return t||F(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||F(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){t||F(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return t||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||F(e,4,this.length),$.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||F(e,4,this.length),$.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||F(e,8,this.length),$.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||F(e,8,this.length),$.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){N(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},o.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):B(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):B(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return q(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return q(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;a1?t-1:0),i=1;i2?n-2:0),o=2;o=n?e:e.length+1===n?""+t+e:""+new Array(n-e.length+1).join(t)+e},this.to_hex=function(e){return"string"==typeof e&&(e=e.charCodeAt(0)),e.toString(16)}}).call(this)}).call(t,n(18))},function(e,t,n){var r=n(101);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){"use strict";var r=n(668),i=Math.max;e.exports=function(e){return i(0,r(e))}},function(e,t,n){function r(e){return null==e?void 0===e?u:s:(e=Object(e),l&&l in e?o(e):a(e))}var i=n(76),o=n(837),a=n(866),s="[object Null]",u="[object Undefined]",l=i?i.toStringTag:void 0;e.exports=r},function(e,t,n){function r(e,t){var n=o(e,t);return i(n)?n:void 0}var i=n(795),o=n(838);e.exports=r},function(e,t){function n(e){return null!=e&&"object"==typeof e}e.exports=n},function(e,t,n){"use strict"},function(e,t,n){"use strict";var r=n(10),i=(n(7),function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)}),o=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},a=function(e,t,n){var r=this;if(r.instancePool.length){var i=r.instancePool.pop();return r.call(i,e,t,n),i}return new r(e,t,n)},s=function(e,t,n,r){var i=this;if(i.instancePool.length){var o=i.instancePool.pop();return i.call(o,e,t,n,r),o}return new i(e,t,n,r)},u=function(e){var t=this;e instanceof t||r("25"),e.destructor(),t.instancePool.length`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",u="]",l=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|]*>|)","i"),c=/[\\&]/,p="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",f=new RegExp("\\\\"+p+"|"+a,"gi"),h=new RegExp('[&<>"]',"g"),d=new RegExp(a+'|[&<>"]',"gi"),m=function(e){return 92===e.charCodeAt(0)?e.charAt(1):o(e)},v=function(e){return c.test(e)?e.replace(f,m):e},g=function(e){try{return r(i(e))}catch(t){return e}},y=function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return e}},_=function(e,t){return h.test(e)?t?e.replace(d,y):e.replace(h,y):e};e.exports={unescapeString:v,normalizeURI:g,escapeXml:_,reHtmlTag:l,OPENTAG:s,CLOSETAG:u,ENTITY:a,ESCAPABLE:p}},function(e,t){e.exports={}},function(e,t,n){var r=n(172),i=n(169);e.exports=function(e){return r(i(e))}},function(e,t,n){var r=n(169);e.exports=function(e){return Object(r(e))}},function(e,t){var n=e.exports={version:"2.5.1"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(132),i=n(341);e.exports=n(99)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(351)();e.exports=function(e){return e!==r&&null!==e}},function(e,t,n){"use strict";function r(e){return void 0===e||null===e}function i(e){return"object"==typeof e&&null!==e}function o(e){return Array.isArray(e)?e:r(e)?[]:[e]}function a(e,t){var n,r,i,o;if(t)for(o=Object.keys(t),n=0,r=o.length;n`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",u="]",l=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|]*>|)","i"),c=/[\\&]/,p="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",f=new RegExp("\\\\"+p+"|"+a,"gi"),h=new RegExp('[&<>"]',"g"),d=new RegExp(a+'|[&<>"]',"gi"),m=function(e){return 92===e.charCodeAt(0)?e.charAt(1):o(e)},v=function(e){return c.test(e)?e.replace(f,m):e},g=function(e){try{return r(i(e))}catch(t){return e}},y=function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return e}},_=function(e,t){return h.test(e)?t?e.replace(d,y):e.replace(h,y):e};e.exports={unescapeString:v,normalizeURI:g,escapeXml:_,reHtmlTag:l,OPENTAG:s,CLOSETAG:u,ENTITY:a,ESCAPABLE:p}},function(e,t,n){"use strict";var r=n(12),i=n(441),o=n(1026),a=n(1027),s=n(87),u=n(1028),l=n(1029),c=n(1030),p=n(1034),f=s.createElement,h=s.createFactory,d=s.cloneElement,m=r,v=function(e){return e},g={Children:{map:o.map,forEach:o.forEach,count:o.count,toArray:o.toArray,only:p},Component:i.Component,PureComponent:i.PureComponent,createElement:f,cloneElement:d,isValidElement:s.isValidElement,PropTypes:u,createClass:c,createFactory:h,createMixin:v,DOM:a,version:l,__spread:m};e.exports=g},function(e,t,n){"use strict";function r(e){return void 0!==e.ref}function i(e){return void 0!==e.key}var o=n(12),a=n(47),s=(n(9),n(445),Object.prototype.hasOwnProperty),u=n(443),l={key:!0,ref:!0,__self:!0,__source:!0},c=function(e,t,n,r,i,o,a){var s={$$typeof:u,type:e,key:t,ref:n,props:a,_owner:o};return s};c.createElement=function(e,t,n){var o,u={},p=null,f=null;if(null!=t){r(t)&&(f=t.ref),i(t)&&(p=""+t.key),void 0===t.__self?null:t.__self,void 0===t.__source?null:t.__source;for(o in t)s.call(t,o)&&!l.hasOwnProperty(o)&&(u[o]=t[o])}var h=arguments.length-2;if(1===h)u.children=n;else if(h>1){for(var d=Array(h),m=0;m1){for(var g=Array(v),y=0;y=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(527),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){n(589);for(var r=n(22),i=n(54),o=n(68),a=n(19)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u0&&void 0!==arguments[0]?arguments[0]:{};return{type:v,payload:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.CLEAR=t.NEW_AUTH_ERR=t.NEW_SPEC_ERR_BATCH=t.NEW_SPEC_ERR=t.NEW_THROWN_ERR_BATCH=t.NEW_THROWN_ERR=void 0,t.newThrownErr=r,t.newThrownErrBatch=i,t.newSpecErr=o,t.newSpecErrBatch=a,t.newAuthErr=s,t.clear=u;var l=n(248),c=function(e){return e&&e.__esModule?e:{default:e}}(l),p=t.NEW_THROWN_ERR="err_new_thrown_err",f=t.NEW_THROWN_ERR_BATCH="err_new_thrown_err_batch",h=t.NEW_SPEC_ERR="err_new_spec_err",d=t.NEW_SPEC_ERR_BATCH="err_new_spec_err_batch",m=t.NEW_AUTH_ERR="err_new_auth_err",v=t.CLEAR="err_clear"},function(e,t,n){var r=n(51),i=n(319),o=n(317),a=n(33),s=n(126),u=n(184),l={},c={},t=e.exports=function(e,t,n,p,f){var h,d,m,v,g=f?function(){return e}:u(e),y=r(n,p,t?2:1),_=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(o(g)){for(h=s(e.length);h>_;_++)if((v=t?y(a(d=e[_])[0],d[1]):y(e[_]))===l||v===c)return v}else for(m=g.call(e);!(d=m.next()).done;)if((v=i(m,y,d.value,t))===l||v===c)return v};t.BREAK=l,t.RETURN=c},function(e,t){e.exports=!0},function(e,t,n){var r=n(127)("meta"),i=n(27),o=n(53),a=n(37).f,s=0,u=Object.isExtensible||function(){return!0},l=!n(52)(function(){return u(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},p=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!u(e))return"F";if(!t)return"E";c(e)}return e[r].i},f=function(e,t){if(!o(e,r)){if(!u(e))return!0;if(!t)return!1;c(e)}return e[r].w},h=function(e){return l&&d.NEED&&u(e)&&!o(e,r)&&c(e),e},d=e.exports={KEY:r,NEED:!1,fastKey:p,getWeak:f,onFreeze:h}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(180),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(128);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(28),i=n(71),o=n(72),a=n(103),s=n(130),u=function(e,t,n){var l,c,p,f,h=e&u.F,d=e&u.G,m=e&u.S,v=e&u.P,g=e&u.B,y=d?r:m?r[t]||(r[t]={}):(r[t]||{}).prototype,_=d?i:i[t]||(i[t]={}),b=_.prototype||(_.prototype={});d&&(n=t);for(l in n)c=!h&&y&&void 0!==y[l],p=(c?y:n)[l],f=g&&c?s(p,r):v&&"function"==typeof p?s(Function.call,p):p,y&&a(y,l,p,e&u.U),_[l]!=p&&o(_,l,f),v&&b[l]!=p&&(b[l]=p)};r.core=i,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},function(e,t,n){var r=n(59),i=n(609),o=n(627),a=Object.defineProperty;t.f=n(99)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){"use strict";var r,i=n(352),o=n(355),a=n(672),s=n(677);r=e.exports=function(e,t){var n,r,a,u,l;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],null==e?(n=a=!0,r=!1):(n=s.call(e,"c"),r=s.call(e,"e"),a=s.call(e,"w")),l={value:t,configurable:n,enumerable:r,writable:a},u?i(o(u),l):l},r.gs=function(e,t,n){var r,u,l,c;return"string"!=typeof e?(l=n,n=t,t=e,e=null):l=arguments[3],null==t?t=void 0:a(t)?null==n?n=void 0:a(n)||(l=n,n=void 0):(l=t,t=n=void 0),null==e?(r=!0,u=!1):(r=s.call(e,"c"),u=s.call(e,"e")),c={get:t,set:n,configurable:r,enumerable:u},l?i(o(l),c):c}},function(e,t,n){"use strict";e.exports=n(669)("forEach")},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(o(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),i=l.length,u=0;u0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){i=s;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";var r=n(75);e.exports=r.DEFAULT=new r({include:[n(111)],explicit:[n(748),n(747),n(746)]})},function(e,t,n){function r(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e]/;e.exports=i},function(e,t,n){"use strict";var r,i=n(23),o=n(225),a=/^[ \r\n\t\f]/,s=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,u=n(233),l=u(function(e,t){if(e.namespaceURI!==o.svg||"innerHTML"in e)e.innerHTML=t;else{r=r||document.createElement("div"),r.innerHTML=""+t+"";for(var n=r.firstChild;n.firstChild;)e.appendChild(n.firstChild)}});if(i.canUseDOM){var c=document.createElement("div");c.innerHTML=" ",""===c.innerHTML&&(l=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),a.test(t)||"<"===t[0]&&s.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t}),c=null}e.exports=l},function(e,t,n){"use strict";function r(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]="number"==typeof e[n]?e[n]:e[n].val);return t}t.__esModule=!0,t.default=r,e.exports=t.default},function(e,t,n){"use strict";e.exports=function(e,t){var n,r,i,o=-1,a=e.posMax,s=e.pos,u=e.isInLabel;if(e.isInLabel)return-1;if(e.labelUnmatchedScopes)return e.labelUnmatchedScopes--,-1;for(e.pos=t+1,e.isInLabel=!0,n=1;e.pos1&&void 0!==arguments[1])||arguments[1];return e=(0,s.normalizeArray)(e),{type:p,payload:{thing:e,shown:t}}}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e=(0,s.normalizeArray)(e),{type:c,payload:{thing:e,mode:t}}}Object.defineProperty(t,"__esModule",{value:!0}),t.SHOW=t.UPDATE_MODE=t.UPDATE_FILTER=t.UPDATE_LAYOUT=void 0,t.updateLayout=r,t.updateFilter=i,t.show=o,t.changeMode=a;var s=n(11),u=t.UPDATE_LAYOUT="layout_update_layout",l=t.UPDATE_FILTER="layout_update_filter",c=t.UPDATE_MODE="layout_update_mode",p=t.SHOW="layout_show"},function(e,t,n){"use strict";function r(e){return{type:u,payload:e}}function i(e){var t=e.value,n=e.pathMethod;return{type:l,payload:{value:t,pathMethod:n}}}function o(e){var t=e.value,n=e.pathMethod;return{type:c,payload:{value:t,pathMethod:n}}}function a(e){var t=e.value,n=e.path,r=e.method;return{type:p,payload:{value:t,path:n,method:r}}}function s(e){var t=e.server,n=e.key,r=e.val;return{type:f,payload:{server:t,key:n,val:r}}}Object.defineProperty(t,"__esModule",{value:!0}),t.setSelectedServer=r,t.setRequestBodyValue=i,t.setRequestContentType=o,t.setResponseContentType=a,t.setServerVariableValue=s;var u=t.UPDATE_SELECTED_SERVER="oas3_set_servers",l=t.UPDATE_REQUEST_BODY_VALUE="oas3_set_request_body_value",c=t.UPDATE_REQUEST_CONTENT_TYPE="oas3_set_request_content_type",p=t.UPDATE_RESPONSE_CONTENT_TYPE="oas3_set_response_content_type",f=t.UPDATE_SERVER_VARIABLE_VALUE="oas3_set_server_variable_value"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=h(e,t);if(n)return(0,s.default)(n,{declaration:!0,indent:"\t"})}Object.defineProperty(t,"__esModule",{value:!0}),t.memoizedSampleFromSchema=t.memoizedCreateXMLExample=t.sampleXmlFromSchema=t.inferSchema=t.sampleFromSchema=void 0,t.createXMLExample=i;var o=n(11),a=n(1125),s=r(a),u=n(910),l=r(u),c={string:function(){return"string"},string_email:function(){return"user@example.com"},"string_date-time":function(){return(new Date).toISOString()},number:function(){return 0},number_float:function(){return 0},integer:function(){return 0},boolean:function(e){return"boolean"!=typeof e.default||e.default}},p=function(e){e=(0,o.objectify)(e);var t=e,n=t.type,r=t.format,i=c[n+"_"+r]||c[n];return(0,o.isFunc)(i)?i(e):"Unknown Type: "+e.type},f=t.sampleFromSchema=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.objectify)(t),i=r.type,a=r.example,s=r.properties,u=r.additionalProperties,l=r.items,c=n.includeReadOnly,f=n.includeWriteOnly;if(void 0!==a)return a;if(!i)if(s)i="object";else{if(!l)return;i="array"}if("object"===i){var h=(0,o.objectify)(s),d={};for(var m in h)h[m].readOnly&&!c||h[m].writeOnly&&!f||(d[m]=e(h[m],n));if(!0===u)d.additionalProp1={};else if(u)for(var v=(0,o.objectify)(u),g=e(v,n),y=1;y<4;y++)d["additionalProp"+y]=g;return d}return"array"===i?[e(l,n)]:t.enum?t.default?t.default:(0,o.normalizeArray)(t.enum)[0]:"file"!==i?p(t):void 0},h=(t.inferSchema=function(e){return e.schema&&(e=e.schema),e.properties&&(e.type="object"),e},t.sampleXmlFromSchema=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.objectify)(t),i=r.type,a=r.properties,s=r.additionalProperties,u=r.items,l=r.example,c=n.includeReadOnly,f=n.includeWriteOnly,h=r.default,d={},m={},v=t.xml,g=v.name,y=v.prefix,_=v.namespace,b=r.enum,x=void 0,k=void 0;if(!i)if(a||s)i="object";else{if(!u)return;i="array"}if(g=g||"notagname",x=(y?y+":":"")+g,_){m[y?"xmlns:"+y:"xmlns"]=_}if("array"===i&&u){if(u.xml=u.xml||v||{},u.xml.name=u.xml.name||v.name,v.wrapped)return d[x]=[],Array.isArray(l)?l.forEach(function(t){u.example=t,d[x].push(e(u,n))}):Array.isArray(h)?h.forEach(function(t){u.default=t,d[x].push(e(u,n))}):d[x]=[e(u,n)],m&&d[x].push({_attr:m}),d;var w=[];return Array.isArray(l)?(l.forEach(function(t){u.example=t,w.push(e(u,n))}),w):Array.isArray(h)?(h.forEach(function(t){u.default=t,w.push(e(u,n))}),w):e(u,n)}if("object"===i){var E=(0,o.objectify)(a);d[x]=[],l=l||{};for(var S in E)if((!E[S].readOnly||c)&&(!E[S].writeOnly||f))if(E[S].xml=E[S].xml||{},E[S].xml.attribute){var C=Array.isArray(E[S].enum)&&E[S].enum[0],A=E[S].example,D=E[S].default;m[E[S].xml.name||S]=void 0!==A&&A||void 0!==l[S]&&l[S]||void 0!==D&&D||C||p(E[S])}else{E[S].xml.name=E[S].xml.name||S,E[S].example=void 0!==E[S].example?E[S].example:l[S];var O=e(E[S]);Array.isArray(O)?d[x]=d[x].concat(O):d[x].push(O)}return!0===s?d[x].push({additionalProp:"Anything can be here"}):s&&d[x].push({additionalProp:p(s)}),m&&d[x].push({_attr:m}),d}return k=void 0!==l?l:void 0!==h?h:Array.isArray(b)?b[0]:p(t),d[x]=m?[{_attr:m},k]:k,d});t.memoizedCreateXMLExample=(0,l.default)(i),t.memoizedSampleFromSchema=(0,l.default)(f)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){return e instanceof Error?{type:T,error:!0,payload:e}:"string"==typeof e?{type:T,payload:e.replace(/\t/g," ")||""}:{type:T,payload:""}}function o(e){return{type:W,payload:e}}function a(e){return{type:M,payload:e}}function s(e){if(!e||"object"!==(void 0===e?"undefined":(0,k.default)(e)))throw new Error("updateJson must only accept a simple JSON object");return{type:P,payload:e}}function u(e,t,n,r,i){return{type:I,payload:{path:e,value:r,paramName:t,paramIn:n,isXml:i}}}function l(e){return{type:z,payload:{pathMethod:e}}}function c(e,t){return{type:U,payload:{path:e,value:t,key:"consumes_value"}}}function p(e,t){return{type:U,payload:{path:e,value:t,key:"produces_value"}}}function f(e,t){return{type:L,payload:{path:e,method:t}}}function h(e,t){return{type:q,payload:{path:e,method:t}}}function d(e,t,n){return{type:V,payload:{scheme:e,path:t,method:n}}}Object.defineProperty(t,"__esModule",{value:!0}),t.execute=t.executeRequest=t.logRequest=t.setMutatedRequest=t.setRequest=t.setResponse=t.validateParams=t.formatIntoYaml=t.resolveSpec=t.parseToJson=t.SET_SCHEME=t.UPDATE_RESOLVED=t.UPDATE_OPERATION_VALUE=t.ClEAR_VALIDATE_PARAMS=t.CLEAR_REQUEST=t.CLEAR_RESPONSE=t.LOG_REQUEST=t.SET_MUTATED_REQUEST=t.SET_REQUEST=t.SET_RESPONSE=t.VALIDATE_PARAMS=t.UPDATE_PARAM=t.UPDATE_JSON=t.UPDATE_URL=t.UPDATE_SPEC=void 0;var m=n(20),v=r(m),g=n(90),y=r(g),_=n(31),b=r(_),x=n(43),k=r(x);t.updateSpec=i,t.updateResolved=o,t.updateUrl=a,t.updateJsonSpec=s,t.changeParam=u,t.clearValidateParams=l,t.changeConsumesValue=c,t.changeProducesValue=p,t.clearResponse=f,t.clearRequest=h,t.setScheme=d;var w=n(203),E=r(w),S=n(1115),C=r(S),A=n(248),D=r(A),O=n(11),T=t.UPDATE_SPEC="spec_update_spec",M=t.UPDATE_URL="spec_update_url",P=t.UPDATE_JSON="spec_update_json",I=t.UPDATE_PARAM="spec_update_param",F=t.VALIDATE_PARAMS="spec_validate_param",N=t.SET_RESPONSE="spec_set_response",R=t.SET_REQUEST="spec_set_request",B=t.SET_MUTATED_REQUEST="spec_set_mutated_request",j=t.LOG_REQUEST="spec_log_request",L=t.CLEAR_RESPONSE="spec_clear_response",q=t.CLEAR_REQUEST="spec_clear_request",z=t.ClEAR_VALIDATE_PARAMS="spec_clear_validate_param",U=t.UPDATE_OPERATION_VALUE="spec_update_operation_value",W=t.UPDATE_RESOLVED="spec_update_resolved",V=t.SET_SCHEME="set_scheme",H=(t.parseToJson=function(e){return function(t){var n=t.specActions,r=t.specSelectors,i=t.errActions,o=r.specStr,a=null;try{e=e||o(),i.clear({source:"parser"}),a=E.default.safeLoad(e)}catch(e){return console.error(e),i.newSpecErr({source:"parser",level:"error",message:e.reason,line:e.mark&&e.mark.line?e.mark.line+1:void 0})}return n.updateJsonSpec(a)}},t.resolveSpec=function(e,t){return function(n){var r=n.specActions,i=n.specSelectors,o=n.errActions,a=n.fn,s=a.fetch,u=a.resolve,l=a.AST,c=n.getConfigs,p=c(),f=p.modelPropertyMacro,h=p.parameterMacro,d=p.requestInterceptor,m=p.responseInterceptor;void 0===e&&(e=i.specJson()),void 0===t&&(t=i.url());var v=l.getLineNumberForPath,g=i.specStr();return u({fetch:s,spec:e,baseDoc:t,modelPropertyMacro:f,parameterMacro:h,requestInterceptor:d,responseInterceptor:m}).then(function(e){var t=e.spec,n=e.errors;if(o.clear({type:"thrown"}),n.length>0){var i=n.map(function(e){return console.error(e),e.line=e.fullPath?v(g,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",Object.defineProperty(e,"message",{enumerable:!0,value:e.message}),e});o.newThrownErrBatch(i)}return r.updateResolved(t)})}},t.formatIntoYaml=function(){return function(e){var t=e.specActions,n=e.specSelectors,r=n.specStr,i=t.updateSpec;try{var o=E.default.safeDump(E.default.safeLoad(r()),{indent:2});i(o)}catch(e){i(e)}}},t.validateParams=function(e,t){return{type:F,payload:{pathMethod:e,isOAS3:t}}},t.setResponse=function(e,t,n){return{payload:{path:e,method:t,res:n},type:N}},t.setRequest=function(e,t,n){return{payload:{path:e,method:t,req:n},type:R}},t.setMutatedRequest=function(e,t,n){return{payload:{path:e,method:t,req:n},type:B}},t.logRequest=function(e){return{payload:e,type:j}},t.executeRequest=function(e){return function(t){var n=t.fn,r=t.specActions,i=t.specSelectors,o=t.getConfigs,a=t.oas3Selectors,s=e.pathName,u=e.method,l=e.operation,c=o(),p=c.requestInterceptor,f=c.responseInterceptor,h=l.toJS();if(e.contextUrl=(0,C.default)(i.url()).toString(),h&&h.operationId?e.operationId=h.operationId:h&&s&&u&&(e.operationId=n.opId(h,s,u)),i.isOAS3()){e.server=a.selectedServer(),e.serverVariables=a.serverVariables(e.server).toJS(),e.requestContentType=a.requestContentType(s,u),e.responseContentType=a.responseContentType(s,u)||"*/*";var d=a.requestBodyValue(s,u);(0,O.isJSONObject)(d)?e.requestBody=JSON.parse(d):e.requestBody=d}var m=(0,b.default)({},e);m=n.buildRequest(m),r.setRequest(e.pathName,e.method,m);var v=function(t){var n=p.apply(this,[t]),i=(0,b.default)({},n);return r.setMutatedRequest(e.pathName,e.method,i),n};e.requestInterceptor=v,e.responseInterceptor=f;var g=Date.now();return n.execute(e).then(function(t){t.duration=Date.now()-g,r.setResponse(e.pathName,e.method,t)}).catch(function(t){return r.setResponse(e.pathName,e.method,{error:!0,err:(0,D.default)(t)})})}},function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.path,n=e.method,r=(0,y.default)(e,["path","method"]);return function(e){var i=e.fn.fetch,o=e.specSelectors,a=e.specActions,s=o.spec().toJS(),u=o.operationScheme(t,n),l=o.contentTypeValues([t,n]).toJS(),c=l.requestContentType,p=l.responseContentType,f=/xml/i.test(c),h=o.parameterValues([t,n],f).toJS();return a.executeRequest((0,v.default)({fetch:i,spec:s,pathName:t,method:n,parameters:h,requestContentType:c,scheme:u,responseContentType:p},r))}});t.execute=H},function(e,t,n){"use strict";var r=n(11),i=n(1136);i.keys().forEach(function(t){if("./index.js"!==t){var n=i(t);e.exports[(0,r.pascalCaseFilename)(t)]=n.default?n.default:n}})},function(e,t,n){"use strict";function r(e){switch(e._type){case"document":case"block_quote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"link":case"image":case"custom_inline":case"custom_block":return!0;default:return!1}}var i=function(e,t){this.current=e,this.entering=!0===t},o=function(){var e=this.current,t=this.entering;if(null===e)return null;var n=r(e);return t&&n?e._firstChild?(this.current=e._firstChild,this.entering=!0):this.entering=!1:e===this.root?this.current=null:null===e._next?(this.current=e._parent,this.entering=!1):(this.current=e._next,this.entering=!0),{entering:t,node:e}},a=function(e){return{current:e,root:e,entering:!0,next:o,resumeAt:i}},s=function(e,t){this._type=e,this._parent=null,this._firstChild=null,this._lastChild=null,this._prev=null,this._next=null,this._sourcepos=t,this._lastLineBlank=!1,this._open=!0,this._string_content=null,this._literal=null,this._listData={},this._info=null,this._destination=null,this._title=null,this._isFenced=!1,this._fenceChar=null,this._fenceLength=0,this._fenceOffset=null,this._level=null,this._onEnter=null,this._onExit=null},u=s.prototype;Object.defineProperty(u,"isContainer",{get:function(){return r(this)}}),Object.defineProperty(u,"type",{get:function(){return this._type}}),Object.defineProperty(u,"firstChild",{get:function(){return this._firstChild}}),Object.defineProperty(u,"lastChild",{get:function(){return this._lastChild}}),Object.defineProperty(u,"next",{get:function(){return this._next}}),Object.defineProperty(u,"prev",{get:function(){return this._prev}}),Object.defineProperty(u,"parent",{get:function(){return this._parent}}),Object.defineProperty(u,"sourcepos",{get:function(){return this._sourcepos}}),Object.defineProperty(u,"literal",{get:function(){return this._literal},set:function(e){this._literal=e}}),Object.defineProperty(u,"destination",{get:function(){return this._destination},set:function(e){this._destination=e}}),Object.defineProperty(u,"title",{get:function(){return this._title},set:function(e){this._title=e}}),Object.defineProperty(u,"info",{get:function(){return this._info},set:function(e){this._info=e}}),Object.defineProperty(u,"level",{get:function(){return this._level},set:function(e){this._level=e}}),Object.defineProperty(u,"listType",{get:function(){return this._listData.type},set:function(e){this._listData.type=e}}),Object.defineProperty(u,"listTight",{get:function(){return this._listData.tight},set:function(e){this._listData.tight=e}}),Object.defineProperty(u,"listStart",{get:function(){return this._listData.start},set:function(e){this._listData.start=e}}),Object.defineProperty(u,"listDelimiter",{get:function(){return this._listData.delimiter},set:function(e){this._listData.delimiter=e}}),Object.defineProperty(u,"onEnter",{get:function(){return this._onEnter},set:function(e){this._onEnter=e}}),Object.defineProperty(u,"onExit",{get:function(){return this._onExit},set:function(e){this._onExit=e}}),s.prototype.appendChild=function(e){e.unlink(),e._parent=this,this._lastChild?(this._lastChild._next=e,e._prev=this._lastChild,this._lastChild=e):(this._firstChild=e,this._lastChild=e)},s.prototype.prependChild=function(e){e.unlink(),e._parent=this,this._firstChild?(this._firstChild._prev=e,e._next=this._firstChild,this._firstChild=e):(this._firstChild=e,this._lastChild=e)},s.prototype.unlink=function(){this._prev?this._prev._next=this._next:this._parent&&(this._parent._firstChild=this._next),this._next?this._next._prev=this._prev:this._parent&&(this._parent._lastChild=this._prev),this._parent=null,this._next=null,this._prev=null},s.prototype.insertAfter=function(e){e.unlink(),e._next=this._next,e._next&&(e._next._prev=e),e._prev=this,this._next=e,e._parent=this._parent,e._next||(e._parent._lastChild=e)},s.prototype.insertBefore=function(e){e.unlink(),e._prev=this._prev,e._prev&&(e._prev._next=e),e._next=this,this._prev=e,e._parent=this._parent,e._prev||(e._parent._firstChild=e)},s.prototype.walker=function(){return new a(this)},e.exports=s},function(e,t){var n=Object.prototype.toString;e.exports=function(e){switch(n.call(e)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===e?"null":void 0===e?"undefined":e!==e?"nan":e&&1===e.nodeType?"element":typeof(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e))}},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var r=n(51),i=n(172),o=n(70),a=n(126),s=n(569);e.exports=function(e,t){var n=1==e,u=2==e,l=3==e,c=4==e,p=6==e,f=5==e||p,h=t||s;return function(t,s,d){for(var m,v,g=o(t),y=i(g),_=r(s,d,3),b=a(y.length),x=0,k=n?h(t,b):u?h(t,0):void 0;b>x;x++)if((f||x in y)&&(m=y[x],v=_(m,x,g),e))if(n)k[x]=v;else if(v)switch(e){case 3:return!0;case 5:return m;case 6:return x;case 2:k.push(m)}else if(c)return!1;return p?-1:l||c?c:k}}},function(e,t,n){var r=n(93),i=n(19)("toStringTag"),o="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),i))?n:o?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(27),i=n(22).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(93);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){"use strict";function r(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=i(t),this.reject=i(n)}var i=n(92);e.exports.f=function(e){return new r(e)}},function(e,t,n){var r=n(33),i=n(578),o=n(171),a=n(178)("IE_PROTO"),s=function(){},u=function(){var e,t=n(170)("iframe"),r=o.length;for(t.style.display="none",n(315).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("