Courseiva

Juniper Networks Automation and DevOps, Associate (JNCIA-DevOps, JN0-224) (JNCIA-DevOps) (JNCIA-DevOps) — Questions 226–273

273 questions total · 4 pages · All types, answers revealed

Page 3

Page 4 of 4

226
MCQeasy

In 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?

A.dev.close()
B.dev.terminate()
C.dev.end_session()
D.dev.disconnect()
AnswerA

Calling dev.close() tears down the NETCONF session and releases the underlying SSH transport, satisfying the requirement to terminate cleanly after all configuration and operational tasks finish. Without it, the persistent session lingers, exhausting device resources and blocking other management connections.

Why this answer

In PyEZ, the Device object maintains an active NETCONF session over SSH (port 830) that must be explicitly torn down. The dev.close() method cleanly closes the NETCONF session, releases the underlying SSH transport, and frees associated resources. Without calling close(), the session may linger until timeout, consuming VTY/session slots on the Junos device.

Exam trap

JNCIA-DevOps often tests whether candidates confuse PyEZ's close() with generic connection-termination method names like disconnect(), terminate(), or end_session() — only close() is the actual PyEZ API.

How to eliminate wrong answers

Option B is wrong because dev.terminate() is not a valid PyEZ Device method — there is no such API for ending sessions. Option C is wrong because dev.end_session() does not exist in the PyEZ Device class; NETCONF session teardown is not exposed under that name. Option D is wrong because dev.disconnect() is not a PyEZ method — while 'disconnect' sounds plausible, PyEZ uses close() to release the NETCONF/SSH connection.

227
MCQeasy

What is the primary benefit of using PyEZ Table and View abstractions over raw RPC XML parsing in Python scripts?

A.They eliminate the need to establish a Device connection object
B.They automatically convert XML into structured Python data structures like dictionaries and lists
C.They allow direct execution of Junos CLI operational commands without NETCONF
D.They automatically commit configurations to the active database
AnswerB

PyEZ Table and View map returned XML elements into native Python dictionaries and lists, removing manual XPath and element traversal. This satisfies the scenario's need to avoid raw RPC XML parsing and work with structured data directly.

Why this answer

PyEZ Table and View abstractions map Junos XML output to Python dictionaries and lists, eliminating the need for manual XML parsing. Tables define the structure and XPath, while Views map XML elements to Python attributes. This provides a clean, programmatic interface to operational data, making scripts more readable and maintainable.

Exam trap

JNCIA-DevOps often tests whether candidates understand that Table/View still rely on NETCONF and a Device object — the trap is thinking they bypass the connection or use CLI directly.

How to eliminate wrong answers

Option A is wrong because Table and View still require a Device connection object to execute RPCs — they do not eliminate it. Option C is wrong because Table and View use NETCONF RPCs under the hood, not direct CLI execution; they do not bypass NETCONF. Option D is wrong because Table and View are for reading operational data, not for committing configurations.

228
MCQhard

When using NETCONF to edit a Junos configuration, you include the attribute operation="create" on an existing configuration leaf. What behavior does the device exhibit?

A.The attribute is ignored, and the operation defaults to merge.
B.The configuration value is updated successfully.
C.The device returns an rpc-error indicating that the target data model element already exists.
D.The existing node is deleted and recreated with the new value.
AnswerC

The create operation demands that the target element not already exist. Applied to an existing leaf, Junos rejects the edit and returns an rpc-error stating the element exists, rather than silently merging or overwriting it.

Why this answer

The 'create' operation adds a configuration node only if it does not already exist; if it exists, it returns an error.

229
MCQeasy

Which character is used to indicate a mapping key-value pair in YAML syntax?

A.Semicolon (;)
B.Arrow (->)
C.Colon (:)
D.Equals sign (=)
AnswerC

A colon separates a mapping key from its value, as in key: value. YAML requires this delimiter to associate each key with its corresponding scalar, sequence or nested mapping, making the colon the syntax marker for key-value pairs.

Why this answer

In YAML, a key-value mapping is represented by a colon followed by a space (: ).

230
Multi-Selectmedium

Which TWO Python standard library modules are commonly combined when a script needs to fetch web content (such as Junos REST API data) and parse the resulting payload? (Choose two)

Select 2 answers
A.json
B.yaml
C.socket
D.urllib.request
E.pickle
AnswersA, D

The json module parses the REST API payload returned by the fetch, converting JSON text into Python dictionaries for manipulation. Combined with urllib.request, which performs the HTTP retrieval, it satisfies the scenario's need to fetch and then parse Junos REST API data.

Why this answer

Option D, urllib.request, is correct because it is the standard library module used to open URLs and perform HTTP requests, so it can fetch web content such as Junos REST API data. Option A, json, is correct because REST API payloads are typically returned in JSON format, and the json module parses that response text into Python dictionaries and lists. Together, urllib.request retrieves the raw response and json.loads() converts it into usable Python objects.

Option B, yaml, is not needed here since the scenario specifies web content/REST payloads, which are JSON rather than YAML. Option C, socket, is a lower-level networking module and does not provide convenient HTTP fetching or payload parsing. Option E, pickle, is for serializing/deserializing Python objects and is not used to parse JSON API responses.

231
MCQhard

An automation script executes a NETCONF <get-config> query with a specific subtree filter for interface statistics. However, the response contains configuration data instead of operational statistics. Why did this occur?

A.The session was not locked prior to executing the query.
B.Interface statistics cannot be retrieved via NETCONF; CLI parsing is required.
C.The <get-config> RPC targets configuration datastores, whereas interface statistics are operational state data retrieved via the <get> RPC.
D.The subtree filter syntax was invalid, causing the device to fallback to the default configuration view.
AnswerC

The NETCONF <get-config> RPC reads only from configuration datastores (running, candidate, startup), so it can never return operational state. Interface statistics live in the device's operational datastore, which is queried exclusively through the <get> RPC. The script's choice of RPC, not its subtree filter, caused the wrong data to be returned.

Why this answer

<get-config> retrieves configuration data, whereas operational statistics require the <get> RPC with operational filters.

232
MCQhard

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?

A.dev.rpc.get-ethernet-switching-table-information()
B.dev.get_ethernet_switching_table_information()
C.dev.execute_rpc('get-ethernet-switching-table-information')
D.dev.rpc.get_ethernet_switching_table_information()
AnswerD

PyEZ maps XML tags to Python methods by converting hyphens to underscores, so get-ethernet-switching-table-information becomes get_ethernet_switching_table_information. Calling it on the dev.rpc object executes the custom RPC and returns the Ethernet switching table, satisfying the stem's naming constraint.

Why this answer

PyEZ maps XML RPC hyphens to Python underscores, allowing you to call rpc methods directly as attributes on dev.rpc.

233
MCQeasy

Which tool or library is commonly used in Python to simplify interacting with Junos NETCONF APIs by abstracting low-level XML handling?

A.Netmiko
B.Junos PyEZ (juniper-eznc)
C.Paramiko
D.Requests
AnswerB

Junos PyEZ abstracts NETCONF's low-level XML into Python objects and methods, so engineers configure and query Junos without hand-crafting XML RPCs. It directly satisfies the stem's constraint of simplifying NETCONF interaction by hiding XML handling.

Why this answer

PyEZ is Juniper's official Python library designed specifically for interacting with Junos devices via NETCONF.

234
Multi-Selecthard

Which TWO components are essential parts of a model-driven network automation architecture on Junos devices? (Choose two)

Select 2 answers
A.YANG data models defining the structure and constraints of configuration and state data
B.Standardized management protocols such as NETCONF or gRPC/gNMI
C.Manual terminal emulation sessions using Telnet
D.Proprietary screen-scraping PERL scripts parsing raw CLI text
E.Physical serial port multiplexers
AnswersA, B

YANG models supply the machine-readable schema defining configuration and state data structure, types and constraints. This schema is what lets automation tools generate valid payloads and validate changes, satisfying the model-driven requirement in the stem.

Why this answer

Option A is correct because YANG data models are the foundational schema in a model-driven architecture, formally defining the structure, hierarchy, types, and constraints of both configuration and state data on Junos devices, enabling programmatic and vendor-neutral interaction. Option B is correct because model-driven automation requires standardized, model-aware management protocols — NETCONF (typically over SSH on port 830) and gRPC/gNMI — to transport YANG-modeled data and support operations like get-config, edit-config, and telemetry, rather than relying on human-readable CLI output. Options C, D, and E are not part of a model-driven architecture: Telnet terminal emulation, screen-scraping PERL scripts that parse raw CLI text, and physical serial port multiplexers all represent legacy, CLI-centric or hardware-centric approaches that lack structured data models and standardized programmatic interfaces.

235
MCQeasy

Which NETCONF RPC tag is used to gracefully terminate an active NETCONF session with a Junos device?

A.<terminate-session>
B.<close-session>
C.<disconnect>
D.<kill-session>
AnswerB

The `<close-session>` RPC performs a graceful NETCONF session teardown, allowing the Junos device to release locks and resources cleanly before closing the transport. This satisfies the stem's requirement for graceful termination, unlike `<kill-session>`, which forcibly ends another user's session without that orderly shutdown.

Why this answer

The <close-session> RPC requests graceful termination of the NETCONF session.

236
Multi-Selecteasy

Which TWO benefits are gained by applying DevOps principles to Junos network management? (Choose two)

Select 2 answers
A.Elimination of all network documentation requirements
B.Mandatory requirement for physical console cables on every device
C.Consistent, repeatable deployments through automation and version control
D.Exclusive reliance on manual CLI configuration commands
E.Improved collaboration and shared ownership between network and software engineering teams
AnswersC, E

Automation plus version control makes each Junos deployment reproducible: the same committed templates and playbooks produce identical results every run. This directly delivers the consistent, repeatable deployments the stem asks for as a DevOps benefit.

Why this answer

Option C is correct because DevOps principles applied to Junos network management emphasize infrastructure-as-code, where configurations are stored in version control systems (e.g., Git) and deployed through automation tools such as Ansible, PyEZ, or Junos Terraform provider, yielding consistent and repeatable deployments. Option E is correct because DevOps fundamentally breaks down silos between teams, fostering shared ownership and improved collaboration between network engineers and software developers through shared tooling, CI/CD pipelines, and common repositories. Option A is incorrect because documentation remains essential in DevOps environments; automation and version control supplement, but do not eliminate, documentation requirements.

Option B is incorrect because physical console cables are not mandated by DevOps principles; out-of-band management may still be used for recovery, but DevOps does not require a console cable on every device. Option D is incorrect because DevOps explicitly moves away from exclusive manual CLI configuration toward programmatic, automated configuration via NETCONF, REST API, or Junos automation frameworks.

237
MCQhard

An automation engineer is designing a deployment strategy for Junos devices using Git branches. Which branching strategy model aligns best with continuous delivery where feature branches are merged frequently into a shared integration branch that automatically triggers staging tests?

A.Creating a separate permanent branch for every physical router in the network and never merging them.
B.Locking the master branch for 12 months while developing a single monolithic configuration update offline.
C.Using tag-based releases exclusively without utilizing any version control branches.
D.Trunk-based development where developers merge small, frequent changes into a central main branch that drives automated pipelines.
AnswerD

Trunk-based development merges small, frequent commits into one shared main branch, so every push immediately drives automated pipelines. This satisfies the stem's continuous delivery constraint, where frequent integration into a central branch triggers staging tests, unlike long-lived feature branches that delay integration.

Why this answer

Trunk-based development aligns best with continuous delivery because developers merge small, frequent changes into a central main branch, which automatically triggers staging tests via CI/CD pipelines. This reduces merge conflicts, shortens feedback loops, and keeps the main branch always deployable.

Exam trap

JNCIA-DevOps often tests the misconception that long-lived feature branches or tag-only releases support continuous delivery, when in fact trunk-based development is the recommended model.

How to eliminate wrong answers

Option A is wrong because creating a permanent branch per router and never merging prevents integration, causing drift and making automated testing impossible. Option B is wrong because locking the master branch for 12 months and developing offline is the opposite of continuous delivery, delaying feedback and increasing integration risk. Option C is wrong because tag-based releases without branches ignore the branching model needed for parallel development and automated pipeline triggers.

238
Multi-Selectmedium

You 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.)

Select 2 answers
A.`ConnectTimeoutError`
B.`ConnectAuthError`
C.`RpcError`
D.`PermissionError`
E.`ConfigError`
AnswersA, B

`ConnectTimeoutError` is raised when PyEZ cannot establish a connection to the device within the specified timeout period. This typically occurs when the device is unreachable, the management interface is down, or there is a network issue. It indicates that the connection attempt timed out.

Why this answer

PyEZ defines a set of exceptions for connection-related failures. `ConnectAuthError` is raised when authentication fails, and `ConnectTimeoutError` is raised when the connection attempt times out due to an unreachable device or network issue. These two exceptions directly address the scenarios of authentication failure and unreachability, making them the correct choices.

Exam trap

The trap here is confusing RPC or configuration exceptions with connection exceptions, or selecting a generic Python exception like `PermissionError` instead of PyEZ-specific ones.

239
Multi-Selectmedium

Which TWO benefits are gained by using Python virtual environments when developing PyEZ and Jinja2 automation scripts? (Choose two)

Select 2 answers
A.They automatically compile Python scripts into binary executable files for Junos.
B.They allow installing specific versions of PyEZ, lxml, and Jinja2 independently of system Python.
C.They remove the need to install SSH clients on the local machine.
D.They enable direct root-level execution of Junos CLI commands on physical routers.
E.They isolate Python package dependencies for specific projects, preventing version conflicts.
AnswersB, E

Virtual environments create an isolated directory with its own interpreter and site-packages, so pip installs PyEZ, lxml, and Jinja2 there rather than into system Python. This satisfies the constraint of dependency isolation, letting each project pin distinct library versions without conflicting with OS-managed packages or other automation projects.

Why this answer

Option B is correct because a Python virtual environment creates an isolated site-packages directory with its own pip, so you can install pinned versions of PyEZ, lxml, and Jinja2 (e.g., pip install junos-eznc==2.6.3) without touching or conflicting with the system Python's packages. Option E is correct because that same isolation means each project's dependency set is self-contained, so upgrading a library for one automation project cannot break another project that depends on a different version. The unmarked options do not belong: virtual environments do not compile scripts into Junos binaries (A), do not replace SSH clients since PyEZ still uses NETCONF over SSH (C), and do not grant root-level CLI execution on routers (D).

240
Multi-Selecthard

When executing a configuration commit in Junos via NETCONF, which TWO commit parameters or modifiers can be specified in the RPC? (Choose two)

Select 2 answers
A.Direct packet capture on port 0
B.Check-only validation (verifying syntax without activating the configuration)
C.Confirmed commit (with timeout/rollback functionality)
D.Instant kernel bypass switching
E.Format hard disk partition primary
AnswersB, C

Check-only validation runs the full commit syntax and semantic checks without activating the candidate configuration, satisfying the requirement to specify a commit modifier within the NETCONF RPC. Junos exposes this as the `<check/>` element inside `<commit-configuration>`, letting automation validate changes before a real commit.

Why this answer

Option B is correct because the Junos NETCONF <commit> RPC supports the <check> element, which performs a check-only validation of the candidate configuration — the device verifies syntax and commit-time constraints without actually activating the configuration. Option C is correct because the <commit> RPC also supports the <confirmed/> element (optionally with a <confirm-timeout> value in seconds), which activates the configuration but automatically rolls back to the previous committed configuration unless a confirming commit is issued within the timeout. Option A is wrong because packet capture on port 0 is not a commit parameter; capture is configured via firewall filter actions or the 'monitor traffic' CLI, not the NETCONF commit RPC.

Option D is wrong because 'instant kernel bypass switching' is not a Junos commit modifier — it is not a real Junos feature at all. Option E is wrong because formatting a hard disk partition is an installation/disk operation, not a parameter of the NETCONF commit RPC.

241
Multi-Selecteasy

An automation developer is designing a script that reads routing policy parameters from a configuration file. Which TWO data formats are natively supported and commonly used across Junos automation toolchains like PyEZ, Ansible, and REST APIs for data serialization? (Choose two)

Select 2 answers
A.YAML
B.BMP
C.JSON
D.RTF
E.EXE
AnswersA, C

YAML is natively consumed by Junos automation toolchains: Ansible playbooks and inventories are YAML, PyEZ supports YAML templates, and Junos configuration data converts cleanly to and from YAML. This native, widespread support across PyEZ, Ansible and REST APIs makes it one of the two formats the question requires.

Why this answer

YAML (A) is correct because Junos automation toolchains such as Ansible and PyEZ commonly use YAML for structured configuration data, and Junos devices can consume YAML-formatted data in automation workflows. JSON (C) is correct because Junos REST APIs and PyEZ return and accept JSON as a native data serialization format for structured routing policy parameters. BMP (B) is incorrect because it is a binary image/monitoring protocol, not a data serialization format.

RTF (D) is incorrect because it is a rich text document format, not used for automation data serialization. EXE (E) is incorrect because it is an executable file format, not a structured data format.

Exam trap

JNCIA-DevOps often tests whether candidates can distinguish data serialization formats (JSON, YAML, XML) from unrelated file formats (BMP, RTF, EXE) that appear in the same answer list.

242
MCQeasy

Which XML tag encapsulates the entire response returned by a Junos device in reply to a valid NETCONF RPC request?

A.<rpc-reply>
B.<response-data>
C.<xml-reply>
D.<netconf-response>
AnswerA

Every valid NETCONF RPC response is wrapped in the <rpc-reply> element, which carries the message-id matching the request and contains the returned data or errors. This is the mandatory outer envelope defined by RFC 6241, so it encapsulates the entire response.

Why this answer

Every NETCONF response from a Junos device is wrapped in an <rpc-reply> tag.

243
MCQhard

A Python automation script parses a Junos telemetry stream in JSON. The JSON payload uses integer keys in a dictionary (e.g., {443: 'HTTPS'}). When loaded into Python using json.loads(), what data type do the dictionary keys become?

A.They are converted to floating-point numbers.
B.They remain integer objects.
C.The parser raises a KeyError because JSON keys must be alphabetic.
D.They are converted to Python string objects.
AnswerD

JSON object keys are always strings per the specification, so json.loads() yields Python str keys regardless of whether the source text shows integers like 443. The integer appearance is purely lexical; parsing normalises every key to a string object.

Why this answer

JSON specification dictates that object keys must be strings. When json.loads() parses an object, any keys (even if numeric-looking) are converted to Python strings.

244
Multi-Selecthard

When developing Python scripts that utilize PyEZ and Jinja2, which THREE best practices ensure robust and maintainable automation code? (Choose three)

Select 3 answers
A.Using the PyEZ Config context manager to ensure locks are released and rollbacks occur on error
B.Hardcoding administrative passwords inside template files for easy rendering
C.Using try-except blocks to catch specific PyEZ exceptions like ConnectError and ConfigError
D.Avoiding device.close() calls to keep network sessions open permanently
E.Separating Jinja2 template files from core Python execution scripts
AnswersA, C, E

The PyEZ Config context manager acquires the configuration lock and automatically releases it, rolling back on error. This guarantees clean lock handling during Jinja2-driven configuration loads, satisfying the stem's requirement for robust, maintainable automation code that avoids orphaned locks.

Why this answer

Option A is correct because the PyEZ Config context manager (with Config(dev) as cu:) automatically acquires the configuration lock, and on an exception it discards the candidate configuration and releases the lock, preventing stale locks and partial commits. Option C is correct because catching specific PyEZ exceptions such as ConnectError, ConfigError, LockError, and CommitError lets scripts handle connection and configuration failures precisely rather than masking all errors with a bare except. Option E is correct because keeping Jinja2 templates in separate .j2 files (loaded via Environment with FileSystemLoader) separates presentation from logic, improving readability, reuse, and maintainability.

Option B is wrong because hardcoding administrative passwords in template files exposes credentials and violates secure secret-handling practices. Option D is wrong because omitting device.close() leaks NETCONF/SSH sessions and consumes device and client resources; sessions should be closed when work is complete.

Exam trap

JNCIA-DevOps often tests PyEZ best practices, and candidates may be tempted by options that seem convenient (like hardcoding passwords or keeping sessions open) but are actually poor practices, leading them to select incorrect answers.

245
MCQeasy

When executing an RPC call in PyEZ, what format is typically returned by default if you do not parse it into another structure?

A.A JSON dictionary
B.An XML Element (lxml.etree)
C.A raw plain text string
D.A Python list of strings
AnswerB

PyEZ RPC replies default to raw lxml.etree XML elements rather than dictionaries or JSON. The response is only converted when you explicitly request another structure, such as calling the RPC with a different return format or parsing it yourself.

Why this answer

PyEZ RPC calls return an ElementTree object (XML Element) representing the response from the Junos device.

246
Multi-Selecthard

An automation engineer is designing a Python script that converts Junos device configuration data between JSON and YAML formats. The script must correctly handle data types to avoid misconfiguration. Which TWO statements about JSON and YAML data type handling are correct? (Choose two.)

Select 2 answers
A.JSON allows trailing commas in arrays and objects.
B.YAML represents a null value with the tilde (~) character.
C.JSON natively supports multi-line strings without escaping newlines.
D.YAML supports anchors and aliases for reusing configuration blocks.
E.JSON supports comments, which can be used to annotate configuration sections.
AnswersB, D

In YAML, the tilde (~) is a valid and canonical representation of a null value. This is important when converting from JSON, where null is used. Understanding this mapping allows automation scripts to preserve null semantics when translating between the two formats, ensuring that missing or empty values are handled correctly.

Why this answer

YAML's tilde represents null, and YAML supports anchors and aliases for reuse. These features are absent in JSON, which lacks comments, disallows trailing commas, and requires escaped newlines for multi-line strings. Understanding these differences is essential when converting between formats in automation scripts.

Exam trap

The trap here is assuming that JSON supports features like comments or trailing commas because they are common in other data formats, or overlooking YAML's unique features like anchors.

247
MCQhard

A network automation engineer is writing a Python script using the Junos PyEZ library to retrieve operational state from a QFX Series switch. The script needs to retrieve interface statistics using an RPC instead of raw CLI text parsing. Which PyEZ method should the engineer execute to invoke the 'get-interface-information' RPC and receive the structured XML response?

A.dev.rpc.get_interface_information()
B.dev.get_config(format='xml')
C.dev.load(action='set', format='xml')
D.dev.execute_cli('show interfaces')
AnswerA

Calling `dev.rpc.get_interface_information()` invokes the `get-interface-information` RPC directly over NETCONF, returning structured XML rather than parsed CLI text. PyEZ auto-generates snake_case methods from RPC names, satisfying the stem's requirement to avoid raw CLI parsing and retrieve operational interface statistics from the QFX switch.

Why this answer

In Junos PyEZ, the dev.rpc() method is used to execute native Junos XML RPCs directly against the device and return the results as an ElementTree XML object.

248
MCQeasy

Which of the following data types is natively supported in JSON without requiring custom serialization handlers?

A.Python set
B.Complex number
C.Python tuple
D.Boolean
AnswerD

JSON defines a fixed set of native types, and boolean is one of them, serialised as true or false. Parsers map it directly to native language booleans, so no custom handler is needed, unlike types such as dates or binary data that require bespoke encoding.

Why this answer

JSON natively supports a limited set of data types: string, number, boolean, null, array, and object. Boolean is one of these primitive types, so it can be directly represented as true or false without any custom serialization. This makes it straightforward to include boolean values in JSON payloads for APIs and configuration files.

Exam trap

The trap is assuming that because Python has many built-in types, JSON supports them all natively; candidates may overlook that JSON only supports a small set of primitive types.

How to eliminate wrong answers

Option A is wrong because Python set is not a JSON data type; JSON arrays are ordered and can contain duplicates, while sets are unordered and unique, requiring conversion to a list for serialization. Option B is wrong because complex numbers are not supported in JSON; they would need to be represented as strings or objects with real and imaginary parts. Option C is wrong because Python tuple is not a JSON type; tuples are serialized as JSON arrays, but the tuple type itself is not native to JSON.

249
MCQmedium

A network automation engineer is using a Python script with the PyYAML library to load a YAML file that defines a Junos device's configuration. The script needs to ensure that the loaded data is a Python dictionary and that no arbitrary Python objects are instantiated during parsing. Which function should the engineer use to safely load the YAML content?

A.yaml.load(stream, Loader=yaml.FullLoader)
B.yaml.load(stream, Loader=yaml.BaseLoader)
C.yaml.safe_load(stream)
D.yaml.load(stream, Loader=yaml.UnsafeLoader)
AnswerC

yaml.safe_load is the recommended function for safely parsing YAML into Python objects. It only constructs standard Python types such as dictionaries, lists, strings, integers, and booleans, and it does not execute arbitrary code or instantiate custom objects. This prevents security vulnerabilities when loading configuration files from untrusted sources.

Why this answer

Using yaml.safe_load ensures that only standard Python data types are constructed from the YAML input. It prevents the instantiation of arbitrary objects and mitigates security risks such as code execution. This is the recommended approach for parsing configuration files in automation scripts.

Exam trap

The trap here is assuming that any Loader other than UnsafeLoader is safe, or that BaseLoader is sufficient for type preservation.

250
Multi-Selecthard

A network automation engineer is utilizing the Junos PyEZ library in Python to manage device configurations. Which THREE methods or classes are part of the core Junos PyEZ library functionality? (Choose THREE)

Select 3 answers
A.ConnectError exception for handling connection failures to the device
B.Config context manager (e.g., 'with Config(dev) as cu:') for handling configuration blocks
C.Docker container orchestration module for spinning up microservices
D.Playbook execution engine for running local bash shell scripts
E.Device class from 'jnpr.junos' for managing connections and sessions
AnswersA, B, E

ConnectError is a genuine Junos PyEZ exception raised when the NETCONF session to the device cannot be established, covering authentication, timeout and transport failures. This satisfies the stem's requirement for a core PyEZ class, letting automation handle unreachable devices gracefully.

Why this answer

Option A is correct because Junos PyEZ defines the ConnectError exception in jnpr.junos.exception, which is raised when a session cannot be established with the device (for example, due to authentication failure or unreachable host), making it part of the core library's error-handling functionality. Option B is correct because the Config class in jnpr.junos.utils.config is used as a context manager (e.g., 'with Config(dev) as cu:') to load, commit, rollback, and lock configuration changes on a Junos device. Option E is correct because the Device class from jnpr.junos is the central PyEZ class used to open NETCONF sessions over SSH, manage connections, and issue RPCs to the device.

Option C is incorrect because Docker container orchestration is not provided by Junos PyEZ; PyEZ is a NETCONF-based device management library, not a container platform. Option D is incorrect because PyEZ does not include a playbook execution engine for local bash scripts; that functionality belongs to tools like Ansible or shell scripting, not the PyEZ library.

251
Multi-Selecthard

You 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.)

Select 2 answers
A.Views must be defined in a separate YAML file and cannot be coded in Python.
B.Tables automatically convert all XML responses into JSON format.
C.Tables can only retrieve configuration data, not operational data.
D.A View defines how to extract specific fields from the XML response of an RPC.
E.A Table uses a View to parse the RPC output and returns a list of dictionaries.
AnswersD, E

A View in PyEZ is a class that maps XML elements to Python attributes. It specifies XPath expressions to extract desired fields from the RPC response. This allows structured access to data without manual XML parsing. The View is used by a Table to transform the raw XML into a list of dictionaries or objects.

Why this answer

A View defines the extraction of fields from XML, and a Table uses that View to parse RPC output into a list of dictionaries. The other statements are incorrect: Tables do not auto-convert to JSON, Views can be in Python, and Tables are for operational data.

Exam trap

The trap here is thinking that Tables automatically convert XML to JSON, or that Views must be in YAML, when in fact they are flexible and produce dictionaries.

252
MCQeasy

An automation engineer is designing a Junos network automation workflow and needs to select the component of the Junos automation architecture responsible for parsing XML and JSONRPC client requests and interacting directly with the Junos kernel and daemons. Which component fulfills this role?

A.mgd (Management Daemon)
B.jails
C.rpd (Routing Protocol Daemon)
D.jsd (Junos Script Daemon)
AnswerA

The management daemon (mgd) is the Junos process that terminates XML and JSONRPC client sessions, parses those requests, and communicates directly with the kernel and other daemons, so it satisfies the stem's requirement for the component interacting with Junos internals.

Why this answer

MGD (Management Daemon) is the primary user interface handler in Junos OS. It processes CLI commands, Netconf XML requests, and JSON-RPC APIs, translating them into operations interacting with the Junos kernel and individual routing daemons via RRDS.

253
MCQmedium

A network automation team is using Junos PyEZ to retrieve interface statistics from a device. They need to ensure that the script can handle multiple devices concurrently and that each device connection is properly closed after the operation. Which approach should they take?

A.Use a single Device object and call open() and close() manually for each device.
B.Use the PyEZ 'multi' module to connect to all devices and retrieve data.
C.Use the Device class with the 'with' statement inside a ThreadPoolExecutor.
D.Use the Device class with a context manager for each device in a loop.
AnswerC

The ThreadPoolExecutor from the concurrent.futures module allows concurrent execution of tasks. By wrapping each Device connection in a 'with' statement within a thread, you ensure that each connection is properly closed after use. This combination satisfies both concurrency and resource management. Junos PyEZ Device objects are not thread-safe, so each thread must have its own Device instance, which this approach provides.

Why this answer

To handle multiple devices concurrently while ensuring proper connection closure, use ThreadPoolExecutor to run tasks in parallel, and within each task, use a context manager (with statement) to create and automatically close a Device connection. This ensures each device gets its own connection and that resources are released. The other options either lack concurrency or misuse a single Device object.

Exam trap

The trap here is thinking that a single Device object can be reused for multiple devices, or that a simple loop provides concurrency, when in fact each device needs its own connection and parallelism requires threading or async.

254
MCQhard

An engineer applies a configuration change using NETCONF with <edit-config> and specifies default-operation="replace" at the top level, but includes an element with operation="merge". How does Junos evaluate this?

A.The transaction fails because default-operation and element operations conflict.
B.The specific element operation ('merge') takes precedence over the transaction-level default-operation ('replace').
C.The device rolls back the configuration due to ambiguous parameters.
D.The default-operation takes precedence, ignoring the merge attribute.
AnswerB

Junos applies the most specific operation. An element-level operation attribute overrides the transaction-level default-operation, so that element merges while the remaining hierarchy follows replace. Attribute precedence resolves the conflict in favour of the explicit merge.

Why this answer

Per-element operation attributes override the default-operation specified at the transaction level.

255
MCQeasy

An administrator configures the Junos REST API service. By default, which TCP port does the device listen on for secure HTTPS REST requests?

A.443
B.3443
C.8080
D.830
AnswerB

Junos enables the REST API over HTTPS by default on TCP port 3443, distinct from the standard 443 used by other web services. Plain HTTP REST listens on port 3000. The stem's secure HTTPS constraint therefore maps directly to 3443.

Why this answer

The default TCP port for secure HTTPS requests in the Junos REST API daemon (jpagent) is port 3443.

256
MCQeasy

What is the primary benefit of using structured data formats (such as XML, JSON, or YAML) over unstructured CLI text output in Junos automation?

A.They allow automation scripts to parse device output reliably without relying on brittle regular expressions.
B.Structured data formats take up less memory on the Junos Routing Engine hard drive.
C.They eliminate the need to authenticate when connecting via NETCONF or gRPC.
D.They automatically convert all IPv4 addresses to IPv6 format.
AnswerA

Structured formats expose explicit keys and hierarchy, so scripts extract fields by name or path instead of pattern-matching raw CLI text. This removes the brittleness of regular expressions that break whenever Junos output formatting or spacing changes.

Why this answer

Structured data formats can be easily parsed programmatically without relying on fragile regular expressions.

257
MCQeasy

Which Junos configuration hierarchy is used to configure system services parameters related to the REST API agent?

A.set system rest-api
B.set protocols rest
C.set management-plane api
D.set system services jpagent
AnswerD

The `system services jpagent` hierarchy enables the Junos REST API agent, satisfying the stem's requirement for REST API service parameters. Unlike NETCONF over SSH or the legacy JUNOScript API, jpagent exposes RESTful HTTP/HTTPS access, so its configuration lives under `system services` alongside other daemons such as `ssh` and `telnet`.

Why this answer

The jpagent service is configured under the 'set system services jpagent' CLI hierarchy.

258
Multi-Selecthard

Which THREE statements correctly contrast the session handling of NETCONF versus the Junos REST API? (Choose three)

Select 3 answers
A.NETCONF maintains a persistent, stateful connection over an SSH session with capability exchanges.
B.NETCONF requires an HTTP web server running on port 80 to maintain session state.
C.NETCONF sessions automatically expire every 30 seconds if an interactive keystroke is not received.
D.Junos REST API relies on standard HTTP headers for authentication per request rather than maintaining an interactive shell session.
E.Junos REST API utilizes stateless HTTP request/response transactions.
AnswersA, D, E

NETCONF's SSH transport carries a long-lived, stateful session where both peers exchange capability sets at startup, then reuse that negotiated context for every subsequent RPC. This satisfies the stem's contrast with the Junos REST API, which is stateless per HTTP request and re-establishes context each call.

Why this answer

Option A is correct because NETCONF operates over a persistent SSH transport (typically TCP port 830) and establishes a stateful session that begins with a hello message exchanging capabilities between client and server. Option D is correct because the Junos REST API authenticates each request individually using standard HTTP headers (such as Authorization with Basic credentials or an X-Auth-Token) rather than relying on an interactive shell session. Option E is correct because the Junos REST API follows the stateless HTTP request/response model, where each transaction is independent and no session context is retained between calls.

Option B is incorrect because NETCONF does not use HTTP or port 80; it runs over SSH, and HTTP is the transport for REST, not NETCONF. Option C is incorrect because NETCONF sessions do not expire every 30 seconds based on keystrokes; they persist until explicitly closed or timed out by configured idle limits.

259
MCQhard

You are configuring a webhook in your version control system to trigger an automated CI/CD pipeline whenever a developer pushes a configuration commit to the main branch of your Junos automation repository. What security mechanism should be implemented on the receiving pipeline webhook endpoint?

A.Validating a shared secret token or HMAC cryptographic signature sent in the webhook request headers.
B.Opening TCP port 22 directly to the public internet without firewall rules.
C.Hardcoding the developer's Linux user password inside the webhook listener script.
D.Disabling all SSL/TLS certificates to allow unencrypted HTTP packet inspection.
AnswerA

HMAC signatures or shared secret tokens let the pipeline verify each webhook payload genuinely originated from the version control system, rejecting forged requests. This satisfies the stem's requirement for a security mechanism on the receiving endpoint, preventing attackers triggering unauthorised deployments.

Why this answer

Webhooks should be secured using secret tokens or HMAC signatures to ensure requests genuinely originate from the trusted VCS platform.

260
Multi-Selecteasy

Which TWO of the following are valid extensions commonly used for YAML files? (Choose two)

Select 2 answers
A..xml
B..jsn
C..yaml
D..txt
E..yml
AnswersC, E

YAML's official specification and its original design documentation both sanction .yaml as the canonical file extension, so tooling such as parsers and linters recognises it directly. This satisfies the stem's requirement for a valid YAML extension, alongside the equally accepted short form.

Why this answer

Option C (.yaml) is correct because .yaml is the canonical, officially recommended file extension for YAML documents, as defined by the YAML specification and used by tools like PyYAML, Kubernetes manifests, and Ansible playbooks. Option E (.yml) is also correct because .yml is the widely accepted short-form alternative extension for YAML files, supported by virtually all YAML parsers and commonly seen in CI/CD configs such as .travis.yml, docker-compose.yml, and GitHub Actions workflows. Option A (.xml) is incorrect because it denotes Extensible Markup Language files, a completely different markup syntax with angle-bracket tags, not YAML's indentation-based structure.

Option B (.jsn) is incorrect because it is not a standard extension for any common serialization format; JSON files use .json, and .jsn is not a recognized YAML extension. Option D (.txt) is incorrect because plain-text files have no defined structure and are not parsed as YAML by convention, even though YAML is technically a text format.

Exam trap

JNCIA-DevOps often tests whether candidates recognize both .yaml and .yml as valid, while distracting with extensions from other formats like .xml or generic .txt.

261
MCQhard

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?

A.Writing custom Python scripts that use regex to parse 'show route' outputs on the fly.
B.Defining routing policies in Jinja2 templates and YAML data files, committing them to Git, and automatically pushing them via Ansible playbooks.
C.Manually logging into each router via SSH during a maintenance window to type out policy-options statements.
D.Using dynamic routing protocols like BGP to automatically advertise prefixes without human intervention.
AnswerB

Storing Jinja2 templates and YAML data in Git, then deploying via Ansible, treats routing policy as version-controlled, declarative code. This satisfies the IaC requirement by making configuration reproducible and reviewable rather than manually applied on devices.

Why this answer

IaC defines infrastructure in declarative configuration files stored in version control, allowing automated testing and deployment.

262
MCQmedium

When 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?

A.Disabling authentication in the script
B.Storing credentials in plaintext in a public GitHub repository
C.Hardcoding credentials in base64 encoding
D.Using SSH key-based authentication or environment variables/config files (.junodes)
AnswerD

SSH key-based authentication removes passwords from source entirely, while the `.junodes` configuration file and environment variables let PyEZ retrieve credentials at runtime. Both satisfy the stem's constraint that credentials must not be hardcoded, keeping secrets outside version-controlled scripts.

Why this answer

PyEZ natively supports configuration files like ~/.junodes or passing parameters dynamically, but also respects environment variables or SSH keys.

263
MCQmedium

You send an edit-config RPC with an invalid XML tag name. What is the standard structure of the error returned in the <rpc-reply>?

A.A standard Linux kernel panic log string.
B.An HTTP 400 Bad Request status code.
C.A syslog message printed directly to the terminal emulator.
D.An <rpc-error> element containing diagnostic sub-elements like <error-message> and <error-tag>.
AnswerD

An invalid tag name is a protocol-level parsing failure, so the NETCONF server returns a single `<rpc-error>` element nested inside `<rpc-reply>`. Its diagnostic children, notably `<error-tag>` (here `malformed-message`) and `<error-message>`, identify the fault, satisfying the stem's requirement for the standard error structure.

Why this answer

NETCONF errors are returned inside an <rpc-error> element containing details such as error-type, error-tag, and error-message.

264
Multi-Selecteasy

Which TWO statements are true regarding the NETCONF protocol hello message exchange? (Choose two.)

Select 2 answers
A.The client uses the hello message to lock the configuration database before session initialization.
B.The client hello message must include the list of YANG modules it intends to modify during the session.
C.Both client and server exchange capabilities using XML elements containing URI strings.
D.The server hello message includes a session ID attribute assigned to the NETCONF session.
E.The hello message exchange is optional if a pre-shared SSH key is used for authentication.
AnswersC, D

NETCONF hello messages carry a `<capabilities>` element listing capability URIs, and both peers send their own hello immediately upon session establishment, so each side learns the other's supported capabilities. This satisfies the stem's requirement that both client and server exchange capabilities, with each capability identified by a URI string inside XML.

Why this answer

Option C is correct because in the NETCONF hello exchange both peers send a <hello> element containing a <capabilities> list, where each capability is expressed as a URI string (for example urn:ietf:params:netconf:base:1.0 or urn:ietf:params:netconf:capability:candidate:1.0), allowing each side to learn the other's supported features. Option D is correct because the server's hello includes a <session-id> element, a positive integer attribute that uniquely identifies the NETCONF session for the duration of that connection. Option A is wrong because database locking is performed later with <lock> operations, not during the hello exchange, and the hello occurs before any configuration operations.

Option B is wrong because the client hello advertises supported capabilities, not a list of YANG modules it intends to modify. Option E is wrong because the hello exchange is mandatory in NETCONF regardless of the SSH authentication method used.

Exam trap

JNCIA-DevOps often tests whether candidates know the hello exchange is mandatory and that capabilities are advertised (not negotiated), and candidates frequently assume locking or module-intent declarations happen during hello.

265
MCQeasy

When establishing a NETCONF session over SSH, which standard capability announcement is exchanged during the initial hello message phase?

A.http://xml.juniper.net/junos/rpc/v1
B.urn:ietf:params:netconf:base:1.0
C.netconf:params:xml:ns:netconf:base:2.0
D.urn:juniper:params:netconf:ssh:1.0
AnswerB

The base NETCONF capability urn:ietf:params:netconf:base:1.0 is announced in the server's hello message during session establishment, per RFC 6241. It signals support for the core NETCONF protocol operations, forming the mandatory baseline capability exchanged before any RPCs are issued.

Why this answer

NETCONF capabilities are exchanged in <hello> messages at session startup, referencing URIs like urn:ietf:params:netconf:base:1.0.

266
MCQeasy

An automation engineer is writing a Python script that uses the ncclient library to connect to a Junos device via NETCONF. The engineer wants to retrieve the entire candidate configuration from the device. Which NETCONF operation should be used?

A.<get> with a subtree filter for configuration
B.<copy-config> from running to candidate
C.<get-config> with source set to <candidate/>
D.<edit-config> with operation 'get'
AnswerC

This is correct because <get-config> retrieves configuration data from a specified datastore. Setting the source to <candidate/> requests the candidate configuration. This is the standard NETCONF operation to read configuration from a datastore, and it returns the full configuration unless filtered. It is the appropriate choice for retrieving the candidate configuration.

Why this answer

To retrieve the candidate configuration via NETCONF, the correct operation is <get-config> with the source datastore specified as <candidate/>. This operation reads configuration data from the chosen datastore. Other operations like <get> target running state and configuration, <copy-config> modifies datastores, and <edit-config> changes configuration.

Therefore, <get-config> is the proper choice.

Exam trap

The trap here is confusing <get> with <get-config>; <get> retrieves running configuration and state data, but cannot target the candidate datastore.

267
MCQmedium

You 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?

A.Remove the `terse=True` argument from the RPC call to retrieve the full interface information.
B.Use the `get_config` method with `config_format='set'` to retrieve the interface configuration and infer the operational status.
C.Set the `normalize=True` parameter in the `Device` object to ensure all fields are returned.
D.Call `get_interface_information` with `interface_name='all'` to retrieve details for every interface including all status fields.
AnswerA

The `terse=True` argument instructs the Junos device to return a condensed version of the interface information, omitting fields such as admin-status and oper-status. By removing this argument, the RPC returns the complete output, including all operational status fields. This is the correct approach to get the full data without altering the RPC itself.

Why this answer

The `terse` argument is a common RPC option that reduces output size by omitting detailed fields. For complete operational status, it must be omitted. The other options either retrieve the wrong type of data or do not affect the output completeness.

Removing `terse=True` directly addresses the missing fields.

Exam trap

The trap here is assuming that adding other parameters or using a different method will automatically include all fields, while the `terse` flag is the specific cause of the missing data.

268
Multi-Selecthard

In Git version control, which TWO commands are used to integrate changes from one branch into another? (Choose two)

Select 2 answers
A.git init
B.git merge
C.git status
D.git clone
E.git rebase
AnswersB, E

git merge integrates divergent branch histories by creating a merge commit that joins the two tips, preserving both lineages. This satisfies the stem's requirement for combining changes from one branch into another while retaining the full commit graph, unlike history-rewriting approaches.

Why this answer

git merge (B) is correct because it integrates changes from one branch into another by combining their commit histories, typically creating a merge commit when the target branch has diverged. git rebase (E) is also correct because it integrates changes by replaying commits from one branch onto another, producing a linear history. git init (A) only initializes a new repository and does not integrate branch changes. git status (C) merely reports working tree and staging state without modifying history. git clone (D) copies a remote repository locally but does not merge or rebase branches.

Exam trap

The trap here is confusing repository setup or inspection commands (init, clone, status) with branch integration commands (merge, rebase) — candidates may pick 'git clone' thinking it 'brings changes together' from a remote.

269
MCQmedium

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?

A.dev.facts
B.dev.rpc.get_system_inventory()
C.dev.gather_facts()
D.dev.get_facts()
AnswerA

Accessing `dev.facts` triggers PyEZ to run the built-in facts gathering routine, returning a dictionary of hardware and OS inventory such as model, serial number, hostname and Junos version. This satisfies the stem's requirement for standard inventory facts from an open Device instance without manual RPC calls.

Why this answer

The dev.facts property on a PyEZ Device instance returns a dictionary of standard hardware and OS inventory facts, such as hostname, model, serial number, Junos version, and uptime. It is populated automatically when the Device connects and is accessed as a property, not called as a method. This is the canonical way to retrieve inventory facts in PyEZ scripts.

Exam trap

JNCIA-DevOps often tests whether candidates know dev.facts is a property (no parentheses) rather than a method, and candidates frequently add parentheses or invent method names like get_facts() or gather_facts().

How to eliminate wrong answers

Option B is wrong because dev.rpc.get_system_inventory() is a lower-level RPC call that returns raw XML inventory data, not a parsed dictionary of standard facts, and it is not the idiomatic PyEZ facts mechanism. Option C is wrong because gather_facts() is not a PyEZ Device method — that naming resembles Ansible's setup module, not PyEZ. Option D is wrong because get_facts() is not a PyEZ Device method; facts are exposed as the dev.facts property, not via a getter method.

270
MCQmedium

An 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?

A.dev.get_version()
B.dev.version
C.dev.os_version
D.dev.facts['version']
AnswerD

The `facts` dictionary exposes device state gathered at connection time, and its `version` key returns the Junos OS release string loaded on the device. Checking `dev.facts['version']` therefore satisfies the stem's requirement to inspect software version before deciding whether an RPC is supported.

Why this answer

The PyEZ Device object exposes device facts through the `dev.facts` dictionary, and the loaded Junos software version is stored under the key `'version'`. Accessing `dev.facts['version']` returns the string reported by the device (for example, '21.4R3-S2.6'), which a script can parse to decide whether a feature RPC is supported. This is the canonical PyEZ pattern for version inspection.

Exam trap

JNCIA-DevOps often tests the distinction between PyEZ's facts dictionary and non-existent convenience attributes, so candidates who assume a `dev.version` or `dev.os_version` property exists pick the wrong answer.

How to eliminate wrong answers

Option A is wrong because `get_version()` is not a method on the PyEZ Device object — version data is exposed via the facts dictionary, not a dedicated getter. Option B is wrong because `dev.version` is not a defined attribute; PyEZ does not expose version as a top-level property. Option C is wrong because `dev.os_version` does not exist in PyEZ; the OS version lives inside `dev.facts`, not as a standalone attribute.

271
Multi-Selecthard

Which THREE HTTP methods are commonly used within the Junos REST API for managing configuration and operational resources? (Choose three)

Select 3 answers
A.TRACE
B.POST
C.GET
D.CONNECT
E.DELETE
AnswersB, C, E

POST carries configuration and RPC payloads to the Junos REST API, creating or loading candidate configuration and invoking operational commands. It satisfies the stem's need for a method that manages resources rather than merely reading them.

Why this answer

The Junos REST API uses standard HTTP verbs to manipulate configuration and operational resources, and the three commonly supported methods are GET, POST, and DELETE. GET (C) is correct because it is used to retrieve operational data or configuration information from Junos, such as via REST endpoints that return XML or JSON representations of state and configuration. POST (B) is correct because it is used to create, modify, or execute configuration and operational requests, including loading configuration changes or invoking RPCs through the REST API.

DELETE (E) is correct because it is used to remove configuration statements or resources at a specified REST endpoint. TRACE (A) is not used by the Junos REST API; it is a diagnostic HTTP method for echoing requests and is generally disabled for security. CONNECT (D) is also not part of Junos REST API resource management; it establishes a tunnel through a proxy and is unrelated to configuration or operational resource handling.

272
MCQeasy

Which Python module is part of the standard library and provides functions to serialize and deserialize JSON data?

A.requests
B.yaml
C.junos-eznc
D.json
AnswerD

The json module ships with every standard Python installation, requiring no pip install, and exposes loads() and dumps() for deserialising and serialising JSON strings. That built-in availability is precisely what the question's 'part of the standard library' constraint demands.

Why this answer

The 'json' module is part of the Python standard library and requires no external installation.

273
MCQeasy

An automation engineer stores Junos interface descriptions in a YAML file. One description includes the text 'Link: 10G uplink to core-sw-01'. After loading the file with a standard YAML parser, the engineer finds the value is not parsed as expected. Which YAML syntax should the engineer use to store this value correctly?

A.Prefix the value with an ampersand: &Link: 10G uplink to core-sw-01
B.Enclose the value in square brackets: [Link: 10G uplink to core-sw-01]
C.Escape the colon with a backslash: Link\: 10G uplink to core-sw-01
D.Wrap the value in double quotes: "Link: 10G uplink to core-sw-01"
AnswerD

In YAML, a colon followed by a space inside a plain scalar is interpreted as a key-value separator, which breaks parsing of this value. Quoting the scalar with double quotes forces the parser to treat the entire string, including the colon and space, as a single string literal, preserving the intended description for Junos configuration.

Why this answer

YAML plain scalars cannot contain a colon followed by a space because that sequence signals a mapping key-value separator. Quoting the scalar with double quotes (or single quotes) tells the parser to treat the entire content as a literal string. This preserves the description exactly as intended so Junos configuration templates receive the correct value.

Exam trap

The trap here is assuming YAML supports backslash escaping like JSON or Python, when in fact quoting is the correct way to include special characters such as a colon followed by a space.

Page 3

Page 4 of 4

All pages