Skip to content

Unable to add link to deployed lab #285

@BMG-DYNAMIT

Description

@BMG-DYNAMIT

Operating System

Ubuntu 22.04

Kathará Version

3.7.4

Bug Description

Hi,

I am trying to add a link between machines to an already deployed lab.
Maybe I am doing something wrong, but it does not for me.

Take a look at my example code.

import logging

from Kathara.manager.Kathara import Kathara
from Kathara.model.Lab import Lab
from Kathara.setting.Setting import Setting

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

if __name__ == '__main__':
    Setting.get_instance().load_from_disk()

    logger.info("Creating Lab BGP Announcement...")
    lab = Lab("BGP Announcement")

    logger.info("Creating router1...")
    # Create router1 with image "kathara/frr"
    router1 = lab.new_machine("router1", **{"image": "kathara/frr"})

    # link = lab.get_or_new_link("A")

    # Create and connect router1 interfaces
    # lab.connect_machine_to_link(router1.name, link.name)

    logger.info("Creating router2...")
    # Create router2 with image "kathara/frr"
    router2 = lab.new_machine("router2", **{"image": "kathara/frr"})

    # Create and connect router1 interfaces
    # lab.connect_machine_to_link(router2.name, link.name)

    logger.info("Deploying BGP Announcement lab...")
    Kathara.get_instance().deploy_lab(lab)

    Kathara.get_instance().connect_tty(machine_name=router1.name, lab_hash=lab.hash)

    link = lab.get_or_new_link("A")

    Kathara.get_instance().deploy_link(link)

    # I am unable to add the link, the interface does not show up with ip add
    # If I use connect_machine_to_link and add_interface I get an exception that both machines are already connected

    lab.connect_machine_to_link(router1.name, link.name)
    # router1.add_interface(link)

    lab.connect_machine_to_link(router2.name, link.name)
    # router2.add_interface(link)

    # The interface to the link does not show up!
    Kathara.get_instance().connect_tty(machine_name=router1.name, lab_hash=lab.hash)

    logger.info("Undeploying BGP Announcement lab...")
    Kathara.get_instance().undeploy_lab(lab_name=lab.name)

If I connect into the node with connect_tty, the new interface for the link beween the nodes does not show up with ip addr.
If I try to add the interface with add_interface after connecting the machine to the link, I get an exception.

If I only try to add the interface without connect_machine_to_link is also does not work.

Maybe you can tell me what I am doing wrong.

Thanks,

Moritz

Steps To Reproduce

Deploy a link to an already deployed lab and connect a machine to it.

Expected Behavior

A new interface should show up with ip addr after connecting it to the link.

Check Command Output

┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                     System Check                                                     │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Current Manager is:             Docker (Kathara)
Manager version is:             25.0.5
Python version is:              3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Kathara version is:             3.7.3
Operating System version is:    Linux-5.15.150.1-microsoft-standard-WSL2+-x86_64
[Deploying devices]   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/1
[Deleting devices]   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1/1
✓ Container run successfully.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions