@@ -35,6 +35,11 @@ class LogLevel(str, Enum):
3535 CRITICAL = "CRITICAL"
3636
3737
38+ class InterfaceEncapsulation (str , Enum ):
39+ UNTAGGED = "untagged"
40+ DOT1Q = "dot1q"
41+
42+
3843app = typer .Typer (
3944 name = "clab-connector" ,
4045 help = "Integrate or remove an existing containerlab topology with EDA (Event-Driven Automation)" ,
@@ -55,6 +60,20 @@ class LogLevel(str, Enum):
5560 help = "Optional log file path" ,
5661)
5762
63+ edge_encapsulation_option = typer .Option (
64+ None ,
65+ "--edge-encapsulation" ,
66+ help = "Encapsulation type for generated edge interfaces" ,
67+ case_sensitive = False ,
68+ )
69+
70+ isl_encapsulation_option = typer .Option (
71+ None ,
72+ "--isl-encapsulation" ,
73+ help = "Encapsulation type for generated inter-switch link interfaces" ,
74+ case_sensitive = False ,
75+ )
76+
5877
5978def complete_json_files (
6079 _ctx : typer .Context , _param : typer .Option , incomplete : str
@@ -81,7 +100,7 @@ def complete_eda_url(
81100
82101
83102@app .command (name = "integrate" , help = "Integrate containerlab with EDA" )
84- def integrate_cmd (
103+ def integrate_cmd ( # noqa: PLR0913
85104 topology_data : Annotated [
86105 Path ,
87106 typer .Option (
@@ -147,6 +166,8 @@ def integrate_cmd(
147166 "--sync-timeout" ,
148167 help = "Timeout for node synchronization check in seconds" ,
149168 ),
169+ edge_encapsulation : InterfaceEncapsulation | None = edge_encapsulation_option ,
170+ isl_encapsulation : InterfaceEncapsulation | None = isl_encapsulation_option ,
150171):
151172 """CLI command to integrate a containerlab topology with EDA."""
152173
@@ -172,6 +193,14 @@ class Args:
172193 args .skip_edge_intfs = skip_edge_intfs
173194 args .enable_sync_check = enable_sync_check
174195 args .sync_timeout = sync_timeout
196+ if edge_encapsulation and edge_encapsulation != InterfaceEncapsulation .UNTAGGED :
197+ args .edge_encapsulation = edge_encapsulation .value
198+ else :
199+ args .edge_encapsulation = None
200+ if isl_encapsulation and isl_encapsulation != InterfaceEncapsulation .UNTAGGED :
201+ args .isl_encapsulation = isl_encapsulation .value
202+ else :
203+ args .isl_encapsulation = None
175204
176205 def execute_integration (a ):
177206 eda_client = create_eda_client (
@@ -193,6 +222,8 @@ def execute_integration(a):
193222 topology_file = a .topology_data ,
194223 skip_edge_intfs = a .skip_edge_intfs ,
195224 namespace_override = a .namespace_override ,
225+ edge_encapsulation = a .edge_encapsulation ,
226+ isl_encapsulation = a .isl_encapsulation ,
196227 )
197228
198229 try :
@@ -364,6 +395,8 @@ def generate_crs_cmd(
364395 "--skip-edge-intfs" ,
365396 help = "Skip creation of edge links and their interfaces" ,
366397 ),
398+ edge_encapsulation : InterfaceEncapsulation | None = edge_encapsulation_option ,
399+ isl_encapsulation : InterfaceEncapsulation | None = isl_encapsulation_option ,
367400):
368401 """
369402 Generate the CR YAML manifests (artifacts, init, node security profile,
@@ -383,6 +416,18 @@ def generate_crs_cmd(
383416 separate = separate ,
384417 skip_edge_intfs = skip_edge_intfs ,
385418 namespace = namespace_override ,
419+ edge_encapsulation = (
420+ edge_encapsulation .value
421+ if edge_encapsulation
422+ and edge_encapsulation != InterfaceEncapsulation .UNTAGGED
423+ else None
424+ ),
425+ isl_encapsulation = (
426+ isl_encapsulation .value
427+ if isl_encapsulation
428+ and isl_encapsulation != InterfaceEncapsulation .UNTAGGED
429+ else None
430+ ),
386431 )
387432 generator .generate ()
388433 generator .output_manifests ()
0 commit comments