From: Henrik Andersson Date: Tue, 19 Jan 2021 11:50:26 +0000 (+0000) Subject: Merge "Minor documentation improvements" X-Git-Tag: 2.2.0~83 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=7bef63e604a6391d6f9264c049a51e6d0680e07a;hp=6296305fad90e21103fa92e05e0d21a3ba1356a2;p=nonrtric.git Merge "Minor documentation improvements" --- diff --git a/docker-compose/mr/docker-compose.yml b/docker-compose/mr/docker-compose.yml index 48cc04ce..e2948f40 100644 --- a/docker-compose/mr/docker-compose.yml +++ b/docker-compose/mr/docker-compose.yml @@ -38,7 +38,7 @@ services: KAFKA_OPTS: -Djava.security.auth.login.config=/etc/zookeeper/secrets/jaas/zk_server_jaas.conf -Dzookeeper.kerberos.removeHostFromPrincipal=true -Dzookeeper.kerberos.removeRealmFromPrincipal=true -Dzookeeper.authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider -Dzookeeper.requireClientAuthScheme=sasl ZOOKEEPER_SERVER_ID: 1 volumes: - - ./zk/zk_server_jaas.conf:/etc/zookeeper/secrets/jaas/zk_server_jaas.conf + - ./mr/zk/zk_server_jaas.conf:/etc/zookeeper/secrets/jaas/zk_server_jaas.conf networks: - default @@ -63,7 +63,7 @@ services: # Reduced the number of partitions only to avoid the timeout error for the first subscribe call in slow environment KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS: 1 volumes: - - ./kafka/zk_client_jaas.conf:/etc/kafka/secrets/jaas/zk_client_jaas.conf + - ./mr/kafka/zk_client_jaas.conf:/etc/kafka/secrets/jaas/zk_client_jaas.conf networks: - default depends_on: @@ -78,9 +78,9 @@ services: environment: enableCadi: 'false' volumes: - - ./mr/MsgRtrApi.properties:/appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties - - ./mr/logback.xml:/appl/dmaapMR1/bundleconfig/etc/logback.xml - - ./mr/cadi.properties:/appl/dmaapMR1/etc/cadi.properties + - ./mr/mr/MsgRtrApi.properties:/appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties + - ./mr/mr/logback.xml:/appl/dmaapMR1/bundleconfig/etc/logback.xml + - ./mr/mr/cadi.properties:/appl/dmaapMR1/etc/cadi.properties networks: - default depends_on: diff --git a/docker-compose/policy-service/docker-compose.yaml b/docker-compose/policy-service/docker-compose.yaml index 4abb65e9..fd2e9b06 100644 --- a/docker-compose/policy-service/docker-compose.yaml +++ b/docker-compose/policy-service/docker-compose.yaml @@ -32,9 +32,9 @@ services: - 8081:8081 - 8433:8433 volumes: - - ./config/application_configuration.json:/opt/app/policy-agent/data/application_configuration.json:ro + - ./policy-service/config/application_configuration.json:/opt/app/policy-agent/data/application_configuration.json:ro # For using own certs instead of the default ones (built into the container), # place them in config/ directory, update the application-policyagent.yaml file, and uncomment the following lines - # - ./config/keystore-policyagent.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro - # - ./config/truststore-policyagent.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro - # - ./config/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro + # - ./policy-service/config/keystore-policyagent.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro + # - ./policy-service/config/truststore-policyagent.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro + # - ./policy-service/config/application-policyagent.yaml:/opt/app/policy-agent/config/application.yaml:ro diff --git a/docker-compose/rapp/docker-compose.yaml b/docker-compose/rapp/docker-compose.yaml index a7f6f431..ade37f71 100644 --- a/docker-compose/rapp/docker-compose.yaml +++ b/docker-compose/rapp/docker-compose.yaml @@ -29,6 +29,6 @@ services: aliases: - r-app-catalogue ports: - - 8080:8080 - - 8433:8433 + - 8680:8680 + - 8633:8633 diff --git a/docker-compose/sdnc/docker-compose.yml b/docker-compose/sdnc/docker-compose.yml index 6ad80d9f..fc5b0132 100644 --- a/docker-compose/sdnc/docker-compose.yml +++ b/docker-compose/sdnc/docker-compose.yml @@ -58,9 +58,9 @@ services: # For using own certs instead of the default ones (built into the container), # place them in config/ directory, update the https-props-a1controller.properties file, and uncomment the following lines #volumes: - # - ./config/keystore-a1controller.jks:/etc/ssl/certs/java/keystore.jks:ro - # - ./config/truststore-a1controller.jks:/etc/ssl/certs/java/truststore.jks:ro - # - ./config/https-props-a1controller.properties:/opt/onap/sdnc/data/properties/https-props.properties:ro + # - ./sdnc/config/keystore-a1controller.jks:/etc/ssl/certs/java/keystore.jks:ro + # - ./sdnc/config/truststore-a1controller.jks:/etc/ssl/certs/java/truststore.jks:ro + # - ./sdnc/config/https-props-a1controller.properties:/opt/onap/sdnc/data/properties/https-props.properties:ro logging: driver: "json-file" options: diff --git a/r-app-catalogue/Dockerfile b/r-app-catalogue/Dockerfile index a85f57d6..cd2efc9b 100644 --- a/r-app-catalogue/Dockerfile +++ b/r-app-catalogue/Dockerfile @@ -23,10 +23,12 @@ ARG JAR WORKDIR /opt/app/r-app-catalogue RUN mkdir -p /var/log/r-app-catalogue +RUN mkdir -p /opt/app/r-app-catalogue/etc/cert/ -EXPOSE 8081 8433 +EXPOSE 8680 8633 ADD /config/application.yaml /opt/app/r-app-catalogue/config/application.yaml +ADD /config/r-app-catalogue-keystore.jks /opt/app/r-app-catalogue/etc/cert/keystore.jks ADD target/${JAR} /opt/app/r-app-catalogue/r-app-catalogue.jar diff --git a/r-app-catalogue/config/application.yaml b/r-app-catalogue/config/application.yaml index fadf7d24..1ef0bdcc 100644 --- a/r-app-catalogue/config/application.yaml +++ b/r-app-catalogue/config/application.yaml @@ -1,4 +1,30 @@ + # ========================LICENSE_START================================= + # Copyright (C) 2021 Nordix Foundation. 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=================================== + spring: profiles: active: prod - +server: + # Configuration of the HTTP/REST server. The parameters are defined and handled by the springboot framework. + # See springboot documentation. + port : 8633 + http-port: 8680 + ssl: + key-store-type: JKS + key-store: /opt/app/r-app-catalogue/etc/cert/keystore.jks + key-store-password: r-app-catalogue + key-password: r-app-catalogue + key-alias: server-cert diff --git a/r-app-catalogue/config/r-app-catalogue-keystore.jks b/r-app-catalogue/config/r-app-catalogue-keystore.jks new file mode 100644 index 00000000..192fe173 Binary files /dev/null and b/r-app-catalogue/config/r-app-catalogue-keystore.jks differ diff --git a/r-app-catalogue/pom.xml b/r-app-catalogue/pom.xml index 07e4c39d..5da52d34 100644 --- a/r-app-catalogue/pom.xml +++ b/r-app-catalogue/pom.xml @@ -157,6 +157,17 @@ junit-jupiter-engine test + + org.springframework.boot + spring-boot-starter-test + test + + + org.apache.httpcomponents + httpclient + test + + diff --git a/r-app-catalogue/src/main/java/org/oransc/rappcatalogue/configuration/TomcatConfig.java b/r-app-catalogue/src/main/java/org/oransc/rappcatalogue/configuration/TomcatConfig.java new file mode 100644 index 00000000..a04a3323 --- /dev/null +++ b/r-app-catalogue/src/main/java/org/oransc/rappcatalogue/configuration/TomcatConfig.java @@ -0,0 +1,56 @@ +/*- + * ========================LICENSE_START================================= + * Copyright (C) 2021 Nordix Foundation. 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.oransc.rappcatalogue.configuration; + +import org.apache.catalina.connector.Connector; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; +import org.springframework.boot.web.servlet.server.ServletWebServerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Configure embedded Tomcat + */ + +@Configuration +public class TomcatConfig { + + @Value("${server.http-port}") + private int httpPort = 0; + + // Embedded Tomcat with HTTP and HTTPS support + @Bean + public ServletWebServerFactory servletContainer() { + TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory(); + + if (httpPort > 0) { + tomcat.addAdditionalTomcatConnectors(getHttpConnector(httpPort)); + } + return tomcat; + } + + private static Connector getHttpConnector(int httpPort) { + Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL); + connector.setScheme("http"); + connector.setPort(httpPort); + connector.setSecure(false); + return connector; + } +} diff --git a/r-app-catalogue/src/test/java/org/oransc/rappcatalogue/HttpsRequestTest.java b/r-app-catalogue/src/test/java/org/oransc/rappcatalogue/HttpsRequestTest.java new file mode 100644 index 00000000..3cf2c2e7 --- /dev/null +++ b/r-app-catalogue/src/test/java/org/oransc/rappcatalogue/HttpsRequestTest.java @@ -0,0 +1,113 @@ +/*- + * ========================LICENSE_START================================= + * Copyright (C) 2021 Nordix Foundation. 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.oransc.rappcatalogue; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; + +import javax.net.ssl.SSLContext; + +import org.apache.http.client.HttpClient; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.ssl.SSLContextBuilder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.test.web.client.TestRestTemplate.HttpClientOption; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.boot.web.server.AbstractConfigurableWebServerFactory; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.util.ResourceUtils; +import org.springframework.web.client.ResourceAccessException; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@TestPropertySource( + properties = { // + "server.ssl.key-store=./config/r-app-catalogue-keystore.jks", // + "server.http-port=0"}) +public class HttpsRequestTest { + + @Value("${server.ssl.key-store-password}") + private String keyStorePassword; // inject password from config + + @Value("${server.ssl.key-store}") + private String keyStore; // inject keyStore from config + + @LocalServerPort + private int port; + + @Autowired + private AbstractConfigurableWebServerFactory webServerFactory; + + @Test + public void testSsl() { + assertEquals(this.webServerFactory.getSsl().isEnabled(), true); + } + + @Test + public void rest_OverPlainHttp_GetsBadRequestRequiresTLS() throws Exception { + TestRestTemplate template = new TestRestTemplate(); + ResponseEntity responseEntity = + template.getForEntity("http://localhost:" + port + "/services", String.class); + assertEquals(HttpStatus.BAD_REQUEST, responseEntity.getStatusCode()); + assertTrue(responseEntity.getBody().contains("This combination of host and port requires TLS")); + } + + @Test + public void rest_WithoutSSLConfiguration_ThrowsSSLExceptionUnableFindValidCertPath() throws Exception { + TestRestTemplate template = new TestRestTemplate(); + + ResourceAccessException thrown = assertThrows(ResourceAccessException.class, () -> { + template.getForEntity("https://localhost:" + port + "/services", String.class); + }); + assertTrue(thrown.getMessage().contains("unable to find valid certification path to requested target")); + } + + @Test + public void rest_WithTwoWaySSL_AuthenticatesAndGetsExpectedResponse() throws Exception { + + SSLContext sslContext = new SSLContextBuilder().loadKeyMaterial(ResourceUtils.getFile(keyStore), + keyStorePassword.toCharArray(), keyStorePassword.toCharArray()).build(); + + SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext); + HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build(); + HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient); + RestTemplateBuilder rtb = + new RestTemplateBuilder().requestFactory(() -> factory).rootUri("https://localhost:" + port); + + TestRestTemplate template = new TestRestTemplate(rtb, null, null, HttpClientOption.SSL); + + ResponseEntity responseEntity = template.getForEntity("/services", String.class); + assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); + assertEquals("[]", responseEntity.getBody()); + } + +} diff --git a/test/auto-test/FTC1100.sh b/test/auto-test/FTC1100.sh index fa30fef5..d312caa7 100755 --- a/test/auto-test/FTC1100.sh +++ b/test/auto-test/FTC1100.sh @@ -152,11 +152,19 @@ ecs_api_a1_get_type_ids 200 EMPTY ecs_api_a1_get_type 404 test-type ecs_api_edp_get_type_ids 200 EMPTY -ecs_api_edp_get_type 404 test-type - -ecs_api_edp_get_producer_ids 200 EMPTY -ecs_api_edp_get_producer 404 test-prod +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_type 404 test-type +else + ecs_api_edp_get_type_2 404 test-type +fi +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 EMPTY + ecs_api_edp_get_producer 404 test-prod +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE EMPTY + ecs_api_edp_get_producer_2 404 test-prod +fi ecs_api_edp_get_producer_status 404 test-prod ecs_api_edp_delete_producer 404 test-prod @@ -185,12 +193,39 @@ fi ecs_api_edp_get_producer_jobs 404 test-prod +if [ $ECS_VERSION == "V1-2" ]; then + ecs_api_edp_get_type_2 404 test-type + ecs_api_edp_delete_type_2 404 test-type +fi ### Setup of producer/job and testing apis ### ## Setup prod-a -ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json -ecs_api_edp_put_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json + ecs_api_edp_put_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json +else + #V1-2 + ecs_api_edp_get_type_ids 200 EMPTY + ecs_api_edp_get_type_2 404 type1 + ecs_api_edp_put_producer_2 404 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 + + # Create type, delete and create again + ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json + ecs_api_edp_get_type_2 200 type1 + ecs_api_edp_get_type_ids 200 type1 + ecs_api_edp_delete_type_2 204 type1 + ecs_api_edp_get_type_2 404 type1 + ecs_api_edp_get_type_ids 200 EMPTY + ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json + ecs_api_edp_get_type_ids 200 type1 + ecs_api_edp_get_type_2 200 type1 testdata/ecs/ei-type-1.json + + ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 + ecs_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 + + ecs_api_edp_delete_type_2 406 type1 +fi ecs_api_a1_get_type_ids 200 type1 @@ -201,11 +236,25 @@ else fi ecs_api_edp_get_type_ids 200 type1 -ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a +else + ecs_api_edp_get_type_2 200 type1 testdata/ecs/ei-type-1.json +fi -ecs_api_edp_get_producer_ids 200 prod-a +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-a +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a + ecs_api_edp_get_producer_ids_2 200 type1 prod-a + ecs_api_edp_get_producer_ids_2 200 type2 EMPTY +fi -ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json +else + ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 +fi ecs_api_edp_get_producer_status 200 prod-a ENABLED @@ -289,7 +338,13 @@ prodstub_equal create/prod-a/job2 1 ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json ## Setup prod-b -ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json +else + ecs_api_edp_put_type_2 201 type2 testdata/ecs/ei-type-2.json + ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 +fi + ecs_api_a1_get_type_ids 200 type1 type2 if [ -z "$FLAT_A1_EI" ]; then @@ -301,14 +356,27 @@ else fi ecs_api_edp_get_type_ids 200 type1 type2 -ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a -ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b - -ecs_api_edp_get_producer_ids 200 prod-a prod-b +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a + ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b +else + ecs_api_edp_get_type_2 200 type1 testdata/ecs/ei-type-1.json + ecs_api_edp_get_type_2 200 type2 testdata/ecs/ei-type-2.json +fi -ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json -ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-a prod-b +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b +fi +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json + ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json +else + ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 + ecs_api_edp_get_producer_2 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 +fi ecs_api_edp_get_producer_status 200 prod-b ENABLED @@ -346,14 +414,27 @@ ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdat ## Setup prod-c (no types) -ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c NOTYPE - +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c NOTYPE +else + ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c NOTYPE +fi -ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c +fi -ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json -ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json -ecs_api_edp_get_producer 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c EMPTY +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json + ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json + ecs_api_edp_get_producer 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c EMPTY +else + ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 + ecs_api_edp_get_producer_2 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 + ecs_api_edp_get_producer_2 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c EMPTY +fi ecs_api_edp_get_producer_status 200 prod-c ENABLED @@ -362,7 +443,11 @@ ecs_api_edp_get_producer_status 200 prod-c ENABLED # Delete job then producer ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3 -ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c +fi if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_delete_job 204 type2 job3 @@ -371,25 +456,42 @@ else fi ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 -ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c +fi ecs_api_edp_delete_producer 204 prod-b ecs_api_edp_get_producer_status 404 prod-b ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 -ecs_api_edp_get_producer_ids 200 prod-a prod-c +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-a prod-c +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-c +fi prodstub_equal delete/prod-b/job3 1 if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_put_job 404 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json else - ecs_api_a1_put_job 404 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json + if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_a1_put_job 404 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json + else + ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json + ecs_api_a1_get_job_status 200 job3 DISABLED + fi fi # Put producer then job -ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json +else + ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 +fi ecs_api_edp_get_producer_status 200 prod-b ENABLED @@ -397,16 +499,28 @@ if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_put_job 201 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json ecs_api_a1_get_job_status 200 type2 job3 ENABLED else - ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template2.json + if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template2.json + else + ecs_api_a1_put_job 200 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template2.json + fi ecs_api_a1_get_job_status 200 job3 ENABLED fi prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3 -ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c +fi -prodstub_equal create/prod-b/job3 2 +if [ $ECS_VERSION == "V1-1" ]; then + prodstub_equal create/prod-b/job3 2 +else + prodstub_equal create/prod-b/job3 3 +fi prodstub_equal delete/prod-b/job3 1 # Delete only the producer @@ -415,7 +529,11 @@ ecs_api_edp_delete_producer 204 prod-b ecs_api_edp_get_producer_status 404 prod-b ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3 -ecs_api_edp_get_producer_ids 200 prod-a prod-c +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-a prod-c +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-c +fi if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type2 job3 DISABLED @@ -428,7 +546,11 @@ cr_equal received_callbacks?id=job3-status 1 cr_api_check_all_ecs_events 200 job3-status DISABLED # Re-create the producer -ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json +else + ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 +fi ecs_api_edp_get_producer_status 200 prod-b ENABLED @@ -446,7 +568,12 @@ prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/j ## Setup prod-d -ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-1.json +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json +else + ecs_api_edp_put_type_2 201 type4 testdata/ecs/ei-type-1.json + ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 +fi ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY @@ -470,7 +597,11 @@ else fi # Re-PUT the producer with zero types -ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d NOTYPE +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d NOTYPE +else + ecs_api_edp_put_producer_2 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d NOTYPE +fi if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_ids 404 type4 NOWNER @@ -493,7 +624,12 @@ prodstub_equal create/prod-d/job8 1 prodstub_equal delete/prod-d/job8 0 ## Re-setup prod-d -ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-1.json +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json +else + ecs_api_edp_put_type_2 200 type4 testdata/ecs/ei-type-4.json + ecs_api_edp_put_producer_2 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 +fi if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_ids 404 type4 NOWNER @@ -522,7 +658,12 @@ prodstub_equal delete/prod-d/job8 0 ## Setup prod-e -ecs_api_edp_put_producer 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6 testdata/ecs/ei-type-6.json +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_put_producer 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6 testdata/ecs/ei-type-6.json +else + ecs_api_edp_put_type_2 201 type6 testdata/ecs/ei-type-6.json + ecs_api_edp_put_producer_2 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6 +fi ecs_api_a1_get_job_ids 200 type6 NOWNER EMPTY @@ -546,7 +687,12 @@ else fi ## Setup prod-f -ecs_api_edp_put_producer 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6 testdata/ecs/ei-type-6.json +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_put_producer 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6 testdata/ecs/ei-type-6.json +else + ecs_api_edp_put_type_2 200 type6 testdata/ecs/ei-type-6.json + ecs_api_edp_put_producer_2 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6 +fi ecs_api_a1_get_job_ids 200 type6 NOWNER job10 @@ -565,7 +711,11 @@ fi ## Status updates prod-a and jobs -ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f +fi ecs_api_edp_get_producer_status 200 prod-a ENABLED ecs_api_edp_get_producer_status 200 prod-b ENABLED @@ -580,7 +730,11 @@ prodstub_arm_producer 200 prod-a 400 # Wait for producer prod-a to go disabled ecs_api_edp_get_producer_status 200 prod-a DISABLED 360 -ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f +fi ecs_api_edp_get_producer_status 200 prod-a DISABLED ecs_api_edp_get_producer_status 200 prod-b ENABLED @@ -610,7 +764,11 @@ prodstub_arm_producer 200 prod-a 200 # Wait for producer prod-a to go enabled ecs_api_edp_get_producer_status 200 prod-a ENABLED 360 -ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f +fi ecs_api_edp_get_producer_status 200 prod-a ENABLED ecs_api_edp_get_producer_status 200 prod-b ENABLED @@ -639,7 +797,11 @@ prodstub_arm_producer 200 prod-a 400 # Wait for producer prod-a to go disabled ecs_api_edp_get_producer_status 200 prod-a DISABLED 360 -ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-a prod-b prod-c prod-d prod-e prod-f +fi ecs_api_edp_get_producer_status 200 prod-a DISABLED ecs_api_edp_get_producer_status 200 prod-b ENABLED @@ -665,7 +827,12 @@ fi # Wait for producer prod-a to be removed ecs_equal json:ei-producer/v1/eiproducers 5 1000 -ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e prod-f +fi + ecs_api_edp_get_producer_status 404 prod-a ecs_api_edp_get_producer_status 200 prod-b ENABLED @@ -701,7 +868,11 @@ prodstub_arm_producer 200 prod-e 400 ecs_api_edp_get_producer_status 200 prod-e DISABLED 1000 -ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e prod-f +fi ecs_api_edp_get_producer_status 404 prod-a ecs_api_edp_get_producer_status 200 prod-b ENABLED @@ -739,11 +910,15 @@ prodstub_arm_job_create 200 prod-e job10 200 ecs_api_edp_get_producer_status 200 prod-e ENABLED 360 -ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e prod-f +fi + +#Wait for job to be updated +sleep_wait 120 -#Job 10 should be updated when the producer goes enabled -deviation "Job 10 should be updated when the producer prod-e goes enabled" -prodstub_check_jobdata 200 prod-e job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json prodstub_arm_producer 200 prod-f 400 @@ -752,7 +927,11 @@ ecs_api_edp_get_producer_status 200 prod-f DISABLED 360 ecs_equal json:ei-producer/v1/eiproducers 4 1000 -ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e +else + ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-b prod-c prod-d prod-e +fi ecs_api_edp_get_producer_status 404 prod-a ecs_api_edp_get_producer_status 200 prod-b ENABLED diff --git a/test/auto-test/FTC1800.sh b/test/auto-test/FTC1800.sh index ba8b9f27..90ea3b5a 100755 --- a/test/auto-test/FTC1800.sh +++ b/test/auto-test/FTC1800.sh @@ -38,6 +38,7 @@ SUPPORTED_RUNMODES="DOCKER KUBE" . ../common/prodstub_api_functions.sh . ../common/control_panel_api_functions.sh . ../common/controller_api_functions.sh +. ../common/cr_api_functions.sh #### TEST BEGIN #### @@ -105,13 +106,32 @@ do fi done -ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json +if [ $ECS_VERSION == "V1-1" ]; then -ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json + ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json -ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json + ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json -ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json + ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json + + ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json + +else + + ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json + ecs_api_edp_put_type_2 201 type2 testdata/ecs/ei-type-2.json + ecs_api_edp_put_type_2 201 type3 testdata/ecs/ei-type-3.json + ecs_api_edp_put_type_2 201 type4 testdata/ecs/ei-type-4.json + ecs_api_edp_put_type_2 201 type5 testdata/ecs/ei-type-5.json + + ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 + + ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 type2 + + ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 type2 type3 + + ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 type5 +fi ecs_equal json:ei-producer/v1/eiproducers 4 @@ -127,7 +147,7 @@ do if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type1 job$i ENABLED else - ecs_api_a1_get_job_status 200 job$i ENABLED + ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi fi if [ $(($i%5)) -eq 1 ]; then @@ -135,7 +155,7 @@ do if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type2 job$i ENABLED else - ecs_api_a1_get_job_status 200 job$i ENABLED + ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi fi if [ $(($i%5)) -eq 2 ]; then @@ -143,7 +163,7 @@ do if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type3 job$i ENABLED else - ecs_api_a1_get_job_status 200 job$i ENABLED + ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi fi if [ $(($i%5)) -eq 3 ]; then @@ -151,7 +171,7 @@ do if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type4 job$i ENABLED else - ecs_api_a1_get_job_status 200 job$i ENABLED + ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi fi if [ $(($i%5)) -eq 4 ]; then @@ -159,7 +179,7 @@ do if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type5 job$i ENABLED else - ecs_api_a1_get_job_status 200 job$i ENABLED + ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi fi done @@ -215,47 +235,59 @@ do if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type1 job$i DISABLED else - ecs_api_a1_get_job_status 200 job$i DISABLED + ecs_api_a1_get_job_status 200 job$i DISABLED 120 fi fi if [ $(($i%5)) -eq 1 ]; then if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type2 job$i DISABLED else - ecs_api_a1_get_job_status 200 job$i DISABLED + ecs_api_a1_get_job_status 200 job$i DISABLED 120 fi fi if [ $(($i%5)) -eq 2 ]; then if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type3 job$i DISABLED else - ecs_api_a1_get_job_status 200 job$i DISABLED + ecs_api_a1_get_job_status 200 job$i DISABLED 120 fi fi if [ $(($i%5)) -eq 3 ]; then if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type4 job$i DISABLED else - ecs_api_a1_get_job_status 200 job$i DISABLED + ecs_api_a1_get_job_status 200 job$i DISABLED 120 fi fi if [ $(($i%5)) -eq 4 ]; then if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type5 job$i DISABLED else - ecs_api_a1_get_job_status 200 job$i DISABLED + ecs_api_a1_get_job_status 200 job$i DISABLED 120 fi fi done +if [ $ECS_VERSION == "V1-1" ]; then + + ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json + + ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json + + ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json -ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json + ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json -ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json +else + ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 + + ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 type2 -ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json + ecs_api_edp_put_producer_2 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 type2 type3 -ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json + ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 type5 + +fi ecs_equal json:ei-producer/v1/eiproducers 4 @@ -270,35 +302,35 @@ do if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type1 job$i ENABLED else - ecs_api_a1_get_job_status 200 job$i ENABLED + ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi fi if [ $(($i%5)) -eq 1 ]; then if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type2 job$i ENABLED else - ecs_api_a1_get_job_status 200 job$i ENABLED + ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi fi if [ $(($i%5)) -eq 2 ]; then if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type3 job$i ENABLED else - ecs_api_a1_get_job_status 200 job$i ENABLED + ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi fi if [ $(($i%5)) -eq 3 ]; then if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type4 job$i ENABLED else - ecs_api_a1_get_job_status 200 job$i ENABLED + ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi fi if [ $(($i%5)) -eq 4 ]; then if [ -z "$FLAT_A1_EI" ]; then ecs_api_a1_get_job_status 200 type5 job$i ENABLED else - ecs_api_a1_get_job_status 200 job$i ENABLED + ecs_api_a1_get_job_status 200 job$i ENABLED 120 fi fi done diff --git a/test/auto-test/PM_EI_DEMO.sh b/test/auto-test/PM_EI_DEMO.sh index fd5871c3..324d892e 100755 --- a/test/auto-test/PM_EI_DEMO.sh +++ b/test/auto-test/PM_EI_DEMO.sh @@ -190,9 +190,17 @@ prodstub_arm_job_create 200 prod-a job2 ecs_api_service_status 200 ## Setup prod-a -ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json +if [ $ECS_VERSION == "V1-1" ]; then + ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json -ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json + ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json +else + ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json + + ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 + + ecs_api_edp_get_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 +fi ecs_api_edp_get_producer_status 200 prod-a ENABLED diff --git a/test/common/agent_api_functions.sh b/test/common/agent_api_functions.sh index 98a8b56a..1cd430eb 100644 --- a/test/common/agent_api_functions.sh +++ b/test/common/agent_api_functions.sh @@ -308,7 +308,7 @@ api_equal() { if [ $# -eq 2 ] || [ $# -eq 3 ]; then if [[ $1 == "json:"* ]]; then if [ "$PMS_VERSION" == "V2" ]; then - __var_test "Policy Agent" $PA_PATH"/v2/" $1 "=" $2 $3 + __var_test "Policy Agent" $PA_PATH$PMS_API_PREFIX"/v2/" $1 "=" $2 $3 else __var_test "Policy Agent" $PA_PATH"/" $1 "=" $2 $3 fi diff --git a/test/common/ecs_api_functions.sh b/test/common/ecs_api_functions.sh index 986f3968..ba451e6f 100644 --- a/test/common/ecs_api_functions.sh +++ b/test/common/ecs_api_functions.sh @@ -473,7 +473,7 @@ ecs_api_a1_get_type_ids() { # API Test function: GET ​/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status # args: [] -# args (flat uri structure): [] +# args (flat uri structure): [ []] # (Function for test scripts) ecs_api_a1_get_job_status() { __log_test_start $@ @@ -506,31 +506,60 @@ ecs_api_a1_get_job_status() { fi else echo -e $YELLOW"USING NOT CONFIRMED INTERFACE - FLAT URI STRUCTURE"$EYELLOW - if [ $# -ne 2 ] && [ $# -ne 3 ]; then - __print_err " []" $@ + if [ $# -lt 2 ] && [ $# -gt 4 ]; then + __print_err " [ []]" $@ return 1 fi query="/A1-EI/v1/eijobs/$2/status" - res="$(__do_curl_to_api ECS GET $query)" - status=${res:${#res}-3} + start=$SECONDS + for (( ; ; )); do + res="$(__do_curl_to_api ECS GET $query)" + status=${res:${#res}-3} - if [ $status -ne $1 ]; then - __log_test_fail_status_code $1 $status - return 1 - fi - if [ $# -eq 3 ]; then - body=${res:0:${#res}-3} - targetJson="{\"eiJobStatus\": \"$3\"}" - echo " TARGET JSON: $targetJson" >> $HTTPLOG - res=$(python3 ../common/compare_json.py "$targetJson" "$body") + if [ $# -eq 4 ]; then + duration=$((SECONDS-start)) + echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}" + if [ $duration -gt $4 ]; then + echo "" + duration=-1 #Last iteration + fi + else + duration=-1 #single test, no wait + fi - if [ $res -ne 0 ]; then - __log_test_fail_body - return 1 + if [ $status -ne $1 ]; then + if [ $duration -eq -1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi fi - fi + if [ $# -ge 3 ] && [ $status -eq $1 ]; then + body=${res:0:${#res}-3} + targetJson="{\"eiJobStatus\": \"$3\"}" + echo " TARGET JSON: $targetJson" >> $HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + if [ $duration -eq -1 ]; then + __log_test_fail_body + return 1 + fi + else + duration=-1 #Goto pass + fi + fi + if [ $duration -eq -1 ]; then + if [ $# -eq 4 ]; then + echo "" + fi + __log_test_pass + return 0 + else + sleep 1 + fi + done fi __log_test_pass @@ -818,7 +847,7 @@ ecs_api_edp_get_producer_status() { # API Test function: GET /ei-producer/v1/eiproducers -# args: [ EMPTY | +] +# args (v1_1): [ EMPTY | +] # (Function for test scripts) ecs_api_edp_get_producer_ids() { __log_test_start $@ @@ -864,8 +893,58 @@ ecs_api_edp_get_producer_ids() { return 0 } +# API Test function: GET /ei-producer/v1/eiproducers +# args (v1_2): [ ( NOTYPE | ) [ EMPTY | +] ] +# (Function for test scripts) +ecs_api_edp_get_producer_ids_2() { + __log_test_start $@ + + if [ $# -lt 1 ]; then + __print_err " [ ( NOTYPE | ) [ EMPTY | +] ]" $@ + return 1 + fi + + query="/ei-producer/v1/eiproducers" + if [ $# -gt 1 ] && [ $2 != "NOTYPE" ]; then + query=$query"?ei_type_id=$2" + fi + res="$(__do_curl_to_api ECS GET $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + if [ $# -gt 2 ]; then + body=${res:0:${#res}-3} + targetJson="[" + + for pid in ${@:3} ; do + if [ "$targetJson" != "[" ]; then + targetJson=$targetJson"," + fi + if [ $pid != "EMPTY" ]; then + targetJson=$targetJson"\"$pid\"" + fi + done + + targetJson=$targetJson"]" + echo " TARGET JSON: $targetJson" >> $HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + + __log_test_pass + return 0 +} + # API Test function: GET /ei-producer/v1/eitypes/{eiTypeId} -# args: [ (EMPTY | []+)] +# args: (v1_1) [ (EMPTY | []+)] # (Function for test scripts) ecs_api_edp_get_type() { __log_test_start $@ @@ -923,8 +1002,115 @@ ecs_api_edp_get_type() { return 0 } +# API Test function: GET /ei-producer/v1/eitypes/{eiTypeId} +# args: (v1_2) [ ] +# (Function for test scripts) +ecs_api_edp_get_type_2() { + __log_test_start $@ + + paramError=1 + if [ $# -eq 2 ]; then + paramError=0 + fi + if [ $# -eq 3 ]; then + paramError=0 + fi + if [ $paramError -ne 0 ]; then + __print_err " [ ]" $@ + return 1 + fi + + query="/ei-producer/v1/eitypes/$2" + res="$(__do_curl_to_api ECS GET $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + if [ $# -eq 3 ]; then + body=${res:0:${#res}-3} + + if [ -f $3 ]; then + schema=$(cat $3) + else + __log_test_fail_general "Job template file "$3", does not exist" + return 1 + fi + + targetJson="{\"ei_job_data_schema\":$schema}" + + echo " TARGET JSON: $targetJson" >> $HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + __log_test_pass + return 0 +} + +# API Test function: PUT /ei-producer/v1/eitypes/{eiTypeId} +# args: (v1_2) +# (Function for test scripts) +ecs_api_edp_put_type_2() { + __log_test_start $@ + + if [ $# -ne 3 ]; then + __print_err " " $@ + return 1 + fi + + if [ ! -f $3 ]; then + __log_test_fail_general "Job schema file "$3", does not exist" + return 1 + fi + schema=$(cat $3) + input_json="{\"ei_job_data_schema\":$schema}" + file="./tmp/put_type.json" + echo $input_json > $file + + query="/ei-producer/v1/eitypes/$2" + res="$(__do_curl_to_api ECS PUT $query $file)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + __log_test_pass + return 0 +} + +# API Test function: DELETE /ei-producer/v1/eitypes/{eiTypeId} +# args: (v1_2) +# (Function for test scripts) +ecs_api_edp_delete_type_2() { + __log_test_start $@ + + if [ $# -ne 2 ]; then + __print_err " " $@ + return 1 + fi + + query="/ei-producer/v1/eitypes/$2" + res="$(__do_curl_to_api ECS DELETE $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + __log_test_pass + return 0 +} + # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId} -# args: [ (EMPTY | [ ]+) ] +# args: (v1_1) [ (EMPTY | [ ]+) ] # (Function for test scripts) ecs_api_edp_get_producer() { __log_test_start $@ @@ -992,6 +1178,67 @@ ecs_api_edp_get_producer() { return 0 } +# API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId} +# args (v1_2): [ (EMPTY | +) ] +# (Function for test scripts) +ecs_api_edp_get_producer_2() { + __log_test_start $@ + + #Possible arg count: 2, 5, 6, 7, 8 etc + paramError=1 + if [ $# -eq 2 ]; then + paramError=0 + fi + if [ $# -eq 5 ] && [ "$5" == "EMPTY" ]; then + paramError=0 + fi + if [ $# -ge 5 ]; then + paramError=0 + fi + + if [ $paramError -ne 0 ]; then + __print_err " [ (EMPTY | +) ]" $@ + return 1 + fi + + query="/ei-producer/v1/eiproducers/$2" + res="$(__do_curl_to_api ECS GET $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + if [ $# -gt 2 ]; then + body=${res:0:${#res}-3} + targetJson="[" + if [ $# -gt 4 ] && [ "$5" != "EMPTY" ]; then + arr=(${@:5}) + for ((i=0; i<$(($#-4)); i=i+1)); do + if [ "$targetJson" != "[" ]; then + targetJson=$targetJson"," + fi + targetJson=$targetJson"\"${arr[$i]}\"" + done + fi + targetJson=$targetJson"]" + if [ $# -gt 4 ]; then + targetJson="{\"supported_ei_types\":$targetJson,\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\"}" + fi + echo " TARGET JSON: $targetJson" >> $HTTPLOG + res=$(python3 ../common/compare_json.py "$targetJson" "$body") + + if [ $res -ne 0 ]; then + __log_test_fail_body + return 1 + fi + fi + + __log_test_pass + return 0 +} + # API Test function: DELETE /ei-producer/v1/eiproducers/{eiProducerId} # args: # (Function for test scripts) @@ -1017,7 +1264,7 @@ ecs_api_edp_delete_producer() { } # API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId} -# args: NOTYPE|[ ]+ +# args: (v1_1) NOTYPE|[ ]+ # (Function for test scripts) ecs_api_edp_put_producer() { __log_test_start $@ @@ -1071,6 +1318,55 @@ ecs_api_edp_put_producer() { return 0 } +# API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId} +# args: (v1_2) NOTYPE|[+] +# (Function for test scripts) +ecs_api_edp_put_producer_2() { + __log_test_start $@ + + #Valid number of parametrer 5,6,8,10, + paramError=1 + if [ $# -eq 5 ] && [ "$5" == "NOTYPE" ]; then + paramError=0 + elif [ $# -ge 5 ]; then + paramError=0 + fi + if [ $paramError -ne 0 ]; then + __print_err " NOTYPE|[+]" $@ + return 1 + fi + + inputJson="[" + if [ $# -gt 4 ] && [ "$5" != "NOTYPE" ]; then + arr=(${@:5}) + for ((i=0; i<$(($#-4)); i=i+1)); do + if [ "$inputJson" != "[" ]; then + inputJson=$inputJson"," + fi + inputJson=$inputJson"\""${arr[$i]}"\"" + done + fi + inputJson="\"supported_ei_types\":"$inputJson"]" + + inputJson=$inputJson",\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\"" + + inputJson="{"$inputJson"}" + + file="./tmp/.p.json" + echo "$inputJson" > $file + query="/ei-producer/v1/eiproducers/$2" + res="$(__do_curl_to_api ECS PUT $query $file)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + __log_test_pass + return 0 +} + # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/eijobs # args: (EMPTY | [ ]+) # (Function for test scripts) diff --git a/test/common/test_env-onap-honolulu.sh b/test/common/test_env-onap-honolulu.sh index ad78a211..f3c5b519 100644 --- a/test/common/test_env-onap-honolulu.sh +++ b/test/common/test_env-onap-honolulu.sh @@ -176,7 +176,7 @@ POLICY_AGENT_EXTERNAL_SECURE_PORT=8433 # Policy Agent containe POLICY_AGENT_INTERNAL_SECURE_PORT=8433 # Policy Agent container internal secure port (container -> container) POLICY_AGENT_APIS="V1 V2" # Supported northbound api versions PMS_VERSION="V2" # Tested version of northbound API -PMS_API_PREFIX="" # api url prefix, only for V2 +PMS_API_PREFIX="/a1-policy" # api url prefix, only for V2. Shall contain leading "/" POLICY_AGENT_APP_NAME="policymanagementservice" # Name for Policy Agent container POLICY_AGENT_DISPLAY_NAME="Policy Management Service" @@ -186,7 +186,7 @@ POLICY_AGENT_APP_NAME_ALIAS="policy-agent-container" # Alias name, name used POLICY_AGENT_CONFIG_KEY="policy-agent" # Key for consul config POLICY_AGENT_PKG_NAME="org.onap.ccsdk.oran.a1policymanagementservice" # Java base package name POLICY_AGENT_ACTUATOR="/actuator/loggers/$POLICY_AGENT_PKG_NAME" # Url for trace/debug -POLICY_AGENT_ALIVE_URL="/v2/status" # Base path for alive check +POLICY_AGENT_ALIVE_URL="$PMS_API_PREFIX/v2/status" # Base path for alive check POLICY_AGENT_COMPOSE_DIR="policy_agent" # Dir in simulator_group for docker-compose POLICY_AGENT_CONFIG_MOUNT_PATH="/opt/app/policy-agent/config" # Path in container for config file POLICY_AGENT_DATA_MOUNT_PATH="/opt/app/policy-agent/data" # Path in container for data file @@ -210,6 +210,7 @@ ECS_ALIVE_URL="/status" # Base path for alive c ECS_COMPOSE_DIR="ecs" # Dir in simulator_group for docker-compose ECS_CONFIG_MOUNT_PATH=/opt/app/enrichment-coordinator-service/config # Internal container path for configuration ECS_CONFIG_FILE=application.yaml # Config file name +ECS_VERSION="V1-1" # Version where the types are added in the producer registration MR_DMAAP_APP_NAME="dmaap-mr" # Name for the Dmaap MR MR_STUB_APP_NAME="mr-stub" # Name of the MR stub diff --git a/test/common/test_env-oran-cherry.sh b/test/common/test_env-oran-cherry.sh index 156600da..bc20aba7 100755 --- a/test/common/test_env-oran-cherry.sh +++ b/test/common/test_env-oran-cherry.sh @@ -220,7 +220,7 @@ ECS_ALIVE_URL="/status" # Base path for alive c ECS_COMPOSE_DIR="ecs" # Dir in simulator_group for docker-compose ECS_CONFIG_MOUNT_PATH=/opt/app/enrichment-coordinator-service/config # Internal container path for configuration ECS_CONFIG_FILE=application.yaml # Config file name - +ECS_VERSION="V1-1" # Version where the types are added in the producer registration MR_DMAAP_APP_NAME="dmaap-mr" # Name for the Dmaap MR MR_STUB_APP_NAME="mr-stub" # Name of the MR stub diff --git a/test/common/test_env-oran-dawn.sh b/test/common/test_env-oran-dawn.sh index bd759081..8943ffdf 100755 --- a/test/common/test_env-oran-dawn.sh +++ b/test/common/test_env-oran-dawn.sh @@ -227,7 +227,7 @@ ECS_ALIVE_URL="/status" # Base path for alive c ECS_COMPOSE_DIR="ecs" # Dir in simulator_group for docker-compose ECS_CONFIG_MOUNT_PATH=/opt/app/enrichment-coordinator-service/config # Internal container path for configuration ECS_CONFIG_FILE=application.yaml # Config file name - +ECS_VERSION="V1-2" # Version where the types are decoupled from the producer registration MR_DMAAP_APP_NAME="dmaap-mr" # Name for the Dmaap MR MR_STUB_APP_NAME="mr-stub" # Name of the MR stub diff --git a/test/simulator-group/policy_agent/mnt/.gitignore b/test/simulator-group/policy_agent/mnt/.gitignore new file mode 100644 index 00000000..1e82fc7d --- /dev/null +++ b/test/simulator-group/policy_agent/mnt/.gitignore @@ -0,0 +1 @@ +*.yaml diff --git a/test/simulator-group/sim-monitor.js b/test/simulator-group/sim-monitor.js index 9a0616d5..56a6e6d2 100644 --- a/test/simulator-group/sim-monitor.js +++ b/test/simulator-group/sim-monitor.js @@ -219,6 +219,8 @@ var ricbasename="ricsim" var rc_services="" +var pmsprefix="" + function fetchAllMetrics_pol() { console.log("Fetching policy metrics " + refreshCount_pol) @@ -923,14 +925,17 @@ app.get("/mon",function(req, res){ refreshCount_rc=5 var bn=req.query.basename + pmsprefix=req.query.pmsprefix - if (bn == undefined) { + console.log("PMS"+pmsprefix) + if ((bn == undefined) || (pmsprefix == undefined)) { getCtr=0 - return res.redirect('/mon?basename=ricsim'); + return res.redirect('/mon?basename=ricsim&pmsprefix=/a1-policy/v2'); } else { ricbasename=bn } + //Build web page var htmlStr = "" + "" + @@ -941,6 +946,7 @@ app.get("/mon",function(req, res){ "" + "" + "

Change basename in url if other ric sim prefix is used

" + + "

Change pmsprefix in url if pms with other prefix is used

" + "
" + "

Policy agent

" + "" +