From: Shawn Routhier Date: Fri, 19 Jun 2015 18:52:32 +0000 (-0700) Subject: Merge branch 'trac3799' Add support for per subnet statistics in v6 X-Git-Tag: trac3910_base~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4aa4808268bbc54290578f60ba60ed33cf344712;p=thirdparty%2Fkea.git Merge branch 'trac3799' Add support for per subnet statistics in v6 Conflicts: ChangeLog doc/guide/dhcp6-srv.xml src/bin/dhcp6/tests/dhcp6_test_utils.cc --- 4aa4808268bbc54290578f60ba60ed33cf344712 diff --cc ChangeLog index c020f3ad45,a919c41441..0b743dc596 --- a/ChangeLog +++ 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. diff --cc doc/guide/dhcp6-srv.xml index 60a59cc22b,7322019817..38a0fac357 --- a/doc/guide/dhcp6-srv.xml +++ b/doc/guide/dhcp6-srv.xml @@@ -2589,8 -2589,8 +2589,8 @@@ should include options from the isc opt The DHCPv6 server supports the following statistics: - +
- DHCPv4 Statistics + DHCPv6 Statistics @@@ -2604,178 -2604,68 +2604,238 @@@ + + pkt6-received + integer + Number of DHCPv6 packets received. This includes all packets: + valid, bogus, corrupted, rejected etc. This statistic is expected + to grow rapidly. + + + + pkt6-receive-drop + integer + 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. + + + + pkt6-parse-failed + integer + 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. + + + + pkt6-solicit-received + integer + + 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. + + + + + pkt6-advertise-received + integer + + 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. + + + + + pkt6-request-received + integer + 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). + + + + + pkt6-reply-received + integer + 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. + + + + + pkt6-renew-received + integer + 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. + + + + + pkt6-rebind-received + integer + 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. + + + + + pkt6-release-received + integer + 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. + + + + + pkt6-decline-received + integer + + 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. + + + + + pkt6-infrequest-received + integer + + 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. + + + + + pkt6-unknown-received + integer + 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. + + + + pkt6-sent + integer + 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. + + + + pkt6-advertise-sent + integer + 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. + + + + pkt6-reply-sent + integer + 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. + + + - - + + subnet[id].total-nas + integer + + 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 + id is the subnet-id of a given subnet. This + statistic is exposed for each subnet separately. This statistic is + reset during a reconfiguration event. + + + + + subnet[id].assigned-nas + integer + + 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 id is the subnet-id of a given + subnet. This statistic is exposed for each subnet separately. This + statistic is reset during a reconfiguration event. + + + + + subnet[id].total-pds + integer + + 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 + id is the subnet-id of a given subnet. This + statistic is exposed for each subnet separately. This statistic is + reset during a reconfiguration event. + + + + + subnet[id].assigned-pds + integer + + 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 id is the subnet-id of a given + subnet. This statistic is exposed for each subnet separately. This + statistic is reset during a reconfiguration event. + + + + +
diff --cc src/bin/dhcp6/tests/dhcp6_test_utils.cc index dd40b049b9,03847b3eb0..ace8bbfb28 --- a/src/bin/dhcp6/tests/dhcp6_test_utils.cc +++ b/src/bin/dhcp6/tests/dhcp6_test_utils.cc @@@ -745,44 -771,6 +774,43 @@@ Dhcpv6SrvTest::testReleaseReject(Lease: EXPECT_TRUE(LeaseMgrFactory::instance().deleteLease(addr)); } +void +Dhcpv6SrvTest::testReceiveStats(uint8_t pkt_type, const std::string& stat_name) { + - using namespace isc::stats; + 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_);