-
Notifications
You must be signed in to change notification settings - Fork 274
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
Decouple cmd
package from the clab
application part1
#1906
Conversation
What would we consider the right abstraction for topology handover? |
As per our discussion here: #1905 I want to outline the (admittedly few) design requirements Cilium would have for utilizing ContainerLab as an embedded library. I'd like to first mention that our initial goal to using ContainerLab is for embedding test case scenarios. Cilium has quite a few complex testing scenarios. Using ContainerLab would allow us to rely on an already mature solution which can setup network topologies for dedicated Cilium datapath testing. We are tracking this issue here: cilium/cilium#27450 Luckily, our requirements are not too crazy (IMO, you may think otherwise with your mental map of ContainerLab :))
Can you explain a bit more about what you mean by "topology handover".
It would be possible for the library to take in a generic io.Reader, no? Therefore, the caller can provide any medium (file, in-memory, network-socket, etc...) which implements the io.Reader interface. The implications of this is that the one doing the reading must also do the topology syntax checking at read time. |
What we do is, that we always create the
Would it be sufficient for you to get the netns handle and query the interfaces yourself to figure out the ifindex's. Otherwise we could probably provide these in the results.
Like what you answered below, provide a file or an io.reader.
Yes thats my thinking, you provide an io.Reader seems to be a good approach. |
@ldelossa Another question: Is your plan to use containerlab also as a means to deploy the container / network namespaces or is it mainly your objective to use containerlab for wiring? |
This sounds completely reasonable to me. As long as the naming is consistent with the container names in the topology file, the user of the library can do the correlating.
When you say "query the interfaces" what do you mean here exactly?
100% to this. Especially if you want to modify a topology in Golang, having to go "back-through" the JSON would be inconvenient :).
I'm not sure I'm seeing a difference between "deploying" and "wiring". |
I would also like to express my interest. As a net eng I've been using clab for years. And now I'm going to utilize clab as part of in-house product. Initial idea was to use clab via hacky bash scripting. It will be great to have some API. The main tasks for clab as a library: 1) initial lab deploy - deploy nodes and links between them, 2) links management during lab runtime (deploy new links, destroy links, manage links params like packet loss/delay via tc netem) 3) destroy lab topology |
cmd
package from the clab
application part1
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1906 +/- ##
==========================================
+ Coverage 53.90% 54.00% +0.10%
==========================================
Files 156 158 +2
Lines 11382 11430 +48
==========================================
+ Hits 6135 6173 +38
- Misses 4387 4396 +9
- Partials 860 861 +1
|
To allow using Containerlab as a go library we need to adjust some things, that went wrong in the past.