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 on QFX Series switches and ACX Series, MX Series, PTX Series, and T Series routers.
Support for Python added in Junos OS Release 17.1R1 on ACX500, ACX1000, ACX1100, ACX2000, ACX2100, ACX2200, and ACX4000 routers, and EX Series switches.
Support for Python added in Junos OS Release 17.3R1 on SRX1500, SRX4100, SRX4200, SRX5400, SRX5600, and SRX5800 devices and vSRX instances.
Support for Python added in Junos OS Release 18.3R1 on ACX5048 and ACX5096 routers.