200-901 exam dumps

200-901 practice question 58 of 204

Cisco DevNet Associate. Associate level, Cisco. Free question with the correct answer and a full explanation.

200-901 Question 58

Single answer

You are tasked with automating the creation of a VLAN on a Cisco switch using the Cisco pyATS SDK. The SDK documentation states that the 'config' method is used to send configuration commands to a network device. Below is a snippet of the script that you need to complete:

from genie.conf import Genie

testbed = Genie.init('testbed.yaml')
device = testbed.devices['switch1']
device.connect()

# Add your code here to create VLAN 100 with the name 'Test_VLAN'

Which of the following Python code snippets will correctly create VLAN 100 with the name 'Test_VLAN' as per the SDK documentation?

  1. A

    device.config(['vlan 100', 'name Test_VLAN'])

  2. B

    device.configure('vlan 100 name Test_VLAN')

  3. C

    device.config('vlan 100\nname Test_VLAN')

  4. D

    device.execute(['vlan 100', 'name Test_VLAN'])

Show answer and explanation

Correct answer: A

Explanation

To configure a device using the Cisco pyATS SDK, the 'config' method is used, which accepts a list of configuration commands. In this case, the correct syntax is to pass a list with 'vlan 100' and 'name Test_VLAN' as separate items. The other options either use incorrect methods or incorrect argument formats.

  • A. Correct.

    Correct. The 'config' method accepts a list of configuration commands, and this syntax is consistent with the pyATS SDK documentation.

  • B. Incorrect.

    Incorrect. The 'configure' method is not part of the pyATS SDK; instead, the 'config' method is used for device configuration.

  • C. Incorrect.

    Incorrect. The 'config' method requires a list of commands, not a single string with line breaks.

  • D. Incorrect.

    Incorrect. The 'execute' method is used for sending operational commands, not configuration commands.

Timed practice exam

Take a 200-901 practice test under exam conditions

75 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam