Juniper Networks · Free Practice Questions · Last reviewed May 2026
30real exam-style questions organised by domain, each with the correct answer highlighted and a plain-English explanation of why it's right — and why the others are wrong.
Which PyEZ utility module should you import if you need to upgrade the Junos operating system on a remote device via a Python script?
from jnpr.junos.utils.upgrade import Upgrade
from jnpr.junos.utils.config import Config
from jnpr.junos.device import OS_Update
from jnpr.junos.utils.sw import SW
Correct. SW is the PyEZ software utility module.
When managing configuration changes via PyEZ Config utility, which context manager ensures that changes are automatically rolled back if an exception occurs within the block?
with Config(dev, mode='private') as cu:
try: cu.lock() except: cu.rollback()
with Config(dev) as cu:
Correct. Using the Config utility as a Python context manager guarantees rollback if an unhandled exception disrupts the block.
cu.commit(rollback_on_error=True)
You 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?
auto_reboot=1
reboot=True
Correct. Passing reboot=True to the sw.upgrade() method triggers a device reload upon completion.
reload_after_install=True
action='reboot'
An 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?
cu.load(path='interfaces.conf', format='text')
Correct. The path parameter specifies the file location and format specifies its syntax.
dev.load_configuration(file='interfaces.conf')
cu.load_file('interfaces.conf')
cu.read_config('interfaces.conf')
You 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?
dev.rpc.get-ethernet-switching-table-information()
dev.get_ethernet_switching_table_information()
dev.execute_rpc('get-ethernet-switching-table-information')
dev.rpc.get_ethernet_switching_table_information()
Correct. PyEZ converts hyphens in RPC names to underscores for Python method calls.
You 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?
dev.facts
Correct. dev.facts is a property dictionary that returns the gathered facts of the device.
dev.rpc.get_system_inventory()
dev.gather_facts()
dev.get_facts()
Want more Python And PyEZ practice?
Practice this domainWhat is the primary benefit of using structured data formats (such as XML, JSON, or YAML) over unstructured CLI text output in Junos automation?
They allow automation scripts to parse device output reliably without relying on brittle regular expressions.
Correct. Structured data eliminates the need for complex, error-prone regex parsing of CLI text.
Structured data formats take up less memory on the Junos Routing Engine hard drive.
They eliminate the need to authenticate when connecting via NETCONF or gRPC.
They automatically convert all IPv4 addresses to IPv6 format.
In a DevOps pipeline managing Junos devices, an engineer implements 'Infrastructure as Code' (IaC). Which practice best exemplifies this methodology when applied to Junos routing policies?
Writing custom Python scripts that use regex to parse 'show route' outputs on the fly.
Defining routing policies in Jinja2 templates and YAML data files, committing them to Git, and automatically pushing them via Ansible playbooks.
Correct. Using templates, data files, version control, and automation tools embodies IaC.
Manually logging into each router via SSH during a maintenance window to type out policy-options statements.
Using dynamic routing protocols like BGP to automatically advertise prefixes without human intervention.
An engineer needs to explain the primary advantage of treating network configurations as code in a modern DevOps workflow. Which principle best describes this approach?
Immutable infrastructure deployment where devices are replaced rather than updated manually.
Compiling the network CLI commands into binary machine code before executing them on Junos devices.
Storing configurations in a version control system to track history, enable rollbacks, and facilitate collaboration.
Correct. Network as code emphasizes version control systems (VCS) like Git for tracking history and peer review.
Automating the complete removal of the command-line interface in favor of graphical topology builders.
You are configuring a CI/CD pipeline for Junos network deployments. The pipeline must validate the syntax of generated candidate configurations against a physical or virtual Junos device before committing them to production. Which stage of the CI/CD pipeline does this validation step represent?
Continuous Deployment stage
Continuous Integration validation stage
Correct. Validating candidate configurations without committing them is part of CI testing.
Continuous Monitoring stage
Infrastructure Provisioning stage
Your CI/CD pipeline includes a linters step before deployment. Why is running a linter against YAML or Jinja2 template files critical in a Junos automation workflow?
To compile YAML files into Junos microcode for the Packet Forwarding Engine.
To automatically execute unit tests against live BGP peering sessions.
To detect syntax errors, indentation issues, and style violations in template and data files before deployment.
Correct. Linters validate static code and markup syntax prior to runtime execution.
To encrypt sensitive passwords stored within plaintext configuration files.
A network engineer is using Git for version control of Junos configurations. During a peer review on a pull request, a merge conflict arises because two engineers modified the same interface description line in different branches. What is the correct procedure to resolve this conflict in Git?
Reboot the Junos routing engine to clear the Git repository cache and force a fast-forward merge.
Run the 'git force-merge' command to automatically discard the older branch's changes.
Use 'git reset --hard' on the remote repository to delete both conflicting branches entirely.
Manually edit the conflict markers in the affected configuration file, stage the resolved file, and complete the merge commit.
Correct. Merge conflicts require manual intervention using conflict markers (<<<<, ====, >>>>), then staging and committing.
Want more Junos Automation Stack And DevOps Concepts practice?
Practice this domainAn automation script reads a multi-document YAML file containing configuration templates for various Junos router models. To process each document individually in Python using PyYAML, which function should the engineer invoke?
yaml.read_multi()
yaml.load_all()
yaml.safe_load_all()
Correct. yaml.safe_load_all() safely parses a multi-document YAML stream into an iterator of Python objects.
yaml.parse_documents()
An engineer needs to represent an ordered list of IP addresses in a YAML configuration file for a Junos automation playbook. Which valid YAML syntax correctly defines a sequence of items?
ip_addresses = {192.168.1.1, 192.168.1.2}
ip_addresses: [192.168.1.1: 192.168.1.2]
ip_addresses: - 192.168.1.1 - 192.168.1.2
Correct. The hyphen (-) prefix defines a list/sequence in YAML.
ip_addresses: * 192.168.1.1 * 192.168.1.2
A Python script retrieves interface statistics from a Junos device in JSON format, modifies a threshold value, and needs to output it back into a formatted JSON string with an indentation level of 4 spaces for readability. Which Python snippet achieves this?
json.format(data, spacing=4)
json.dumps(data, indent=4)
Correct. json.dumps() serializes a Python object to a JSON formatted string using an indentation of 4 spaces.
json.dump(data, indent=4)
json.stringify(data, spaces=4)
An automation engineer is writing a Python script that takes a complex nested Python dictionary containing Junos telemetry parameters and converts it into a YAML string. Which PyYAML function should be used?
yaml.export()
yaml.serialize_string()
yaml.to_yaml()
yaml.safe_dump()
Correct. yaml.safe_dump() serializes a Python object into a safe YAML representation.
A network automation script is reading a YAML configuration file containing Junos device credentials. The script encounters an unhandled exception when attempting to load the file using PyYAML. Upon inspection, the error is caused by a tab character used for indentation instead of spaces. Which YAML specification rule does this violate?
Tab characters are strictly forbidden for indentation in YAML.
Correct. YAML parsers throw a scanner error when tab characters are used for block indentation.
Comments must start with a double forward slash (//).
YAML files require all keys to be wrapped in double quotes.
Top-level keys must start with a hyphen (-) character.
You are writing a Python automation script that processes JSON output from a Junos device's 'show interfaces' operational command via PyEZ. One of the interface descriptions contains raw control characters. When the script attempts to dump this data to a JSON string using json.dumps(), it raises a ValueError. Which parameter should you pass to json.dumps() to handle non-printable or out-of-range character encoding gracefully?
skipkeys=True
check_circular=False
ensure_ascii=False
Correct. ensure_ascii=False ensures that non-ASCII or special characters are serialized without crashing the encoder.
allow_nan=True
Want more Data Serialization practice?
Practice this domainWhich NETCONF RPC tag is used to gracefully terminate an active NETCONF session with a Junos device?
<terminate-session>
<close-session>
<close-session> gracefully closes the current NETCONF session.
<disconnect>
<kill-session>
While executing a NETCONF edit-config operation, you want to ensure that any syntax errors or invalid statements immediately cause the device to roll back the entire transaction without applying partial changes. Which parameter achieves this?
<error-option>rollback-on-error</error-option>
'rollback-on-error' ensures atomicity by rolling back changes if an error is encountered.
<test-option>test-then-set</test-option>
<default-operation>none</default-operation>
<error-option>stop-on-error</error-option>
Which XML tag encapsulates the entire response returned by a Junos device in reply to a valid NETCONF RPC request?
<rpc-reply>
RFC 6241 specifies <rpc-reply> as the container for responses to <rpc> requests.
<response-data>
<xml-reply>
<netconf-response>
You want to retrieve only the system hostname from the Junos running configuration using NETCONF. Which filtering technique is most efficient?
Subtree filtering using XML element tags matching the configuration hierarchy
Subtree filtering uses specific XML elements to mirror the configuration tree and filter the output.
XPath expression filtering via the select attribute
Regular expression pattern matching within the <filter> attribute
Retrieving the entire configuration and parsing it locally with a Python script
You need to lock the candidate configuration datastore in your NETCONF script to prevent concurrent modifications by other administrators. Which XML element accomplishes this?
<lock-config>
<acquire-lock>
<exclusive-edit>
<lock>
The <lock> operation allows the client to lock the configuration system datastore.
You are writing a Python script to retrieve the operational state of interfaces from a Junos device using NETCONF. Which XML RPC element must be enclosed within the <rpc> tag to request operational data?
<pull-operational>
<get-rpc-reply>
<get-config>
<get>
The <get> element allows retrieving running operational state and configuration data.
Want more NETCONF And XML API practice?
Practice this domainWhen executing a configuration change via the Junos REST API, what is the role of the HTTP DELETE method?
To clear operational state counters such as interface packet counters.
To terminate an active REST API session and revoke the auth token.
To delete a specific configuration hierarchy or statement from the candidate configuration.
HTTP DELETE maps to deleting configuration elements in the candidate datastore.
To discard the entire candidate configuration.
An administrator wishes to secure their Junos REST API connections by configuring HTTPS instead of plain HTTP. Which command under 'system services jpagent' accomplishes this?
set system services jpagent https
This command enables secure HTTP (HTTPS) access for the jpagent.
set system services netconf ssl
set security ipsec-vpn
set system services rest secure
Which data serialization formats are natively supported by the Junos REST API for both input and output payloads?
JSON and XML
Junos REST API fully supports both JavaScript Object Notation (JSON) and eXtensible Markup Language (XML).
CSV and HTML
JSON and YAML
YAML and Protocol Buffers
Which service daemon must be explicitly enabled in the Junos CLI configuration to allow REST API requests to be processed by the routing engine?
set system services api-daemon
set system services netconf
set system services rest http
set system services jpagent
Enabling jpagent starts the Junos REST API daemon.
You are writing a Python script to retrieve interface statistics from a Junos device using the REST API. You use HTTP Basic Authentication. Which HTTP header must be included to pass the encoded credentials correctly?
Proxy-Authenticate
Authorization
The 'Authorization' header is standard for passing Basic Authentication credentials in HTTP requests.
Junos-Auth-Token
X-API-Key
An automation engineer is trying to retrieve operational data from a Junos device using the REST API. They send an HTTP GET request to the URI path 'http://192.168.1.1:3000/api/font/operational/system/information', but the request fails with a 404 Not Found error. What is the cause of this failure?
Authentication credentials were missing from the HTTP header.
The URI path contains an invalid prefix segment 'font' instead of the required API root structure.
The correct operational API route uses '/api/operational/system/information', and 'font' is an incorrect path segment.
The port 3000 is reserved for NETCONF and cannot be used for REST API requests.
Operational data retrieval requires an HTTP POST method instead of GET.
Want more Junos REST API practice?
Practice this domainThe JNCIA-DevOps exam has 200 questions and must be completed in 120 minutes. The passing score is 700/1000.
Scenario-based questions covering exam objectives with detailed answer explanations.
The exam covers 5 domains: Python And PyEZ, Junos Automation Stack And DevOps Concepts, Data Serialization, NETCONF And XML API, Junos REST API. Questions are weighted by domain — higher-weight domains appear more on your actual exam.
No. These are original exam-style practice questions written against the official Juniper Networks JNCIA-DevOps exam objectives. They are not copied from the real exam. Courseiva focuses on genuine understanding, not memorisation of braindumps.
Courseiva tracks your accuracy per domain and routes you toward weak areas automatically. Free, no account required.