Skip to content

Commit 900c112

Browse files
committed
fix clab for ceos
1 parent 7e2b0a7 commit 900c112

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

templates/clab_topology.j2

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ topology:
3939

4040
links:
4141
{% set processed_endpoints = [] %}
42+
{% set device_kinds = {} %}
43+
{% for device in topology.node.devices.edges %}
44+
{% set _ = device_kinds.update({device.node.name.value: device.node.platform.node.containerlab_os.value}) %}
45+
{% endfor %}
4246
{% for device in topology.node.devices.edges %}
4347
{% for interface in device.node.interfaces.edges %}
4448
{% if interface.node.connector is defined and interface.node.connector.node is not none and interface.node.role.value not in ["console", "management"] %}
@@ -51,6 +55,14 @@ topology:
5155
{% set _ = processed_endpoints.append(endpoint_key) %}
5256
{% set endpoint1 = endpoint1.replace("Ethernet", "eth") %}
5357
{% set endpoint2 = endpoint2.replace("Ethernet", "eth") %}
58+
{% set device1_name = endpoint1.split(":")[0] %}
59+
{% set device2_name = endpoint2.split(":")[0] %}
60+
{% if device_kinds.get(device1_name) == "arista_ceos" %}
61+
{% set endpoint1 = endpoint1.split("/")[0] %}
62+
{% endif %}
63+
{% if device_kinds.get(device2_name) == "arista_ceos" %}
64+
{% set endpoint2 = endpoint2.split("/")[0] %}
65+
{% endif %}
5466
- endpoints: ["{{ endpoint1 }}", "{{ endpoint2 }}"]
5567
{% endif %}
5668
{% endif %}

0 commit comments

Comments
 (0)