diff options
author | Sylvain Desbureaux <sylvain.desbureaux@orange.com> | 2021-12-10 10:55:32 +0100 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2021-12-13 20:51:33 +0000 |
commit | 6e5625b242c92c7e6763f03daae8cb3238ee760d (patch) | |
tree | d14e6e7e8605553a6d2652549a3d64ad71ee4380 /ms | |
parent | 3763eb87d5717063ea35975cce184563013eaad1 (diff) |
[SDC Client] Allow HTTP
By default, SDC client is using only https, which can be problematic
when used on top of service mesh for example.
Let's override isUseHttpsWithSDC in order to allow use of http thanks to
a configuration variable.
Issue-ID: OOM-2258
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: I029f1dc802bba647b8088fb61a5e60680337aa00
Diffstat (limited to 'ms')
7 files changed, 73 insertions, 12 deletions
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java index 5caac6a5a..b56772afb 100644 --- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java @@ -67,6 +67,21 @@ public class SdcListenerConfiguration implements IConfiguration { @Value("${listenerservice.config.isUseHttpsWithDmaap}") private boolean isUseHttpsWithDmaap; + @Value("${listenerservice.config.isUseHttpsWithSDC}") + private boolean isUseHttpsWithSDC; + + @Value("${listenerservice.config.httpsProxyHost}") + private String getHttpsProxyHost; + + @Value("${listenerservice.config.httpProxyHost}") + private String getHttpProxyHost; + + @Value("${listenerservice.config.httpsProxyPort}") + private int getHttpsProxyPort; + + @Value("${listenerservice.config.httpProxyPort}") + private int getHttpProxyPort; + @Override public String getAsdcAddress() { return asdcAddress; @@ -142,5 +157,31 @@ public class SdcListenerConfiguration implements IConfiguration { return isUseHttpsWithDmaap; } + @Override + public Boolean isUseHttpsWithSDC() { + return isUseHttpsWithSDC; + } + + @Override + public String getHttpsProxyHost() { + return getHttpsProxyHost; + } + + @Override + public String getHttpProxyHost() { + return getHttpsProxyHost; + } + + @Override + public int getHttpsProxyPort() { + return getHttpsProxyPort; + } + + @Override + public int getHttpProxyPort() { + return getHttpsProxyPort; + } + + } diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java index ee27a9475..dd81d7628 100644 --- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java @@ -81,8 +81,7 @@ public class ListenerServiceImpl implements ListenerService { @Value("${listenerservice.config.grpcPort}") private int grpcPort; - private static final String CBA_ZIP_PATH = - "Artifacts/[a-zA-Z0-9-_.]+/Deployment/CONTROLLER_BLUEPRINT_ARCHIVE/[a-zA-Z0-9-_.()]+[.]zip"; + private static final String CBA_ZIP_PATH = "Artifacts/[a-zA-Z0-9-_.]+/Deployment/CONTROLLER_BLUEPRINT_ARCHIVE/[a-zA-Z0-9-_.()]+[.]zip"; private static final int SUCCESS_CODE = 200; private static final Logger LOGGER = LoggerFactory.getLogger(ListenerServiceImpl.class); diff --git a/ms/sdclistener/application/src/main/resources/application.yaml b/ms/sdclistener/application/src/main/resources/application.yaml index d07d8ae61..080f19d26 100644 --- a/ms/sdclistener/application/src/main/resources/application.yaml +++ b/ms/sdclistener/application/src/main/resources/application.yaml @@ -14,10 +14,15 @@ listenerservice: keyStorePath: ${keyStorePath} activateServerTLSAuth : ${activateServerTLSAuth:false} isUseHttpsWithDmaap: ${isUseHttpsWithDmaap:false} + isUseHttpsWithSDC: ${isUseHttpsWithSDC:true} archivePath: ${archivePath:/opt/app/onap/cds-sdc-listener/} grpcAddress: ${grpcAddress:localhost} grpcPort: ${grpcPort:9111} authHeader: ${authHeader:Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==} + httpsProxyHost: ${httpsProxyHost:} + httpProxyHost: ${httpProxyHost:} + httpsProxyPort: ${httpsProxyPort:0} + httpProxyPort: ${httpProxyPort:0} #port needed by Liveness probe server: port: ${healthcheckPort:9000} diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java index 8275bc084..bc07c5207 100644 --- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java @@ -46,6 +46,8 @@ public class SdcListenerConfigurationTest { assertEquals(listenerConfiguration.getEnvironmentName(), "AUTO"); assertEquals(listenerConfiguration.getConsumerID(), "cds-id-local"); assertEquals(listenerConfiguration.activateServerTLSAuth(), false); + assertEquals(listenerConfiguration.isUseHttpsWithSDC(), true); + assertEquals(listenerConfiguration.isUseHttpsWithDmaap(), false); } } diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java index 4179ccab0..dcf942f37 100644 --- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java @@ -32,7 +32,7 @@ import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; import org.onap.ccsdk.cds.sdclistener.handler.BluePrintProcesssorHandler; import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus; import org.onap.sdc.api.results.IDistributionClientDownloadResult; -import org.onap.sdc.impl.mock.DistributionClientResultStubImpl; +import org.onap.sdc.utils.DistributionActionResultEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.SpringBootTest; @@ -50,15 +50,14 @@ import static org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus.Notificati import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK; @RunWith(SpringRunner.class) -@EnableConfigurationProperties({SdcListenerAuthClientInterceptor.class, BluePrintProcesssorHandler.class, - SdcListenerDto.class, ListenerServiceImpl.class, SdcListenerStatus.class, SdcListenerConfiguration.class}) -@SpringBootTest(classes = {ListenerServiceImplTest.class}) +@EnableConfigurationProperties({ SdcListenerAuthClientInterceptor.class, BluePrintProcesssorHandler.class, + SdcListenerDto.class, ListenerServiceImpl.class, SdcListenerStatus.class, SdcListenerConfiguration.class }) +@SpringBootTest(classes = { ListenerServiceImplTest.class }) public class ListenerServiceImplTest { private static final String CSAR_SAMPLE = "src/test/resources/service-ServicePnfTest-csar.csar"; private static final String WRONG_CSAR_SAMPLE = "src/test/resources/wrong_csar_pattern.csar"; - private static final String CBA_ZIP_PATH = - "Artifacts/[a-zA-Z0-9-_.]+/Deployment/CONTROLLER_BLUEPRINT_ARCHIVE/[a-zA-Z0-9-_.()]+[.]zip"; + private static final String CBA_ZIP_PATH = "Artifacts/[a-zA-Z0-9-_.]+/Deployment/CONTROLLER_BLUEPRINT_ARCHIVE/[a-zA-Z0-9-_.()]+[.]zip"; private static final String ZIP_FILE = ".zip"; private static final String CSAR_FILE = ".csar"; private static final String DISTRIBUTION_ID = "1"; @@ -141,10 +140,20 @@ public class ListenerServiceImplTest { return null; } - public class DistributionClientDownloadResultStubImpl extends DistributionClientResultStubImpl - implements IDistributionClientDownloadResult { + public class DistributionClientDownloadResultStubImpl implements IDistributionClientDownloadResult { - public DistributionClientDownloadResultStubImpl() {} + @Override + public DistributionActionResultEnum getDistributionActionResult() { + return DistributionActionResultEnum.SUCCESS; + } + + @Override + public String getDistributionMessageResult() { + return "Stub Result, method not implemented!"; + } + + public DistributionClientDownloadResultStubImpl() { + } public byte[] getArtifactPayload() { File file = Paths.get(CSAR_SAMPLE).toFile(); diff --git a/ms/sdclistener/distribution/src/main/dc/docker-compose.yaml b/ms/sdclistener/distribution/src/main/dc/docker-compose.yaml index 1c68f6cf3..b03953e72 100755 --- a/ms/sdclistener/distribution/src/main/dc/docker-compose.yaml +++ b/ms/sdclistener/distribution/src/main/dc/docker-compose.yaml @@ -20,6 +20,7 @@ services: keyStorePath: activateServerTLSAuth: "false" isUseHttpsWithDmaap: "false" + isUseHttpsWithSDC: "true" archivePath: /opt/app/onap/cds-sdc-listener/ grpcAddress: localhost grpcPort: 9111 @@ -27,3 +28,7 @@ services: #port needed by Liveness probe healthcheckPort: "9000" sprintWebListenerEnabled: "true" + httpsProxyHost: + httpProxyHost: + httpsProxyPort: 0 + httpProxyPort: 0 diff --git a/ms/sdclistener/parent/pom.xml b/ms/sdclistener/parent/pom.xml index 244102db4..98574b09d 100755 --- a/ms/sdclistener/parent/pom.xml +++ b/ms/sdclistener/parent/pom.xml @@ -39,7 +39,7 @@ <mockk.version>1.9</mockk.version> <dmaap.client.version>1.1.5</dmaap.client.version> <mockkserver.version>5.5.1</mockkserver.version> - <sdc-distribution-client.version>1.4.0</sdc-distribution-client.version> + <sdc-distribution-client.version>1.4.5</sdc-distribution-client.version> <jmockit.version>1.49</jmockit.version> <reactorcore.version>3.2.6.RELEASE</reactorcore.version> </properties> |