JN0-224 Sample Questions & Answers
The PyEZ library and JSNAPy, used for Python scripting, get the deepest coverage, ahead of NETCONF, XML and XPath interfaces, the broader automation stack of tools, frameworks and APIs, YAML and JSON serialization, and the Junos REST API.
Launch the full JN0-224 simulator →Showing 10 of 20 free samples.
- Question 1Intermediate
Python/PyEZ · Remote Procedure Calls (RPCs)
A Python script using PyEZ needs to retrieve the BGP summary information and then process only the neighbors that are in the 'Established' state. Given that
dev.rpc.get_bgp_summary_information()returns a complex XML object, what is the most effective way to access the desired data?Show answer & explanation
Correct answer: C
The PyEZ RPC reply is an
lxmlobject, which is ideal for parsing with XPath. Using an XPath expression like.//bgp-peer[peer-state='Established']with the.findall()method is the most direct, efficient, and reliable way to select only the specific XML elements that match the criteria. This avoids fragile string manipulation and inefficient manual iteration. - Question 2Intermediate
NETCONF/XML API · NETCONF Operations
What is the function of the
operation="merge"attribute within a NETCONFRPC sent to a Junos device?Show answer & explanation
Correct answer: B
The
operation="merge"attribute instructs the NETCONF server to merge the configuration data from the RPC with the configuration in the target datastore. New elements in the RPC are added, and existing elements are updated. It does not delete elements that are absent from the RPC, which is the key difference from thereplaceoperation. - Question 3Advanced
Python/PyEZ · Junos Snapshot Administrator (JSNAPy)
Company Background:
Global Financial Services Inc. operates a large-scale network with strict compliance and uptime requirements. Network changes are only permitted during scheduled weekly maintenance windows and must be rigorously validated to prevent service disruptions. The network operations team is small and needs to automate as much of the change validation process as possible to reduce human error and meet tight deadlines.Current Situation:
The team currently relies on manual CLI commands to check the state of core routers before and after applying configuration changes. This process is slow, error-prone, and generates inconsistent reports. They have decided to build an automated solution using Python, leveraging the PyEZ library for device interaction and JSNAPy for state validation.Technical Requirements:
- The solution must be a single Python script that can be executed from a central automation server.
- Before applying any changes, the script must capture a 'pre-change' snapshot of the device state. This must include the full IPv4 routing table, the status of all BGP sessions, and the operational status of all physical interfaces.
- After changes are applied (manually or by another script), the script must capture a 'post-change' snapshot of the same data points.
- The script must compare the two snapshots and generate a simple, clear report indicating a PASS or FAIL status. A FAIL status should be triggered if any BGP sessions have dropped, any critical interfaces have gone down, or if specific critical routes are missing from the routing table.
Constraint:
The solution must not require any custom daemons or agents to be installed on the Junos devices themselves.Which approach best satisfies all the requirements for this automated validation solution?
Show answer & explanation
Correct answer: B
This approach directly addresses all requirements using the intended tools. JSNAPy is specifically designed for this use case. A JSNAPy configuration file allows the declarative definition of what data to snapshot (routing table, BGP summary, interfaces) and the conditions for a PASS/FAIL result. The Python script can then orchestrate the JSNAPy operations (
--snap,--check), providing a robust, maintainable, and scalable solution without requiring screen scraping or complex manual comparisons. - Question 4IntermediateSelect 2
Data Serialization · YAML
An engineer is creating a YAML file to store a list of NTP servers. Which of the following snippets are syntactically correct representations of a list in YAML? (Select TWO)
Show answer & explanation
Correct answers: A, C
- Question 5Beginner
Junos Automation Stack and DevOps Concepts · DevOps culture, practices, and tools
True or False: In a mature DevOps workflow, the principle of Infrastructure as Code (IaC) encourages defining network configurations in version-controlled files, which are then used to automate deployments, ensuring consistency and repeatability.
Show answer & explanation
Correct answer: A
This statement is true. A core tenet of Infrastructure as Code (IaC) is to manage and provision infrastructure through machine-readable definition files (e.g., YAML, JSON) rather than manual configuration. These files are stored in a version control system (like Git), becoming the single source of truth. Automation tools then use these files to apply configurations, which makes the process repeatable, consistent, and auditable.
- Question 6Advanced
Python/PyEZ · PyEZ exception handling
A PyEZ script attempts to apply a complex configuration change but fails during the commit phase, raising a
CommitErrorexception. The operational requirement is that any failed commit must leave the device in its original state. How should the script's error handling be structured to meet this requirement and provide detailed logs for troubleshooting?Show answer & explanation
Correct answer: C
The correct and safest way to handle a
CommitErroris to catch the specific exception and then call therollback()method on theConfigutility object. This reverts the candidate configuration to the currently active running configuration. Capturing the exception as a variable (e.g.,as e) allows the script to access the detailed error message from the device, which can then be logged for effective troubleshooting. - Question 7Intermediate
NETCONF/XML API · XML API concepts and syntax
An engineer needs to retrieve only the configuration for the
ge-0/0/0interface and all its subunits from a Junos device using a single NETCONFoperation. Which XML filter provides the most precise way to request this specific data?flowchart TD A[Client: Construct get-config RPC] --> B{Add XML Filter for ge-0/0/0}; B --> C[Send RPC to Junos Device]; C --> D[Device: Process Filter]; D --> E[Device: Return ONLY ge-0/0/0 Config]; E --> F[Client: Receive Filtered XML Data];Show answer & explanation
Correct answer: B
This filter correctly uses the subtree filtering mechanism. It specifies the exact path down to the
element and includes theelement with the valuege-0/0/0. This acts as an identifier, telling the NETCONF server to return the entirecontainer (including all its children like units) where the name matchesge-0/0/0. This is the standard and most precise method for selecting a specific named element. - Question 8Beginner
REST API · Junos REST API
In the context of RESTful APIs, which HTTP method is defined as idempotent and is primarily used to fully replace an existing resource or create it if it does not exist?
Show answer & explanation
Correct answer: D
The HTTP PUT method is designed to be idempotent, meaning that making the same call multiple times will produce the same result as making it once. It is used to send data to a server to create or update a resource, completely replacing the resource at the target URI with the new payload. If the resource doesn't exist, PUT can create it.
- Question 9Intermediate
Python/PyEZ · Remote Procedure Calls (RPCs)
To execute the operational command
show chassis hardwareand receive the output as a structured XML object using PyEZ, you would use the methoddev.rpc._________().Show answer & explanation
Correct answer: B
PyEZ maps Junos OS operational commands to RPCs by replacing spaces with underscores and converting the command to lowercase. Therefore,
show chassis hardwarebecomes the RPCget-chassis-hardware-information, which is called in PyEZ asdev.rpc.get_chassis_hardware_information(). - Question 10Advanced
NETCONF/XML API · NETCONF Operations
An automation script needs to remove a single BGP neighbor,
198.51.100.2, from an existing peer group namedEBGP-PEERSwithout impacting any other neighbors in that group. Whichoperationattribute should be used on theelement in the NETCONFRPC?Show answer & explanation
Correct answer: D
To remove a specific configuration element that has a unique identifier (like a BGP neighbor address), you must specify the element and its identifier in the XML hierarchy and add the attribute
operation="delete"to that element. This tells the NETCONF server to remove only that specific instance, leaving other elements at the same level untouched.
Ready for the real thing?
The full JN0-224 simulator has every exam-style question, timed mode, and instant scoring.