feat(contact_player): initial planned_contacts support - #23
Draft
axodentally wants to merge 7 commits into
Draft
Conversation
Collaborator
Author
|
This change is part of the following stack:
Change managed by git-spice. |
This was referenced Jul 16, 2026
Collaborator
Author
|
AI generated flowchart, with a simplified view of the new model. Irrelevant parts like flowchart TD
%% ── Domain model (unchanged) ──
subgraph ccp["ccp.py"]
LinkProperties["LinkProperties\n{bandwidth, loss,\ndelay, jitter}"]
Contact["Contact\n{src: Node, dst: Node,\nnetwork, begin, end, props}"]
ContactPlan["ContactPlan\n{contacts: dict[Contact,\nContactState], loop}"]
end
subgraph player["contact_player.py"]
ContactHandler["ContactHandler\n(ABC)\n{plan, nodes}"]
TcNetemHandler["TcNetemContactHandler\n{plan, nodes}\nApplies tc/netem to\nDocker interfaces"]
CommandHandler["CommandContactHandler\n{plan, nodes, command}\nRuns user script in\nsource container"]
ContactPlayer["ContactPlayer\n{handlers: list[ContactHandler],\nscenario_path, netmap_path}"]
end
%% ── Relationships ──
Contact -->|"props"| LinkProperties
ContactPlan -->|"from_ccp_file()\nwraps"| Contact
TcNetemHandler -->|"inherits from"| ContactHandler
CommandHandler -->|"inherits from"| ContactHandler
ContactHandler-->|"holds"| ContactPlan
ContactPlayer -->|"owns list of"| ContactHandler
Rationale:
|
This was referenced Jul 23, 2026
axodentally
marked this pull request as ready for review
July 29, 2026 07:28
gh0st42
force-pushed
the
refactor/contact-player-part3
branch
from
August 24, 2026 07:23
5ddd134 to
6f26a1c
Compare
gh0st42
force-pushed
the
feat/planned-contacts
branch
from
August 24, 2026 07:23
5dd37f3 to
575ebcc
Compare
gh0st42
force-pushed
the
refactor/contact-player-part3
branch
from
August 24, 2026 07:25
6f26a1c to
a680d5d
Compare
gh0st42
force-pushed
the
feat/planned-contacts
branch
from
August 24, 2026 07:25
575ebcc to
71d3de3
Compare
gh0st42
force-pushed
the
feat/planned-contacts
branch
from
August 24, 2026 07:30
71d3de3 to
c7b1db6
Compare
axodentally
force-pushed
the
feat/planned-contacts
branch
from
August 25, 2026 09:13
c7b1db6 to
3e6cd78
Compare
axodentally
marked this pull request as draft
August 25, 2026 14:37
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
TcNetemContactHandler.setup() no longer deduplicates by source interface: unique_contact_links includes the destination, so multiple contacts over the same network can generate duplicate parallel tc qdisc add commands for the same device. Please deduplicate the tc setup/cleanup paths by (src, interface) and add a multi-peer/same-network regression test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
The CCSDS reference scenarios make a destinction between
plannedcontacts andactualcontacts. The planned contacts are those, that should theoretically happen between two nodes, based on their orbital properties.The actual contacts are a subset of those, removing some of the planned contact entries to simulate unforseen events, that made it not possible to establish a connection.
This allows to test the behavior of software, when it is believed to have contact to a peer, but the data will never arrive.
Therefor, nse2 should enable/disable contacts based on the
actual_contacts.csvcontact plan. But then, software inside each node should be informed about changes to contacts based on the believedplanned_contacts.csvcontact plan.Implementation
This PR implements this feature, by allowing the
contact_playerclass to own more than one contact plans (here: actuallyContactHandler, that then own aContactPlan). The player owns the timing loop and waits for upcoming events in the plans. When an event happens at a given time (i.e. a contact changes state fromactive->inactive), the player calls theprocess_time(self, time:int) -> Nonefunction on allContactHandlers, that then independently decide what do to at that time.And here, the
TcNetemContactHandler, which applies theactualcontact changes to the docker interfaces and inherits fromContactHandlerabstract base class, executes its tc-netem commands on the network interfaces.While the
CommandContactHandlerexecutes a user-specified script or command for each event, with environment variables giving the needed context (like the type of event, beingsetup,cleanup,activateordeactivateand contact information like source and destination node, properties, etc)That way, the python implementation remains modular for future usecases and changes. While the usage of a user-defined script/command gives users the broadest possible freedom to react to events in their nodes, without needing to change any python code. The script is just added or mounted to each node in the docker image/container, possibly even different scripts for different nodes.