Skip to content

8‐3 Delete Commands

Yusuke Ogawa edited this page Dec 25, 2025 · 19 revisions

Since this process will directly edit the master file, please be sure to back up the master file before proceeding.

What you can do with these steps

You can execute the following "add" command from the CLI.

Basic syntax:

python [file path]/network_sketcher.py [command] --master [master file path]
  • The part marked as [command] 、--master [master file path] below can be modified.
    python [file path]/network_sketcher.py -master [master file path] [command]

delete area

Deletes the entire area. All devices within the area, along with their interface settings and connections, will also be deleted.

python [file path]/network_sketcher.py delete area [area_name] --master [master file path]
  • ex.

+BEFORE+

#python .\network_sketcher.py show area_location --master “C:\work[MASTER]test.xlsx”
[[‘DC1’, ‘DC2’], [‘DC3’, ‘DC4’]]

+area deleted+

#python .\network_sketcher.py delete area ‘DC3’ --master “C:\work[MASTER]test.xlsx”
--- Area deleted --- DC3
Devices removed: [‘DC3_device_’, ‘SW-3’]
All associated links and configurations have been removed.

+AFTER+

#python .\network_sketcher.py show area_location --master “C:\work[MASTER]test.xlsx”
[[‘DC1’, ‘DC2’], [‘DC4’]]

[Tips]

  • All devices within the area will be deleted
  • All Layer 1 links connected to the deleted devices will also be removed
  • The area layout will be automatically updated
  • Waypoint-specific areas (area names ending with wp) can also be deleted

delete ip_address

This function deletes the IP address of a Layer 3 interface. You can delete one IP address at a time.

python [file path]/network_sketcher.py delete ip_address [device name] [layer3_portname] [ip_address/subnetmask] --master [master file path] 
  • ex.

+BEFORE+
#python .\network_sketcher.py show l3_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW2', 'Vlan 100', '', '192.168.100.100/24']

+IP Address deleted+
#python .\network_sketcher.py delete ip_address 'L3SW2' 'Vlan 100' '192.168.100.100/24' --master "C:\work\[MASTER]test.xlsx"
--- IP Address deleted --- L3SW2,Vlan 100,192.168.100.100/24

+AFTER+
#python .\network_sketcher.py show l3_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW2', 'Vlan 100', '', '']

delete device

This command deletes the specified device, along with all Layer 1 links connected to the deleted device.

python [file path]/network_sketcher.py delete device [device_name] --master [master file path]

ex.

+BEFORE+

#python .\network_sketcher.py show device --master "C:\work[MASTER]test.xlsx"
['DC1_device_', 'L3SW1', 'L3SW2', 'SW-1', 'SW-2', 'SW-3']

#python .\network_sketcher.py show l1_link --master "C:\work[MASTER]test.xlsx"
[['SW-1', 'GigabitEthernet 0/0'], ['SW-3', 'GigabitEthernet 0/1']] [['SW-1', 'GigabitEthernet 0/1'], ['SW-2', 'GigabitEthernet 0/0']] [['SW-2', 'GigabitEthernet 0/1'], ['L3SW1', 'GigabitEthernet 0/0']]

+device deleted+

#python .\network_sketcher.py delete device 'SW-2' --master "C:\work[MASTER]test.xlsx"
--- Device deleted --- SW-2

+AFTER+

#python .\network_sketcher.py show device --master "C:\work[MASTER]test.xlsx"
['DC1_device_', 'L3SW1', 'L3SW2', 'SW-1', 'SW-3']

#python .\network_sketcher.py show l1_link --master "C:\work[MASTER]test.xlsx"
[['SW-1', 'GigabitEthernet 0/0'], ['SW-3', 'GigabitEthernet 0/1']]

[Tips]

  • All Layer 1 links connected to the deleted device will also be deleted.
  • If it is the last device in an area, it cannot be deleted (use the delete area command).
  • If it is a waypoint (a device in an area ending in wp), use the delete waypoint command.

delete l1_link

Deletes the Layer 1 physical connection between devices. All associated Layer 2 and Layer 3 configurations on the deleted interface are automatically removed. Only one physical link can be deleted at a time.

python [file path]/network_sketcher.py delete l1_link [from_device] [from_portname] --master [master file path]
  • ex.

+BEFORE+

#python .\network_sketcher.py show l1_link --master “C:\work[MASTER]test.xlsx”
[[‘SW-1’, ‘GigabitEthernet 0/0’], [‘SW-3’, ‘GigabitEthernet 0/1’]] [[‘SW-1’, ‘GigabitEthernet 0/1’], [‘SW-2’, ‘GigabitEthernet 0/0’]]

+l1_link deleted+

#python .\network_sketcher.py delete l1_link ‘SW-1’ 'GigabitEthernet 0/1' --master “C:\work[MASTER]test.xlsx”
--- Layer 1 link deleted --- SW-1 GigabitEthernet 0/1 <-> SW-2 GigabitEthernet 0/0

+AFTER+

#python .\network_sketcher.py show l1_link --master “C:\work[MASTER]test.xlsx”
[[‘SW-1’, ‘GigabitEthernet 0/0’], [‘SW-3’, ‘GigabitEthernet 0/1’]]

[Tips]

  • Cascade deletion: Deleting an L1 link automatically deletes the following: Any other Layer 2 and Layer 3 configurations are also deleted.:
    • Port-channel membership (if the interface is a member)
    • L2 segments (VLANs) configured on the interface
    • Subinterfaces (virtual ports) bound to the interface
    • IP addresses on subinterfaces
    • The entire Port-channel and its L3 configuration if all member interfaces are deleted
  • Specify only the from device and from port name (to device/to port are automatically determined)
  • Since the port name contains spaces, it must be enclosed in single quotes ('port 0')
  • Use with caution: This single command can remove extensive Layer 2/Layer 3 configurations

delete l2_segment

This function deletes the Layer 2 segment (such as VLAN) configured on the interface. You can delete one Layer 2 segment at a time.

python [file path]/network_sketcher.py delete l2_segment [device name] [layer2_portname] [l2segment_name] --master [master file path] 
  • ex.

+BEFORE+
#python .\network_sketcher.py show l3_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW2', 'GigabitEthernet 0/0', '', 'Vlan100,Vlan200,Vlan300,addvlan999', '']

+l2_segment deleted+
#python .\network_sketcher.py delete l2_segment 'L3SW2' 'GigabitEthernet 0/0' 'addvlan999' --master "C:\work\[MASTER]test.xlsx"
--- l2 Segment deleted --- L3SW2,GigabitEthernet 0/0,addvlan999

+AFTER+
#python .\network_sketcher.py show l3_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW2', 'GigabitEthernet 0/0', '', 'Vlan100,Vlan200,Vlan300', '']

delete portchannel

The port channel (LAG) configured on the Layer 1 interface will be deleted, along with the Layer 2 segment configured on the port channel.

python [file path]/network_sketcher.py delete portchannel [device name] [layer1_portname] --master [master file path] 
  • ex.

+BEFORE+
#python .\network_sketcher.py show l2_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW1', 'GigabitEthernet 0/0', 'PortChannel 1', 'vlan1', '']
['L3SW1', 'GigabitEthernet 0/1', 'PortChannel 1', 'vlan1', '']

#python .\network_sketcher.py show l3_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW1', 'PortChannel 1', '', '']

+portchannel deleted+
#python .\network_sketcher.py delete portchannel 'L3SW1' 'GigabitEthernet 0/0' --master "C:\work\[MASTER]test.xlsx"
--- portchannel deleted --- L3SW1,GigabitEthernet 0/0,PortChannel 1

#python .\network_sketcher.py delete portchannel 'L3SW1' 'GigabitEthernet 0/1' --master "C:\work\[MASTER]test.xlsx"
--- portchannel deleted --- L3SW1,GigabitEthernet 0/1,PortChannel 1

+AFTER+
#python .\network_sketcher.py show l2_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW1', 'GigabitEthernet 0/0', '', '', '']
['L3SW1', 'GigabitEthernet 0/1', '', '', '']

#python .\network_sketcher.py show l3_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW1', 'GigabitEthernet 0/0', '', '']
['L3SW1', 'GigabitEthernet 0/1', '', '']

delete virtual_port

This will delete Layer 3 interfaces such as VLAN interfaces (SVIs).This command cannot be used to delete a port channel.

python [file path]/network_sketcher.py delete virtual_port [device name] [virtual_portname] --master [master file path] 
  • ex.

+BEFORE+
#python .\network_sketcher.py show l2_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW2', '', 'addvlan 999', '', '']
['L3SW2', '', 'Vlan 300', 'Vlan300', '']

#python .\network_sketcher.py show l3_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW2', 'Vlan 300', '', '']
['L3SW2', 'addvlan 999', '', '']

+virtual_port deleted+
#python .\network_sketcher.py delete virtual_port 'L3SW2' 'addvlan 999' --master "C:\work\[MASTER]test.xlsx"
--- Virtual Port deleted --- L3SW2,addvlan 999

+AFTER+
#python .\network_sketcher.py show l2_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW2', '', 'Vlan 300', 'Vlan300', '']

#python .\network_sketcher.py show l3_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW2', 'Vlan 300', '', '']

delete vport_l1if_direct_binding

This command deletes a virtual port connected to a layer 1 port. This command also deletes layer 2 elements such as VLANs connected to the virtual port.

python [file path]/network_sketcher.py delete vport_l1if_direct_binding [device name] [vport_name_direct_binding] --master [master file path] 
  • ex.

+BEFORE+
#python .\network_sketcher.py show l2_interface --master "C:\work\[MASTER]test.xlsx"
['Catalyst 3560', 'GigabitEthernet 0/0', 'GigabitEthernet 0/0.100', '', 'vlan100']

+vport_l1if_direct_binding deleted+
#python .\network_sketcher.py delete vport_l1if_direct_binding "Catalyst 3560" "GigabitEthernet 0/0.100" --master "C:\work\[MASTER]test.xlsx"
--- vport_l1if_direct_binding deleted --- Catalyst 3560,GigabitEthernet 0/0.100,vlan100

+AFTER+
#python .\network_sketcher.py show l2_interface --master "C:\work\[MASTER]test.xlsx"
['Catalyst 3560', 'GigabitEthernet 0/0', '', '', '']

delete vport_l2_direct_binding

Remove elements that send and receive layer 2 traffic, such as VLAN (l2_segment), directly from the virtual port.

python [file path]/network_sketcher.py delete vport_l2_direct_binding [device name] [virtual port] [l2_name_direct_binding] --master [master file path] 
  • ex.

+BEFORE+
#python .\network_sketcher.py show l2_interface --master "C:\work\[MASTER]test.xlsx"
['Catalyst 3560', 'GigabitEthernet 0/0', 'GigabitEthernet 0/0.100', '', 'vlan100']

+virtual_port deleted+
#python .\network_sketcher.py delete vport_l2_direct_binding "Catalyst 3560" "GigabitEthernet 0/0.100" “vlan100” --master "C:\work\[MASTER]test.xlsx"
--- vport_l2_direct_binding deleted --- Catalyst 3560,GigabitEthernet 0/0.100,vlan100

+AFTER+
#python .\network_sketcher.py show l2_interface --master "C:\work\[MASTER]test.xlsx"
['Catalyst 3560', 'GigabitEthernet 0/0', 'GigabitEthernet 0/0.100', '', '']

delete waypoint

Deletes a waypoint from the dedicated waypoint area. All Layer 1 links connected to the deleted waypoint will also be deleted simultaneously.

python [file path]/network_sketcher.py delete waypoint [waypoint_name] --master [master file path]
  • ex.

+BEFORE+

#python .\network_sketcher.py show waypoint_location --master “C:\work[MASTER]test.xlsx”
[‘WAN-1_wp_’, [[‘WAN-1’, ‘WAN-2’, ‘WAN-3’]]]

#python .\network_sketcher.py show l1_link --master “C:\work[MASTER]test.xlsx”
[[‘SW-1’, ‘GigabitEthernet 0/0’], [‘WAN-2’, ‘port 0’]] [[‘WAN-2’, ‘port 1’], [‘SW-2’, ‘GigabitEthernet 0/0’]]

+Waypoint deleted+

#python .\network_sketcher.py delete waypoint ‘WAN-2’ --master “C:\work[MASTER]test.xlsx”
--- Waypoint deleted --- WAN-2
Associated links removed: 2

+AFTER+

#python .\network_sketcher.py show waypoint_location --master “C:\work[MASTER]test.xlsx”
[‘WAN-1_wp_’, [[‘WAN-1’, ‘WAN-3’]]]

#python .\network_sketcher.py show l1_link --master “C:\work[MASTER]test.xlsx”
(Links connected to WAN-2 have been deleted)

[Tips]

  • Waypoints must be placed within dedicated waypoint areas (area names ending with wp)
  • All Layer 1 links connected to a deleted waypoint will also be deleted
  • Regular devices (non-waypoints) cannot be deleted (use the device delete command instead)
  • Device placement within waypoint areas is automatically updated

Clone this wiki locally