diff --git a/demo/INTEGRATION-TESTS.md b/demo/INTEGRATION-TESTS.md index b8a8bf456c..dadf204a0a 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 MacOS 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..aec54cc5c1 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 MacOS 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/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/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 diff --git a/demo/features/steps/0160-connection.py b/demo/features/steps/0160-connection.py index 1f26148959..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 = 8020 + start_port = int(AGENT_PORT) extra_args = None if BDD_EXTRA_AGENT_ARGS: diff --git a/demo/run_bdd b/demo/run_bdd index 40c42bdf65..8b4c602818 100755 --- a/demo/run_bdd +++ b/demo/run_bdd @@ -125,6 +125,12 @@ done AGENT_MODULE="agent_container" 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 3a133526ae..b451cb72fe 100755 --- a/demo/run_demo +++ b/demo/run_demo @@ -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 @@ -240,6 +246,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..f4b7506dd8 100644 --- a/demo/runners/agent_container.py +++ b/demo/runners/agent_container.py @@ -61,7 +61,7 @@ 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 [] 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"