Courseiva

200-901 Infrastructure and Automation Practice Question

An automation engineer is writing a Python script that uses the ncclient library to retrieve the running configuration from a Cisco IOS XE device via NETCONF. The device requires SSH and uses the default NETCONF port. Which code snippet correctly establishes a NETCONF session and retrieves the configuration?

⚠ Common exam trap

The trap here is assuming that NETCONF uses the standard SSH port 22, when in fact it uses port 830 by default.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

from ncclient import manager with manager.connect(host='10.1.1.1', port=830, username='admin', password='pass', hostkey_verify=False) as m: config = m.get_config(source='running')

NETCONF over SSH uses port 830 by default. The ncclient library provides manager.connect to establish a session and get_config to retrieve configuration data. The source parameter specifies the datastore, such as 'running'. Using the correct port and method ensures successful communication with the device.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    from ncclient import manager with manager.connect(host='10.1.1.1', port=22, username='admin', password='pass', hostkey_verify=False) as m: config = m.get_config(source='running')

    Why it's wrong here

    The default NETCONF port is 830, not 22. While SSH uses port 22, NETCONF over SSH typically listens on port 830. Using port 22 will likely fail to establish a NETCONF session because the device expects NETCONF on 830. The rest of the code is correct, but the port is wrong.

  • ✗

    from ncclient import manager with manager.connect(host='10.1.1.1', port=830, username='admin', password='pass', hostkey_verify=False) as m: config = m.get(source='running')

    Why it's wrong here

    The method to retrieve configuration in ncclient is get_config, not get. The get method is used to retrieve state data or execute RPCs, not to fetch configuration. Using get with source='running' will result in an error or unexpected behavior.

  • ✓

    from ncclient import manager with manager.connect(host='10.1.1.1', port=830, username='admin', password='pass', hostkey_verify=False) as m: config = m.get_config(source='running')

    Why this is correct

    This snippet correctly uses port 830, the default for NETCONF over SSH. It establishes a connection with manager.connect and retrieves the running configuration using get_config with source='running'. The hostkey_verify=False is often used in lab environments to bypass host key checking.

  • ✗

    from ncclient import manager with manager.connect(host='10.1.1.1', port=22, username='admin', password='pass', hostkey_verify=False) as m: config = m.get(source='running')

    Why it's wrong here

    This option has two errors: the port is 22 instead of 830, and the method is get instead of get_config. Both mistakes will prevent successful retrieval of the running configuration. The correct port and method are essential for NETCONF operations.

About these practice questions

This 200-901 question is part of Courseiva's 975-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Cisco exam blueprint

This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.