Be able to write PyEZ scripts that load, merge, and commit configuration, catch CommitError and read its message, install images with the SW utility, and invoke JSNAPy checks in code. Getting the exact method names and parameters right is essential.
Start practicing
Python And PyEZ — choose a session length
Free · No account required
Domain overview
This domain covers automating Junos devices with Python and the PyEZ library. Questions present short scripting scenarios: loading and committing configuration, handling exceptions, using the SW utility for image installs, and running JSNAPy checks. You must know the correct classes, methods, and parameters to accomplish each task programmatically.
Exam objectives
Using Config and commit_check with load merge to apply candidate configuration via PyEZ
Retrieving device error text from CommitError and RpcError exception objects
Installing Junos images with the PyEZ SW utility and its reboot parameter
Running JSNAPy snapshot comparisons programmatically by importing and instantiating the appropriate class
Confusing load merge with load replace or load override, which changes how candidate configuration is combined
Assuming commit failures raise a generic exception rather than CommitError with device message details
Forgetting that the SW utility reboot behavior is controlled by a method parameter, not automatic
Click any question to see the full explanation and answer options, or start a focused practice session above.
Which PyEZ utility module should you import if you need to upgrade the Junos operating system on a remote device via a Python script?
2You are using the PyEZ SW utility to install a new Junos image on a device. Which method parameter allows the script to automatically reboot the device after a successful installation?
3An engineer is applying a candidate configuration using PyEZ and needs to load it from an external text file named 'interfaces.conf'. Which Config method should be used?
4You need to execute a custom remote procedure call (RPC) in PyEZ to retrieve the Ethernet switching table. The tag in Junos XML API is get-ethernet-switching-table-information. How should you write this method call in Python?
5You are writing a Python script to gather operational state information from a Junos device using PyEZ. Which method should you call on an open Device instance to retrieve standard hardware and OS inventory facts into a dictionary?
6You are writing a script that uses PyEZ to load a partial configuration merge. By default, what configuration database mode does the Config utility lock and load into?
7An automation engineer is writing a Python script using Junos PyEZ to connect to a device. Which module and class must be imported to instantiate a device object representing the Junos target?
8What is the primary templating engine used alongside Python for generating structured Junos configuration text in network automation workflows?
9In a Jinja2 template designed for Junos configuration, how do you correctly output the value of a variable named 'hostname'?
10What is JSNAPy primarily used for in Junos network automation?
11You want to run a JSNAPy verification test via Python code. Which Python class should you import and instantiate to execute the snapshot comparison programmatically?
12When executing an RPC call in PyEZ, what format is typically returned by default if you do not parse it into another structure?
13In a Python script utilizing PyEZ, what method must be called on the Device instance after all configuration and operational tasks are complete to properly terminate the NETCONF session?
14When using Jinja2 templates in Python to generate configurations, how can you load a template file from disk prior to rendering it with variables?
15An automation script needs to check if a Junos device supports a specific feature before executing an RPC. Which PyEZ property can be checked to inspect the software version loaded on the device?
16You are writing a script that performs multiple configuration changes inside a single PyEZ Config context. How can you verify that the candidate configuration has syntax errors before committing it?
17What Jinja2 feature allows you to include the contents of another template file into your main configuration template?
18In JSNAPy, what file format is used to define test cases and expected operational states?
19Which Jinja2 construct is used to define reusable blocks of template code that can be called with arguments like a function?
20When writing a Python script that connects to multiple Junos devices concurrently using PyEZ, which Python module is commonly used to manage thread pooling and parallel execution?
21You have captured a baseline snapshot using JSNAPy and want to compare a newly taken snapshot against that baseline. Which JSNAPy command-line action executes this comparison?
22When using PyEZ to push a configuration, you want to log out all NETCONF XML traffic exchanged between the script and the Junos device for debugging purposes. How do you enable this logging in Python?
23When writing a Python script to interact with Junos devices, you want to ensure that password credentials are not hardcoded in the source code. What is a recommended best practice supported by PyEZ?
24What is the primary benefit of using PyEZ Table and View abstractions over raw RPC XML parsing in Python scripts?
25When using Jinja2 inheritance, which tag is placed in a base template to indicate where child templates can insert their custom content?
26Which TWO characteristics describe JSNAPy snapshot operations? (Choose two)
27Which TWO of the following are valid ways to instantiate a PyEZ Device object in Python, providing connection parameters? (Choose two)
28Which TWO statements are true regarding PyEZ Table and View definitions? (Choose two)
29Which THREE exceptions can be raised by PyEZ during script execution when interacting with a Junos device? (Choose three)
30Which THREE advanced features or methods are available on a PyEZ Device instance for session management and inspection? (Choose three)
31Which TWO benefits are gained by using Python virtual environments when developing PyEZ and Jinja2 automation scripts? (Choose two)
32Which TWO tasks are typically automated using Python and PyEZ in a network DevOps pipeline? (Choose two)
33Which TWO commands or tools are associated with running JSNAPy snapshot verifications from a CLI environment? (Choose two)
34When developing Python scripts that utilize PyEZ and Jinja2, which THREE best practices ensure robust and maintainable automation code? (Choose three)
35An automation engineer is writing a Python script using Juniper PyEZ to connect to a Junos device. Which context manager approach is best practice to ensure the Device session is properly closed even if an exception occurs?
36When modifying a Junos device configuration using the PyEZ Config table-driven or Context manager (with Config(dev) as cu:), what is the default behavior regarding locking the candidate configuration?
37You are writing a script that uses Jinja2 to dynamically render a Junos interface configuration. Which Python module and function are required to load a template from the local filesystem and render it with a dictionary of variables?
38An automation script needs to compare pre- and post-change states on a Junos device using JSNAPy (Junos Snapshot Administrator). Which configuration file format is used by JSNAPy to define snapshot checks and test assertions?
39You are utilizing PyEZ Table and View abstractions to parse interface statistics. Which base class must your custom Table class inherit from to map to Junos XML output?
40When implementing Jinja2 templates for Junos configuration generation, which THREE features or syntax constructs are natively supported by the Jinja2 engine?
41Which TWO actions can be performed using the JSNAPy command-line interface (CLI) tool during network verification workflows?
42You are writing a Python script that uses PyEZ to connect to a Junos device. After calling `dev.open()`, you need to verify that the NETCONF session is active before performing operational commands. Which statement correctly checks the connection status and returns a Boolean value?
43A Python script using PyEZ loads a configuration from a file and commits it on a Junos device. The commit fails with a `CommitError` exception. You need to retrieve the specific error message returned by the device. Which method or attribute should you use to obtain the detailed error text?
44You are using PyEZ to retrieve the operational status of all interfaces on a Junos device. You want to get the output in a structured Python dictionary rather than raw XML. Which method should you use on the Device object?
45You are writing a Python script using PyEZ to retrieve and process operational data from a Junos device. Which TWO statements correctly describe the use of PyEZ Table and View for parsing operational data? (Choose two.)
46You are automating the retrieval of operational data from a Junos device using PyEZ. You write a Python script that calls the RPC method `get_interface_information` with the argument `terse=True` on a `Device` object. The script executes successfully, but the returned XML contains only a subset of interface details, missing fields like `admin-status` and `oper-status`. You need the full operational status for each interface. What should you do to obtain the complete data?
47You are developing a Python script using PyEZ to load a configuration onto a Junos device. You need to ensure that the configuration is merged with the existing candidate configuration, and that the load operation does not perform a commit check automatically. Which method should you use to load the configuration from a file?
48You are writing a PyEZ script that must connect to a Junos device and run several RPCs, but you need the connection to automatically recover if the NETCONF session drops during a long-running task. Which PyEZ connection parameter should you configure to enable this behavior?
49You are writing a PyEZ script to retrieve the configured hostname from a Junos device. You want to use the simplest method that returns the hostname as a string without parsing XML manually. Which PyEZ feature should you use?
50You are developing a PyEZ script that loads a configuration snippet onto a Junos device. You want to ensure the configuration is merged with the existing candidate configuration and then committed. Which sequence of PyEZ methods should you use?
51You are writing a PyEZ script that must retrieve interface statistics from a Junos device. You want to use a predefined PyEZ Table to avoid writing custom parsing logic. Which predefined Table should you use to get operational status and statistics for all interfaces?
52You are writing a PyEZ script that needs to handle exceptions when connecting to a Junos device and executing RPCs. Which TWO exceptions are raised by PyEZ when authentication fails or when the device is unreachable? (Choose two.)
53You are developing a Python script using Junos PyEZ to retrieve and process operational data. You need to handle exceptions that may occur during device interaction. Which two exceptions are raised by PyEZ when a connection or authentication issue occurs? (Choose two.)
Be able to write PyEZ scripts that load, merge, and commit configuration, catch CommitError and read its message, install images with the SW utility, and invoke JSNAPy checks in code. Getting the exact method names and parameters right is essential.
The Courseiva JNCIA-DevOps question bank contains 53 questions in the Python And PyEZ domain. Click any question to see the full explanation and answer breakdown.
Start with a 10-question focused session to identify your baseline accuracy in this domain. Read every explanation — even for questions you answer correctly — to understand the reasoning. Once you score consistently above 80%, move to a 20–30 question session to confirm depth before moving to the next domain.
Yes — the session launcher on this page draws questions exclusively from the Python And PyEZ domain. Choose 10, 20, 30, or 50 questions for a focused session, or click individual questions to review them one by one.
Save your results, see per-domain analytics, and get readiness scores — free, for every certification.
Sign Up FreeFree forever · Every certification included