Kathara icon indicating copy to clipboard operation
Kathara copied to clipboard

Add deploy/undeploy device/link methods to Manager

Open Skazza94 opened this issue 2 years ago • 0 comments

Currently, there's no way to deploy/undeploy a single device or collision domain. The only way is to use deploy_lab and undeploy_lab with the selected_machines parameter.

Moreover, the only way to update a device is to call the update_lab method with a diff from the previous state. This design limits the flexibility, especially for the update. In fact, it is not even possible to disconnect a device from a collision domain.

Requested changes are:

  • [x] Add deploy_machine method, which is a shortcut for *Machine.deploy_machines(machine.lab, selected_machines={machine.name})
  • [x] Add deploy_link method, which is a shortcut for *Link.deploy_links(link.lab, selected_links={link.name})
  • [x] Add undeploy_machine method, which is a shortcut for *Machine.undeploy_machines(machine.lab.hash, selected_machines={machine.name})
  • [x] Change *Link.undeploy method to accept a list of selected_links as optional parameter
  • [x] Add undeploy_link method, which is a shortcut for *Link.undeploy(link.lab.hash, selected_links={link.name})

In order to support more expressive device updates, it will also:

  • [x] Remove the Manager.update_lab method completely
  • [x] Add a Manager.connect_machine_to_link(machine: Machine, link: Link) method that will perform a similar code to the current update_lab, and will also update the Lab, Machine, and Link objects state accordingly.
  • [x] Add a Manager.disconnect_machine_from_link(machine: Machine, link: Link) method that will disconnect a device from a specific collision domain.

In order to support disconnecting a collision domain from CLI, it will also:

  • [x] Add a method in Manager to reconstruct a network scenario state from API objects. This is required to correctly check if a device is connected to a collision domain at runtime, since it could be done using the above methods at any time and the original object is lost after the CLI command exits.
  • [x] Rename --eth on vconfig in --add in order to be more semantically correct.
  • [x] Add a --rm parameter on vconfig to delete an interface.
  • [x] Rename --eth on lconfig in --add in order to be more semantically correct.
  • [x] Add a --rm parameter on lconfig to delete an interface.

Skazza94 avatar Jun 07 '22 10:06 Skazza94