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

Save/restore vlan reservations #244

Merged
merged 10 commits into from
Dec 6, 2024
Merged

Save/restore vlan reservations #244

merged 10 commits into from
Dec 6, 2024

Conversation

sajith
Copy link
Member

@sajith sajith commented Nov 26, 2024

Resolves #215. The API is really simple, and is implemented using @property:

# Get the current VLAN allocation table.
vlan_table = temanager.vlan_tags_table

# Restore VLAN allocation table.
temanager.vlan_tags_table = vlan_table

We do some checks in the setter, such as: the input data is in the expected shape, and that we have no existing allocations. The assumption is that SDX Controller would attempt to restore VLAN allocation state only during startup.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 12038444933

Details

  • 17 of 17 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.4%) to 91.239%

Totals Coverage Status
Change from base Build 11916789690: 0.4%
Covered Lines: 1185
Relevant Lines: 1290

💛 - Coveralls

@sajith sajith marked this pull request as ready for review November 26, 2024 20:30
Copy link
Collaborator

@YufengXin YufengXin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For its said purpose, it looks nice. But-:) we may need to have
(1) the instructions for sdx-controller to use the two methods? why the sdx-controller needs to restore the vlan table during startup? who creates the table and calls the setter?

(2) the second scenario: sdx-controller works for some time with some connection provisioned (ie, some vlans allocated from some or all domains), then it crashes and needs a restart: right now, I think the logic is to read the topologies from DB, the existing bandwidth and vlan allocation information are lost?

@sajith
Copy link
Member Author

sajith commented Dec 2, 2024

@YufengXin Good catches. Thank you!

(1) the instructions for sdx-controller to use the two methods? why the sdx-controller needs to restore the vlan table during startup? who creates the table and calls the setter?

SDX Controller will have to maintain the table, because state management is better left to the application. As long as PCE is a library, it should not be maintaining any state between process restarts. Currently SDX Controller already restores some PCE state (topologies), and it should do the rest of it too.

(2) the second scenario: sdx-controller works for some time with some connection provisioned (ie, some vlans allocated from some or all domains), then it crashes and needs a restart: right now, I think the logic is to read the topologies from DB, the existing bandwidth and vlan allocation information are lost?

True, we need to restore that also. Thank you for the reminder! Perhaps that could be implemented with a separate issue and PR?

@sajith sajith requested a review from YufengXin December 2, 2024 16:04
Copy link
Collaborator

@YufengXin YufengXin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. A PR in SDX-controller for the corresponding state persistence.

  2. Another PR for persistent state after crash recovery

@sajith
Copy link
Member Author

sajith commented Dec 2, 2024

Perhaps we could add a new TEManager.restore_state() method, and that would be simpler to use:

temanager.restore_state(
    topologies  = [topology1, topology2, topology3],
    vlan_table = vlan_table,
    bandwidth_allocation = bandwidth_allocation,
    latency_allocation = latency_allocation
)

This could be even simpler if we have a corresponding get_state() that returns all the state we care about, and then SDX Controller would not have to care about all these details:

# At various SDX Controller checkpoints:
state = temanager.get_state()
db.upsert("temanager-state", state)
# During SDX Controller startup:
state = db.read("temanager-state")
temanager.restore_state(state)

Basically SDX Controller would have to call get_state() and save the results in the DB when there are events that cause state to change (a new connection is made, a link was cut, service degraded... etc?), and then call restore_state() at startup.

Just thinking aloud. Perhaps there is a better way to do this.

@sajith sajith merged commit e21de30 into main Dec 6, 2024
11 checks passed
@sajith sajith deleted the 215.restore-vlan-reservations branch December 6, 2024 20:05
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.

Persistent vlan resource between SDX-controller restart
3 participants