300-435 Question 70
Select 4You are tasked with automating the configuration of multiple Cisco devices using NetMiko. To ensure proper device management, you need to establish an SSH connection, execute a configuration command, and verify its success. Which of the following steps should you include in your Python script to accomplish this?
- A
Use the 'ConnectHandler' function to establish the SSH connection to the device.
- B
Invoke the 'send_command' method to push the configuration changes to the device.
- C
Use the 'send_config_set' method to apply configuration commands in global configuration mode.
- D
Verify the configuration changes by executing 'show' commands using the 'send_command' method.
- E
Close the connection using the 'disconnect' method after the configuration is complete.
Show answer and explanation
Correct answers: A, C, D, E
Explanation
NetMiko provides a simple and effective way to automate device management tasks. To manage devices effectively, you must first establish an SSH connection using 'ConnectHandler'. Configuration changes should be applied using 'send_config_set' to ensure they are executed in the global configuration mode. Verifying the changes using 'send_command' with appropriate 'show' commands is crucial to ensure the intended outcome. Finally, always close the connection using 'disconnect' to avoid resource leaks.
- A. Correct.
'ConnectHandler' is the correct method to establish an SSH connection in NetMiko. Without this, you cannot communicate with the device.
- B. Incorrect.
'send_command' is used for running show commands or retrieving information, not for pushing configuration changes to the device.
- C. Correct.
'send_config_set' is the appropriate method in NetMiko to apply configuration commands in global configuration mode.
- D. Correct.
Verifying configuration changes is a best practice and can be done using 'send_command' to execute 'show' commands.
- E. Correct.
Closing the SSH connection using 'disconnect' is essential to release resources and complete the session cleanly.