Skip to content

Add unit tests for L2VPN state machine transitions#515

Open
gretelliz wants to merge 3 commits intomainfrom
unit_tests
Open

Add unit tests for L2VPN state machine transitions#515
gretelliz wants to merge 3 commits intomainfrom
unit_tests

Conversation

@gretelliz
Copy link

@gretelliz gretelliz commented Feb 4, 2026

Description

This PR adds new unit tests to validate the current and desired behavior of the L2VPN connection state machine.

Important:
This PR does not modify any production code in sdx-controller (no changes to sdx_datamodel.connection_sm, connection_handler.py, or any other module).
It only introduces new test cases in the new file test_connection_state_machine.py to document and verify the state machine behavior.

These tests are intended to:

  • Serve as living documentation of the expected transitions
  • Help detect regressions if/when the state machine is updated
  • Highlight gaps between current implementation and requirements (via xfailed tests)

This PR closes atlanticwave-sdx/datamodel#199
(and builds upon the context from atlanticwave-sdx/datamodel#184).

What the tests verify

The new tests cover the following specific requirements:

  1. DOWN → MODIFYING (via MODIFY action)
  2. DOWN → DELETED (via DELETE action)
  3. ERROR → MODIFYING (via MODIFY action)
  4. DISABLED → DELETED (via DELETE action)
  5. MODIFYING → DELETED (via DELETE action)
  6. Existence of the new MAINTENANCE state (test_maintenance_state_exists)
  7. UP → MAINTENANCE (via MW_START action)
  8. MAINTENANCE → UP (via MW_END action)

Current test results (as of this PR)

  • 7 passed
  • 2 xfailed (UP → MAINTENANCE and MAINTENANCE → UP)

Reason for the two xfailed tests:
The current connection_state_machine() implementation does not raise ConnectionSMException for these transitions.
The xfailed status serves as a marker that these transitions still need proper implementation / validation in a future PR.

Related issues

@coveralls
Copy link

coveralls commented Feb 4, 2026

Pull Request Test Coverage Report for Build 21653251912

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 53.895%

Totals Coverage Status
Change from base Build 20488537231: 0.0%
Covered Lines: 1266
Relevant Lines: 2349

💛 - Coveralls

@gretelliz gretelliz requested a review from italovalcy February 4, 2026 00:28
@lmarinve lmarinve requested review from YufengXin and removed request for italovalcy February 4, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create a basic test for issue 184 on sdx controller

2 participants