Squashed commit of the following: commit 606d572db561d8de659bce6ac96252f8a1d7ee29 Author: Oliver Gorwits <oliver@cpan.org> Date: Sat May 6 14:56:07 2017 +0100 tests should be release tests, so move to xt/ commit7673f3ee1eAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sat May 6 14:19:19 2017 +0100 allow check_acl to accept Device or NetAddr::IP instance commitc31059bc01Author: Oliver Gorwits <oliver@cpan.org> Date: Sat May 6 14:19:00 2017 +0100 update docs commitdeaeab2670Author: Oliver Gorwits <oliver@cpan.org> Date: Sat May 6 14:18:27 2017 +0100 SNMP only stanza has access to full check_acl features commit4a44fa5863Author: Oliver Gorwits <oliver@cpan.org> Date: Mon May 1 18:49:38 2017 +0100 add AND operator and negation support to ACLs
		
			
				
	
	
		
			256 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			256 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!DOCTYPE html>
 | 
						|
<html>
 | 
						|
<head>
 | 
						|
    <meta charset="utf-8">
 | 
						|
    <title>portsort.js test suite</title>
 | 
						|
    <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script>
 | 
						|
    <script src="http://code.jquery.com/qunit/qunit-1.14.0.js" type="text/javascript"></script>
 | 
						|
    <script src="../js/qunit-tap.js" type="text/javascript"></script>
 | 
						|
    <script>
 | 
						|
        qunitTap(QUnit, function() { console.log.apply(console, arguments); });
 | 
						|
    </script>
 | 
						|
    <link href="http://code.jquery.com/qunit/qunit-1.14.0.css" type="text/css" rel="stylesheet"></link>
 | 
						|
    <script src="../../share/public/javascripts/jquery.dataTables.min.js" type="text/javascript"></script>
 | 
						|
    <script src="../../share/public/javascripts/portsort.js" type="text/javascript"></script>
 | 
						|
    <script type="text/javascript">
 | 
						|
        $(function () {
 | 
						|
            module("portsort.js"),
 | 
						|
            test("different values types", function () {
 | 
						|
                wrapTest(
 | 
						|
                    ['a',1],
 | 
						|
                    [1,'a'],
 | 
						|
                    'number always comes first');
 | 
						|
                wrapTest(
 | 
						|
                    ['1',1],
 | 
						|
                    ['1',1],
 | 
						|
                    'number vs numeric string - should remain unchanged (error in chrome)');
 | 
						|
                wrapTest(
 | 
						|
                    ['02',3,2,'01'],
 | 
						|
                    ['01','02',2,3],
 | 
						|
                    'padding numeric string vs number');
 | 
						|
            });
 | 
						|
            test("numerics", function () {
 | 
						|
                wrapTest(
 | 
						|
                    ['10',9,2,'1','4'],
 | 
						|
                    ['1',2,'4',9,'10'],
 | 
						|
                    'string vs number');
 | 
						|
                wrapTest(
 | 
						|
                    ['0001','002','001'],
 | 
						|
                    ['0001','001','002'],
 | 
						|
                    '0 left-padded numbers');
 | 
						|
                wrapTest(
 | 
						|
                    [2,1,'1','0001','002','02','001'],
 | 
						|
                    ['0001','001','002','02',1,'1',2],
 | 
						|
                    '0 left-padded numbers and regular numbers');
 | 
						|
                wrapTest(
 | 
						|
                    ['10.0401',10.022,10.042,'10.021999'],
 | 
						|
                    ['10.021999',10.022,'10.0401',10.042],
 | 
						|
                    'decimal string vs decimal, different precision');
 | 
						|
                wrapTest(
 | 
						|
                    ['10.04',10.02,10.03,'10.01'],
 | 
						|
                    ['10.01',10.02,10.03,'10.04'],
 | 
						|
                    'decimal string vs decimal, same precision');
 | 
						|
                wrapTest(
 | 
						|
                    ['10001','10011','101','10010','10','100','10002',
 | 
						|
                     '10112','10111'],
 | 
						|
                    ['10','100','101','10001','10002','10010','10011',
 | 
						|
                     '10111','10112'],
 | 
						|
                    'mixed length');
 | 
						|
            });
 | 
						|
            test("IP addresses", function () {
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        '192.168.0.100',
 | 
						|
                        '192.168.0.1',
 | 
						|
                        '192.168.1.1',
 | 
						|
                        '192.168.0.250',
 | 
						|
                        '192.168.1.123',
 | 
						|
                        '10.0.0.2',
 | 
						|
                        '10.0.0.1'
 | 
						|
                    ],
 | 
						|
                    [
 | 
						|
                        '10.0.0.1',
 | 
						|
                        '10.0.0.2',
 | 
						|
                        '192.168.0.1',
 | 
						|
                        '192.168.0.100',
 | 
						|
                        '192.168.0.250',
 | 
						|
                        '192.168.1.1',
 | 
						|
                        '192.168.1.123'
 | 
						|
                    ]);
 | 
						|
            });
 | 
						|
            test("space(s) as first character(s)", function () {
 | 
						|
                wrapTest(
 | 
						|
                    ['alpha',' 1','  3',' 2',0],
 | 
						|
                    [0,' 1',' 2','  3','alpha']);
 | 
						|
            });
 | 
						|
            test("wireless controllers", function () {
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        '00:14:0e:12:34:56','00:08:30:01:23:45.1',
 | 
						|
                        '00:15:c7:ab:23:10.0','00:14:0e:01:23:45',
 | 
						|
                        '00:08:30:01:23:45.0','00:15:c7:ab:23:00.1'
 | 
						|
                    ],
 | 
						|
                    [
 | 
						|
                        '00:08:30:01:23:45.0','00:08:30:01:23:45.1',
 | 
						|
                        '00:14:0e:01:23:45','00:14:0e:12:34:56',
 | 
						|
                        '00:15:c7:ab:23:00.1','00:15:c7:ab:23:10.0'
 | 
						|
                    ],'ap ports');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        'wlan-controller1/0.104','wlan-controller1/0',
 | 
						|
                        'wlan-controller1/0.252','wlan-controller1/0.103'
 | 
						|
                    ],
 | 
						|
                    [
 | 
						|
                        'wlan-controller1/0','wlan-controller1/0.103',
 | 
						|
                        'wlan-controller1/0.104','wlan-controller1/0.252'
 | 
						|
                    ],'controller ports');
 | 
						|
            });
 | 
						|
            test("ports", function () {
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        '1.1','1.13','1.14','1.19','1.2','Vlan318','1.25',
 | 
						|
                        '1.29','3.12','1.3','1.37','1.38','1.4','1.43',
 | 
						|
                        '1.6','8.34'
 | 
						|
                    ],
 | 
						|
                    [
 | 
						|
                        '1.1','1.2','1.3','1.4','1.6','1.13','1.14','1.19',
 | 
						|
                        '1.25','1.29','1.37','1.38','1.43','3.12','8.34',
 | 
						|
                        'Vlan318'
 | 
						|
                    ],'Avaya');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        'GigabitEthernet9/0/12',
 | 
						|
                        'GigabitEthernet9/0/11',
 | 
						|
                        'GigabitEthernet1/0/14',
 | 
						|
                        'GigabitEthernet1/1/12',
 | 
						|
                    ],
 | 
						|
                    [
 | 
						|
                        'GigabitEthernet1/0/14',
 | 
						|
                        'GigabitEthernet1/1/12',
 | 
						|
                        'GigabitEthernet9/0/11',
 | 
						|
                        'GigabitEthernet9/0/12',
 | 
						|
                    ],'Cisco');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        '1/1/1','0/1/1','0/3/20','0/2/1','0/3/1','0/3/2',
 | 
						|
                        '0/3/11','0/3/10'
 | 
						|
                        
 | 
						|
                    ],[
 | 
						|
                        '0/1/1','0/2/1','0/3/1','0/3/2','0/3/10','0/3/11',
 | 
						|
                        '0/3/20','1/1/1'
 | 
						|
                    ],'Dell');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        '1:10','1:2','1:1','1:11'
 | 
						|
                        
 | 
						|
                    ],[
 | 
						|
                        '1:1','1:2','1:10','1:11'
 | 
						|
                    ],'Extreme');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        'D10','D11','D2','D1', 'A30', 'A3'
 | 
						|
                    ],[
 | 
						|
                        'A3', 'A30', 'D1','D2','D10','D11'
 | 
						|
                    ],'HP A & D');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        'B10','B11','B2','B1', 'A30', 'A3'
 | 
						|
                    ],[
 | 
						|
                        'A3', 'A30', 'B1','B2','B10','B11'
 | 
						|
                    ],'HP A & B');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        '10GigabitEthernet1/1/12',
 | 
						|
                        'GigabitEthernet1/0/14',
 | 
						|
                        'GigabitEthernet9/0/12',
 | 
						|
                        '10GigabitEthernet9/0/11',
 | 
						|
                    ],[
 | 
						|
                        'GigabitEthernet1/0/14',
 | 
						|
                        '10GigabitEthernet1/1/12',
 | 
						|
                        '10GigabitEthernet9/0/11',
 | 
						|
                        'GigabitEthernet9/0/12',
 | 
						|
                    ],'Foundry 10Gb');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        'Slot: 1 Port: 2 Gigabit - Level',
 | 
						|
                        'Slot: 1 Port: 1 Gigabit - Level',
 | 
						|
                        'Slot: 0 Port: 15 Gigabit - Level',
 | 
						|
                        'Slot: 1 Port: 10 Gigabit - Level',
 | 
						|
                        'Slot: 0 Port: 1 Gigabit - Level'
 | 
						|
                    ],[
 | 
						|
                        'Slot: 0 Port: 1 Gigabit - Level',
 | 
						|
                        'Slot: 0 Port: 15 Gigabit - Level',
 | 
						|
                        'Slot: 1 Port: 1 Gigabit - Level',
 | 
						|
                        'Slot: 1 Port: 2 Gigabit - Level',
 | 
						|
                        'Slot: 1 Port: 10 Gigabit - Level'
 | 
						|
                    ],'Netgear');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        'port-channel190','port-channel19',
 | 
						|
                        'port-channel1044','port-channel2','port-channel104'
 | 
						|
                        
 | 
						|
                    ],[
 | 
						|
                        'port-channel2','port-channel19','port-channel104',
 | 
						|
                        'port-channel190','port-channel1044'
 | 
						|
                    ],'port-channel');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        'Serial1/1:5',
 | 
						|
                        'Serial2/0:5-Bearer Channel',
 | 
						|
                        'Serial2/0:20',
 | 
						|
                        'Serial1/1:5-Bearer Channel',
 | 
						|
                        'Serial1/1:0',
 | 
						|
                        'Serial2/0:21',
 | 
						|
                        'Serial2/0:5',
 | 
						|
                        'Serial2/0:20-Bearer Channel'
 | 
						|
                    ],[
 | 
						|
                        'Serial1/1:0',
 | 
						|
                        'Serial1/1:5',
 | 
						|
                        'Serial1/1:5-Bearer Channel',
 | 
						|
                        'Serial2/0:5',
 | 
						|
                        'Serial2/0:5-Bearer Channel',
 | 
						|
                        'Serial2/0:20',
 | 
						|
                        'Serial2/0:20-Bearer Channel',
 | 
						|
                        'Serial2/0:21'
 | 
						|
                    ],'serial');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        'unrouted VLAN 990','unrouted VLAN 95',
 | 
						|
                        'unrouted VLAN 985','unrouted VLAN 99',
 | 
						|
                        'unrouted VLAN 950'
 | 
						|
                        
 | 
						|
                    ],[
 | 
						|
                        'unrouted VLAN 95','unrouted VLAN 99',
 | 
						|
                        'unrouted VLAN 950','unrouted VLAN 985',
 | 
						|
                        'unrouted VLAN 990'
 | 
						|
                    ],'unrouted vlans');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        'Vlan10','Vlan910','Vlan1','Vlan91'
 | 
						|
                    ],[
 | 
						|
                        'Vlan1','Vlan10','Vlan91','Vlan910'
 | 
						|
                    ],'vlans');
 | 
						|
                wrapTest(
 | 
						|
                    [
 | 
						|
                        'voice-port 2/10','voice-port 2/1','voice-port 2/2',
 | 
						|
                        'voice-port 2/11'
 | 
						|
                    ],[
 | 
						|
                        'voice-port 2/1','voice-port 2/2','voice-port 2/10',
 | 
						|
                        'voice-port 2/11',
 | 
						|
                        
 | 
						|
                    ],'voice-port');
 | 
						|
            });
 | 
						|
 | 
						|
        });
 | 
						|
        var sortFn = jQuery.fn.dataTableExt.oSort["portsort-asc"];
 | 
						|
        function wrapTest(origArray, sortArray, message) {
 | 
						|
            deepEqual($.extend([], origArray).sort(sortFn), sortArray, (message ? message + ' - ' : '') + QUnit.jsDump.parse(origArray));
 | 
						|
        };
 | 
						|
    </script>
 | 
						|
</head>
 | 
						|
<body>  
 | 
						|
   <div id="qunit"></div>
 | 
						|
   <div id="qunit-fixture"></div>
 | 
						|
</body>  
 | 
						|
</html>
 |