hostname() Function (Python, SLAX, and XSLT)
Namespaces
http://xml.juniper.net/junos/commit-scripts/1.0
Python Syntax
name = jcs.hostname(address)
SLAX Syntax
var $name = jcs:hostname(address);
XSLT Syntax
<xsl:variable name="name" select="jcs:hostname(address)"/>
Description
Return the fully qualified domain name associated with a given IPv4 or IPv6 address. The DNS server must be configured on the device in order to resolve the domain name.
Parameters
address |
String containing an IPv4 or IPv6 address. |
Return Value
name |
Hostname associated with the IP address. |
Usage Examples
The following SLAX example initializes the variable address
with the IP address 198.51.100.1. The $address
variable is passed as the argument to the jcs:hostname()
function. If the DNS server is configured
on the device, the function will resolve the IP address and return
the fully qualified domain name, which is stored in the variable host
.
var $address = "198.51.100.1"; var $host = jcs:hostname($address);
In XSLT:
<xsl:variable name="address" select="198.51.100.1"> <xsl:variable name="host" select="jcs:hostname($address)"/>
In Python:
host = jcs.hostname("198.51.100.1")
Release Information
Function introduced in Junos OS Release 7.6.
Support for SLAX syntax added in Junos OS Release 8.2.
Support for Python added in Junos OS Release 16.1R1.