使用 CLI 配置 ztp.json
总结 通过 SSH 连接到 Apstra ZTP 服务器并配置ztp.json文件。
为了减少出错几率,我们建议使用 Apstra ZTP GUI 配置器进行配置 ztp.json
,但您可以选择改用 CLI,如下所述。您可以使用 vi 或 nano 等文本编辑器直接配置 ZTP 配置。
使用 CLI 配置 ztp.json
- 打开终端并通过 SSH 连接到 Apstra ZTP 服务器。
ssh admin@<apstra-ztp-server-ip>
其中<apstra-ztp-server-ip>
是 Apstra ZTP 服务器的 IP 地址。 - ZTP 配置文件位于目录中的 Apstra ZTP 虚拟机
/containers_data/tftp
上。admin@apstra-ztp:~$ sudo ls -l /containers_data/tftp total 336 -rwxrwxrwx 1 admin admin 2448 Aug 28 16:39 config_verifier.py -rwxrwxrwx 1 admin admin 742 Aug 28 16:39 container_init.sh -rwxr-xr-x 1 admin admin 292 Sep 11 15:17 cumulus_slicer_custom.sh -rwxrwxrwx 1 admin admin 178 Aug 28 16:39 Dockerfile -rwxrwxrwx 1 admin admin 107 Aug 28 16:39 eos_custom.sh -rwxr-xr-x 1 admin admin 75 Sep 11 15:17 eos_slicer_custom.sh -rwxrwxrwx 1 admin admin 5735 Aug 28 16:39 junos_apstra_ztp_bootstrap.sh -rwxrwxrwx 1 admin admin 1799 Aug 28 16:39 junos_custom.sh -rwxr-xr-x 1 admin admin 564 Sep 11 15:17 junos_evo_slicer_custom.sh -rwxr-xr-x 1 admin admin 517 Sep 11 15:17 junos_slicer_custom.sh -rwxr-xr-x 1 admin admin 214 Sep 11 15:17 linux_slicer_custom.sh -rwxrwxrwx 1 admin admin 86 Aug 28 16:39 nxos_custom.sh -rwxr-xr-x 1 admin admin 78 Sep 11 15:17 nxos_slicer_custom.sh -rwxrwxrwx 1 admin admin 205 Aug 28 16:39 poap-md5sum -rw-rw-r-- 1 admin admin 26720 Sep 11 15:17 pxelinux.0 -rwxrwxrwx 1 admin admin 1843 Aug 28 16:39 rsyslog.conf -rwxrwxrwx 1 admin admin 170 Aug 28 16:39 sonic_custom.sh -rwxr-xr-x 1 admin admin 88 Sep 11 15:17 sonic_slicer_custom.sh -rwxrwxrwx 1 admin admin 2640 Sep 11 15:17 ztp.json -rwxrwxrwx 1 admin admin 115549 Aug 28 16:58 ztp.py -rwxrwxrwx 1 root root 115506 Aug 28 16:58 ztp.py.md5
ztp.json
使用文本编辑器(如 vi 或 nano)打开文件。admin@apstra-ztp:~$ sudo nano /containers_data/tftp/ztp.json
- 默认部分包括默认键值对。此处定义的值适用于所有设备,除非在更具体的部分中定义了相同的密钥,例如针对特定平台、型号或序列号。更具体的键优先于不太具体的键。有关密钥详细信息,请参阅ztp.json密钥。
{ "defaults": { "nxos-image": "http://buildfiles.dc1.apstra.com/apstrktr/switch_images/cisco/nxos.10.2.5.bin", "eos-image": "http://buildfiles.dc1.apstra.com/apstrktr/switch_images/arista/EOS-4.27.6M.swi", "cumulus-image": "http://buildfiles.dc1.apstra.com/apstrktr/switch_images/cumulus/cl-4.2.1-bcm-amd64.bin", "junos-image": "http://10.24.128.10/apstrktr/switch_images/juniper/junos-5e-22.2R3.15.tgz", "junos-evo-image": "http://10.24.128.10/apstrktr/switch_images/juniper/junos-evo-install-qfx-ms-fixed-x86-64> "sonic-image": "http://buildfiles.dc1.apstra.com/apstrktr/switch_images/sonic/sonic-4.0.5-GA-adv-bcm.bin", "license": "http://onie.dc1.apstra.com/lic/cumulus.lic", "device-root-password": "admin", "device-user": "admin", "device-user-password": "admin" },
还是这个?
{ "defaults": { "nxos-versions": [ "nxos-version1" ], "nxos-image": "aos_nxos_image.bin", "eos-versions": [ "eos-version1", "eos-version2" ], "eos-image": "aos_eos_image.bin", "junos-versions": [ "junos-version1", "junos-version2" ], "junos-image": "http://10.85.24.52/juniper/21.2R1-S2.2/jinstall-host-qfx-5e-x86-64-21.2R1-S2.2-secure-signed.tgz", "junos-evo-versions": [ "junos-evo-version1" ], "junos-evo-image": "http://server_address/path/to/install_package_name.tgz", "sonic-versions": [ "sonic-version1", "sonic-version2" ], "sonic-image": "http://server_address/path/to/sonic_package_name.bin", "device-root-password": "admin", "device-user": "aosadmin", "device-user-password": "aosadmin", "custom-config": "", "management-subnet-prefixlen": "", "management-master-ip": "", "management-backup-ip": "", "management-ip": "", "management-gw-ip": "", "dual-routing-engine": false, "system-agent-params": { "platform": "", "agent_type": "onbox", "operation_mode": "", "profile": "", "install_requirements": false, "job_on_create": "", "force_package_install": false, "enable_monitor": false, "packages": [], "id": "" } }, "junos": { "nxos-versions": [], "nxos-image": "", "eos-versions": [], "eos-image": "", "junos-versions": [ "21.2R1-S2.2" ], "junos-image": "http://10.85.24.52/juniper/21.2R1-S2.2/jinstall-host-qfx-5e-x86-64-21.2R1-S2.2-secure-signed.tgz", "junos-evo-versions": [], "junos-evo-image": "", "sonic-versions": [], "sonic-image": "", "device-root-password": "root123", "device-user": "aosadmin", "device-user-password": "aosadmin123", "custom-config": "", "management-subnet-prefixlen": "", "management-master-ip": "", "management-backup-ip": "", "management-ip": "", "management-gw-ip": "", "dual-routing-engine": false, "system-agent-params": { "platform": "junos", "agent_type": "offbox", "install_requirements": false, "job_on_create": "install", "force_package_install": false, "packages": [] } }, "junos-evo": { "nxos-versions": [], "nxos-image": "", "eos-versions": [], "eos-image": "", "junos-versions": [], "junos-image": "", "junos-evo-versions": [], "junos-evo-image": "", "sonic-versions": [], "sonic-image": "", "device-root-password": "root123", "device-user": "", "device-user-password": "aosadmin123", "custom-config": "", "management-subnet-prefixlen": "", "management-master-ip": "", "management-backup-ip": "", "management-ip": "", "management-gw-ip": "", "dual-routing-engine": false, "system-agent-params": { "platform": "junos", "agent_type": "offbox", "operation_mode": "", "profile": "", "install_requirements": false, "job_on_create": "install", "force_package_install": false, "enable_monitor": false, "packages": [], "id": "" } }, "eos": { "nxos-versions": [], "nxos-image": "", "eos-versions": [], "eos-image": "", "junos-versions": [], "junos-image": "", "junos-evo-versions": [], "junos-evo-image": "", "sonic-versions": [], "sonic-image": "", "device-root-password": "", "device-user": "", "device-user-password": "", "custom-config": "eos_custom.sh", "management-subnet-prefixlen": "", "management-master-ip": "", "management-backup-ip": "", "management-ip": "", "management-gw-ip": "", "dual-routing-engine": false, "system-agent-params": { "platform": "", "agent_type": "", "operation_mode": "", "profile": "", "install_requirements": false, "job_on_create": "", "force_package_install": false, "enable_monitor": false, "packages": [], "id": "" } }, "nxos": { "nxos-versions": [], "nxos-image": "", "eos-versions": [], "eos-image": "", "junos-versions": [], "junos-image": "", "junos-evo-versions": [], "junos-evo-image": "", "sonic-versions": [], "sonic-image": "", "device-root-password": "admin123", "device-user": "", "device-user-password": "", "custom-config": "", "management-subnet-prefixlen": "", "management-master-ip": "", "management-backup-ip": "", "management-ip": "", "management-gw-ip": "", "dual-routing-engine": false, "system-agent-params": { "platform": "", "agent_type": "onbox", "operation_mode": "", "profile": "", "install_requirements": false, "job_on_create": "", "force_package_install": false, "enable_monitor": false, "packages": [], "id": "" } }, "JNP10002-60C [QFX10002-60C]": { "nxos-versions": [], "nxos-image": "", "eos-versions": [], "eos-image": "", "junos-versions": [ "21.2R1-S1.3" ], "junos-image": "http://10.85.24.52/juniper/21.2R1-S1.3/junos-vmhost-install-qfx-x86-64-21.2R1-S1.3.tgz", "junos-evo-versions": [], "junos-evo-image": "", "sonic-versions": [], "sonic-image": "", "device-root-password": "", "device-user": "", "device-user-password": "", "custom-config": "", "management-subnet-prefixlen": "", "management-master-ip": "", "management-backup-ip": "", "management-ip": "", "management-gw-ip": "", "dual-routing-engine": false, "system-agent-params": { "platform": "", "agent_type": "", "operation_mode": "", "profile": "", "install_requirements": false, "job_on_create": "", "force_package_install": false, "enable_monitor": false, "packages": [], "id": "" } }, "QFX10002-36Q": { "nxos-versions": [], "nxos-image": "", "eos-versions": [], "eos-image": "", "junos-versions": [ "21.2R1-S2.2" ], "junos-image": "http://10.85.24.52/juniper/21.2R1-S2.2/jinstall-host-qfx-10-f-x86-64-21.2R1-S2.2-secure-signed.tgz", "junos-evo-versions": [], "junos-evo-image": "", "sonic-versions": [], "sonic-image": "", "device-root-password": "", "device-user": "", "device-user-password": "", "custom-config": "", "management-subnet-prefixlen": "", "management-master-ip": "", "management-backup-ip": "", "management-ip": "", "management-gw-ip": "", "dual-routing-engine": false, "system-agent-params": { "platform": "", "agent_type": "", "operation_mode": "", "profile": "", "install_requirements": false, "job_on_create": "", "force_package_install": false, "enable_monitor": false, "packages": [], "id": "" } } }
- 特定于平台的部分包括基于每个设备的平台应用于每个设备的配置。有关自定义配置文件的信息,请参阅创建特定于供应商的自定义配置
"junos": { "device-root-password": "root123", "custom-config": "junos_slicer_custom.sh" }, "junos-evo": { "device-root-password": "root123", "custom-config": "junos_evo_slicer_custom.sh" }, "eos": { "custom-config": "eos_slicer_custom.sh" }, "nxos": { "custom-config": "nxos_slicer_custom.sh" }, "cumulus": { "custom-config": "cumulus_slicer_custom.sh" }, "sonic": { "custom-config": "sonic_slicer_custom.sh" }, "linux": { "custom-config": "linux_slicer_custom.sh" } }
- 特定于模型的参数包括:
- 序列号参数包括:
"5254003765C9": { "device-root-password": "root123", "junos-versions": [ "22.2R3.15" ], "junos-image": "", "system-agent-params": null }, "525400EB0A3C": { "device-root-password": "root123", "junos-versions": [ "22.2R3.15" ], "junos-image": "", "system-agent-params": null }, "5254002FFA41": { "device-root-password": "root123", "junos-versions": [ "22.2R3.15" ], "junos-image": "", "system-agent-params": null }, "525400C36BF6": { "device-root-password": "root123", "junos-versions": [ "22.2R3.15" ], "junos-image": "", "system-agent-params": null }, "525400DE0AE4": { "device-root-password": "root123", "junos-versions": [ "22.2R3.15" ], "junos-image": "", "system-agent-params": null }, "525400B813C8": { "system-agent-params": null }, "5254007F0AF8": { "system-agent-params": null }, "5254008DDCCF": { "system-agent-params": null }, "525400602A79": { "system-agent-params": null }, "5254004D62B3": { "system-agent-params": null },