Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
Automation Scripting User Guide
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

get-protocol() Function (SLAX and XSLT)

date_range 13-Jan-21

Namespaces

content_copy zoom_out_map
http://xml.juniper.net/junos/commit-scripts/1.0

SLAX Syntax

content_copy zoom_out_map
var $protocol = jcs:get-protocol(connection);

XSLT Syntax

content_copy zoom_out_map
<xsl:variable name="protocol" select="jcs:get-protocol(connection)"/>

Description

Return the session protocol associated with the connection handle. The protocol values are junoscript, netconf, and junos-netconf.

Parameters

connection

Connection handle generated by a call to the jcs:open() function.

Return Value

protocol

Session protocol associated with the connection handle. The values are junoscript, netconf, and junos-netconf.

Usage Examples

In the following code snippet, the user, bsmith, establishes a NETCONF session on the default port with the remote device, fivestar. Since the code does not specify a value for the password, the user is prompted for a password during script execution. Once authentication is established, the code calls the jcs:get-protocol() function and stores the return value in the variable $protocol, which is then printed to the CLI.

content_copy zoom_out_map
var $netconf := {
     <method> "netconf";
     <username> "bsmith";
}
var $connection = jcs:open("fivestar", $netconf);
var $protocol = jcs:get-protocol($connection);
expr jcs:output($protocol);
expr jcs:close($connection);

The CLI displays the following output:

content_copy zoom_out_map
bsmith@fivestar's password:
  
netconf

Release Information

Function introduced in Junos OS Release 11.4.

footer-navigation