diff --git a/.github/workflows/ri-consumer.yml b/.github/workflows/ri-consumer.yml index 5252f28..b39d3ce 100644 --- a/.github/workflows/ri-consumer.yml +++ b/.github/workflows/ri-consumer.yml @@ -2,37 +2,53 @@ name: Run ri consumer against sdc11073 provider on: push: + workflow_dispatch: jobs: test: strategy: matrix: - branch: [master] - sdcri_version: ["5.1.1", "6.0.0-SNAPSHOT"] + sdc11073_repo: [draegerwerk/sdc11073] + sdcpi_branch: [feature/pat_20] tls_enable: [true, false] + include: + - sdc11073_repo: draegerwerk/sdc11073 + sdc11073_branch: master fail-fast: false runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 - - name: Set up Python 3.10 - uses: actions/setup-python@v4 + uses: actions/checkout@v6 + + - name: Set up Python 3.13 + uses: actions/setup-python@v6 with: - python-version: '3.10' + python-version: '3.13' + - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v5 with: java-version: '17' distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v6 + - name: Checkout sdc11073 - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: - repository: draegerwerk/sdc11073 - ref: ${{ matrix.branch }} + repository: ${{ matrix.sdc11073_repo }} + ref: ${{ matrix.sdc11073_branch }} path: sdc11073_git + - name: Install sdc11073 run: | python -m pip install -e ./sdc11073_git + + - name: Checkout sdpi + run: | + git clone --branch=${{ matrix.sdcpi_branch }} https://gitlab.com/sdc-suite/sdc-ri-adjuncts/sdpi.git sdpi_git + - name: Run test run: | - ./ri_consumer.sh ${{ matrix.sdcri_version }} ${{ matrix.tls_enable }} + ./ri_consumer.sh ${{ matrix.tls_enable }} diff --git a/.github/workflows/sdc11073-consumer.yml b/.github/workflows/sdc11073-consumer.yml index b6ec154..33e868a 100644 --- a/.github/workflows/sdc11073-consumer.yml +++ b/.github/workflows/sdc11073-consumer.yml @@ -2,37 +2,53 @@ name: Run sdc11073 consumer against ri provider on: push: + workflow_dispatch: jobs: test: strategy: matrix: - branch: [master] - sdcri_version: ["5.1.1", "6.0.0-SNAPSHOT"] + sdc11073_repo: [draegerwerk/sdc11073] + sdcpi_branch: [feature/pat_20] tls_enable: [true, false] + include: + - sdc11073_repo: draegerwerk/sdc11073 + sdc11073_branch: master fail-fast: false runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 - - name: Set up Python 3.10 - uses: actions/setup-python@v4 + uses: actions/checkout@v6 + + - name: Set up Python 3.13 + uses: actions/setup-python@v6 with: - python-version: '3.10' + python-version: '3.13' + - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v5 with: java-version: '17' distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v6 + - name: Checkout sdc11073 - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: - repository: draegerwerk/sdc11073 - ref: ${{ matrix.branch }} + repository: ${{ matrix.sdc11073_repo }} + ref: ${{ matrix.sdc11073_branch }} path: sdc11073_git + - name: Install sdc11073 run: | python -m pip install -e ./sdc11073_git + + - name: Checkout sdpi + run: | + git clone --branch=${{ matrix.sdcpi_branch }} https://gitlab.com/sdc-suite/sdc-ri-adjuncts/sdpi.git sdpi_git + - name: Run test run: | - ./sdc11073_consumer.sh ${{ matrix.sdcri_version }} ${{ matrix.tls_enable }} + ./sdc11073_consumer.sh ${{ matrix.tls_enable }} diff --git a/app-config.toml b/app-config.toml new file mode 100644 index 0000000..2d4de7a --- /dev/null +++ b/app-config.toml @@ -0,0 +1,23 @@ +[provider] +epr = "urn:uuid:12345678-6f55-11ea-9697-123456789abc" +address = "127.0.0.1" +writeCommlog = false +[provider.tls] +disableTls = true +publicKeyFile = "**\\participant_public.pem" +privateKeyFile = "**\\participant_private.pem" +caCertFile = "**\\ca_certificate.pem" +privateKeyPassword = "dummypass" +[provider.updateTimes] +descriptionUpdateIntervalInMillis = 10000 + +[consumer] +epr = "urn:uuid:12345678-6f55-11ea-9697-123456789abc" +address = "127.0.0.1" +writeCommlog = true +[consumer.tls] +disableTls = true +publicKeyFile = "**\\user_certificate_root_signed.pem" +privateKeyFile = "**\\user_private_key_encrypted.pem" +caCertFile = "**\\root_certificate.pem" +privateKeyPassword = "dummypass" \ No newline at end of file diff --git a/ri/pom.xml b/ri/pom.xml deleted file mode 100644 index 97e661b..0000000 --- a/ri/pom.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - 4.0.0 - - com.draeger.integrationtest - 0.0.3 - ri - - - 5.6.1 - 1.6.1 - - - - - org.somda.sdc - glue-examples - ${sdcri-version} - - - - - - consumer - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - - java - - - - - com.example.consumer1.ConsumerIT - - --epr=urn:uuid:12345678-6f55-11ea-9697-123456789abc - --no_tls - - - - - - - - consumer-tls - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - - java - - - - - com.example.consumer1.ConsumerIT - - --usercert=../certs/usercert.pem - --userkey=../certs/userkey.pem - --cacert=../certs/cacert.pem - --userkey_password=dummypass - --epr=urn:uuid:12345678-6f55-11ea-9697-123456789abc - - - - - - - - provider - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - - java - - - - - com.example.provider1.Provider - - --no_tls - --epr=urn:uuid:12345678-6f55-11ea-9697-123456781abc - - - - - - - - provider-tls - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - - java - - - - - com.example.provider1.Provider - - --usercert=../certs/usercert.pem - --userkey=../certs/userkey.pem - --cacert=../certs/cacert.pem - --userkey_password=dummypass - --epr=urn:uuid:12345678-6f55-11ea-9697-123456781abc - - - - - - - - allow-snapshots - - true - - - - snapshots-repo - https://oss.sonatype.org/content/repositories/snapshots - - false - - - true - - - - - - diff --git a/ri_consumer.sh b/ri_consumer.sh index 30579d6..dae858b 100755 --- a/ri_consumer.sh +++ b/ri_consumer.sh @@ -1,34 +1,49 @@ #!/bin/bash args=("$@") -echo sdcri-version is "${args[0]}" -echo flag indicating to use TLS is "${args[1]}" +echo flag indicating to use TLS is "${args[0]}" ip addr -echo ref_ip is "${ref_ip}" - -export ref_fac="theFacility" -export ref_bed="comfyBed" -export ref_poc="noPoint" -if [ "${args[1]}" == "true" ]; then -export ref_ca=$(pwd)/certs -export ref_ssl_passwd=dummypass +epr="urn:uuid:12345678-6f55-11ea-9697-123456789abc" +ip_addr="127.0.0.1" +cert_path="$(pwd)/certs" +cert_passwd="dummypass" + +sdc11073_path="$(pwd)/sdc11073_git" +if [ "${args[0]}" == "true" ]; then + echo "Starting sdc11073 provider with TLS" + PYTHONPATH=$sdc11073_path python3 -m pat.provider --epr $epr --ip $ip_addr --certificate-folder $cert_path --ssl-password $cert_passwd & +else + echo "Starting sdc11073 provider without TLS" + PYTHONPATH=$sdc11073_path python3 -m pat.provider --epr $epr --ip $ip_addr & fi -echo "Starting sdc11073 provider" - -python3 sdc11073_git/examples/ReferenceTest/reference_provider.py & - -if [ "${args[1]}" == "true" ]; then -echo "Starting SDCri consumer with TLS" -cd ri && mvn -Dsdcri-version=${args[0]} -Pconsumer-tls -Pallow-snapshots exec:java; ((test_exit_code = $?)) +if [ "${args[0]}" == "true" ]; then + echo "Starting sdpi consumer with TLS" + disableTls_value="false" else -echo "Starting SDCri consumer without TLS" -cd ri && mvn -Dsdcri-version=${args[0]} -Pconsumer -Pallow-snapshots exec:java; ((test_exit_code = $?)) + echo "Starting sdpi consumer without TLS" + disableTls_value="true" fi +config="$(mktemp --suffix=.toml)" +cat > "$config" << EOF +[consumer] +epr = "$epr" +address = "$ip_addr" +writeCommlog = true +[consumer.tls] +disableTls = $disableTls_value +publicKeyFile = "$cert_path/user_certificate_root_signed.pem" +privateKeyFile = "$cert_path/user_private_key_encrypted.pem" +caCertFile = "$cert_path/root_certificate.pem" +privateKeyPassword = "$cert_passwd" +EOF + +(cd sdpi_git && ./gradlew run -PchooseMain=org.somda.sdpi.test.v2.consumer.MainKt --args="--config ${config}"); test_exit_code=$? + echo "Terminating sdc11073 provider" jobs && kill %1 -pkill -f sdc11073 +pkill -f pat.provider exit "$test_exit_code" \ No newline at end of file diff --git a/sdc11073_consumer.sh b/sdc11073_consumer.sh index 5b4cdbc..c575e60 100755 --- a/sdc11073_consumer.sh +++ b/sdc11073_consumer.sh @@ -1,35 +1,47 @@ #!/bin/bash + args=("$@") -echo sdcri-version is "${args[0]}" -echo flag indicating to use TLS is "${args[1]}" +echo flag indicating to use TLS is "${args[0]}" ip addr -echo ref_ip is "${ref_ip}" +epr="urn:uuid:87654321-6f55-1314-9697-123456789cba" +ip_addr="127.0.0.1" +cert_path="$(pwd)/certs" +cert_passwd="dummypass" +timeout_ref_provider="120" -if [ "${args[1]}" == "true" ]; then - export ref_ca=$(pwd)/certs - export ref_ssl_passwd=dummypass -fi -export ref_search_epr="" -# ref_discovery_runs defines the maximum executions of searching services via sdc11073 wsdiscovery -export ref_discovery_runs="20" -# EXTERNAL_DEVICE_RUNNING="true" indicates unittest in sdc11073 that an external SDC Provider is started -export EXTERNAL_DEVICE_RUNNING="true" - -if [ "${args[1]}" == "true" ]; then -echo "Starting SDCri provider with TLS" -(cd ri && sleep 999999999 | mvn -Dsdcri-version=${args[0]} -Pprovider-tls -Pallow-snapshots exec:java) & +if [ "${args[0]}" == "true" ]; then + echo "Starting sdpi provider with TLS" + disableTls_value="false" else -echo "Starting SDCri provider without TLS" -(cd ri && sleep 999999999 | mvn -Dsdcri-version=${args[0]} -Pprovider -Pallow-snapshots exec:java) & + echo "Starting sdpi provider without TLS" + disableTls_value="true" fi -sleep 20 -cd sdc11073_git -echo "Starting sdc11073 consumer reference_consumer" -python3 -m examples.ReferenceTest.reference_consumer; ((test_exit_code = $?)) -echo "Starting sdc11073 consumer test_client_connects" -python3 -m unittest examples.ReferenceTest.test_reference.Test_Reference.test_client_connects; ((test_exit_code = test_exit_code || $?)) +config="$(mktemp --suffix=.toml)" +cat > "$config" << EOF +[provider] +epr = "$epr" +address = "$ip_addr" +writeCommlog = true +[provider.tls] +disableTls = $disableTls_value +publicKeyFile = "$cert_path/user_certificate_root_signed.pem" +privateKeyFile = "$cert_path/user_private_key_encrypted.pem" +caCertFile = "$cert_path/root_certificate.pem" +privateKeyPassword = "$cert_passwd" +EOF + +(cd sdpi_git && ./gradlew run -PchooseMain=org.somda.sdpi.test.v2.provider.MainKt --args="--config ${config}") & + +cd sdc11073_git +if [ "${args[0]}" == "true" ]; then + echo "Starting sdc11073 consumer with TLS" + python3 -m pat.consumer --epr $epr --ip $ip_addr --certificate-folder $cert_path --ssl-password $cert_passwd --timeout-ref-provider $timeout_ref_provider; ((test_exit_code = $?)) +else + echo "Starting sdc11073 consumer without TLS" + python3 -m pat.consumer --epr $epr --ip $ip_addr --timeout-ref-provider $timeout_ref_provider; ((test_exit_code = $?)) +fi echo "Terminating SDCri provider" jobs && kill %1