On 12/19/2011 05:12 PM, Petr Vobornik wrote:
On 12/19/2011 04:44 PM, Petr Vobornik wrote:
[Web UI]

Added support of parsing and validation of IPv4 and IPv6 addresses.
Class IP.address can also create reverse address from any valid IPv4 or
IPv6 address.

This functionality is prerequisite for tickets:
https://fedorahosted.org/freeipa/ticket/1466
https://fedorahosted.org/freeipa/ticket/1975

Ticket: https://fedorahosted.org/freeipa/ticket/1466


Self NACK

Getting reverse addresses is not functional for integer IPv4 input.

Updated patch will follow tomorrow.

Fixed.
Attached new patch.

--
Petr Vobornik
From 5c64802a363f1361d5d6a23446238e9c1eacbbdf Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Mon, 19 Dec 2011 16:14:04 +0100
Subject: [PATCH] Parsing of IPv4 and IPv6 addresses

Added support of parsing and validation of IPv4 and IPv6 addresses.
Class IP.address can also create reverse address from any valid IPv4 or IPv6 address.

This functionality is needed for tickets:
https://fedorahosted.org/freeipa/ticket/1466
https://fedorahosted.org/freeipa/ticket/1975
---
 install/ui/Makefile.am           |    1 +
 install/ui/ip.js                 |  366 ++++++++++++++++++++++++++++++++++++++
 install/ui/jsl.conf              |    1 +
 install/ui/test/all_tests.html   |    4 +-
 install/ui/test/details_tests.js |    1 -
 install/ui/test/ip_tests.html    |   18 ++
 install/ui/test/ip_tests.js      |  217 ++++++++++++++++++++++
 install/ui/test/jsl.conf         |    4 +-
 8 files changed, 609 insertions(+), 3 deletions(-)
 create mode 100644 install/ui/ip.js
 create mode 100644 install/ui/test/ip_tests.html
 create mode 100644 install/ui/test/ip_tests.js

diff --git a/install/ui/Makefile.am b/install/ui/Makefile.am
index 835888d94e65704ae12d4098ead210bfb195ce85..b316c391c184874c6dd6cb6d855c2769de2b259d 100644
--- a/install/ui/Makefile.am
+++ b/install/ui/Makefile.am
@@ -30,6 +30,7 @@ app_DATA =				\
 	hostgroup.js 			\
 	index.html 			\
 	ipa.css				\
+	ip.js				\
 	ipa.js				\
 	jquery-ui.css			\
 	jquery-ui.js			\
diff --git a/install/ui/ip.js b/install/ui/ip.js
new file mode 100644
index 0000000000000000000000000000000000000000..9ba39416aba660024071e3eb604470ddcfd845d8
--- /dev/null
+++ b/install/ui/ip.js
@@ -0,0 +1,366 @@
+/*  Authors:
+ *    Petr Vobornik <pvobo...@redhat.com>
+ *
+ * Copyright (C) 2010 Red Hat
+ * see file 'COPYING' for use and warranty information
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+var IP = {};
+
+IP.address = function(spec) {
+
+    spec = spec || {};
+
+    var that = {};
+
+    that.input = spec.address || '';
+
+    that.type;
+    that.parts = [];
+    that.reverse_address = '';
+    that.only_decimal = spec.only_decimal !== undefined? spec.only_decimal :
+                            false ; //for parsing IPv4 address
+
+    that.parse = function() {
+
+        that.get_type();
+
+        if (that.type === 'v4-quads') {
+            return that.parse_v4_quads();
+        } else if (that.type === 'v4-int') {
+            return that.parse_v4_int();
+        } else if (that.type === 'v6') {
+            return that.parse_v6();
+        }
+
+        that.set_error('not an ip address');
+        return false;
+    };
+
+    that.get_type = function() {
+
+        if (that.input.indexOf(':') > -1) that.type = 'v6';
+        else if (that.input.indexOf('.') > -1) that.type = 'v4-quads';
+        else that.type = 'v4-int';
+
+        return that.type;
+    };
+
+    that.parse_v4_int = function() {
+
+        var part = { value: that.input };
+        if(!that.is_part_valid_v4(part, 32, that.only_decimal)) return false;
+
+        that.parts = [];
+        that.make_quads(part.decimal_value, that.parts);
+
+        that.valid = true;
+        return true;
+    };
+
+    that.parse_v4_quads = function() {
+
+        that.parts = that.input.split('.');
+
+        if (that.parts.length !== 4) {
+            return that.set_error('invalid number of parts');
+        }
+
+        for (var i=0; i<4; i++) {
+
+            var part = { value: that.parts[i] };
+
+            if (!that.is_part_valid_v4(part, 8, that.only_decimal)) {
+                return false;
+            }
+            that.parts[i] = part.decimal_value;
+        }
+
+        that.valid = true;
+        return true;
+    };
+
+    that.parse_v6 = function() {
+
+        that.parts = that.input.split(':');
+
+        var total_parts = that.parts.length;
+        var ipv4_present = false;
+        var double_colon = false;
+        var double_colon_position;
+
+        var i;
+
+        for (i=0; i<that.parts.length; i++) {
+            var part = that.parts[i];
+
+            if (i === that.parts.length -1 && part.indexOf('.') > -1) {
+                ipv4_present = true;
+                total_parts++; //ipv4 part consists of 4 octects (two parts)
+            }
+
+            //checking for ::
+            if (part.length === 0) {
+
+                if (!double_colon || //first occurance
+                        (double_colon && i === 1) || //still at the beginning
+                        (double_colon && i === that.parts.length - 1 &&
+                            double_colon_position === i -1)) { //still at the end
+
+                    part = '0000';
+                    that.parts[i] = part;
+                    double_colon = true;
+                    double_colon_position = i;
+                } else { //second occurance of ::
+                    return that.set_error('invalid format: mupltiple ::');
+                }
+            }
+
+            //add missing zeros for not empty parts
+            if (part.length !== 0 && part.length < 4) {
+                part = add_trailing_zeros(part, 4 - part.length);
+                that.parts[i] = part;
+            }
+        }
+
+        //add missing empty parts
+        if (double_colon) {
+            var parts_to_add = 8 - total_parts;
+
+            for (i=0; i<parts_to_add; i++) {
+                that.parts.splice(double_colon_position, 0, '0000');
+            }
+        }
+
+        //change ipv4 part
+        if (ipv4_present) {
+            var ipv4_address = IP.address();
+            ipv4_address.input = that.parts[that.parts.length -1];
+            ipv4_address.only_decimal = true;
+            if (ipv4_address.parse() && ipv4_address.type === 'v4-quads') {
+                var v4_parts = ipv4_address.parts;
+                var oct1 = dec_2_hex(v4_parts[0]);
+                var oct2 = dec_2_hex(v4_parts[1]);
+                var oct3 = dec_2_hex(v4_parts[2]);
+                var oct4 = dec_2_hex(v4_parts[3]);
+
+                //replace IPv4 part with two IPv6 parts (4 octets)
+                that.parts[that.parts.length -1] = oct1+oct2;
+                that.parts.push(oct3+oct4);
+            } else {
+                return that.set_error('invalid IPv4 part');
+            }
+        }
+
+        //validate length after modifications
+        if (that.parts.length !== 8) {
+            return that.set_error('invalid number of parts');
+        }
+
+        //validate each part
+        for (i=0; i<8; i++) {
+
+            if (!that.is_part_valid_v6(that.parts[i])) {
+                return false;
+            }
+        }
+
+        that.valid = true;
+        return true;
+    };
+
+    function dec_2_hex(val) {
+        var dec = parseInt(val, 10);
+        var hex = dec.toString(16);
+        hex = add_trailing_zeros(hex, 2 - hex.length);
+        return hex;
+    }
+
+    function add_trailing_zeros(val, num) {
+        for (var i=0; i<num; i++) {
+            val='0'+val;
+        }
+        return val;
+    }
+
+    that.get_reverse = function() {
+
+        if (!that.valid) return 'invalid input address';
+
+        if (that.type === 'v4-quads' || that.type === 'v4-int') {
+            return that.get_v4_reverse();
+        } else if (that.type === 'v6') {
+            return that.get_v6_reverse();
+        }
+
+        return '';
+    };
+
+    that.get_v4_reverse = function() {
+
+        that.reverse_parts = [];
+
+        for (var i=3; i>=0; i--) {
+            that.reverse_parts.push(that.parts[i]);
+        }
+
+        that.reverse_parts.push('in-addr');
+        that.reverse_parts.push('arpa');
+
+        return that.reverse_parts.join('.');
+    };
+
+    that.get_v6_reverse = function() {
+
+        that.reverse_parts = [];
+
+        var address = that.parts.join('');
+
+        for (var i=31; i>=0; i--) {
+            that.reverse_parts.push(address[i]);
+        }
+
+        that.reverse_parts.push('ip6');
+        that.reverse_parts.push('arpa');
+
+        return that.reverse_parts.join('.');
+    };
+
+    that.set_error = function(msg) {
+        that.valid = false;
+        that.error = msg;
+        return false;
+    };
+
+    that.is_part_valid_v6 = function(str) {
+
+        if (str.length === 0) {
+            return that.set_error('not a number');
+        }
+
+        if (str.length > 4) {
+            return that.set_error('wrong format - too long');
+        }
+
+        for (var i=0; i<str.length; i++) {
+
+            var digit = parseInt(str[i], 16);
+
+            //check if character is digit
+            if (isNaN(digit)) {
+                return that.set_error('invalid format: \''+digit+'\'');
+            }
+        }
+
+        return true;
+    };
+
+    /*
+     * Checks if part.value is valid IPv4 integer of given size (in bits).
+     * Validation can be limited only to decimal values by only_decimal argument.
+     * Sets its decimal representation to part.decimal_value.
+     */
+    that.is_part_valid_v4 = function(part, bits, only_decimal) {
+
+        if (!part.value || part.value.length === 0) {
+            return that.set_error('not a number');
+        }
+
+        var radix = that.get_radix(part.value);
+
+        var number = part.value;
+
+        if (radix === 16) number = part.value.substring(2);
+        else if (radix === 8) number = part.value.substring(1);
+
+        if (radix !== 10 && only_decimal) {
+            return that.set_error('not a decimal number');
+        }
+
+        for (var i=0; i<number.length; i++) {
+
+            var digit = parseInt(number[i], radix);
+
+            //check if character is digit in its radix
+            if (isNaN(digit)) {
+                return that.set_error('invalid format: \''+digit+'\'');
+            }
+
+            //check for leading zeros
+            if (i === 0 && digit === 0 && number.length > 1) {
+                return that.set_error('invalid format: trailing zeros');
+            }
+        }
+
+        var max_value = Math.pow(2, bits) - 1;
+
+        part.decimal_value = parseInt(part.value, radix);
+
+        if (part.decimal_value > max_value) {
+            return that.set_error('value out of range');
+        }
+
+        return true;
+    };
+
+    that.get_radix = function(str) {
+
+        var normalized = str.toLowerCase();
+
+        if (normalized.length > 2 &&
+                normalized[0] === '0' &&
+                normalized[1] === 'x') {
+            return 16;
+
+        } else if (normalized.length > 1 && normalized[0] === '0') {
+            return 8;
+        }
+
+        return 10;
+    };
+
+    that.make_quads = function(integer, quads) {
+
+        var hex_str = integer.toString(16);
+        if (hex_str.length < 8) {
+            hex_str = add_trailing_zeros(8 - hex_str.length);
+        }
+
+        for (var i=0; i<hex_str.length; i+=2) {
+            var quad_hex = hex_str.substring(i,i+2);
+            var quad = parseInt(quad_hex, 16);
+            quads.push(quad.toString(10));
+        }
+    };
+
+    that.get_radix = function(str) {
+
+        var normalized = str.toLowerCase();
+
+        if (normalized.length > 2 &&
+                normalized[0] === '0' &&
+                normalized[1] === 'x') {
+            return 16;
+
+        } else if (normalized.length > 1 && normalized[0] === '0') {
+            return 8;
+        }
+
+        return 10;
+    };
+
+    return that;
+};
\ No newline at end of file
diff --git a/install/ui/jsl.conf b/install/ui/jsl.conf
index d4bbf770fb18a0c2abf702aa0232a8ed35e1fea8..37dc26a2e511459e7766c079161d9fca91186ec5 100644
--- a/install/ui/jsl.conf
+++ b/install/ui/jsl.conf
@@ -129,6 +129,7 @@
 +process ipa.js
 +process widget.js
 +process field.js
++process ip.js
 +process dialog.js
 +process search.js
 +process details.js
diff --git a/install/ui/test/all_tests.html b/install/ui/test/all_tests.html
index a62210ec99d0b6e70282f59d3b5b4295fa34784a..8dcf65f58d5a04391c97fa0dcca2b83daace2e9f 100644
--- a/install/ui/test/all_tests.html
+++ b/install/ui/test/all_tests.html
@@ -8,6 +8,7 @@
     <script type="text/javascript" src="../jquery.ba-bbq.js"></script>
     <script type="text/javascript" src="../jquery-ui.js"></script>
     <script type="text/javascript" src="../jquery.ordered-map.js"></script>
+    <script type="text/javascript" src="../ip.js"></script>
     <script type="text/javascript" src="../ipa.js"></script>
     <script type="text/javascript" src="../widget.js"></script>
     <script type="text/javascript" src="../field.js"></script>
@@ -30,6 +31,7 @@
     <script type="text/javascript" src="certificate_tests.js"></script>
     <script type="text/javascript" src="aci_tests.js"></script>
     <script type="text/javascript" src="widget_tests.js"></script>
+    <script type="text/javascript" src="ip_tests.js"></script>
 </head>
 <body>
     <h1 id="qunit-header">Complete Test Suite</h1>
@@ -39,4 +41,4 @@
     <ol id="qunit-tests"></ol>
     <div id="qunit-fixture"></div>
 </body>
-</html>
+</html>
\ No newline at end of file
diff --git a/install/ui/test/details_tests.js b/install/ui/test/details_tests.js
index 353fb3ea1165c61e5504bd180ba0d393544eb407..60c899e60074d754beab2c5d20304615f46284d6 100644
--- a/install/ui/test/details_tests.js
+++ b/install/ui/test/details_tests.js
@@ -121,7 +121,6 @@ test("Testing details lifecycle: create, load.", function(){
         method: 'show',
         args: ['kfrog'],
         on_success: function(data, text_status, xhr) {
-            result = data.result.result;
             ok(true, "IPA.command() succeeded.");
         },
         on_error: function(xhr, text_status, error_thrown) {
diff --git a/install/ui/test/ip_tests.html b/install/ui/test/ip_tests.html
new file mode 100644
index 0000000000000000000000000000000000000000..db6682f97b618ce34541b30b07dbf09ce37b71fb
--- /dev/null
+++ b/install/ui/test/ip_tests.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>IP addresses test suite</title>
+    <link rel="stylesheet" href="qunit.css" type="text/css" media="screen">
+    <script type="text/javascript" src="qunit.js"></script>
+    <script type="text/javascript" src="../ip.js"></script>
+    <script type="text/javascript" src="ip_tests.js"></script>
+</head>
+<body>
+    <h1 id="qunit-header">IP addresses test suite</h1>
+    <h2 id="qunit-banner"></h2>
+    <div id="qunit-testrunner-toolbar"></div>
+    <h2 id="qunit-userAgent"></h2>
+    <ol id="qunit-tests"></ol>
+    <div id="qunit-fixture"></div>
+</body>
+</html>
\ No newline at end of file
diff --git a/install/ui/test/ip_tests.js b/install/ui/test/ip_tests.js
new file mode 100644
index 0000000000000000000000000000000000000000..9deed41f069156e42603f6c2b98ac79b240eaa24
--- /dev/null
+++ b/install/ui/test/ip_tests.js
@@ -0,0 +1,217 @@
+/*  Authors:
+ *    Petr Vobornik <pvobo...@redhat.com>
+ *
+ * Copyright (C) 2010 Red Hat
+ * see file 'COPYING' for use and warranty information
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+module('ip-addresses',{
+    setup: function() {
+    },
+    teardown: function() {
+    }
+});
+
+var get_address = function(str) {
+    var address = IP.address();
+    address.input = str;
+    return address;
+};
+
+var get_reverse = function(str) {
+    var address = get_address(str);
+    address.parse();
+    return address.get_reverse();
+};
+
+test('Testing correct IPv4 addresses', function() {
+
+    var address = get_address('255.0.173.1');
+    ok(address.parse(), 'Dotted decimal - 255.0.173.1');
+
+    address = get_address('0377.0.0255.01');
+    ok(address.parse(), 'Dotted octal - 0377.0.0255.01');
+
+    address = get_address('0xFF.0x0.0xAD.0x1');
+    ok(address.parse(), 'Dotted hexadecimal - 0xFF.0x.0xAD.0x1');
+
+    address = get_address('4294967295');
+    ok(address.parse(), 'Max decimal - 4294967295');
+
+    address = get_address('037777777777');
+    ok(address.parse(), 'Max octal - 037777777777');
+
+    address = get_address('0xFFFFFFFF');
+    ok(address.parse(), 'Max hexadecimal - 0xFFFFFFFF');
+
+    address = get_address('255.0.0xAD.0376');
+    ok(address.parse(), 'Dotted mixed - 255.0.0xAD.01');
+
+    address = get_address('4294946302');
+    ok(address.parse(), 'Decimal integer - 4294946302');
+
+    address = get_address('037777726776');
+    ok(address.parse(), 'Octal integer - 037777726776');
+
+    address = get_address('0XFFFFADFE');
+    ok(address.parse(), 'Hexadecimal integer - 0XFFFFADFE');
+
+    address = get_address('0');
+    ok(address.parse(), 'Zero decimal - 0');
+
+    address = get_address('00');
+    ok(address.parse(), 'Zero octal - 00');
+
+    address = get_address('0X0');
+    ok(address.parse(), 'Zero hexa - 0X0');
+});
+
+test('Testing incorrect IPv4 addresses', function() {
+
+    var address = get_address('256.0.0.1');
+    ok(!address.parse(), 'Out of range - 256.0.0.1');
+
+    address = get_address('0x100.0.0.1');
+    ok(!address.parse(), 'Out of range - 0x100.0.0.1');
+
+    address = get_address('0400.0.0.1');
+    ok(!address.parse(), 'Out of range - 0400.0.0.1');
+
+
+    address = get_address('0x100000000');
+    ok(!address.parse(), 'Out of range - 0x100000000');
+
+    address = get_address('040000000000');
+    ok(!address.parse(), 'Out of range - 040000000000');
+
+    address = get_address('4294967296');
+    ok(!address.parse(), 'Out of range - 4294967296');
+
+    address = get_address('250.0.173');
+    ok(!address.parse(), '3 parts - 250.0.173');
+
+    address = get_address('250.0.173.21.21');
+    ok(!address.parse(), '5 parts - 250.0.173.21.21');
+
+    address = get_address('250.001.173.21');
+    ok(!address.parse(), 'Trailing zeros - 250.001.173.21');
+
+    address = get_address('250.001.173.FF');
+    ok(!address.parse(), 'Bad hexapart - 250.01.173.FF');
+
+    address = get_address('abcd');
+    ok(!address.parse(), 'Word - abcd');
+
+    address = get_address('192.168 .0.21');
+    ok(!address.parse(), 'With space - 192.168 .0.21');
+
+    address = get_address(' 192.168 .0.21');
+    ok(!address.parse(), 'With space - " 192.168.0.21"');
+});
+
+test('Testing correct IPv6 addresses', function() {
+
+    var address = get_address('2001:0db8:85a3:0000:0000:8a2e:0370:7334');
+    ok(address.parse(), 'Address - 2001:0db8:85a3:0000:0000:8a2e:0370:7334');
+
+    address = get_address('2001:db8:85a3:0:0:8a2e:370:7334');
+    ok(address.parse(), 'Without trailing zeros - 2001:db8:85a3:0:0:8a2e:370:7334');
+
+    address = get_address('2001:db8::1:0:0:1');
+    ok(address.parse(), 'With :: - 2001:db8::1:0:0:1');
+
+    address = get_address('::1');
+    ok(address.parse(), 'Address - ::1');
+
+    address = get_address('::');
+    ok(address.parse(), 'Address - ::');
+
+    address = get_address('1::');
+    ok(address.parse(), 'Address - 1::');
+
+    address = get_address('::ffff:192.0.2.128');
+    ok(address.parse(), 'With IPv4 part - ::ffff:192.0.2.128');
+
+});
+
+test('Testing incorrect IPv6 addresses', function() {
+
+    var address = get_address('02001:0db8:85a3:0000:0000:8a2e:0370:7334');
+    ok(!address.parse(), 'Too long part- 02001:0db8:85a3:0000:0000:8a2e:0370:7334');
+
+    address = get_address('2001:db8:85a3:0:0:8a2e:370');
+    ok(!address.parse(), 'Missing part - 2001:db8:85a3:0:0:8a2e:370');
+
+    address = get_address('::1::');
+    ok(!address.parse(), 'Address - ::1::');
+
+    address = get_address(':::');
+    ok(!address.parse(), 'Address - :::');
+
+    address = get_address('1::1::1');
+    ok(!address.parse(), 'Address - 1::1::1');
+
+    address = get_address('::ffff:192.0.0x2.128');
+    ok(!address.parse(), 'With IPv4 hex part - ::ffff:192.0.0x2.128');
+
+    address = get_address('::ffff:192.0.02.128');
+    ok(!address.parse(), 'With IPv4 oct part - ::ffff:192.0.02.128');
+
+    address = get_address('aa:rt::');
+    ok(!address.parse(), 'Invalid chars - aa:rt::');
+});
+
+
+test('Testing reverse addresses', function() {
+
+    var reverse_valid = '4.3.3.7.0.7.3.0.e.2.a.8.0.0.0.0.0.0.0.0.3.a.5.8.8.b.d.0.1.0.0.2.ip6.arpa';
+
+    var reverse = get_reverse('2001:0db8:85a3:0000:0000:8a2e:0370:7334');
+    same(reverse, reverse_valid, '2001:0db8:85a3:0000:0000:8a2e:0370:7334');
+
+    reverse = get_reverse('2001:db8:85a3::8a2e:370:7334');
+    same(reverse, reverse_valid, '2001:db8:85a3::8a2e:370:7334');
+
+    reverse_valid = '1.0.168.192.in-addr.arpa';
+    reverse = get_reverse('192.168.0.1');
+    same(reverse, reverse_valid, '192.168.0.1');
+
+    reverse_valid = '0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa';
+    reverse = get_reverse('::');
+    same(reverse, reverse_valid, '::');
+
+    reverse_valid = '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa';
+    reverse = get_reverse('::1');
+    same(reverse, reverse_valid, '::1');
+
+    reverse_valid = '0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.ip6.arpa';
+    reverse = get_reverse('1::');
+    same(reverse, reverse_valid, '1::');
+
+    reverse_valid = '5.1.0.0.8.a.0.c.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa';
+    reverse = get_reverse('::192.168.0.21');
+    same(reverse, reverse_valid, '::192.168.0.21');
+
+    reverse_valid = '255.254.253.252.in-addr.arpa';
+    reverse = get_reverse('0xFCFDFEFF');
+    same(reverse, reverse_valid, '0xFCFDFEFF');
+
+    reverse = get_reverse('4244504319');
+    same(reverse, reverse_valid, '4244504319');
+
+    reverse = get_reverse('037477377377');
+    same(reverse, reverse_valid, '037477377377');
+});
\ No newline at end of file
diff --git a/install/ui/test/jsl.conf b/install/ui/test/jsl.conf
index 470d928963fbba537d5f61d0bd2f061d1e6b69c6..00607e48b000b4320cc8b377aed2dbfe52314817 100644
--- a/install/ui/test/jsl.conf
+++ b/install/ui/test/jsl.conf
@@ -128,6 +128,7 @@
 +define equals
 +define IPA
 +define expect
++define IP
 
 
 ### Files
@@ -144,4 +145,5 @@
 +process details_tests.js
 +process ipa_tests.js
 +process ordered_map_tests.js
-+process widget_tests.js
\ No newline at end of file
++process widget_tests.js
++process ip_tests.js
\ No newline at end of file
-- 
1.7.6.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to