refactor(contact_player.py): part3: Introduction of a new data model and addition of some level of abstraction - #22
Merged
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 mermaid diagram and summary of changes, which I checked are both correct. flowchart TD
subgraph scenario["scenario.py"]
Node["Node\n{name, id, eid,\ninterfaces}"]
NetworkInterface["NetworkInterface\n{ip, dev}"]
Node -->|"1..N"| NetworkInterface
end
subgraph ccp["ccp.py"]
LinkProperties["LinkProperties\n{bandwidth, loss,\ndelay, jitter}"]
RawCcpContact["RawCcpContact\n{src, dst, begin, end,\nprops, symmetric}"]
RawCcpContactPlan["RawCcpContactPlan\n{contacts, fixed_contacts,\nloop}"]
Contact["Contact\n{src: Node, dst: Node,\nnetwork, begin, end, props}"]
ContactPlan["ContactPlan\n{contacts: dict[Contact,\nContactState], loop}"]
RawCcpContact -->|"props"| LinkProperties
RawCcpContactPlan -->|"contains list of"| RawCcpContact
end
subgraph player["contact_player.py"]
ContactPlayer["ContactPlayer\n{plan, nodes,\nscenario_path, netmap_path}"]
end
RawCcpContact -->|"resolve + expand\nsymmetric"| Contact
Contact -->|"src, dst"| Node
Contact -->|"props"| LinkProperties
ContactPlan -->|"from_ccp_file()\nwraps"| Contact
ContactPlayer -->|"holds"| ContactPlan
ContactPlayer -->|"holds"| Node
Rationale:
|
This was referenced Jul 23, 2026
gh0st42
force-pushed
the
refactor/contact-player-part3
branch
from
August 24, 2026 07:23
5ddd134 to
6f26a1c
Compare
with a higher level of abstraction, allowing us to remove more logic from the contact player at a later point
gh0st42
force-pushed
the
refactor/contact-player-part3
branch
from
August 24, 2026 07:25
6f26a1c to
a680d5d
Compare
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.
This PR is a big one with major changes to the code structure.
The contact plan parsing is now done in two steps: first basic parsing into
RawCcpContacts andRawCcpContactPlan, which only facilitates the pure parsing of accpfile.The second step is converting the raw ccp representation to an abstracted version. The reason being, in the raw ccp file a source node can be a Node
nameoridand the destination eithername,idor the name of a network interface on the source node, that leads to the destination.That fact makes working with such a contact really hard because every time a function wants to do something in relation to a contact, it needs to account for those different possibilities.
Therefor, the
RawCcpContactPlanis converted into aContactPlanconsisting of ofContacts, that now are defined by a source and destinationNode, the Network name that connects both and the remaining contact properties.Besides that, a new
scenario.pyfiles handles the parsing of the docker-compose.yml file and importantly owning the definition of theNodeclassThese introductions then make the logic in the
contact_playermuch simpler, even allowing for a reduction in total lines of code.For further details have a look at the individual commit messages.