dhcpd-pools/tests/expected/formats
Sami Kerola 447241e6c3
tests: improve coverage
Add error condition checks.  Add lease file binding states.  Check all
output formats.  Check leases file that is in mad order, cse all sorting
methods when checking this.  Use json output to check status classfications.
Add cidr range checks.  Add conf include and comment parsing input checks.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-26 15:14:49 +00:00

284 lines
8.3 KiB
Text

=== color text
Ranges:
shared net name first ip last ip max cur percent touch t+c t+c perc
example1 10.0.0.1 - 10.0.0.20 20 11 55.000 0 11 55.000
example1 10.1.0.1 - 10.1.0.20 20 10 50.000 0 10 50.000
example2 10.2.0.1 - 10.2.0.20 20 8 40.000 0 8 40.000
example2 10.3.0.1 - 10.3.0.20 20 9 45.000 0 9 45.000
All networks 10.4.0.1 - 10.4.0.20 20 5 25.000 0 5 25.000
Shared networks:
name max cur percent touch t+c t+c perc
example1 40 21 52.500 0 21 52.500
example2 40 17 42.500 0 17 42.500
Sum of all ranges:
name max cur percent touch t+c t+c perc
All networks 100 43 43.000 0 43 43.000
=== html
<!DOCTYPE html>
<html>
<head>
<title>ISC dhcpd dhcpd-pools output</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs/jq-3.2.1/dt-1.10.16/datatables.min.css">
<style type="text/css">
table.dhcpd-pools th { text-transform: capitalize }
</style>
</head>
<body>
<div class="container">
<h2>ISC DHCPD status</h2>
<h3>Sum of all</h3>
<table id="a" class="dhcpd-pools order-column table table-hover" summary="all">
<thead>
<tr>
<th>name</th>
<th>max</th>
<th>cur</th>
<th>free</th>
<th>percent</th>
<th>touch</th>
<th>t+c</th>
<th>t+c perc</th>
</tr>
</thead>
<tbody>
<tr>
<td>All networks</td>
<td>100</td>
<td>43</td>
<td>57</td>
<td>43.000</td>
<td>0</td>
<td>43</td>
<td>43.000</td>
</tr>
</tbody>
</table>
<h3>Shared networks</h3>
<table id="s" class="dhcpd-pools order-column table table-hover" summary="snet">
<thead>
<tr>
<th>name</th>
<th>max</th>
<th>cur</th>
<th>free</th>
<th>percent</th>
<th>touch</th>
<th>t+c</th>
<th>t+c perc</th>
</tr>
</thead>
<tbody>
<tr>
<td>example1</td>
<td>40</td>
<td>21</td>
<td>19</td>
<td>52.5</td>
<td>0</td>
<td>21</td>
<td>52.500</td>
</tr>
<tr>
<td>example2</td>
<td>40</td>
<td>17</td>
<td>23</td>
<td>42.5</td>
<td>0</td>
<td>17</td>
<td>42.500</td>
</tr>
</tbody>
</table>
<h3>Ranges</h3>
<table id="r" class="dhcpd-pools order-column table table-hover" summary="ranges">
<thead>
<tr>
<th>shared net name</th>
<th>first ip</th>
<th>last ip</th>
<th>max</th>
<th>cur</th>
<th>free</th>
<th>percent</th>
<th>touch</th>
<th>t+c</th>
<th>t+c perc</th>
</tr>
</thead>
<tbody>
<tr>
<td>example1</td>
<td>10.0.0.1</td>
<td>10.0.0.20</td>
<td>20</td>
<td>11</td>
<td>9</td>
<td>55</td>
<td>0</td>
<td>11</td>
<td>55.000</td>
</tr>
<tr>
<td>example1</td>
<td>10.1.0.1</td>
<td>10.1.0.20</td>
<td>20</td>
<td>10</td>
<td>10</td>
<td>50</td>
<td>0</td>
<td>10</td>
<td>50.000</td>
</tr>
<tr>
<td>example2</td>
<td>10.2.0.1</td>
<td>10.2.0.20</td>
<td>20</td>
<td>8</td>
<td>12</td>
<td>40</td>
<td>0</td>
<td>8</td>
<td>40.000</td>
</tr>
<tr>
<td>example2</td>
<td>10.3.0.1</td>
<td>10.3.0.20</td>
<td>20</td>
<td>9</td>
<td>11</td>
<td>45</td>
<td>0</td>
<td>9</td>
<td>45.000</td>
</tr>
<tr>
<td>All networks</td>
<td>10.4.0.1</td>
<td>10.4.0.20</td>
<td>20</td>
<td>5</td>
<td>15</td>
<td>25</td>
<td>0</td>
<td>5</td>
<td>25.000</td>
</tr>
</tbody>
</table>
<br /><div class="well well-lg">
More info at <a href="http://dhcpd-pools.sourceforge.net/">http://dhcpd-pools.sourceforge.net/</a>
</small></div></div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs/jq-3.2.1/dt-1.10.16/datatables.min.js"></script>
<script type="text/javascript" class="init">$(document).ready(function() { $('#s').DataTable({ "iDisplayLength": 50, "lengthMenu": [ [25, 50, 100, -1], [25, 50, 100, "All"] ], "order": [[ 4, "desc" ]] } ); } );</script>
<script type="text/javascript" class="init">$(document).ready(function() { $('#r').DataTable({ "iDisplayLength": 100, "lengthMenu": [ [25, 50, 100, -1], [25, 50, 100, "All"] ], "order": [[ 6, "desc" ]] } ); } );</script>
</body></html>
=== xml
<dhcpstatus>
<subnet>
<location>example1</location>
<range>10.0.0.1 - 10.0.0.20</range>
<defined>20</defined>
<used>11</used>
<touched>0</touched>
<free>9</free>
</subnet>
<subnet>
<location>example1</location>
<range>10.1.0.1 - 10.1.0.20</range>
<defined>20</defined>
<used>10</used>
<touched>0</touched>
<free>10</free>
</subnet>
<subnet>
<location>example2</location>
<range>10.2.0.1 - 10.2.0.20</range>
<defined>20</defined>
<used>8</used>
<touched>0</touched>
<free>12</free>
</subnet>
<subnet>
<location>example2</location>
<range>10.3.0.1 - 10.3.0.20</range>
<defined>20</defined>
<used>9</used>
<touched>0</touched>
<free>11</free>
</subnet>
<subnet>
<location>All networks</location>
<range>10.4.0.1 - 10.4.0.20</range>
<defined>20</defined>
<used>5</used>
<touched>0</touched>
<free>15</free>
</subnet>
<shared-network>
<location>example1</location>
<defined>40</defined>
<used>21</used>
<touched>0</touched>
<free>19</free>
</shared-network>
<shared-network>
<location>example2</location>
<defined>40</defined>
<used>17</used>
<touched>0</touched>
<free>23</free>
</shared-network>
<summary>
<location>All networks</location>
<defined>100</defined>
<used>43</used>
<touched>0</touched>
<free>57</free>
</summary>
</dhcpstatus>
=== csv
"Ranges:"
"shared net name","first ip","last ip","max","cur","percent","touch","t+c","t+c perc"
"example1","10.0.0.1","10.0.0.20","20","11","55.000","0","11","55.000"
"example1","10.1.0.1","10.1.0.20","20","10","50.000","0","10","50.000"
"example2","10.2.0.1","10.2.0.20","20","8","40.000","0","8","40.000"
"example2","10.3.0.1","10.3.0.20","20","9","45.000","0","9","45.000"
"All networks","10.4.0.1","10.4.0.20","20","5","25.000","0","5","25.000"
"Shared networks:"
"name","max","cur","percent","touch","t+c","t+c perc"
"example1","40","21","52.500","0","21","52.500"
"example2","40","17","42.500","0","17","42.500"
"Sum of all ranges:"
"name","max","cur","percent","touch","t+c","t+c perc"
"All networks","100","43","43.000","0","43","43.000"
=== json
{
"subnets": [
{ "location":"example1", "range":"10.0.0.1 - 10.0.0.20", "first_ip":"10.0.0.1", "last_ip":"10.0.0.20", "defined":20, "used":11, "touched":0, "free":9, "percent":55, "touch_count":11, "touch_percent":55, "status":0 },
{ "location":"example1", "range":"10.1.0.1 - 10.1.0.20", "first_ip":"10.1.0.1", "last_ip":"10.1.0.20", "defined":20, "used":10, "touched":0, "free":10, "percent":50, "touch_count":10, "touch_percent":50, "status":0 },
{ "location":"example2", "range":"10.2.0.1 - 10.2.0.20", "first_ip":"10.2.0.1", "last_ip":"10.2.0.20", "defined":20, "used":8, "touched":0, "free":12, "percent":40, "touch_count":8, "touch_percent":40, "status":0 },
{ "location":"example2", "range":"10.3.0.1 - 10.3.0.20", "first_ip":"10.3.0.1", "last_ip":"10.3.0.20", "defined":20, "used":9, "touched":0, "free":11, "percent":45, "touch_count":9, "touch_percent":45, "status":0 },
{ "location":"All networks", "range":"10.4.0.1 - 10.4.0.20", "first_ip":"10.4.0.1", "last_ip":"10.4.0.20", "defined":20, "used":5, "touched":0, "free":15, "percent":25, "touch_count":5, "touch_percent":25, "status":0 }
],
"shared-networks": [
{ "location":"example1", "defined":40, "used":21, "touched":0, "free":19, "percent":52.5, "touch_count":21, "touch_percent":52.5, "status":0 },
{ "location":"example2", "defined":40, "used":17, "touched":0, "free":23, "percent":42.5, "touch_count":17, "touch_percent":42.5, "status":0 }
]
}
=== perfdata
CRITICAL: dhcpd-pools: Ranges - crit: 3 warn: 2 ok: 0; | range_crit=3 range_warn=2 range_ok=0 10.4.0.1_r=5;4;8;0;20 10.4.0.1_rt=0 10.3.0.1_r=9;4;8;0;20 10.3.0.1_rt=0 10.2.0.1_r=8;4;8;0;20 10.2.0.1_rt=0 10.1.0.1_r=10;4;8;0;20 10.1.0.1_rt=0 10.0.0.1_r=11;4;8;0;20 10.0.0.1_rt=0
Shared nets - crit: 2 warn: 0 ok: 0; | snet_crit=2 snet_warn=0 snet_ok=0 'example1_s'=21;8;16;0;40 'example1_st'=0 'example2_s'=17;8;16;0;40 'example2_st'=0