Navigation
Table of Contents
Guide That Contains This Content
[+] Expand All
[-] Collapse All
Download This Guide
Supported Platforms
Related Documentation
- ACX, EX, M, MX, PTX, SRX, T Series
- Summary of Extension Functions in the jcs and slax Namespaces
- break-lines() Function (jcs and slax Namespaces)
- hostname() Function (jcs Namespace)
- regex() Function (jcs and slax Namespaces)
- split() Function (jcs and slax Namespaces)
- ACX, EX, M, MX, SRX, T Series
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
parse-ip() Function (jcs Namespace)
Namespaces
http://xml.juniper.net/junos/commit-scripts/1.0
SLAX Syntax
var $result = jcs:parse-ip("ipaddress/(prefix-length | netmask)");
XSLT Syntax
<xsl:variable name="result" select="jcs:parse-ip('ipaddress/(prefix-length | netmask')"/>
Release Information
Function introduced in Junos OS Release 9.0.
Description
Parse an IPv4 or IPv6 address.
Parameters
ipaddress | — | IPv4 or IPv6 address. |
netmask | — | Netmask defining the network prefix portion of the address. |
prefix-length | — | Prefix length defining the number of bits used in the network prefix portion of the address. |
Return Value
result | — | An array containing:
|
Usage Examples
In the following examples, an IPv4 address and an IPv6 address are parsed and the resulting output is detailed:
var $addr = jcs:parse-ip("10.1.2.10/255.255.255.0");
- $addr[1] contains the host address 10.1.2.10.
- $addr[2] contains the protocol family inet.
- $addr[3] contains the prefix length 24.
- $addr[4] contains the network address 10.1.2.0.
- $addr[5] contains the netmask for IPv4 255.255.255.0.
var $addr = jcs:parse-ip("2001:DB8::c50:8a:800:200C:417A/32");
- $addr[1] contains the host address 2001:db8:0:c50:8a:800:200c:417a.
- $addr[2] contains the protocol family inet6.
- $addr[3] contains the prefix length 32.
- $addr[4] contains the network address 2001:db8::.
- $addr[5] is blank for IPv6 ("").
Related Documentation
- ACX, EX, M, MX, PTX, SRX, T Series
- Summary of Extension Functions in the jcs and slax Namespaces
- break-lines() Function (jcs and slax Namespaces)
- hostname() Function (jcs Namespace)
- regex() Function (jcs and slax Namespaces)
- split() Function (jcs and slax Namespaces)
- ACX, EX, M, MX, SRX, T Series
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces
Published: 2013-03-05
Download This Guide
Supported Platforms
Related Documentation
- ACX, EX, M, MX, PTX, SRX, T Series
- Summary of Extension Functions in the jcs and slax Namespaces
- break-lines() Function (jcs and slax Namespaces)
- hostname() Function (jcs Namespace)
- regex() Function (jcs and slax Namespaces)
- split() Function (jcs and slax Namespaces)
- ACX, EX, M, MX, SRX, T Series
- Junos Script Automation: Understanding Extension Functions in the jcs and slax Namespaces