summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2023-06-02 11:38:36 +0000
committerVasyl Razinkov <vasyl.razinkov@est.tech>2023-06-02 16:21:12 +0000
commit222555c7995645416a47bc52ed8837e3afde8e21 (patch)
tree0eae25247dfbc06538a9170dc5ab9a8addeb5bb3 /openecomp-be/api
parent9fb750f15ee84c4318d729c91c4ba50b61d73b3e (diff)
Revert "Support SIP TLS"
This reverts commit a2feaf9b65cbba66181fb560b5815a62427d65cc. Reason for revert: deployment issue Change-Id: Ic21e213493f51d0c11778187ab054881bba7c21e Issue-ID: SDC-4483 Signed-off-by: MichaelMorris <michael.morris@est.tech>
Diffstat (limited to 'openecomp-be/api')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml5
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VnfPackageRepositoryImpl.java50
2 files changed, 28 insertions, 27 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml
index adc0095b50..40edb974c9 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/pom.xml
@@ -110,11 +110,6 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- <version>${httpcore.version}</version>
- </dependency>
</dependencies>
</project>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VnfPackageRepositoryImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VnfPackageRepositoryImpl.java
index 754199ac29..5bfd29affa 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VnfPackageRepositoryImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VnfPackageRepositoryImpl.java
@@ -16,6 +16,24 @@
*/
package org.openecomp.sdcrests.vsp.rest.services;
+import static javax.ws.rs.core.HttpHeaders.CONTENT_DISPOSITION;
+import static org.openecomp.core.utilities.file.FileUtils.getFileExtension;
+import static org.openecomp.core.utilities.file.FileUtils.getNetworkPackageName;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.security.GeneralSecurityException;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import javax.inject.Named;
+import javax.net.ssl.SSLContext;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.core.Response;
import org.onap.config.api.ConfigurationManager;
import org.onap.config.api.JettySSLUtils;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
@@ -39,20 +57,6 @@ import org.openecomp.sdcrests.vsp.rest.mapping.MapUploadFileResponseToUploadFile
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
-import javax.inject.Named;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.core.Response;
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-
-import static javax.ws.rs.core.HttpHeaders.CONTENT_DISPOSITION;
-import static org.openecomp.core.utilities.file.FileUtils.getFileExtension;
-import static org.openecomp.core.utilities.file.FileUtils.getNetworkPackageName;
-
/**
* Enables integration API interface with VNF Repository (VNFSDK).
* <ol>
@@ -73,15 +77,17 @@ public class VnfPackageRepositoryImpl implements VnfPackageRepository {
private static Client trustSSLClient() {
try {
- return ClientBuilder.newBuilder()
- .sslContext(JettySSLUtils.getSslContext())
- .hostnameVerifier((requestedHost, remoteServerSession) -> requestedHost.equalsIgnoreCase(remoteServerSession.getPeerHost())).build();
- } catch (final Exception e) {
+ SSLContext sslcontext = JettySSLUtils.getSslContext();
+ return ClientBuilder.newBuilder().sslContext(sslcontext).hostnameVerifier((requestedHost, remoteServerSession)
+ -> requestedHost.equalsIgnoreCase(remoteServerSession.getPeerHost())).build();
+
+ } catch (IOException | GeneralSecurityException e) {
LOGGER.error("Failed to initialize SSL context", e);
}
return ClientBuilder.newClient();
}
+
private final Configuration config;
public VnfPackageRepositoryImpl(Configuration config) {
@@ -120,15 +126,15 @@ public class VnfPackageRepositoryImpl implements VnfPackageRepository {
private Response uploadVnfPackage(final String vspId, final String versionId, final String csarId, final byte[] payload) {
try {
final OrchestrationTemplateCandidateManager candidateManager = OrchestrationTemplateCandidateManagerFactory.getInstance()
- .createInterface();
+ .createInterface();
final String filename = formatFilename(csarId);
final String fileExtension = getFileExtension(filename);
final OnboardPackageInfo onboardPackageInfo = new OnboardPackageInfo(getNetworkPackageName(filename), fileExtension,
- ByteBuffer.wrap(payload), OnboardingTypesEnum.getOnboardingTypesEnum(fileExtension));
+ ByteBuffer.wrap(payload), OnboardingTypesEnum.getOnboardingTypesEnum(fileExtension));
final VspDetails vspDetails = new VspDetails(vspId, getVersion(vspId, versionId));
final UploadFileResponse response = candidateManager.upload(vspDetails, onboardPackageInfo);
final UploadFileResponseDto uploadFileResponse = new MapUploadFileResponseToUploadFileResponseDto()
- .applyMapping(response, UploadFileResponseDto.class);
+ .applyMapping(response, UploadFileResponseDto.class);
return Response.ok(uploadFileResponse).build();
} catch (final Exception e) {
ErrorCode error = new GeneralErrorBuilder().build();
@@ -166,7 +172,7 @@ public class VnfPackageRepositoryImpl implements VnfPackageRepository {
if (LOGGER.isErrorEnabled()) {
String body = response.hasEntity() ? response.readEntity(String.class) : "";
LOGGER.error("Unexpected response status while {}: URI={}, status={}, body={}", action, uri, response.getStatus(), body,
- new CoreException(error));
+ new CoreException(error));
}
return generateInternalServerError(error);
}