]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
Merge branch 'trac3799' Add support for per subnet statistics in v6
authorShawn Routhier <sar@isc.org>
Fri, 19 Jun 2015 18:52:32 +0000 (11:52 -0700)
committerShawn Routhier <sar@isc.org>
Fri, 19 Jun 2015 18:52:32 +0000 (11:52 -0700)
Conflicts:
ChangeLog
doc/guide/dhcp6-srv.xml
src/bin/dhcp6/tests/dhcp6_test_utils.cc

1  2 
ChangeLog
doc/guide/dhcp6-srv.xml
src/bin/dhcp6/dhcp6_srv.cc
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc
src/bin/dhcp6/tests/dhcp6_test_utils.cc
src/lib/dhcpsrv/srv_config.h

diff --cc ChangeLog
index c020f3ad452dccb0018e8a2bfe9f6b4188d908da,a919c414419d7ff110e3bff2135f645c5328e525..0b743dc596024db73d8d79c976893a31ea32658a
+++ b/ChangeLog
@@@ -1,42 -1,9 +1,48 @@@
 -XXX.  [func]          sar
++965.  [func]          sar
+       Per IPv6 subnet statistics (subnet[id].assigned-nas, 
+       subnet[id].total-nas, subnet[id].assigned-pds, and subnet[id].total-pds)
+       has been implemented.
+       (Trac #3799, git TBD)
 +964.  [doc]           tomek
 +      User's Guide and Developer's Guide updated with statistics and
 +      control channel description.
 +      (Trac #3800, git 7ce8ca560370ec5f9bd4d5199a177b441f08a47e)
 +
 +963.    [func]                tmark
 +      DHCPv6 server now supports a control channel, implemented over
 +      a UNIX socket. Currently supported commands are: statistic-get,
 +      statistic-reset, statistic-remove, statistic-get-all,
 +      statistic-reset-all, statistic-remove-all, and shutdown.
 +      (Trac #3797, git f49828612d9030c9f3441acaf4b3a9f60b492a3e)
 +
 +962.  [func]          fdupont
 +      Make the parsing of options and vendor options more consistent
 +      between v4 and v6. In addition make the parsing more robust
 +      against malformed packets.
 +      (Trac #3618, git f4066793c5e034386c689fd72d2a91a70ffb6d5f)
 +
 +961.  [func]          fdupont
 +      Improved error messages when handling invalid or malformed
 +      configuration file. File and line number are printed, when
 +      available.
 +      (Trac #3697, git 70fc36e164e988c251bdaaee7e27c5f6407e0f4c)
 +
 +960.  [build]         fdupont
 +      Get rid of the last bundy pieces of code.
 +      (Trac #3732, git 6b7da42f902fabb6855e54a19ea472c18ba82a93)
 +
 +959.  [build]         fdupont
 +      Removed no longer used logging in cc and config libraries.
 +      (Trac #3732, git 8d0324f4786900db953489ebaa9e018b1238543f)
 +
 +958.  [func]          tomek
 +      DHCPv4 server now supports control channel, implemented over UNIX
 +      socket. Currently supported commands are: statistic-get,
 +      statistic-reset, statistic-remove, statistic-get-all,
 +      statistic-reset-all, statistic-remove-all, shutdown.
 +      (Trac #3880, git 688658395518f0b97d5384af81ceab5206691ad5)
 +
  957.  [func]          tomek
        Per IPv4 subnet statistics (subnet[id].assigned-addresses and
        subnet[id].total-addresses) has been implemented.
index 60a59cc22bf9d7145ff2804545fe07c363e4ee62,732201981749e4761f5a292bfb8804669c18147e..38a0fac35782ddb7e21a227262869da7274960b6
@@@ -2589,8 -2589,8 +2589,8 @@@ should include options from the isc opt
        <para>
          The DHCPv6 server supports the following statistics:
        </para>
 -        <table frame="all" id="dhcp4-statistics">
 +        <table frame="all" id="dhcp6-statistics">
-           <title>DHCPv4 Statistics</title>
+           <title>DHCPv6 Statistics</title>
            <tgroup cols='3'>
            <colspec colname='statistic' align='center'/>
            <colspec colname='type' align='center'/>
            </thead>
            <tbody>
  
-           </tbody>
-           </tgroup>
 +            <row>
 +              <entry>pkt6-received</entry>
 +              <entry>integer</entry>
 +              <entry>Number of DHCPv6 packets received. This includes all packets:
 +              valid, bogus, corrupted, rejected etc. This statistic is expected
 +              to grow rapidly.</entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-receive-drop</entry>
 +              <entry>integer</entry>
 +              <entry>Number of incoming packets that were dropped. Exact reason
 +              for dropping packets is logged, but the most common reasons may
 +              be: an unacceptable or not supported packet type, direct responses
 +              are forbidden, the server-id sent by the client does not match the
 +              server's server-id or the packet is malformed.</entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-parse-failed</entry>
 +              <entry>integer</entry>
 +              <entry>Number of incoming packets that could not be parsed.
 +              A non-zero value of this statistic indicates that the server
 +              received a malformed or truncated packet. This may indicate problems
 +              in your network, faulty clients, faulty relay agents or server
 +              code bug.</entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-solicit-received</entry>
 +              <entry>integer</entry>
 +              <entry>
 +                Number of SOLICIT packets received. This statistic is expected
 +                to grow.  Its increase means that clients that just booted
 +                started their configuration process and their initial packets
 +                reached your server.
 +              </entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-advertise-received</entry>
 +              <entry>integer</entry>
 +              <entry>
 +                Number of ADVERTISE packets received. Advertise packets are sent
 +                by the server and the server is never expected to receive them. A non-zero
 +                value of this statistic indicates an error ocurring in the network.
 +                One likely cause would be a misbehaving relay agent that incorrectly
 +                forwards ADVERTISE messages towards the server, rather back to the
 +                clients.
 +              </entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-request-received</entry>
 +              <entry>integer</entry>
 +              <entry>Number of REQUEST packets received. This statistic
 +                is expected to grow. Its increase means that clients that just booted
 +                received the server's response (ADVERTISE), accepted it and are now
 +                requesting an address (REQUEST).
 +              </entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-reply-received</entry>
 +              <entry>integer</entry>
 +              <entry>Number of REPLY packets received. This statistic is
 +              expected to remain zero at all times, as REPLY packets are sent by
 +              the server and the server is never expected to receive
 +              them. A non-zero value indicates an error. One likely cause would be
 +              a misbehaving relay agent that incorrectly forwards REPLY messages
 +              towards the server, rather back to the clients.
 +              </entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-renew-received</entry>
 +              <entry>integer</entry>
 +              <entry>Number of RENEW packets received. This statistic
 +                is expected to grow. Its increase means that clients received their
 +                addresses and prefixes and are trying to renew them.
 +              </entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-rebind-received</entry>
 +              <entry>integer</entry>
 +              <entry>Number of REBIND packets received. A non-zero value
 +              indicates that clients didn't receive responses to their RENEW messages
 +              (regular lease renewal mechanism) and are attempting to find any server
 +              that is able to take over their leases. It may mean that some server's
 +              REPLY messages never reached the clients.
 +              </entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-release-received</entry>
 +              <entry>integer</entry>
 +              <entry>Number of RELEASE packets received. This statistic is expected
 +              to grow when a device is being shut down in the network. It
 +              indicates that the address or prefix assigned is reported as no longer
 +              needed. Note that many devices, especially wireless, do not send RELEASE,
 +              because of design choice or due to moving out of range.
 +              </entry>
 +            </row>
 +
 +            <row>
 +            <entry>pkt6-decline-received</entry>
 +            <entry>integer</entry>
 +            <entry>
 +              Number of DECLINE packets received. This statistic is expected to
 +              remain close to zero. Its increase means that a client leased an
 +              address, but discovered that the address is currently used by an
 +              unknown device in your network. If this statistic is growing, it
 +              may indicate misconfigured server or devices that have statically
 +              assigned conflicting addresses.
 +            </entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-infrequest-received</entry>
 +              <entry>integer</entry>
 +              <entry>
 +                Number of INFORMATION-REQUEST packets received. This statistic
 +                is expected to grow if there are devices that are using
 +                stateless DHCPv6. INFORMATION-REQUEST messages are used by
 +                clients that request stateless configuration, i.e. options
 +                and parameters other than addresses or prefixes.
 +              </entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-unknown-received</entry>
 +              <entry>integer</entry>
 +              <entry>Number of packets received of an unknown type. Non-zero
 +              value of this statistic indicates that the server received a
 +              packet that it wasn't able to recognize: either with unsupported
 +              type or possibly malformed.</entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-sent</entry>
 +              <entry>integer</entry>
 +              <entry>Number of DHCPv6 packets sent. This statistic is expected
 +              to grow every time the server transmits a packet. In general, it
 +              should roughly match pkt6-received, as most incoming packets cause
 +              the server to respond. There are exceptions (e.g. server receiving a
 +              REQUEST with server-id matching other server), so do not worry, if
 +              it is lesser than pkt6-received.</entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-advertise-sent</entry>
 +              <entry>integer</entry>
 +              <entry>Number of ADVERTISE packets sent. This statistic is
 +              expected to grow in most cases after a SOLICIT is processed. There
 +              are certain uncommon, but valid cases where incoming SOLICIT is
 +              dropped, but in general this statistic is expected to be close to
 +              pkt6-solicit-received.</entry>
 +            </row>
 +
 +            <row>
 +              <entry>pkt6-reply-sent</entry>
 +              <entry>integer</entry>
 +              <entry>Number of REPLY packets sent. This statistic is expected to
 +              grow in most cases after a SOLICIT (with rapid-commit), REQUEST,
 +              RENEW, REBIND, RELEASE, DECLINE or INFORMATION-REQUEST is
 +              processed. There are certain cases where there is no response.
 +              </entry>
 +            </row>
 +
+             <row>
+             <entry>subnet[id].total-nas</entry>
+             <entry>integer</entry>
+             <entry>
+             This statistic shows the total number of NA addresses available for
+             DHCPv6 management for a given subnet. In other words, this is the sum
+             of all addresses in all configured pools. This statistic changes only
+             during configuration changes. Note it does not take into account any
+             addresses that may be reserved due to host reservation. The
+             <emphasis>id</emphasis> is the subnet-id of a given subnet. This
+             statistic is exposed for each subnet separately. This statistic is
+             reset during a reconfiguration event.
+             </entry>
+             </row>
+             <row>
+             <entry>subnet[id].assigned-nas</entry>
+             <entry>integer</entry>
+             <entry>
+             This statistic shows the number of NA addresses in a given subnet that
+             are assigned. This statistic increases every time a new lease is allocated
+             (as a result of receiving a REQUEST message) and is decreased every time a
+             lease is released (a RELEASE message is received). When lease expiration
+             is implemented (planned for Kea 1.0), it will also decrease when a lease
+             is expired. The <emphasis>id</emphasis> is the subnet-id of a given
+             subnet. This statistic is exposed for each subnet separately. This
+             statistic is reset during a reconfiguration event.
+             </entry>
+             </row>
+             <row>
+             <entry>subnet[id].total-pds</entry>
+             <entry>integer</entry>
+             <entry>
+             This statistic shows the total number of PD prefixes available for
+             DHCPv6 management for a given subnet. In other words, this is the sum
+             of all prefixes in all configured pools. This statistic changes only
+             during configuration changes. Note it does not take into account any
+             prefixes that may be reserved due to host reservation. The
+             <emphasis>id</emphasis> is the subnet-id of a given subnet. This
+             statistic is exposed for each subnet separately. This statistic is
+             reset during a reconfiguration event.
+             </entry>
+             </row>
+             <row>
+             <entry>subnet[id].assigned-pds</entry>
+             <entry>integer</entry>
+             <entry>
+             This statistic shows the number of PD prefixes in a given subnet that
+             are assigned. This statistic increases every time a new lease is allocated
+             (as a result of receiving a REQUEST message) and is decreased every time a
+             lease is released (a RELEASE message is received). When lease expiration
+             is implemented (planned for Kea 1.0), it will also decrease when a lease
+             is expired. The <emphasis>id</emphasis> is the subnet-id of a given
+             subnet. This statistic is exposed for each subnet separately. This
+             statistic is reset during a reconfiguration event.
+             </entry>
+             </row>
+         </tbody>
+         </tgroup>
          </table>
      </section>
  
Simple merge
index dd40b049b9bbc495fca046f99b4c764cc078914a,03847b3eb0a36eb9ae226e131efcc193ea2be157..ace8bbfb285e4fe41d00036a1918cea85056063e
@@@ -745,44 -771,6 +774,43 @@@ Dhcpv6SrvTest::testReleaseReject(Lease:
      EXPECT_TRUE(LeaseMgrFactory::instance().deleteLease(addr));
  }
  
-     using namespace isc::stats;
 +void
 +Dhcpv6SrvTest::testReceiveStats(uint8_t pkt_type, const std::string& stat_name) {
 +
 +    StatsMgr& mgr = StatsMgr::instance();
 +    NakedDhcpv6Srv srv(0);
 +
 +    // Let's get a simple SOLICIT...
 +    Pkt6Ptr pkt = PktCaptures::captureSimpleSolicit();
 +
 +    // And pretend it's packet of a different type
 +    pkt->data_[0] = pkt_type;
 +
 +    // Check that those statistics are not set before the test
 +    ObservationPtr pkt6_rcvd = mgr.getObservation("pkt6-received");
 +    ObservationPtr tested_stat = mgr.getObservation(stat_name);
 +    EXPECT_FALSE(pkt6_rcvd);
 +    EXPECT_FALSE(tested_stat);
 +
 +    // Simulate that we have received that traffic
 +    srv.fakeReceive(pkt);
 +
 +    // Server will now process to run its normal loop, but instead of calling
 +    // IfaceMgr::receive6(), it will read all packets from the list set by
 +    // fakeReceive()
 +    srv.run();
 +
 +    // All expected statstics must be present.
 +    pkt6_rcvd = mgr.getObservation("pkt6-received");
 +    tested_stat = mgr.getObservation(stat_name);
 +    ASSERT_TRUE(pkt6_rcvd);
 +    ASSERT_TRUE(tested_stat);
 +
 +    // They also must have expected values.
 +    EXPECT_EQ(1, pkt6_rcvd->getInteger().first);
 +    EXPECT_EQ(1, tested_stat->getInteger().first);
 +}
 +
  void
  Dhcpv6SrvTest::configure(const std::string& config) {
      configure(config, srv_);
Simple merge