# Managing network devices Managing switches is an essential part of MetalSoft. MetalSoft will automatically configure switch ports depending on the intent expressed by the user in the infrastructure designer. For that to happen the switches must be added in the MetalSoft database. The process of adding the switches to the MetalSoft database can be either automatic via ZTP or manual via the UI or the CLI. This guide describes the process of manually adding switches to the database via the CLI. To get details on how to enable ZTP on the switches consult [Registering switches using ZTP](/content/overview/installation/registering_switches_using_ztp.md). > Note that via this CLI-based process the system only touches the ports towards the servers and the SVIs that will act as gateways but will not configure BGP sessions towards the spine network or routing tables. Those must be created manually configured on the switches prior or after adding the switches in the database but before provisioning on those switches. If the BGP session configuration is needed please use the ZTP process. ## Getting switch details using the CLI To list all the switches (to ascertain the switch ID), run the following: ``` metalcloud-cli network-device list ┌──────┬──────────────────────────────────────────┬──────┬─────────────────┬───────────────────┬──────────────────────────┬──────────────────┬────────┐ │ # │ IDENTIFIER │ SITE │ ADDRESS │ MAC │ SERIAL │ DRIVER │ STATUS │ ├──────┼──────────────────────────────────────────┼──────┼─────────────────┼───────────────────┼──────────────────────────┼──────────────────┼────────┤ │ 229 │ pod01-leaf01 │ 558 │ 192.168.224.11 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ │ 230 │ pod01-leaf02 │ 558 │ 192.168.224.12 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ │ 231 │ pod01-leaf03 │ 558 │ 192.168.224.13 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ │ 232 │ pod01-leaf04 │ 558 │ 192.168.224.14 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ │ 233 │ pod02-leaf01 │ 558 │ 192.168.224.19 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ │ 234 │ pod02-leaf02 │ 558 │ 192.168.224.20 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ │ 235 │ pod02-leaf03 │ 558 │ 192.168.224.21 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ │ 236 │ pod02-leaf04 │ 558 │ 192.168.224.22 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ │ 237 │ pod01-spine01 │ 558 │ 192.168.224.17 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ │ 238 │ pod01-spine02 │ 558 │ 192.168.224.18 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ │ 239 │ pod02-spine01 │ 558 │ 192.168.224.25 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ │ 240 │ pod02-spine02 │ 558 │ 192.168.224.26 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ └──────┴──────────────────────────────────────────┴──────┴─────────────────┴───────────────────┴──────────────────────────┴──────────────────┴────────┘ ``` To get some basic details about a switch use the following command. You can use both the switch id or the switch label (which is usually the same as the switch hostname). ``` metalcloud-cli network-device get 229 ┌─────┬──────────────┬──────┬────────────────┬───────────────────┬────────┬──────────────────┬────────┐ │ # │ IDENTIFIER │ SITE │ ADDRESS │ MAC │ SERIAL │ DRIVER │ STATUS │ ├─────┼──────────────┼──────┼────────────────┼───────────────────┼────────┼──────────────────┼────────┤ │ 229 │ pod01-leaf01 │ 558 │ 192.168.224.11 │ 00:00:00:00:00:00 │ │ sonic_enterprise │ active │ └─────┴──────────────┴──────┴────────────────┴───────────────────┴────────┴──────────────────┴────────┘ ``` To get the switch configuration use the yaml format: ``` metalcloud-cli network-device get 229 --format yaml id: "229" revision: 1 status: active siteid: 558 identifierstring: pod01-leaf01 description: "" chassisidentifier: "" country: "" city: "" sitemeta: "" siteroom: "" siterack: "" rackpositionupperunit: 0 rackpositionlowerunit: 0 managementaddress: 192.168.224.11 managementaddressmask: 255.255.255.0 managementaddressgateway: 192.168.224.1 managementport: 22 syslogenabled: 0 username: admin managementpassword: rqi|aes-cbc|usd4/N+CmvKyHRJiIiXnCpwxx1agbC2uR4O6VpvrW896dRKUF09t1PMODHVx/YOw managementmacaddress: "00:00:00:00:00:00" serialnumber: "" driver: sonic_enterprise position: leaf orderindex: 10 tags: "" readyforinitialconfiguration: 0 bootstrapreadinesscheckinprogress: 0 subnetoobid: 0 subnetoobindex: 0 requiresosinstall: false bootstrapskipinitialconfiguration: 0 bootstrapexpectedpartnerhostname: "" loopbackaddressipv4: null loopbackaddressipv6: "" asn: 65316 vtepaddressipv4: null vtepaddressipv6: "" mlagsystemmac: "" mlagdomainid: 0 quarantinevlan: 5 defaultmtu: 0 variablesmaterializedforosassets: {} secretsmaterializedforosassets: {} bootstrapreadinesscheckresult: {} isgateway: true extensioninfo: null links: [] additionalproperties: {} ``` ## Adding a switch using the CLI To add a switch to the database using the CLI create a configuration file `leaf_switch.yaml`: ```yaml identifierString: iad1-bm-sw-01 siteName: test-site provisionerType: evpnvxlanl2 provisionerPosition: leaf driver: junos18 managementUsername: metalsoft managementAddress: 10.72.0.61 managementPort: 22 managementProtocol: ssh managementMACAddress: "00:00:00:00:00:00" primaryWANIPv4SubnetPool: 192.168.253.0 primaryWANIPv4SubnetPrefixSize: 24 primaryWANIPv6SubnetPoolID: 3 primaryWANIPv6SubnetCIDR: fd9f:1a77:a3a0:0000:0000:0000:0000:0000/48 primarySANSubnetPool: 100.64.0.1 primarySANSubnetPrefixSize: 21 quarantineSubnetStart: 10.73.254.0 quarantineSubnetEnd: 10.73.254.63 quarantineSubnetPrefixSize: 26 quarantineSubnetGateway: 10.73.254.2 requiresOSInstall: false isBorderDevice: true isStorageSwitch: false networkTypesAllowed: - wan - lan - quarantine managementPassword: "" primaryWANIPv6SubnetPool: "" primaryWANIPv6SubnetPrefixSize: 0 ``` Add the new switch by running: ```bash $ metalcloud-cli network-device create --config-source leaf_switch.yaml ``` Notes on parameters: * `management*`: These properties must be set to allow MetalSoft access to the respective switch. * `provisionerType`: can be one of `evpnvxlanl2`, `vlan`, `vpls`,`lan`. * `isBorderDevice`: If set to true this switch can be used as part of an external connection * `isStorageSwitch`: If set to true this switch can be used as part of SAN networks. * `quarantineSubnet*`: These properties only apply if the legacy provisioning mode (PXE) is required. These define which subnet to use for the transient provisioning network. * `primaryWANIP*`: These properties control the default WAN subnet that will be used. If one does not exist it will be created upon the creation of the switch. * `primarySAN*`: These properties control the default SAN subnet that will be used. If one does not exist it will be created upon the creation of the switch. ## Editing switch configurations using the CLI 1. Retrieve the current switch configuration and place it in a file ``` metalcloud-cli network-device get 229 -format yaml ``` 2. Save the output to `switch.yaml` and edit the configuration file `switch.yaml` 3. Reconfigure the switch ``` metalcloud-cli network-device update -config-source switch.yaml ``` ## Deleting a switch using the CLI 1. If the switch is part of a pair first delete the pair. Refer to [managing switch pairs](/content/configuration/network/managing_switch_pairs) for instructions. 2. Delete the switch ``` metalcloud-cli network-device delete 229 ``` ## Creating switch pairs To enable multi-chassis link aggregation on the switches, switch pairs must be created. Refer to [managing switch pairs](/content/configuration/network/managing_switch_pairs) for more details. ## Operating without switches MetalSoft can operate in mode where a "dummy" switch driver is used instead of a real one. This mode is sometimes called "BigLAN" mode as it expects everything to be part of the same pre-created LAN network. Refer to [deploying Metalsoft without switches](/content/overview/installation/deploying_metalsoft_without_switches) for more information.