srl-labs / containerlab

container-based networking labs
https://containerlab.dev
BSD 3-Clause "New" or "Revised" License
1.53k stars 262 forks source link

links vars disappeared from config engine output #1610

Closed hellt closed 4 weeks ago

hellt commented 1 year ago

topo

name: test
mgmt:
  external-access: true
  ipv4_subnet: 10.4.123.0/24
topology:
  kinds:
    vr-sros:
      image: registry.srlinux.dev/pub/vr-sros:22.10.R1
      license: /vsim_license/license.txt
  nodes:
    sr-1:
      kind: vr-sros
      type: ixr-s
      config:
        vars:
          clab_system_ip: 10.0.0.1/32
    sr-2:
      kind: vr-sros
      type: ixr-s
      config:
        vars:
          clab_system_ip: 10.0.0.2/32
  links:
    - endpoints: ["sr-1:eth1", "sr-2:eth1"]
      vars:
        port: ["1/1/1", "1/1/1"]
        clab_link_ip: 10.1.2.0/31
        vlan: 0

0.37 had vars

sudo clab config template --vars -t test.yml
INFO[0000] Parsing & checking topology file: test.yml
INFO[0000] sr-1 vars = clab_kind: vr-sros
clab_links:
- clab_far:
    clab_link_ip: 10.1.2.1/31
    clab_link_name: to_sr-1
    clab_node: sr-2
    port: 1/1/1
    vlan: 0
  clab_link_ip: 10.1.2.0/31
  clab_link_name: to_sr-2
  port: 1/1/1
  vlan: 0
clab_management_ipv4: ""
clab_management_ipv6: ""
clab_node: sr-1
clab_nodes: '{sr-2: {...}, sr-1: {...}, }'
clab_role: vr-sros
clab_system_ip: 10.0.0.1/32
clab_type: ixr-s
INFO[0000] sr-2 vars = clab_kind: vr-sros
clab_links:
- clab_far:
    clab_link_ip: 10.1.2.0/31
    clab_link_name: to_sr-2
    clab_node: sr-1
    port: 1/1/1
    vlan: 0
  clab_link_ip: 10.1.2.1/31
  clab_link_name: to_sr-1
  port: 1/1/1
  vlan: 0
clab_management_ipv4: ""
clab_management_ipv6: ""
clab_node: sr-2
clab_nodes: '{sr-2: {...}, sr-1: {...}, }'
clab_role: vr-sros
clab_system_ip: 10.0.0.2/32
clab_type: ixr-s

0.44+ doesn't

sudo clab config template --vars -t test.yml
WARN[0000] Attribute "ipv4_subnet" is deprecated and will be removed in the future. Change it to "ipv4-subnet"
INFO[0000] Parsing & checking topology file: test.yml
INFO[0000] sr-2 vars = clab_kind: vr-sros
clab_links: []
clab_management_ipv4: ""
clab_management_ipv6: ""
clab_node: sr-2
clab_nodes: '{sr-2: {...}, sr-1: {...}, }'
clab_role: vr-sros
clab_system_ip: 10.0.0.2/32
clab_type: ixr-s
INFO[0000] sr-1 vars = clab_kind: vr-sros
clab_links: []
clab_management_ipv4: ""
clab_management_ipv6: ""
clab_node: sr-1
clab_nodes: '{sr-2: {...}, sr-1: {...}, }'
clab_role: vr-sros
clab_system_ip: 10.0.0.1/32
clab_type: ixr-s
sacckth commented 1 year ago

As an almost sole user of this feature... will be forced to rollback :(. Let me know if I can help with something. Issue appeared on 0.43 it seems commit: #1475 is the culprit

steiler commented 1 year ago

I've started working on this a little. https://github.com/steiler/containerlab/tree/templateVariablesFix Variables defined should already be alright, but all the IP-Assignment logic is not there yet.

flosch-dev commented 5 months ago

seems not many people using templates in clab? We are currently on 0.54.2 and I started looking into templating feature while facing this issue.

hellt commented 4 weeks ago

cleaning up stale issues this one is not in the prio queue