Courseiva

CCNA NETCONF And XML API Questions

63 questions · NETCONF And XML API · All types, answers revealed

1
MCQmedium

You want to retrieve only the system hostname from the Junos running configuration using NETCONF. Which filtering technique is most efficient?

A.Subtree filtering using XML element tags matching the configuration hierarchy
B.XPath expression filtering via the select attribute
C.Regular expression pattern matching within the <filter> attribute
D.Retrieving the entire configuration and parsing it locally with a Python script
AnswerA

Subtree filtering uses specific XML elements to mirror the configuration tree and filter the output.

Why this answer

Tag-based filtering allows requesting specific configuration hierarchies by including empty container tags in the <get-config> request.

2
Multi-Selecthard

When executing a NETCONF transaction on a Junos device, an automation script encounters an error or needs to discard changes made in the candidate datastore. Which THREE RPC elements or concepts apply to discarding or rolling back changes in Junos NETCONF workflows? (Choose three.)

Select 3 answers
A.The <rollback-config> operation is a standalone top-level NETCONF protocol operation defined in RFC 6241.
B.The <abort> RPC can be used mid-transaction to cancel an active streaming configuration edit.
C.Unlocking the configuration datastore using <unlock> ensures other administrators are not permanently locked out if a script terminates unexpectedly.
D.The <discard-changes> RPC is used to revert the candidate configuration to match the current running configuration.
E.A commit operation can include a rollback parameter (e.g., <rollback>1</rollback>) to revert to a previous configuration checkpoint.
AnswersC, D, E

Using <unlock> releases the datastore lock, which is a best practice in robust script error-handling blocks.

Why this answer

Junos NETCONF supports discarding candidate changes via <discard-changes>, rolling back committed configurations via rollback IDs in commit operations, and unlocking datastores upon error cleanup.

3
MCQmedium

You want to retrieve the software version and hardware inventory of a Junos device in a single NETCONF request. Which RPC tag combines both hardware and software details?

A.<get-inventory-all>
B.<retrieve-device-state>
C.Executing multiple RPCs or using container elements such as <get-system-information> and <get-chassis-inventory>.
D.<get-hardware-and-software>
AnswerC

Junos provides separate RPCs like <get-system-information> and <get-chassis-inventory> which can be batched or called sequentially.

Why this answer

The <get-software-information> and <get-chassis-inventory> RPCs can be combined, or <get-system-information> can be used; however, Junos provides specific RPCs like <get-software-information>.

4
MCQmedium

You need to lock the candidate configuration datastore in your NETCONF script to prevent concurrent modifications by other administrators. Which XML element accomplishes this?

A.<lock-config>
B.<acquire-lock>
C.<exclusive-edit>
D.<lock>
AnswerD

The <lock> operation allows the client to lock the configuration system datastore.

Why this answer

The <lock> RPC takes a target element specifying which datastore to lock, such as the candidate datastore.

5
MCQmedium

You need to load a set of configuration changes into the Junos candidate datastore from an inline XML string using NETCONF. Which RPC element is used to load configuration data?

A.<update-candidate>
B.<set-config>
C.<load-configuration>
D.<edit-config>
AnswerC

<load-configuration> is the Junos proprietary extension RPC for loading granular configurations.

Why this answer

The <load-configuration> RPC is a Juniper-specific extension used within NETCONF to load configuration data with formats like XML, text, or set.

6
MCQhard

An automation script executes a NETCONF <edit-config> transaction that updates multiple routing protocols. You need to ensure that the changes take effect immediately without requiring a manual commit. Does NETCONF require a separate commit for candidate changes?

A.Yes, but the commit must be initiated via CLI because NETCONF cannot commit.
B.Yes, changes applied to the candidate datastore require an explicit <commit> RPC to become active in running configuration.
C.No, NETCONF automatically commits all <edit-config> changes instantly.
D.Only if the target datastore is explicitly set to running.
AnswerB

Candidate datastore edits require a separate commit operation unless target is running.

Why this answer

When using the candidate datastore in NETCONF, changes must be explicitly committed using the <commit> RPC unless direct datastore is used.

7
MCQmedium

When retrieving operational data using the Junos XML API, how do you request pretty-printed or indented XML output?

A.Add <pretty-print>true</pretty-print> inside the <rpc> tag.
B.Use the NETCONF command-line flag --format-xml.
C.Set the environment variable JUNOS_XML_INDENT=1 in your shell.
D.Include the indent="true" attribute in the RPC request element.
AnswerD

The indent='true' attribute instructs the Junos device to format output with clean indentation.

Why this answer

Junos XML API supports formatting attributes such as indent="true" in RPC requests.

8
Multi-Selecteasy

Which TWO methods can an administrator use to verify that a Python script successfully established a NETCONF session with a Junos device? (Choose two)

Select 2 answers
A.Review BGP neighbor adjacency tables.
B.Run 'show system netconf sessions' on the Junos CLI.
C.Verify physical interface link LEDs.
D.Inspect script execution logs or success return objects from PyEZ/NETCONF connection handlers.
E.Check the device temperature sensors.
AnswersB, D

This operational command lists active NETCONF sessions on the device.

Why this answer

Session verification can be performed by checking active system sessions on the device or inspecting script connection outputs.

9
MCQeasy

Which Junos configuration statement enables the NETCONF service over SSH for remote automation clients?

A.set system services netconf ssh
B.set protocols netconf enable
C.set netconf ssh-server enable
D.set system xml-api netconf enable
AnswerA

This command starts the NETCONF SSH subsystem on Junos.

Why this answer

Enabling NETCONF on Junos requires configuring the system services netconf ssh hierarchy.

10
MCQhard

When executing a NETCONF <get-config> request, you specify <source><candidate/></source> but omit any filtering tags. What is returned in the <rpc-reply>?

A.An rpc-error stating that a filter is mandatory.
B.Only the differences between candidate and running configurations.
C.Only the top-level system hierarchy statements.
D.The complete configuration contained within the candidate datastore.
AnswerD

Without a filter, the entire candidate datastore configuration is returned.

Why this answer

Omiting filter tags on a <get-config> request returns the entire contents of the specified configuration datastore.

11
MCQmedium

You are troubleshooting a NETCONF session where the client sent an improperly formatted XML payload. Where would you expect to find detailed error logging related to this malformed XML request on the Junos device?

A./var/log/netconf.log
B./var/db/config/juniper.conf.gz
C./etc/netconf/errors.xml
D.NETCONF traceoptions output file or /var/log/messages
AnswerD

NETCONF operational logs and parsing errors appear in traceoptions files or /var/log/messages.

Why this answer

Junos logs NETCONF and XML API activity, including parsing errors, into the traceoptions log file if configured, or general system logs.

12
MCQmedium

You need to execute a Junos CLI command (such as 'show version') as an XML RPC request via NETCONF. Which RPC tag encapsulates raw Junos CLI operational commands?

A.<cli><run>show version</run></cli>
B.<execute-cli>show version</execute-cli>
C.<command>show version</command>
D.<rpc-cli-command>show version</rpc-cli-command>
AnswerC

The <command> tag wraps CLI text strings for execution within an RPC.

Why this answer

The <command> tag allows executing arbitrary operational CLI commands formatted as text within the Junos XML API.

13
MCQhard

An administrator issues an edit-config RPC with default-operation="replace" targeting the candidate datastore. What is the impact on the existing configuration on the Junos device?

A.The entire target configuration datastore is replaced by the configuration provided in the RPC payload.
B.The configuration is merged, and any conflicting nodes generate a validation error.
C.The candidate datastore is cleared, and only the default factory configuration is loaded.
D.Only the specific leaf nodes provided in the RPC are updated; everything else remains intact.
AnswerA

Setting default-operation to replace completely overwrites the existing datastore content.

Why this answer

The replace operation overwrites the entire target configuration datastore with the configuration provided in the RPC message.

14
MCQmedium

An automation engineer is writing an application that sends an <edit-config> RPC to a Junos device to load a replacement configuration. The requirement is to completely replace the candidate configuration with the provided configuration content. Which element and attribute combination should be used inside the <edit-config> request?

A.<default-operation>replace</default-operation>
B.<load-options>replace</load-options>
C.<method>replace-all</method>
D.<action>overwrite</action>
AnswerA

Setting the <default-operation> to replace tells the device to replace the target configuration datastore with the configuration provided in the RPC.

Why this answer

To replace the entire configuration or a specific hierarchy level, the <default-operation> element can be set to 'replace', or the element itself can carry the operation='replace' attribute.

15
MCQmedium

You want to validate a candidate configuration on a Junos device without committing it using NETCONF. Which RPC accomplishes this?

A.<test-config>
B.<check-config>
C.<validate><source><candidate/></source></validate>
D.<edit-config test-only="true"/>
AnswerC

The <validate> RPC validates the specified configuration datastore (e.g., candidate).

Why this answer

The <validate> RPC checks the consistency and validity of a specified configuration datastore.

16
MCQmedium

An engineer writes a Python script using ncclient to push changes to a Junos device. After sending the configuration via <edit-config>, the script needs to make the changes active without dropping the NETCONF session lock prematurely or requiring a separate explicit commit RPC if candidate workflows are bypassed. However, using standard candidate datastore workflow, what is the exact RPC required to activate the candidate configuration?

A.<commit/>
B.<apply-changes/>
C.<save-config/>
D.<push-running/>
AnswerA

The <commit/> RPC activates the candidate configuration on a Junos device.

Why this answer

The <commit> RPC is used to commit the candidate configuration to the running configuration datastore in Junos.

17
Multi-Selectmedium

Which TWO operations are valid targets for the NETCONF <get-config> RPC on a Junos device? (Choose two)

Select 2 answers
A.<factory-default/>
B.<candidate/>
C.<startup/>
D.<active-alarm/>
E.<running/>
AnswersB, E

Querying the candidate configuration datastore is fully supported.

Why this answer

<get-config> allows querying configuration datastores such as candidate and running.

18
MCQhard

An engineer executes a NETCONF <discard-changes> RPC. What is the precise effect of this operation on the Junos device?

A.It clears all active alarms and operational logs from the routing engine.
B.It terminates all active NETCONF sessions currently connected to the device.
C.It discards all uncommitted changes currently sitting in the candidate datastore, reverting it to match the running datastore.
D.It reverts the active running configuration to the factory default state.
AnswerC

<discard-changes> resets the candidate datastore to match the running configuration.

Why this answer

The <discard-changes> RPC discards any uncommitted changes present in the candidate configuration datastore.

19
MCQmedium

An automation script connects to a Junos device using NETCONF over SSH and retrieves the running configuration. The engineer notices that the retrieved XML elements contain attributes like 'operation="inherit"'. What do these attributes represent in the context of Junos XML API?

A.They indicate the automation user permission level required to modify that specific node.
B.They represent transient states of the NETCONF parser buffer indicating stream synchronization status.
C.They represent mapping hints for how Junos hierarchical statements map to hierarchical template inheritances during operational state generation.
D.They describe the configuration hierarchy manipulation state, indicating whether a statement is inherited from apply-groups or explicitly defined.
AnswerD

Junos configuration output uses operations and attributes to display inheritance status, such as values derived from apply-groups.

Why this answer

Junos XML output uses attributes such as 'operation' to indicate how configuration statements relate to inheritance, deletion, or modification within hierarchical structures.

20
MCQeasy

An engineer needs to establish a NETCONF session with a Junos device securely. Which underlying transport protocol does NETCONF use by default according to RFC 6242?

A.TCP port 22
B.TCP port 443
C.UDP port 830
D.TCP port 830
AnswerD

RFC 6242 specifies TCP port 830 as the standard port for NETCONF over SSH.

Why this answer

NETCONF over SSH is defined in RFC 6242 and uses TCP port 830 by default for secure transport.

21
Multi-Selectmedium

Which TWO conditions will cause a NETCONF <edit-config> transaction to fail on a Junos device? (Choose two)

Select 2 answers
A.Executing a successful <commit> immediately after editing.
B.Using a valid namespace prefix declared in the NETCONF hello message.
C.Syntax errors in the XML payload structure.
D.Locking the candidate datastore prior to making edits.
E.Configuration validation failure against Junos semantic rules.
AnswersC, E

Malformed XML triggers an XML parsing error and rpc-error response.

Why this answer

Transactions fail due to syntactic errors, missing required fields, or validation failures.

22
MCQhard

An administrator needs to execute a NETCONF RPC that triggers a Junos operational command equivalent to 'clear interfaces statistics ge-0/0/0'. How should this request be formatted using the Junos XML API?

A.<rpc><command>clear interfaces statistics ge-0/0/0</command></rpc>
B.<rpc><edit-config><target><running/></target><clear>ge-0/0/0</clear></edit-config></rpc>
C.<rpc><clear-interfaces-statistics><interface-name>ge-0/0/0</interface-name></clear-interfaces-statistics></rpc>
D.<rpc><load-configuration action="clear"><interface>ge-0/0/0</interface></load-configuration></rpc>
AnswerC

Junos operational commands map directly to XML tags where CLI space-separated words become hyphenated XML tag names.

Why this answer

Operational commands (RPCs) are sent as raw XML elements corresponding to CLI commands under the <command> wrapper or directly as named RPC tags (e.g., <command>clear interfaces statistics interface-name ge-0/0/0</command> or its native equivalent).

23
Multi-Selectmedium

Which TWO statements are true regarding NETCONF locking mechanisms on Junos devices? (Choose two)

Select 2 answers
A.If a NETCONF session terminates unexpectedly, any locks held by that session are automatically released by the device.
B.Multiple concurrent NETCONF sessions can obtain exclusive write locks on the candidate datastore at the same time.
C.Locking the candidate datastore prevents other users or automation scripts from making conflicting changes.
D.Locks can only be released by rebooting the Routing Engine.
E.Locking is strictly mandatory for every single <get-config> request.
AnswersA, C

The device releases locks when the owning session disconnects.

Why this answer

Locks prevent concurrent configuration edits and can be released via explicit unlock or session termination.

24
MCQhard

An automation script performs a NETCONF transaction that triggers an alarm. You want to retrieve current system alarms using the Junos XML API. Which RPC tag represents this request?

A.<retrieve-alarms>
B.<get-system-alarms>
C.<get-alarm-information>
D.<get-chassis-alarms>
AnswerC

<get-alarm-information> is the standard Junos XML API RPC for querying system alarms.

Why this answer

The <get-alarm-information> RPC retrieves active system alarms from the Junos device.

25
MCQhard

During troubleshooting of a Python script using the ncclient library to interact with a Junos device, an automation engineer observes a 'rpc-error' response containing an error-tag of 'operation-failed'. Upon examining the Junos system logs, it is discovered that the candidate configuration had syntax errors introduced by an uncommitted previous session. Which NETCONF capability negotiation mechanism ensures that the client is aware of the exact XML schema constraints before sending the RPC?

A.The <get-schema> RPC operation defined in RFC 6020.
B.The automatic download of Junos PyEZ schema definitions during the SSH handshake phase.
C.NETCONF capability URIs exchanged during the initial hello message exchange.
D.The automated execution of a pre-flight XML validation check via the <validate> RPC.
AnswerC

Clients and servers advertise supported models and schema namespaces via capability URIs in the initial hello messages.

Why this answer

NETCONF hello messages exchange capabilities, which include URLs pointing to XML namespaces and data models such as YANG modules or Junos specific DTDs/XSDs.

26
MCQmedium

You need to commit a candidate configuration change on a Junos device via NETCONF with a confirmed commit timeout of 5 minutes. Which XML payload structure is correct?

A.<rpc><commit-confirm timeout="5"/></rpc>
B.<rpc><commit><confirmed/><confirm-timeout>5</confirm-timeout></commit></rpc>
C.<rpc><edit-config><timeout>300</timeout></edit-config></rpc>
D.<rpc><commit><timeout>5</timeout></commit></rpc>
AnswerB

This structure properly requests a confirmed commit with a 5-minute timeout.

Why this answer

The <commit> RPC accepts a <confirmed/> tag and a <confirm-timeout> element to specify rollback timing.

27
MCQmedium

When you issue a NETCONF <get-config> request for the running configuration, why might the request fail or return empty on certain Junos platforms?

A.Running configuration can only be accessed using CLI commands, never NETCONF.
B.The <running/> datastore capability is supported, but explicit locking rules or device state might restrict it if unsupported parameters are sent.
C.The <running/> tag must always be accompanied by a password attribute.
D.Junos does not support reading the running configuration datastore via NETCONF.
AnswerB

Junos supports running datastore retrieval, but strict adherence to capability negotiation is required.

Why this answer

In standard NETCONF (RFC 6241), the running datastore must be supported, but Junos requires candidate configuration usage for edits; however, running is supported for reading. If it fails, it is often due to datastore capability support.

28
MCQeasy

Which python module is part of the standard library that can be used to parse XML responses returned by NETCONF?

A.netconf.parser
B.xml.etree.ElementTree
C.xml2dict
D.json
AnswerB

ElementTree is standard in Python for XML parsing.

Why this answer

Python's built-in xml.etree.ElementTree module provides tools for parsing and navigating XML data.

29
MCQeasy

A network engineer is establishing a NETCONF session with a Junos device and needs to lock the candidate configuration to prevent concurrent modifications by other administrators. Which NETCONF operation should be executed?

A.<lock><target><candidate/></target></lock>
B.<lock-config><database>candidate</database></lock-config>
C.<get-config><source><candidate/></source><lock/></get-config>
D.<edit-config><target><candidate/></target><operation>lock</operation></edit-config>
AnswerA

This is the correct XML RPC structure to lock the candidate configuration datastore.

Why this answer

The <lock> operation allows a client to lock the configuration datastore of a device to prevent unauthorized or conflicting changes during a transaction.

30
Multi-Selecteasy

Which TWO actions occur during the initial NETCONF session establishment phase between a client and a Junos device? (Choose two)

Select 2 answers
A.The client and server exchange <hello> messages to negotiate supported capabilities.
B.The client sends an immediate <commit> RPC to initialize the session.
C.The routing engine reloads its control plane daemons.
D.The client authenticates via SSH credentials before the NETCONF subsystem initializes.
E.The Junos device automatically locks the running configuration datastore.
AnswersA, D

Capability negotiation via <hello> messages is a mandatory first step in NETCONF.

Why this answer

During session establishment, SSH authentication occurs first, followed by the exchange of <hello> messages containing capabilities.

31
Multi-Selecthard

Which THREE attributes are available within the <edit-config> operation element in NETCONF to specify the modification action on a target node? (Choose three)

Select 3 answers
A.delete
B.replace
C.append
D.modify
E.merge
AnswersA, B, E

'delete' removes the specified node and fails if it does not exist.

Why this answer

NETCONF edit-config operation attributes include merge, replace, create, delete, and remove.

32
MCQmedium

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?

A.<pull-operational>
B.<get-rpc-reply>
C.<get-config>
D.<get>
AnswerD

The <get> element allows retrieving running operational state and configuration data.

Why this answer

The <get> rpc tag is used to retrieve both configuration and operational data, whereas <get-config> is restricted to configuration data.

33
MCQeasy

In Junos XML API, what is the XML namespace associated with Junos-specific RPCs and operational tags?

A.http://www.cisco.com/ns/yang/cisco-se
B.urn:juniper:params:xml:ns:netconf:base:1.0
C.urn:ietf:params:xml:ns:netconf:base:1.0
D.http://xml.juniper.net/junos/*/junos-rpc
AnswerD

Juniper XML API RPCs utilize namespaces starting with http://xml.juniper.net/junos/.

Why this answer

Junos XML API elements use specific namespaces like http://xml.juniper.net/junos/12.1X46/junos-sw for software or general rpc namespaces.

34
Multi-Selecteasy

Which TWO tools or protocols can be used to interact with the Junos XML API besides NETCONF over SSH? (Choose two)

Select 2 answers
A.Junos PyEZ library
B.Syslog over UDP port 514
C.XML API over HTTP/HTTPS (mgmt daemon)
D.RADIUS authentication protocol
E.SNMP v3 traps
AnswersA, C

PyEZ uses NETCONF under the hood to execute XML API calls.

Why this answer

Junos XML API can be accessed via NETCONF over SSH or via HTTP/HTTPS using the Junos XML API over HTTP server.

35
Multi-Selecthard

Which THREE error-tag values defined in NETCONF RFC 6241 may be returned by a Junos device when an edit-config operation fails validation? (Choose three)

Select 3 answers
A.syntax-timeout
B.invalid-value
C.data-exists
D.buffer-overflow
E.missing-element
AnswersB, C, E

'invalid-value' is returned when a configuration value is out of range or malformed.

Why this answer

RFC 6241 error-tags include invalid-value, missing-element, data-exists, and in-use.

36
Multi-Selecteasy

Which TWO benefits does NETCONF provide over traditional screen-scraping CLI automation? (Choose two)

Select 2 answers
A.Structured data representation (XML) that eliminates the need for complex regular expression parsing.
B.Automatic generation of physical fiber cabling diagrams.
C.Elimination of any need for authentication credentials.
D.Formal transaction semantics with built-in validation and error reporting (<rpc-error>).
E.Requirement for lower bandwidth links by compressing all payloads into binary audio streams.
AnswersA, D

Structured XML responses avoid fragile regex scraping.

Why this answer

NETCONF provides structured XML/YANG data formats and reliable error handling compared to fragile CLI screen scraping.

37
Multi-Selecthard

Which THREE error-type values are defined in the NETCONF protocol specification (RFC 6241) for categorizing <rpc-error> messages? (Choose three)

Select 3 answers
A.rpc
B.hardware
C.transport
D.protocol
E.kernel
AnswersA, C, D

'rpc' is a valid NETCONF error-type for RPC envelope issues.

Why this answer

RFC 6241 defines transport, rpc, protocol, and application error types.

38
MCQeasy

What is the standard IETF RFC that defines the core NETCONF protocol architecture and operations?

A.RFC 8040
B.RFC 6241
C.RFC 4253
D.RFC 7950
AnswerB

RFC 6241 specifies the Network Configuration Protocol (NETCONF).

Why this answer

RFC 6241 is the definitive IETF standard defining the NETCONF Configuration Protocol.

39
Multi-Selecthard

Which THREE parameters can be included within a Junos NETCONF <commit> RPC request to customize commit behavior? (Choose three)

Select 3 answers
A.<confirm-timeout> integer </confirm-timeout>
B.<confirmed/>
C.<max-rollback-files> integer </max-rollback-files>
D.<comment> describing the change </comment>
E.<encryption-key> string </encryption-key>
AnswersA, B, D

<confirm-timeout> specifies the rollback timeframe for confirmed commits.

Why this answer

Junos commit RPC options include comment, confirmed, and check (validate).

40
MCQhard

An automation script attempts to load a configuration snippet using NETCONF <edit-config> with operation="delete" on a container statement. What happens if the specified container does not currently exist in the candidate configuration?

A.The device ignores the request and returns an OK response.
B.The device converts the operation to a merge automatically.
C.The device returns a NETCONF rpc-error indicating the node does not exist.
D.The device automatically creates the container as an empty object.
AnswerC

The 'delete' operation requires the target node to exist, otherwise it triggers an error.

Why this answer

The delete operation fails if the target node does not exist, whereas remove is silent if absent.

41
MCQeasy

What is the purpose of the <hello> element exchanged immediately after establishing a NETCONF SSH session?

A.To exchange supported protocol capabilities and namespace identifiers.
B.To authenticate the SSH username and password.
C.To request an immediate reboot of the Junos routing engine.
D.To lock the candidate configuration database automatically.
AnswerA

The <hello> element enables capability negotiation between client and server.

Why this answer

The <hello> element is used by both client and server to exchange supported capabilities and session parameters.

42
Multi-Selecthard

Which THREE distinct operational states or configuration views can be queried using specific Junos XML API RPCs? (Choose three)

Select 3 answers
A.System information via <get-system-information>
B.BGP routing table via <get-bgp-kernel-table>
C.Chassis inventory via <get-chassis-inventory>
D.Firewall filter logs via <get-security-packet-capture>
E.Interface information via <get-interface-information>
AnswersA, C, E

<get-system-information> queries device software, model, and uptime.

Why this answer

Junos XML API provides dedicated RPCs for system information, interface information, and chassis inventory.

43
MCQeasy

Which transport protocol is mandated by RFC 6241 as the standard secure connection mechanism for NETCONF when operating in typical Junos enterprise automation environments?

A.HTTPS
B.SSH
C.gRPC
D.TLS
AnswerB

NETCONF over SSH (TCP port 830 by default) is the standard transport protocol.

Why this answer

RFC 6241 specifies NETCONF over Secure Shell (SSH) as the standard secure transport protocol.

44
MCQeasy

Which Junos XML API output format option allows requesting the output as plain text instead of structured XML?

A.output="ascii"
B.encoding="plain"
C.format="text"
D.type="string"
AnswerC

Adding format='text' to a Junos RPC requests CLI-like text output instead of XML.

Why this answer

Junos XML API allows requesting ASCII/text output format by appending the format='text' attribute to RPC requests.

45
MCQmedium

You are writing a script that parses NETCONF responses from Junos. You encounter an element named <ok/> inside an <rpc-reply>. What does this indicate?

A.The SSH tunnel has been successfully authenticated.
B.The NETCONF operation completed successfully with no error or data payload to return.
C.The candidate configuration has uncommitted changes.
D.The device CPU utilization is normal.
AnswerB

An <ok/> tag is returned for operations like commit or edit-config when successful.

Why this answer

The <ok/> tag indicates that the requested NETCONF operation executed successfully with no data to return.

46
MCQhard

An automation script attempts to unlock a candidate configuration datastore that was previously locked by a different NETCONF session. Which RPC is required to force-terminate that session and release the lock?

A.<kill-session><session-id>...</session-id></kill-session>
B.<unlock target="candidate" force="true"/>
C.<release-lock session-id="..."/>
D.<close-session><session-id>...</session-id></close-session>
AnswerA

<kill-session> forcefully terminates the specified session ID and releases its locks.

Why this answer

The <kill-session> RPC allows terminating another active NETCONF session, which automatically releases any locks held by that session.

47
MCQeasy

What is the role of the <rpc> element in a NETCONF message exchange?

A.It defines the security credentials for SSH authentication.
B.It acts as a wrapper enclosing the specific NETCONF method request sent by the client to the server.
C.It stores error logs returned by the Junos routing engine.
D.It terminates the NETCONF session upon completion.
AnswerB

The <rpc> element encapsulates every request sent by a NETCONF client.

Why this answer

The <rpc> element is the protocol envelope used by the client to send a request to the NETCONF server.

48
MCQeasy

Which command or tool on a Junos device verifies that the NETCONF subsystem is enabled and listening for SSH connections?

A.show netconf settings
B.show xml-api status
C.show netconf status connections
D.show system services netconf ssh
AnswerD

This command verifies the NETCONF SSH service configuration status.

Why this answer

NETCONF over SSH runs as a subsystem on Junos and can be verified via system services configuration or operational commands.

49
MCQhard

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?

A.<error-option>rollback-on-error</error-option>
B.<test-option>test-then-set</test-option>
C.<default-operation>none</default-operation>
D.<error-option>stop-on-error</error-option>
AnswerA

'rollback-on-error' ensures atomicity by rolling back changes if an error is encountered.

Why this answer

The error-option element with the value 'rollback-on-error' instructs the device to abort and roll back if any error occurs.

50
MCQhard

An administrator issues a NETCONF <get-config> request targeting the candidate datastore and includes a namespace prefix that does not match the device's loaded YANG/XML schema namespace. How does Junos respond?

A.The device returns an <rpc-error> indicating an invalid namespace or unrecognized element.
B.The device falls back to default CLI parsing mode.
C.The session is immediately terminated by the SSH server.
D.The device automatically strips the namespace prefix and processes the request.
AnswerA

Incorrect namespaces trigger parsing or validation errors returned in an <rpc-error>.

Why this answer

Mismatched or unknown namespaces in NETCONF requests result in a malformed message or invalid-element rpc-error.

51
MCQeasy

Which NETCONF capability URI indicates that the server supports rolling back configuration changes to previous commit points?

A.urn:ietf:params:netconf:capability:rollback-on-error:1.0
B.http://xml.juniper.net/netconf/junos/1.0
C.urn:ietf:params:netconf:base:1.0
D.Juniper specific capability strings for commit/rollback features advertised in the hello banner.
AnswerD

Juniper advertises specific capability URIs for commit features and rollbacks during the hello phase.

Why this answer

Junos supports rollback capabilities advertised via specific NETCONF capability URIs.

52
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

'create' fails if the item already exists.

Why this answer

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

53
Multi-Selectmedium

An automation engineer is designing a Junos XML API workflow that uses the <get-config> operation. Which THREE parameters or filtering methods are valid when retrieving configuration data from a Junos device using NETCONF? (Choose three.)

Select 3 answers
A.Using SQL queries enclosed in <sql-query> tags to extract table rows directly from the configuration database.
B.Specifying the source datastore (e.g., <source><running/></source>).
C.Using subtree filtering inside the <filter> element to retrieve specific configuration nodes.
D.Using XPath expressions within the <filter> element with type="xpath".
E.Using the <max-depth> attribute within the <get-config> tag to limit configuration tree traversal.
AnswersB, C, D

The <source> element is mandatory in <get-config> to specify which datastore to retrieve.

Why this answer

Valid filtering and parameter methods for <get-config> include specifying the target datastore source, applying subtree filtering, and using xpath-based filters under specific namespace conditions.

54
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

<get-config> only returns configuration; operational stats require <get>.

Why this answer

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

55
MCQhard

You are configuring NETCONF traceoptions on a Junos device to debug an XML parsing issue. Which configuration statement enables logging of all NETCONF protocol messages to a file named 'netconf-debug.log'?

A.set system services netconf traceoptions file netconf-debug.log set system services netconf traceoptions flag all
B.set protocols netconf traceoptions file netconf-debug.log flag detail
C.set security netconf logging file netconf-debug.log
D.set system netconf trace file netconf-debug.log level debug
AnswerA

This is the correct Junos CLI syntax for enabling comprehensive NETCONF tracing.

Why this answer

Traceoptions under the netconf system services hierarchy control logging of NETCONF traffic.

56
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

PyEZ provides high-level abstractions for Junos NETCONF APIs.

Why this answer

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

57
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

<close-session> gracefully closes the current NETCONF session.

Why this answer

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

58
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

RFC 6241 specifies <rpc-reply> as the container for responses to <rpc> requests.

Why this answer

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

59
Multi-Selectmedium

Which TWO configuration datastores are commonly supported and utilized when interacting with Junos devices via NETCONF? (Choose two)

Select 2 answers
A.startup
B.ephemeral
C.candidate
D.running
E.factory
AnswersC, D

The candidate datastore is where edits are staged before committing.

Why this answer

Junos primarily supports the candidate and running datastores for configuration management via NETCONF.

60
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

Per-element attributes override the default-operation setting.

Why this answer

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

61
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

NETCONF protocol defines structured <rpc-error> XML blocks for reporting faults.

Why this answer

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

62
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

Capabilities are advertised inside the <capabilities> element using specific capability URIs.

Why this answer

During the initial NETCONF hello message exchange, both the client and server advertise their supported capabilities using URIs, and the session ID is assigned by the server.

63
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 URI is exchanged in the initial hello messages.

Why this answer

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

Ready to test yourself?

Try a timed practice session using only NETCONF And XML API questions.