Skip to content
Snippets Groups Projects

Feature/nat 244 lag deletion

Closed JORGE SASIAIN requested to merge feature/nat-244-lag-deletion into develop

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 171
    172 This will delete a device and all interfaces that belong to it
    173 """
    174 device = self.get_device_by_name(device_name)
    175 device.delete()
    176 return
    177
    178 def delete_interface(self, device_name: str, iface_name: str) -> None:
    179 """Delete interface by name and by device name.
    180
    181 This will delete an interface even if another one has it as LAG interface
    182 (and will erase the LAG interface field of the latter)
    183 """
    184 interface = self.get_interface_by_name_and_by_device_id(
    185 iface_name=iface_name, device_id=self.get_device_by_name(device_name).id
    186 )
  • Neda Moeini
  • Neda Moeini
  • JORGE SASIAIN added 1 commit

    added 1 commit

    • 3258b4a5 - NAT-244: apply merge review suggestions

    Compare with previous version

  • JORGE SASIAIN added 23 commits

    added 23 commits

    • 3258b4a5...3ba2d249 - 22 commits from branch develop
    • 91fe5d65 - NAT-244: Merge develop and adjust attach_interface_to_lag and its test

    Compare with previous version

  • JORGE SASIAIN
  • JORGE SASIAIN
  • Neda Moeini added 1 commit

    added 1 commit

    Compare with previous version

  • JORGE SASIAIN added 1 commit

    added 1 commit

    Compare with previous version

  • JORGE SASIAIN added 12 commits

    added 12 commits

    Compare with previous version

  • Neda Moeini
  • 239 # Get the lag attached to the physical interface and ensure it is the expected one
    240 lag = self.get_interface_by_name_and_by_device_id(iface_name=lag_name, device_id=device.id)
    241 if not iface.lag:
    242 raise WorkflowStateError(
    243 f"The interface: {iface_name} on device: {device_name} does not belong to any LAG."
    244 )
    245 if iface.lag.id != lag.id:
    246 raise WorkflowStateError(
    247 f"The interface: {iface_name} on device: {device_name} belongs to a different LAG: {lag.name}."
    248 )
    249
    250 # Remove physical interface from lag (that is, remove the lag reference in the physical interface)
    251 iface.lag = None
    252
    253 # Update physical interface
    254 iface.save()
  • 220 270
    221 271 return interface
    222 272
    223 def allocate_interface(self, device_name: str, iface_name: str) -> Interfaces:
    224 """Allocate an interface by marking it as connected."""
    225
    226 device = self.get_device_by_name(device_name)
    227 interface = self.netbox.dcim.interfaces.get(device_id=device.id, name=iface_name)
    273 def unreserve_interface(self, device_name: str, iface_name: str) -> Interfaces:
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading