Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #37695 to v1.4-branch #37713

Merged

Conversation

swan-amazon
Copy link
Contributor

…oading (#37695)

  • Refactor mock server to support distributed configuration loading

Refactors the mock server implementation to support loading configuration from multiple JSON files, enabling flexible mocking of different services during Matter device commissioning validation.

Key Changes:

  • Restructured configuration loading to support directory-based routing configs
  • Added dataclass-based type safety for configuration and route definitions
  • Updated path handling to use pathlib.Path for better cross-platform support
  • Modified server launch configuration to support routing config directory
  • Added configurations for mocking multiple services:
    • Distributed Compliance Ledger (DCL)
    • Product Terms & Conditions server

Technical Improvements:

  • Introduced strongly typed Route and Configuration classes
  • Simplified route matching logic with dedicated matcher
  • Improved error handling for configuration loading
  • Updated unit tests to support new configuration structure

The changes enable quick iteration of mock service responses during preproduction testing and PlugFest validation, particularly for testing new commissioning flows that rely on DCL-based configuration with indirect product server references.

Test Configuration:

  • Added example configurations for VID:65521/65522, PID:32769
  • Updated TC URL endpoints to use port 44538
  • Included sample Terms & Conditions responses
  • server: Add validation checks for SSL certificate and key files

Add input validation to verify that SSL certificate and key files exist and are regular files before attempting to create the SSL context. This provides clearer error messages to users when certificate files are missing or invalid, following the same validation pattern used for config files.

Testing

Tested on origin/master

…oading (project-chip#37695)

* Refactor mock server to support distributed configuration loading

Refactors the mock server implementation to support loading configuration from
multiple JSON files, enabling flexible mocking of different services during
Matter device commissioning validation.

Key Changes:
- Restructured configuration loading to support directory-based routing configs
- Added dataclass-based type safety for configuration and route definitions
- Updated path handling to use pathlib.Path for better cross-platform support
- Modified server launch configuration to support routing config directory
- Added configurations for mocking multiple services:
  * Distributed Compliance Ledger (DCL)
  * Product Terms & Conditions server

Technical Improvements:
- Introduced strongly typed Route and Configuration classes
- Simplified route matching logic with dedicated matcher
- Improved error handling for configuration loading
- Updated unit tests to support new configuration structure

The changes enable quick iteration of mock service responses during preproduction
testing and PlugFest validation, particularly for testing new commissioning
flows that rely on DCL-based configuration with indirect product server
references.

Test Configuration:
- Added example configurations for VID:65521/65522, PID:32769
- Updated TC URL endpoints to use port 44538
- Included sample Terms & Conditions responses

* server: Add validation checks for SSL certificate and key files

Add input validation to verify that SSL certificate and key files exist
and are regular files before attempting to create the SSL context.
This provides clearer error messages to users when certificate files
are missing or invalid, following the same validation pattern used for
config files.
Copy link

semanticdiff-com bot commented Feb 21, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  .vscode/launch.json  13% smaller
  .github/.wordlist.txt Unsupported file format
  examples/chip-tool/commands/dcl/test_dcl_server.py  0% smaller
  integrations/mock_server/README.md Unsupported file format
  integrations/mock_server/configurations/fake_distributed_compliance_ledger/dcl-model-models-65521-32769.json  0% smaller
  integrations/mock_server/configurations/fake_distributed_compliance_ledger/dcl-model-models-65521-32785.json  0% smaller
  integrations/mock_server/configurations/fake_distributed_compliance_ledger/dcl-model-models-65521-32786.json  0% smaller
  integrations/mock_server/configurations/fake_distributed_compliance_ledger/dcl-model-models-65522-32769.json  0% smaller
  integrations/mock_server/configurations/fake_product_server/terms-and-conditions-65521-32769-v1.json  0% smaller
  integrations/mock_server/configurations/fake_product_server/terms-and-conditions-65521-32785-v1.json  0% smaller
  integrations/mock_server/configurations/fake_product_server/terms-and-conditions-65521-32786-v1.json  0% smaller
  integrations/mock_server/configurations/fake_product_server/terms-and-conditions-65522-32769-v1.json  0% smaller
  integrations/mock_server/configurations/server_config.json  0% smaller
  integrations/mock_server/configurations/unittest/config.json  0% smaller
  integrations/mock_server/src/__init__.py  0% smaller
  integrations/mock_server/src/handler.py  0% smaller
  integrations/mock_server/src/main.py  0% smaller
  integrations/mock_server/src/route_configuration.py  0% smaller
  integrations/mock_server/src/router.py  0% smaller
  integrations/mock_server/src/server.py  0% smaller
  integrations/mock_server/tests/__init__.py  0% smaller
  integrations/mock_server/tests/test_mock_server.py  0% smaller

@andy31415 andy31415 merged commit 2b4717e into project-chip:v1.4-branch Feb 21, 2025
69 of 70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants