From 1ba430061bb9737003bccf1cc40fcf37c498859f Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Mon, 15 Jan 2024 11:53:44 -0800 Subject: [PATCH 1/4] Integration test for did:peer Signed-off-by: Ian Costanzo --- demo/features/0454-present-proof.feature | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/demo/features/0454-present-proof.feature b/demo/features/0454-present-proof.feature index 4f7512e69e..e9de592b8f 100644 --- a/demo/features/0454-present-proof.feature +++ b/demo/features/0454-present-proof.feature @@ -26,6 +26,29 @@ Feature: RFC 0454 Aries agent present proof | Faber | --public-did | --wallet-type askar-anoncreds | driverslicense_v2 | Data_DL_MaxValues | DL_age_over_19_v2 | + @T001-RFC0454-DID-PEER + Scenario Outline: Present Proof where the prover does not propose a presentation of the proof and is acknowledged + Given we have "2" agents + | name | role | capabilities | extra | + | Faber | verifier | | | + | Bob | prover | | | + And "" and "Bob" have an existing connection + And "Bob" has an issued credential from "" + And "Faber" and "Bob" have an existing connection + When "Faber" sends a request for proof presentation to "Bob" + Then "Faber" has the proof verified + + @WalletType_Askar + Examples: + | issuer | Acme_capabilities | Acme_extra | Bob_capabilities | Bob_extra | Schema_name | Credential_data | Proof_request | + | Faber | --public-did --did-exchange | --emit-did-peer-2 | --did-exchange | --emit-did-peer-2 | driverslicense_v2 | Data_DL_MaxValues | DL_age_over_19_v2 | + + @WalletType_Askar_AnonCreds + Examples: + | issuer | Acme_capabilities | Acme_extra | Bob_capabilities | Bob_extra | Schema_name | Credential_data | Proof_request | + | Faber | --public-did --wallet-type askar-anoncreds | --emit-did-peer-2 | --wallet-type askar-anoncreds | --emit-did-peer-2 | driverslicense_v2 | Data_DL_MaxValues | DL_age_over_19_v2 | + + @T001.1-RFC0454 Scenario Outline: Present Proof where the prover does not propose a presentation of the proof and is acknowledged Given we have "3" agents From 2c680bcbfcae0ebca122aa47ea87761856c9bb59 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Mon, 15 Jan 2024 12:21:32 -0800 Subject: [PATCH 2/4] Add extra_args capability (like in BDD) and update port assignments Signed-off-by: Ian Costanzo --- demo/features/0160-connection.feature | 4 ++++ demo/features/steps/0160-connection.py | 2 +- demo/run_bdd | 4 ++-- demo/run_demo | 7 +++++-- demo/runners/agent_container.py | 4 ++-- demo/runners/alice.py | 14 +++++++++++++- demo/runners/faber.py | 13 ++++++++++++- 7 files changed, 39 insertions(+), 9 deletions(-) diff --git a/demo/features/0160-connection.feature b/demo/features/0160-connection.feature index 553d037ef2..08f5a0c55f 100644 --- a/demo/features/0160-connection.feature +++ b/demo/features/0160-connection.feature @@ -14,5 +14,9 @@ Feature: RFC 0160 Aries agent connection functions @GHA @UnqualifiedDids Examples: | Acme_capabilities | Acme_extra | Bob_capabilities | Bob_extra | + | --public-did --did-exchange | --emit-did-peer-2 | --did-exchange |--emit-did-peer-2 | + | --public-did --did-exchange | --emit-did-peer-4 | --did-exchange |--emit-did-peer-4 | | --public-did --did-exchange | --emit-did-peer-2 | --did-exchange |--emit-did-peer-4 | | --public-did --did-exchange | --emit-did-peer-4 | --did-exchange |--emit-did-peer-2 | + | --public-did --did-exchange --reuse-connections | --emit-did-peer-2 | --did-exchange |--emit-did-peer-4 | + | --public-did --did-exchange --reuse-connections | --emit-did-peer-4 | --did-exchange |--emit-did-peer-2 | diff --git a/demo/features/steps/0160-connection.py b/demo/features/steps/0160-connection.py index 1f26148959..dc3def6072 100644 --- a/demo/features/steps/0160-connection.py +++ b/demo/features/steps/0160-connection.py @@ -29,7 +29,7 @@ def step_impl(context, n): """Startup 'n' agents based on the options provided in the context table parameters.""" - start_port = 8020 + start_port = 8030 extra_args = None if BDD_EXTRA_AGENT_ARGS: diff --git a/demo/run_bdd b/demo/run_bdd index 40c42bdf65..883cadfad3 100755 --- a/demo/run_bdd +++ b/demo/run_bdd @@ -123,8 +123,8 @@ EOF done AGENT_MODULE="agent_container" -AGENT_PORT=8020 -AGENT_PORT_RANGE=8020-8079 +AGENT_PORT=8030 +AGENT_PORT_RANGE=8030-8089 echo "Preparing agent image..." docker build -q -t acapy-base -f ../docker/Dockerfile .. || exit 1 diff --git a/demo/run_demo b/demo/run_demo index 3a133526ae..782efa1487 100755 --- a/demo/run_demo +++ b/demo/run_demo @@ -130,8 +130,8 @@ done if [ "$AGENT" = "faber" ]; then AGENT_MODULE="faber" - AGENT_PORT=8020 - AGENT_PORT_RANGE=8020-8029 + AGENT_PORT=8010 + AGENT_PORT_RANGE=8010-8019 elif [ "$AGENT" = "alice" ]; then AGENT_MODULE="alice" AGENT_PORT=8030 @@ -240,6 +240,9 @@ fi if ! [ -z "$ACAPY_ARG_FILE" ]; then DOCKER_ENV="${DOCKER_ENV} -e ACAPY_ARG_FILE=${ACAPY_ARG_FILE}" fi +if ! [ -z "$DEMO_EXTRA_AGENT_ARGS" ]; then + DOCKER_ENV="${DOCKER_ENV} -e DEMO_EXTRA_AGENT_ARGS=${DEMO_EXTRA_AGENT_ARGS}" +fi if ! [ -z "${ENABLE_PYDEVD_PYCHARM}" ]; then DOCKER_ENV="${DOCKER_ENV} -e ENABLE_PYDEVD_PYCHARM=${ENABLE_PYDEVD_PYCHARM} -e PYDEVD_PYCHARM_CONTROLLER_PORT=${PYDEVD_PYCHARM_CONTROLLER_PORT} -e PYDEVD_PYCHARM_AGENT_PORT=${PYDEVD_PYCHARM_AGENT_PORT}" diff --git a/demo/runners/agent_container.py b/demo/runners/agent_container.py index 86537399cf..7f602a93d5 100644 --- a/demo/runners/agent_container.py +++ b/demo/runners/agent_container.py @@ -61,10 +61,10 @@ def __init__( log_file: str = None, log_config: str = None, log_level: str = None, - extra_args: List[str] = None, + extra_args: List[str] = [], **kwargs, ): - extra_args = extra_args or [] + # extra_args = extra_args or [] if not no_auto: extra_args.extend( ( diff --git a/demo/runners/alice.py b/demo/runners/alice.py index 31f85d0bea..50da4035a6 100644 --- a/demo/runners/alice.py +++ b/demo/runners/alice.py @@ -23,6 +23,9 @@ prompt_loop, ) + +DEMO_EXTRA_AGENT_ARGS = os.getenv("DEMO_EXTRA_AGENT_ARGS") + logging.basicConfig(level=logging.WARNING) LOGGER = logging.getLogger(__name__) @@ -110,7 +113,15 @@ async def input_invitation(agent_container): async def main(args): - alice_agent = await create_agent_with_args(args, ident="alice") + extra_args = None + if DEMO_EXTRA_AGENT_ARGS: + extra_args = json.loads(DEMO_EXTRA_AGENT_ARGS) + print("Got extra args:", extra_args) + alice_agent = await create_agent_with_args( + args, + ident="alice", + extra_args=extra_args, + ) try: log_status( @@ -139,6 +150,7 @@ async def main(args): log_file=alice_agent.log_file, log_config=alice_agent.log_config, log_level=alice_agent.log_level, + extra_args=extra_args, ) await alice_agent.initialize(the_agent=agent) diff --git a/demo/runners/faber.py b/demo/runners/faber.py index 4d05c939ad..252c8c4a3c 100644 --- a/demo/runners/faber.py +++ b/demo/runners/faber.py @@ -33,6 +33,8 @@ SELF_ATTESTED = os.getenv("SELF_ATTESTED") TAILS_FILE_COUNT = int(os.getenv("TAILS_FILE_COUNT", 100)) +DEMO_EXTRA_AGENT_ARGS = os.getenv("DEMO_EXTRA_AGENT_ARGS") + logging.basicConfig(level=logging.WARNING) LOGGER = logging.getLogger(__name__) @@ -381,7 +383,15 @@ def generate_proof_request_web_request( async def main(args): - faber_agent = await create_agent_with_args(args, ident="faber") + extra_args = None + if DEMO_EXTRA_AGENT_ARGS: + extra_args = json.loads(DEMO_EXTRA_AGENT_ARGS) + print("Got extra args:", extra_args) + faber_agent = await create_agent_with_args( + args, + ident="faber", + extra_args=extra_args, + ) try: log_status( @@ -412,6 +422,7 @@ async def main(args): log_file=faber_agent.log_file, log_config=faber_agent.log_config, log_level=faber_agent.log_level, + extra_args=extra_args, ) faber_schema_name = "degree schema" From 6c5b4359a25b52f0c90685b513483a452d454cca Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Mon, 15 Jan 2024 12:45:30 -0800 Subject: [PATCH 3/4] Fix some bugs and update docs Signed-off-by: Ian Costanzo --- demo/INTEGRATION-TESTS.md | 11 +++++++++++ demo/README.md | 19 +++++++++++++++++++ demo/features/steps/0160-connection.py | 3 ++- demo/run_bdd | 10 ++++++++-- demo/run_demo | 10 ++++++++-- demo/runners/agent_container.py | 2 +- 6 files changed, 49 insertions(+), 6 deletions(-) diff --git a/demo/INTEGRATION-TESTS.md b/demo/INTEGRATION-TESTS.md index b8a8bf456c..334e445a19 100644 --- a/demo/INTEGRATION-TESTS.md +++ b/demo/INTEGRATION-TESTS.md @@ -75,6 +75,17 @@ or: BDD_EXTRA_AGENT_ARGS="{\"wallet-type\":\"askar\"}" ./run_bdd -t @taa_required ``` +The agents run on a pre-defined set of ports, however occasionally your local system may already be using one of these ports. (For example MaxOS recently decided to use 8021 for the ftp proxy service.) + +To overriide the default port settings: + +```bash +AGENT_PORT_OVERRIDE=8030 ./run_bdd -t +``` + +(Note that since the test run multiple agents you require up to 60 available ports.) + + ## Aca-py Integration Tests vs Aries Agent Test Harness (AATH) Aca-py Behave tests are based on the interoperability tests that are implemented in the [Aries Agent Test Harness (AATH)](https://github.com/hyperledger/aries-agent-test-harness). Both use [Behave (Gherkin)](https://behave.readthedocs.io/en/stable/) to execute tests against a running aca-py agent (or in the case of AATH, against any compatible Aries agent), however the aca-py integration tests focus on aca-py specific features. diff --git a/demo/README.md b/demo/README.md index 2f91d3adf6..361c56396a 100644 --- a/demo/README.md +++ b/demo/README.md @@ -26,6 +26,7 @@ There are several demos available for ACA-Py mostly (but not only) aimed at deve - [Multi-ledger](#multi-ledger) - [Multi-tenancy](#multi-tenancy) - [Multi-tenancy *with Mediation*!!!](#multi-tenancy-with-mediation) + - [Other Environment Settings](#other-environment-settings) - [Learning about the Alice/Faber code](#learning-about-the-alicefaber-code) - [OpenAPI (Swagger) Demo](#openapi-swagger-demo) - [Performance Demo](#performance-demo) @@ -396,6 +397,24 @@ Run the demo (Alice or Faber) specifying *both* options: This works exactly as the *vanilla* multi-tenancy, except that all connections are mediated. +## Other Environment Settings + +The agents run on a pre-defined set of ports, however occasionally your local system may already be using one of these ports. (For example MaxOS recently decided to use 8021 for the ftp proxy service.) + +To overriide the default port settings: + +```bash +AGENT_PORT_OVERRIDE=8010 ./run_demo faber +``` + +(The agent requires up to 10 available ports.) + +To pass extra arguements to the agent (for example): + +```bash +DEMO_EXTRA_AGENT_ARGS="[\"--emit-did-peer-2\"]" ./run_demo faber --did-exchange --reuse-connections +``` + ## Learning about the Alice/Faber code These Alice and Faber scripts (in the `demo/runners` folder) implement the controller and run the agent as a sub-process (see the documentation for `aca-py`). The controller publishes a REST service to receive web hook callbacks from their agent. Note that this architecture, running the agent as a sub-process, is a variation on the documented architecture of running the controller and agent as separate processes/containers. diff --git a/demo/features/steps/0160-connection.py b/demo/features/steps/0160-connection.py index dc3def6072..a9006e3378 100644 --- a/demo/features/steps/0160-connection.py +++ b/demo/features/steps/0160-connection.py @@ -22,6 +22,7 @@ BDD_EXTRA_AGENT_ARGS = os.getenv("BDD_EXTRA_AGENT_ARGS") +AGENT_PORT = os.getenv("AGENT_PORT", "8020") @given("{n} agents") @@ -29,7 +30,7 @@ def step_impl(context, n): """Startup 'n' agents based on the options provided in the context table parameters.""" - start_port = 8030 + start_port = int(AGENT_PORT) extra_args = None if BDD_EXTRA_AGENT_ARGS: diff --git a/demo/run_bdd b/demo/run_bdd index 883cadfad3..8b4c602818 100755 --- a/demo/run_bdd +++ b/demo/run_bdd @@ -123,8 +123,14 @@ EOF done AGENT_MODULE="agent_container" -AGENT_PORT=8030 -AGENT_PORT_RANGE=8030-8089 +AGENT_PORT=8020 +AGENT_PORT_RANGE=8020-8079 +# allow override for agent ports +if [ ! -z "$AGENT_PORT_OVERRIDE" ]; then + AGENT_PORT=$AGENT_PORT_OVERRIDE + AGENT_PORT_END=$(expr $AGENT_PORT_OVERRIDE + 59) + AGENT_PORT_RANGE="$AGENT_PORT-$AGENT_PORT_END" +fi echo "Preparing agent image..." docker build -q -t acapy-base -f ../docker/Dockerfile .. || exit 1 diff --git a/demo/run_demo b/demo/run_demo index 782efa1487..b451cb72fe 100755 --- a/demo/run_demo +++ b/demo/run_demo @@ -130,8 +130,8 @@ done if [ "$AGENT" = "faber" ]; then AGENT_MODULE="faber" - AGENT_PORT=8010 - AGENT_PORT_RANGE=8010-8019 + AGENT_PORT=8020 + AGENT_PORT_RANGE=8020-8029 elif [ "$AGENT" = "alice" ]; then AGENT_MODULE="alice" AGENT_PORT=8030 @@ -148,6 +148,12 @@ else echo "Please specify which agent you want to run. Choose from 'faber', 'alice', 'acme', or 'performance'." exit 1 fi +# allow override for agent ports +if [ ! -z "$AGENT_PORT_OVERRIDE" ]; then + AGENT_PORT=$AGENT_PORT_OVERRIDE + AGENT_PORT_END=$(expr $AGENT_PORT_OVERRIDE + 9) + AGENT_PORT_RANGE="$AGENT_PORT-$AGENT_PORT_END" +fi echo "Preparing agent image..." docker build -q -t acapy-base -f ../docker/Dockerfile .. || exit 1 diff --git a/demo/runners/agent_container.py b/demo/runners/agent_container.py index 7f602a93d5..f4b7506dd8 100644 --- a/demo/runners/agent_container.py +++ b/demo/runners/agent_container.py @@ -64,7 +64,7 @@ def __init__( extra_args: List[str] = [], **kwargs, ): - # extra_args = extra_args or [] + extra_args = extra_args or [] if not no_auto: extra_args.extend( ( From f98bc9686181c0d72d8af8ed5af67f3714204bd3 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Tue, 16 Jan 2024 08:51:53 -0800 Subject: [PATCH 4/4] Fix typo Signed-off-by: Ian Costanzo --- demo/INTEGRATION-TESTS.md | 2 +- demo/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/INTEGRATION-TESTS.md b/demo/INTEGRATION-TESTS.md index 334e445a19..dadf204a0a 100644 --- a/demo/INTEGRATION-TESTS.md +++ b/demo/INTEGRATION-TESTS.md @@ -75,7 +75,7 @@ or: BDD_EXTRA_AGENT_ARGS="{\"wallet-type\":\"askar\"}" ./run_bdd -t @taa_required ``` -The agents run on a pre-defined set of ports, however occasionally your local system may already be using one of these ports. (For example MaxOS recently decided to use 8021 for the ftp proxy service.) +The agents run on a pre-defined set of ports, however occasionally your local system may already be using one of these ports. (For example MacOS recently decided to use 8021 for the ftp proxy service.) To overriide the default port settings: diff --git a/demo/README.md b/demo/README.md index 361c56396a..aec54cc5c1 100644 --- a/demo/README.md +++ b/demo/README.md @@ -399,7 +399,7 @@ This works exactly as the *vanilla* multi-tenancy, except that all connections a ## Other Environment Settings -The agents run on a pre-defined set of ports, however occasionally your local system may already be using one of these ports. (For example MaxOS recently decided to use 8021 for the ftp proxy service.) +The agents run on a pre-defined set of ports, however occasionally your local system may already be using one of these ports. (For example MacOS recently decided to use 8021 for the ftp proxy service.) To overriide the default port settings: