-
Notifications
You must be signed in to change notification settings - Fork 13
8‐2 Add Commands
Since this process will directly edit the master file, please be sure to back up the master file before proceeding.
You can execute the following "add" command from the CLI.
- add ip_address
- add l2_segment
- add portchannel
- add virtual_port
- add vport_l1if_direct_binding
- add vport_l2_direct_binding
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]
This process allows you to create an IP address for a Layer 3 interface. You can create one IP address at a time; by repeating the process, you can add multiple IP addresses.
python [file path]/network_sketcher.py add 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', '', '']
+IP Address added+
#python .\network_sketcher.py add ip_address 'L3SW2' 'Vlan 100' '192.168.100.100/24' --master "C:\work\[MASTER]test.xlsx"
--- IP Address added --- 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', '', '192.168.100.100/24']
This feature allows you to create Layer 2 segments (such as VLANs) on the interface. You can create one Layer 2 segment at a time, and multiple Layer 2 segments can be created.
python [file path]/network_sketcher.py add 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', '']
+l2_segment added+
#python .\network_sketcher.py add l2_segment 'L3SW2' 'GigabitEthernet 0/0' 'addvlan999' --master "C:\work\[MASTER]test.xlsx"
--- l2 Segment added --- 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,addvlan999', '']
Create a port channel (LAG) on the Layer 1 interface.
python [file path]/network_sketcher.py add portchannel [device name] [layer1_portname] [portchannel_name] --master [master file path] - ex.
+BEFORE+
#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', '', '']
+portchannel added+
#python .\network_sketcher.py add portchannel 'L3SW1' 'GigabitEthernet 0/0' 'PortChannel 1' --master "C:\work\[MASTER]test.xlsx"
--- portchannel added --- L3SW1,GigabitEthernet 0/0,PortChannel 1
#python .\network_sketcher.py add portchannel 'L3SW1' 'GigabitEthernet 0/1' 'PortChannel 1' --master "C:\work\[MASTER]test.xlsx"
--- portchannel added --- L3SW1,GigabitEthernet 0/1,PortChannel 1
+AFTER+
#python .\network_sketcher.py show l2_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW1', 'GigabitEthernet 0/0', 'PortChannel 1', '', '']
['L3SW1', 'GigabitEthernet 0/1', 'PortChannel 1', '', '']
#python .\network_sketcher.py show l3_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW1', 'PortChannel 1', '', '']
Create Layer 3 virtual interfaces, such as VLAN interfaces (SVIs).After creating a virtual port, it will be in loopback address state, so if you want to connect to a layer 2 segment such as a VLAN, execute the add l2_segment command to connect the created virtual port to the l2_segment.
python [file path]/network_sketcher.py add 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', '', 'Vlan 300', 'Vlan300', '']
#python .\network_sketcher.py show l3_interface --master "C:\work\[MASTER]test.xlsx"
['L3SW2', 'Vlan 300', '', '']
+virtual_port added+
#python .\network_sketcher.py add virtual_port 'L3SW2' 'addvlan 999' --master "C:\work\[MASTER]test.xlsx"
--- Virtual Port added --- L3SW2,addvlan 999
+AFTER+
#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', '', '']
This adds a virtual port that connects directly to a layer 1 interface. For example, this is used when creating subinterfaces on a router and configuring dot1q tagging for each subinterface. It is also possible to configure multiple virtual ports to be connected to a single layer 1 interface. This setting alone only creates a subinterface, so to send and receive layer 2 data, you must add add vport_l2_direct_binding to this setting and add layer 2 elements such as VLANs to the virtual port created.
python [file path]/network_sketcher.py add vport_l1if_direct_binding [device name] [Layer1 port] [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', '', '', '']
+vport_l1if_direct_binding added+
#python .\network_sketcher.py add vport_l1if_direct_binding "Catalyst 3560" "GigabitEthernet 0/0" "GigabitEthernet 0/0.100" --master "C:\work\[MASTER]test.xlsx"
--- vport_l1if_direct_binding added --- Catalyst 3560,GigabitEthernet 0/0,GigabitEthernet 0/0.100
+AFTER+
#python .\network_sketcher.py show l2_interface --master "C:\work\[MASTER]test.xlsx"
['Catalyst 3560', 'GigabitEthernet 0/0', 'GigabitEthernet 0/0.100', '', '']
This command allows a virtual port to directly send and receive Layer 2 data such as VLANs. Normally, a virtual port is connected to an l2_segment, and then that l2_segment is connected to a Layer 1 interface, thereby connecting the Layer 1 interface and the virtual port. However, this command directly connects a virtual port to a Layer 1 interface, allowing Layer 2 elements such as VLANs (l2_segment) to be sent and received. For example, this command is used when creating subinterfaces on a router and configuring dot1q tagging for each subinterface. It is also possible to configure a single virtual port to send and receive Layer 2 data such as multiple VLANs. Note that l2_segment and vport_l2_direct_binding cannot be registered simultaneously on the same virtual port.
python [file path]/network_sketcher.py add 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', '', '']
+virtual_port added+
#python .\network_sketcher.py add vport_l2_direct_binding "Catalyst 3560" "GigabitEthernet 0/0.100" vlan100 --master "C:\work\[MASTER]test.xlsx"
--- vport_l2_direct_binding added --- 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', '', 'vlan100']
- Yusuke Ogawa - Security Architect, Cisco | CCIE#17583
SPDX-License-Identifier: Apache-2.0
Copyright 2023 Cisco Systems, Inc. and its affiliates
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.