Parcourir la source

Merge remote-tracking branch 'origin/trac1976-cont-3' into work/merge

Michal 'vorner' Vaner il y a 12 ans
Parent
commit
19df22ab05
45 fichiers modifiés avec 437 ajouts et 478 suppressions
  1. 5 25
      src/bin/auth/auth_srv.cc
  2. 1 23
      src/bin/auth/auth_srv.h
  3. 0 13
      src/bin/auth/b10-auth.xml
  4. 7 31
      src/bin/auth/benchmarks/query_bench.cc
  5. 22 44
      src/bin/auth/command.cc
  6. 2 7
      src/bin/auth/main.cc
  7. 2 14
      src/bin/auth/tests/auth_srv_unittest.cc
  8. 2 2
      src/bin/auth/tests/command_unittest.cc
  9. 1 1
      src/bin/auth/tests/config_unittest.cc
  10. 0 11
      src/bin/bind10/bind10.xml
  11. 2 7
      src/bin/bind10/bind10_src.py.in
  12. 0 2
      src/bin/bind10/tests/bind10_test.py.in
  13. 2 2
      src/bin/cfgmgr/plugins/Makefile.am
  14. 0 0
      src/bin/cfgmgr/plugins/datasrc_config_plugin.py
  15. 4 4
      src/bin/cfgmgr/plugins/tests/datasrc_test.py
  16. 17 21
      src/bin/ddns/tests/ddns_test.py
  17. 7 143
      src/bin/xfrin/tests/xfrin_test.py
  18. 1 1
      src/bin/xfrin/xfrin.py.in
  19. 3 4
      src/bin/xfrin/xfrin_messages.mes
  20. 0 3
      src/lib/datasrc/client_list.cc
  21. 6 1
      src/lib/datasrc/client_list.h
  22. 31 19
      src/lib/datasrc/tests/client_list_unittest.cc
  23. 10 43
      src/lib/python/isc/server_common/auth_command.py
  24. 0 6
      src/lib/python/isc/server_common/server_common_messages.mes
  25. 12 0
      tests/lettuce/configurations/ddns/ddns.config.orig
  26. 16 13
      tests/lettuce/configurations/ddns/noddns.config.orig
  27. 12 0
      tests/lettuce/configurations/example.org.config.orig
  28. 28 1
      tests/lettuce/configurations/example.org.inmem.config
  29. 12 0
      tests/lettuce/configurations/example2.org.config
  30. 16 8
      tests/lettuce/configurations/inmemory_over_sqlite3/secondary.conf
  31. 53 1
      tests/lettuce/configurations/ixfr-out/testset1-config.db
  32. 10 0
      tests/lettuce/configurations/multi_instance/multi_auth.config.orig
  33. 12 0
      tests/lettuce/configurations/no_db_file.config
  34. 36 1
      tests/lettuce/configurations/nsec3/nsec3_auth.config
  35. 16 9
      tests/lettuce/configurations/xfrin/inmem_slave.conf
  36. 10 0
      tests/lettuce/configurations/xfrin/retransfer_slave.conf
  37. 6 6
      tests/lettuce/features/example.feature
  38. 1 1
      tests/lettuce/features/terrain/bind10_control.py
  39. 20 0
      tests/system/bindctl/nsx1/b10-config.db.template.in
  40. 3 3
      tests/system/bindctl/tests.sh
  41. 5 2
      tests/system/glue/example.good
  42. 20 0
      tests/system/glue/nsx1/b10-config.db.in
  43. 0 2
      tests/system/glue/nsx1/root.db
  44. 6 4
      tests/system/glue/tests.sh
  45. 18 0
      tests/system/ixfr/b10-config.db.in

+ 5 - 25
src/bin/auth/auth_srv.cc

@@ -221,10 +221,9 @@ private:
     AuthSrvImpl(const AuthSrvImpl& source);
     AuthSrvImpl(const AuthSrvImpl& source);
     AuthSrvImpl& operator=(const AuthSrvImpl& source);
     AuthSrvImpl& operator=(const AuthSrvImpl& source);
 public:
 public:
-    AuthSrvImpl(const bool use_cache, AbstractXfroutClient& xfrout_client,
+    AuthSrvImpl(AbstractXfroutClient& xfrout_client,
                 BaseSocketSessionForwarder& ddns_forwarder);
                 BaseSocketSessionForwarder& ddns_forwarder);
     ~AuthSrvImpl();
     ~AuthSrvImpl();
-    isc::data::ConstElementPtr setDbFile(isc::data::ConstElementPtr config);
 
 
     bool processNormalQuery(const IOMessage& io_message, Message& message,
     bool processNormalQuery(const IOMessage& io_message, Message& message,
                             OutputBuffer& buffer,
                             OutputBuffer& buffer,
@@ -247,10 +246,6 @@ public:
     ModuleCCSession* config_session_;
     ModuleCCSession* config_session_;
     AbstractSession* xfrin_session_;
     AbstractSession* xfrin_session_;
 
 
-    /// In-memory data source.  Currently class IN only for simplicity.
-    /// Hot spot cache
-    isc::datasrc::HotCache cache_;
-
     /// Interval timer for periodic submission of statistics counters.
     /// Interval timer for periodic submission of statistics counters.
     IntervalTimer statistics_timer_;
     IntervalTimer statistics_timer_;
 
 
@@ -313,8 +308,7 @@ private:
     auth::Query query_;
     auth::Query query_;
 };
 };
 
 
-AuthSrvImpl::AuthSrvImpl(const bool use_cache,
-                         AbstractXfroutClient& xfrout_client,
+AuthSrvImpl::AuthSrvImpl(AbstractXfroutClient& xfrout_client,
                          BaseSocketSessionForwarder& ddns_forwarder) :
                          BaseSocketSessionForwarder& ddns_forwarder) :
     config_session_(NULL),
     config_session_(NULL),
     xfrin_session_(NULL),
     xfrin_session_(NULL),
@@ -324,10 +318,7 @@ AuthSrvImpl::AuthSrvImpl(const bool use_cache,
     xfrout_connected_(false),
     xfrout_connected_(false),
     xfrout_client_(xfrout_client),
     xfrout_client_(xfrout_client),
     ddns_forwarder_("update", ddns_forwarder)
     ddns_forwarder_("update", ddns_forwarder)
-{
-    // enable or disable the cache
-    cache_.setEnabled(use_cache);
-}
+{}
 
 
 AuthSrvImpl::~AuthSrvImpl() {
 AuthSrvImpl::~AuthSrvImpl() {
     if (xfrout_connected_) {
     if (xfrout_connected_) {
@@ -386,11 +377,10 @@ private:
     AuthSrv* server_;
     AuthSrv* server_;
 };
 };
 
 
-AuthSrv::AuthSrv(const bool use_cache,
-                 isc::xfr::AbstractXfroutClient& xfrout_client,
+AuthSrv::AuthSrv(isc::xfr::AbstractXfroutClient& xfrout_client,
                  isc::util::io::BaseSocketSessionForwarder& ddns_forwarder)
                  isc::util::io::BaseSocketSessionForwarder& ddns_forwarder)
 {
 {
-    impl_ = new AuthSrvImpl(use_cache, xfrout_client, ddns_forwarder);
+    impl_ = new AuthSrvImpl(xfrout_client, ddns_forwarder);
     checkin_ = new ConfigChecker(this);
     checkin_ = new ConfigChecker(this);
     dns_lookup_ = new MessageLookup(this);
     dns_lookup_ = new MessageLookup(this);
     dns_answer_ = new MessageAnswer(this);
     dns_answer_ = new MessageAnswer(this);
@@ -470,16 +460,6 @@ AuthSrv::getIOService() {
 }
 }
 
 
 void
 void
-AuthSrv::setCacheSlots(const size_t slots) {
-    impl_->cache_.setSlots(slots);
-}
-
-size_t
-AuthSrv::getCacheSlots() const {
-    return (impl_->cache_.getSlots());
-}
-
-void
 AuthSrv::setXfrinSession(AbstractSession* xfrin_session) {
 AuthSrv::setXfrinSession(AbstractSession* xfrin_session) {
     impl_->xfrin_session_ = xfrin_session;
     impl_->xfrin_session_ = xfrin_session;
 }
 }

+ 1 - 23
src/bin/auth/auth_srv.h

@@ -92,13 +92,11 @@ private:
 public:
 public:
     /// The constructor.
     /// The constructor.
     ///
     ///
-    /// \param use_cache Whether to enable hot spot cache for lookup results.
     /// \param xfrout_client Communication interface with a separate xfrout
     /// \param xfrout_client Communication interface with a separate xfrout
     /// process.  It's normally a reference to an xfr::XfroutClient object,
     /// process.  It's normally a reference to an xfr::XfroutClient object,
     /// but can refer to a local mock object for testing (or other
     /// but can refer to a local mock object for testing (or other
     /// experimental) purposes.
     /// experimental) purposes.
-    AuthSrv(const bool use_cache,
-            isc::xfr::AbstractXfroutClient& xfrout_client,
+    AuthSrv(isc::xfr::AbstractXfroutClient& xfrout_client,
             isc::util::io::BaseSocketSessionForwarder& ddns_forwarder);
             isc::util::io::BaseSocketSessionForwarder& ddns_forwarder);
     ~AuthSrv();
     ~AuthSrv();
     //@}
     //@}
@@ -187,26 +185,6 @@ public:
     /// \brief Return pointer to the Checkin callback function
     /// \brief Return pointer to the Checkin callback function
     isc::asiolink::SimpleCallback* getCheckinProvider() const { return (checkin_); }
     isc::asiolink::SimpleCallback* getCheckinProvider() const { return (checkin_); }
 
 
-    /// \brief Set or update the size (number of slots) of hot spot cache.
-    ///
-    /// If the specified size is 0, it means the size will be unlimited.
-    /// The specified size is recorded even if the cache is disabled; the
-    /// new size will be effective when the cache is enabled.
-    ///
-    /// This method never throws an exception.
-    ///
-    /// \param slots The number of cache slots.
-    void setCacheSlots(const size_t slots);
-
-    /// \brief Get the current size (number of slots) of hot spot cache.
-    ///
-    /// It always returns the recorded size regardless of the cache is enabled.
-    ///
-    /// This method never throws an exception.
-    ///
-    /// \return The current number of cache slots.
-    size_t getCacheSlots() const;
-
     /// \brief Set the communication session with a separate process for
     /// \brief Set the communication session with a separate process for
     /// outgoing zone transfers.
     /// outgoing zone transfers.
     ///
     ///

+ 0 - 13
src/bin/auth/b10-auth.xml

@@ -44,7 +44,6 @@
   <refsynopsisdiv>
   <refsynopsisdiv>
     <cmdsynopsis>
     <cmdsynopsis>
       <command>b10-auth</command>
       <command>b10-auth</command>
-      <arg><option>-n</option></arg>
       <arg><option>-v</option></arg>
       <arg><option>-v</option></arg>
     </cmdsynopsis>
     </cmdsynopsis>
   </refsynopsisdiv>
   </refsynopsisdiv>
@@ -80,18 +79,6 @@
 
 
     <variablelist>
     <variablelist>
       <varlistentry>
       <varlistentry>
-        <term><option>-n</option></term>
-        <listitem><para>
-          Do not cache answers in memory.
-          The default is to use the cache for faster responses.
-	  The cache keeps the most recent 30,000 answers (positive
-	  and negative) in memory for 30 seconds (instead of querying
-	  the data source, such as SQLite3 database, each time).
-        </para></listitem>
-<!-- TODO: this is SQLite3 only -->
-      </varlistentry>
-
-      <varlistentry>
         <term><option>-v</option></term>
         <term><option>-v</option></term>
         <listitem><para>
         <listitem><para>
 	  Enable verbose logging mode. This enables logging of
 	  Enable verbose logging mode. This enables logging of

+ 7 - 31
src/bin/auth/benchmarks/query_bench.cc

@@ -77,10 +77,9 @@ protected:
 private:
 private:
     typedef boost::shared_ptr<const IOEndpoint> IOEndpointPtr;
     typedef boost::shared_ptr<const IOEndpoint> IOEndpointPtr;
 protected:
 protected:
-    QueryBenchMark(const bool enable_cache,
-                   const BenchQueries& queries, Message& query_message,
+    QueryBenchMark(const BenchQueries& queries, Message& query_message,
                    OutputBuffer& buffer) :
                    OutputBuffer& buffer) :
-        server_(new AuthSrv(enable_cache, xfrout_client, ddns_forwarder)),
+        server_(new AuthSrv(xfrout_client, ddns_forwarder)),
         queries_(queries),
         queries_(queries),
         query_message_(query_message),
         query_message_(query_message),
         buffer_(buffer),
         buffer_(buffer),
@@ -119,17 +118,12 @@ private:
 
 
 class Sqlite3QueryBenchMark  : public QueryBenchMark {
 class Sqlite3QueryBenchMark  : public QueryBenchMark {
 public:
 public:
-    Sqlite3QueryBenchMark(const int cache_slots,
-                          const char* const datasrc_file,
+    Sqlite3QueryBenchMark(const char* const datasrc_file,
                           const BenchQueries& queries,
                           const BenchQueries& queries,
                           Message& query_message,
                           Message& query_message,
                           OutputBuffer& buffer) :
                           OutputBuffer& buffer) :
-        QueryBenchMark(cache_slots >= 0 ? true : false, queries,
-                       query_message, buffer)
+        QueryBenchMark(queries, query_message, buffer)
     {
     {
-        if (cache_slots >= 0) {
-            server_->setCacheSlots(cache_slots);
-        }
         server_->updateConfig(Element::fromJSON("{\"database_file\": \"" +
         server_->updateConfig(Element::fromJSON("{\"database_file\": \"" +
                                                 string(datasrc_file) + "\"}"));
                                                 string(datasrc_file) + "\"}"));
     }
     }
@@ -142,7 +136,7 @@ public:
                           const BenchQueries& queries,
                           const BenchQueries& queries,
                           Message& query_message,
                           Message& query_message,
                           OutputBuffer& buffer) :
                           OutputBuffer& buffer) :
-        QueryBenchMark(false, queries, query_message, buffer)
+        QueryBenchMark(queries, query_message, buffer)
     {
     {
         configureAuthServer(*server_,
         configureAuthServer(*server_,
                             Element::fromJSON(
                             Element::fromJSON(
@@ -274,27 +268,9 @@ main(int argc, char* argv[]) {
 
 
     switch (datasrc_type) {
     switch (datasrc_type) {
     case SQLITE3:
     case SQLITE3:
-        cout << "Benchmark enabling Hot Spot Cache with unlimited slots "
-             << endl;
-        BenchMark<Sqlite3QueryBenchMark>(
-            iteration, Sqlite3QueryBenchMark(0, datasrc_file, queries,
-                                             message, buffer));
-
-        cout << "Benchmark enabling Hot Spot Cache with 10*#queries slots "
-             << endl;
-        BenchMark<Sqlite3QueryBenchMark>(
-            iteration, Sqlite3QueryBenchMark(10 * queries.size(), datasrc_file,
-                                             queries, message, buffer));
-
-        cout << "Benchmark enabling Hot Spot Cache with #queries/2 slots "
-             << endl;
-        BenchMark<Sqlite3QueryBenchMark>(
-            iteration, Sqlite3QueryBenchMark(queries.size() / 2, datasrc_file,
-                                             queries, message, buffer));
-
-        cout << "Benchmark disabling Hot Spot Cache" << endl;
+        cout << "Benchmark with SQLite3" << endl;
         BenchMark<Sqlite3QueryBenchMark>(
         BenchMark<Sqlite3QueryBenchMark>(
-            iteration, Sqlite3QueryBenchMark(-1, datasrc_file, queries,
+            iteration, Sqlite3QueryBenchMark(datasrc_file, queries,
                                              message, buffer));
                                              message, buffer));
         break;
         break;
     case MEMORY:
     case MEMORY:

+ 22 - 44
src/bin/auth/command.cc

@@ -143,74 +143,52 @@ public:
 // Handle the "loadzone" command.
 // Handle the "loadzone" command.
 class LoadZoneCommand : public AuthCommand {
 class LoadZoneCommand : public AuthCommand {
 public:
 public:
-    LoadZoneCommand() :
-        zone_class_(RRClass::IN()), // We need to have something to compile
-        origin_(Name::ROOT_NAME())
-    {}
     virtual void exec(AuthSrv& server, isc::data::ConstElementPtr args) {
     virtual void exec(AuthSrv& server, isc::data::ConstElementPtr args) {
-        // parse and validate the args.
-        if (!validate(args)) {
-            return;
+        if (args == NULL) {
+            isc_throw(AuthCommandError, "Null argument");
+        }
+
+        ConstElementPtr class_elem = args->get("class");
+        RRClass zone_class(class_elem ? RRClass(class_elem->stringValue()) :
+            RRClass::IN());
+
+        ConstElementPtr origin_elem = args->get("origin");
+        if (!origin_elem) {
+            isc_throw(AuthCommandError, "Zone origin is missing");
         }
         }
+        Name origin(origin_elem->stringValue());
 
 
         const boost::shared_ptr<isc::datasrc::ConfigurableClientList>
         const boost::shared_ptr<isc::datasrc::ConfigurableClientList>
-            list(server.getClientList(zone_class_));
+            list(server.getClientList(zone_class));
 
 
         if (!list) {
         if (!list) {
             isc_throw(AuthCommandError, "There's no client list for "
             isc_throw(AuthCommandError, "There's no client list for "
-                      "class " << zone_class_);
+                      "class " << zone_class);
         }
         }
 
 
-        switch (list->reload(origin_)) {
+        switch (list->reload(origin)) {
             case ConfigurableClientList::ZONE_RELOADED:
             case ConfigurableClientList::ZONE_RELOADED:
                 // Everything worked fine.
                 // Everything worked fine.
                 LOG_DEBUG(auth_logger, DBG_AUTH_OPS, AUTH_LOAD_ZONE)
                 LOG_DEBUG(auth_logger, DBG_AUTH_OPS, AUTH_LOAD_ZONE)
-                    .arg(zone_class_).arg(origin_);
+                    .arg(zone_class).arg(origin);
                 return;
                 return;
             case ConfigurableClientList::ZONE_NOT_FOUND:
             case ConfigurableClientList::ZONE_NOT_FOUND:
-                isc_throw(AuthCommandError, "Zone " << origin_ << "/" <<
-                          zone_class_ << " was not found in any configure "
+                isc_throw(AuthCommandError, "Zone " << origin << "/" <<
+                          zone_class << " was not found in any configured "
                           "data source. Configure it first.");
                           "data source. Configure it first.");
             case ConfigurableClientList::ZONE_NOT_CACHED:
             case ConfigurableClientList::ZONE_NOT_CACHED:
-                isc_throw(AuthCommandError, "Zone " << origin_ << "/" <<
-                          zone_class_ << " is not served from memory, but "
+                isc_throw(AuthCommandError, "Zone " << origin << "/" <<
+                          zone_class << " is not served from memory, but "
                           "direcly from the data source. It is not possible "
                           "direcly from the data source. It is not possible "
-                          "to reload into memory, configure it to be cached "
+                          "to reload it into memory. Configure it to be cached "
                           "first.");
                           "first.");
             case ConfigurableClientList::CACHE_DISABLED:
             case ConfigurableClientList::CACHE_DISABLED:
                 // This is an internal error. Auth server must have the cache
                 // This is an internal error. Auth server must have the cache
                 // enabled.
                 // enabled.
                 isc_throw(isc::Unexpected, "Cache disabled in client list of "
                 isc_throw(isc::Unexpected, "Cache disabled in client list of "
-                          "class " << zone_class_);
+                          "class " << zone_class);
         }
         }
     }
     }
-
-private:
-    // Parsed arguments
-    RRClass zone_class_;
-    Name origin_;
-
-    // A helper private method to parse and validate command parameters.
-    // On success, it sets 'old_zone_finder_' to the zone to be updated.
-    // It returns true if everything is okay; and false if the command is
-    // valid but there's no need for further process.
-    bool validate(isc::data::ConstElementPtr args) {
-        if (args == NULL) {
-            isc_throw(AuthCommandError, "Null argument");
-        }
-
-        ConstElementPtr class_elem = args->get("class");
-        zone_class_ = class_elem ? RRClass(class_elem->stringValue()) :
-            RRClass::IN();
-
-        ConstElementPtr origin_elem = args->get("origin");
-        if (!origin_elem) {
-            isc_throw(AuthCommandError, "Zone origin is missing");
-        }
-        origin_ = Name(origin_elem->stringValue());
-
-        return (true);
-    }
 };
 };
 
 
 // The factory of command objects.
 // The factory of command objects.

+ 2 - 7
src/bin/auth/main.cc

@@ -85,9 +85,8 @@ my_command_handler(const string& command, ConstElementPtr args) {
 
 
 void
 void
 usage() {
 usage() {
-    cerr << "Usage:  b10-auth [-u user] [-nv]"
+    cerr << "Usage:  b10-auth [-v]"
          << endl;
          << endl;
-    cerr << "\t-n: do not cache answers in memory" << endl;
     cerr << "\t-v: verbose logging (debug-level)" << endl;
     cerr << "\t-v: verbose logging (debug-level)" << endl;
     exit(1);
     exit(1);
 }
 }
@@ -97,14 +96,10 @@ usage() {
 int
 int
 main(int argc, char* argv[]) {
 main(int argc, char* argv[]) {
     int ch;
     int ch;
-    bool cache = true;
     bool verbose = false;
     bool verbose = false;
 
 
     while ((ch = getopt(argc, argv, ":nu:v")) != -1) {
     while ((ch = getopt(argc, argv, ":nu:v")) != -1) {
         switch (ch) {
         switch (ch) {
-        case 'n':
-            cache = false;
-            break;
         case 'v':
         case 'v':
             verbose = true;
             verbose = true;
             break;
             break;
@@ -143,7 +138,7 @@ main(int argc, char* argv[]) {
             specfile = string(AUTH_SPECFILE_LOCATION);
             specfile = string(AUTH_SPECFILE_LOCATION);
         }
         }
 
 
-        auth_server = new AuthSrv(cache, xfrout_client, ddns_forwarder);
+        auth_server = new AuthSrv(xfrout_client, ddns_forwarder);
         LOG_INFO(auth_logger, AUTH_SERVER_CREATED);
         LOG_INFO(auth_logger, AUTH_SERVER_CREATED);
 
 
         SimpleCallback* checkin = auth_server->getCheckinProvider();
         SimpleCallback* checkin = auth_server->getCheckinProvider();

+ 2 - 14
src/bin/auth/tests/auth_srv_unittest.cc

@@ -91,8 +91,7 @@ class AuthSrvTest : public SrvTestBase {
 protected:
 protected:
     AuthSrvTest() :
     AuthSrvTest() :
         dnss_(),
         dnss_(),
-        server(true, xfrout, ddns_forwarder),
-        rrclass(RRClass::IN()),
+        server(xfrout, ddns_forwarder),
         // The empty string is expected value of the parameter of
         // The empty string is expected value of the parameter of
         // requestSocket, not the app_name (there's no fallback, it checks
         // requestSocket, not the app_name (there's no fallback, it checks
         // the empty string is passed).
         // the empty string is passed).
@@ -182,7 +181,6 @@ protected:
     MockXfroutClient xfrout;
     MockXfroutClient xfrout;
     MockSocketSessionForwarder ddns_forwarder;
     MockSocketSessionForwarder ddns_forwarder;
     AuthSrv server;
     AuthSrv server;
-    const RRClass rrclass;
     vector<uint8_t> response_data;
     vector<uint8_t> response_data;
     AddressList address_store_;
     AddressList address_store_;
     TestSocketRequestor sock_requestor_;
     TestSocketRequestor sock_requestor_;
@@ -1034,16 +1032,6 @@ TEST_F(AuthSrvTest,
                 opcode.getCode(), QR_FLAG | AA_FLAG, 1, 1, 1, 0);
                 opcode.getCode(), QR_FLAG | AA_FLAG, 1, 1, 1, 0);
 }
 }
 
 
-TEST_F(AuthSrvTest, cacheSlots) {
-    // simple check for the get/set operations
-    server.setCacheSlots(10);    // 10 = arbitrary choice
-    EXPECT_EQ(10, server.getCacheSlots());
-
-    // 0 is a valid size
-    server.setCacheSlots(0);
-    EXPECT_EQ(00, server.getCacheSlots());
-}
-
 // Submit UDP normal query and check query counter
 // Submit UDP normal query and check query counter
 TEST_F(AuthSrvTest, queryCounterUDPNormal) {
 TEST_F(AuthSrvTest, queryCounterUDPNormal) {
     // The counter should be initialized to 0.
     // The counter should be initialized to 0.
@@ -1679,7 +1667,7 @@ TEST_F(AuthSrvTest, DDNSForwardPushFail) {
 }
 }
 
 
 TEST_F(AuthSrvTest, DDNSForwardClose) {
 TEST_F(AuthSrvTest, DDNSForwardClose) {
-    scoped_ptr<AuthSrv> tmp_server(new AuthSrv(true, xfrout, ddns_forwarder));
+    scoped_ptr<AuthSrv> tmp_server(new AuthSrv(xfrout, ddns_forwarder));
     UnitTestUtil::createRequestMessage(request_message, Opcode::UPDATE(),
     UnitTestUtil::createRequestMessage(request_message, Opcode::UPDATE(),
                                        default_qid, Name("example.com"),
                                        default_qid, Name("example.com"),
                                        RRClass::IN(), RRType::SOA());
                                        RRClass::IN(), RRType::SOA());

+ 2 - 2
src/bin/auth/tests/command_unittest.cc

@@ -63,7 +63,7 @@ namespace {
 class AuthCommandTest : public ::testing::Test {
 class AuthCommandTest : public ::testing::Test {
 protected:
 protected:
     AuthCommandTest() :
     AuthCommandTest() :
-        server_(false, xfrout_, ddns_forwarder_),
+        server_(xfrout_, ddns_forwarder_),
         rcode_(-1),
         rcode_(-1),
         expect_rcode_(0),
         expect_rcode_(0),
         itimer_(server_.getIOService())
         itimer_(server_.getIOService())
@@ -311,7 +311,7 @@ TEST_F(AuthCommandTest,
     result_ = execAuthServerCommand(server_, "loadzone",
     result_ = execAuthServerCommand(server_, "loadzone",
                                     Element::fromJSON(
                                     Element::fromJSON(
                                         "{\"origin\": \"example.org\"}"));
                                         "{\"origin\": \"example.org\"}"));
-    checkAnswer(0, "Successfull load");
+    checkAnswer(0, "Successful load");
 
 
     // And now it should be present too.
     // And now it should be present too.
     EXPECT_EQ(ZoneFinder::SUCCESS, server_.getClientList(RRClass::IN())->
     EXPECT_EQ(ZoneFinder::SUCCESS, server_.getClientList(RRClass::IN())->

+ 1 - 1
src/bin/auth/tests/config_unittest.cc

@@ -54,7 +54,7 @@ protected:
     AuthConfigTest() :
     AuthConfigTest() :
         dnss_(),
         dnss_(),
         rrclass(RRClass::IN()),
         rrclass(RRClass::IN()),
-        server(true, xfrout, ddns_forwarder),
+        server(xfrout, ddns_forwarder),
         // The empty string is expected value of the parameter of
         // The empty string is expected value of the parameter of
         // requestSocket, not the app_name (there's no fallback, it checks
         // requestSocket, not the app_name (there's no fallback, it checks
         // the empty string is passed).
         // the empty string is passed).

+ 0 - 11
src/bin/bind10/bind10.xml

@@ -47,7 +47,6 @@
       <arg><option>-c <replaceable>config-filename</replaceable></option></arg>
       <arg><option>-c <replaceable>config-filename</replaceable></option></arg>
       <arg><option>-i</option></arg>
       <arg><option>-i</option></arg>
       <arg><option>-m <replaceable>file</replaceable></option></arg>
       <arg><option>-m <replaceable>file</replaceable></option></arg>
-      <arg><option>-n</option></arg>
       <arg><option>-p <replaceable>data_path</replaceable></option></arg>
       <arg><option>-p <replaceable>data_path</replaceable></option></arg>
       <arg><option>-u <replaceable>user</replaceable></option></arg>
       <arg><option>-u <replaceable>user</replaceable></option></arg>
       <arg><option>-v</option></arg>
       <arg><option>-v</option></arg>
@@ -57,7 +56,6 @@
       <arg><option>--config-file</option> <replaceable>config-filename</replaceable></arg>
       <arg><option>--config-file</option> <replaceable>config-filename</replaceable></arg>
       <arg><option>--data-path</option> <replaceable>directory</replaceable></arg>
       <arg><option>--data-path</option> <replaceable>directory</replaceable></arg>
       <arg><option>--msgq-socket-file <replaceable>file</replaceable></option></arg>
       <arg><option>--msgq-socket-file <replaceable>file</replaceable></option></arg>
-      <arg><option>--no-cache</option></arg>
       <arg><option>--no-kill</option></arg>
       <arg><option>--no-kill</option></arg>
       <arg><option>--pid-file</option> <replaceable>filename</replaceable></arg>
       <arg><option>--pid-file</option> <replaceable>filename</replaceable></arg>
       <arg><option>--pretty-name <replaceable>name</replaceable></option></arg>
       <arg><option>--pretty-name <replaceable>name</replaceable></option></arg>
@@ -169,15 +167,6 @@
       </varlistentry>
       </varlistentry>
 
 
       <varlistentry>
       <varlistentry>
-        <term><option>-n</option>, <option>--no-cache</option></term>
-        <listitem>
-	  <para>Disables the hot-spot caching used by the
-	    <citerefentry><refentrytitle>b10-auth</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-	  daemon.</para>
-        </listitem>
-      </varlistentry>
-
-      <varlistentry>
         <term><option>-i</option>, <option>--no-kill</option></term>
         <term><option>-i</option>, <option>--no-kill</option></term>
         <listitem>
         <listitem>
 	  <para>When this option is passed, <command>bind10</command>
 	  <para>When this option is passed, <command>bind10</command>

+ 2 - 7
src/bin/bind10/bind10_src.py.in

@@ -168,7 +168,7 @@ class BoB:
     """Boss of BIND class."""
     """Boss of BIND class."""
     
     
     def __init__(self, msgq_socket_file=None, data_path=None,
     def __init__(self, msgq_socket_file=None, data_path=None,
-                 config_filename=None, clear_config=False, nocache=False,
+                 config_filename=None, clear_config=False,
                  verbose=False, nokill=False, setuid=None, setgid=None,
                  verbose=False, nokill=False, setuid=None, setgid=None,
                  username=None, cmdctl_port=None, wait_time=10):
                  username=None, cmdctl_port=None, wait_time=10):
         """
         """
@@ -192,7 +192,6 @@ class BoB:
         self.ccs = None
         self.ccs = None
         self.curproc = None
         self.curproc = None
         self.msgq_socket_file = msgq_socket_file
         self.msgq_socket_file = msgq_socket_file
-        self.nocache = nocache
         self.component_config = {}
         self.component_config = {}
         # Some time in future, it may happen that a single component has
         # Some time in future, it may happen that a single component has
         # multple processes (like a pipeline-like component). If so happens,
         # multple processes (like a pipeline-like component). If so happens,
@@ -568,8 +567,6 @@ class BoB:
         if self.uid is not None and self.__started:
         if self.uid is not None and self.__started:
             logger.warn(BIND10_START_AS_NON_ROOT_AUTH)
             logger.warn(BIND10_START_AS_NON_ROOT_AUTH)
         authargs = ['b10-auth']
         authargs = ['b10-auth']
-        if self.nocache:
-            authargs += ['-n']
         if self.verbose:
         if self.verbose:
             authargs += ['-v']
             authargs += ['-v']
 
 
@@ -1052,8 +1049,6 @@ def parse_args(args=sys.argv[1:], Parser=OptionParser):
     parser.add_option("-m", "--msgq-socket-file", dest="msgq_socket_file",
     parser.add_option("-m", "--msgq-socket-file", dest="msgq_socket_file",
                       type="string", default=None,
                       type="string", default=None,
                       help="UNIX domain socket file the b10-msgq daemon will use")
                       help="UNIX domain socket file the b10-msgq daemon will use")
-    parser.add_option("-n", "--no-cache", action="store_true", dest="nocache",
-                      default=False, help="disable hot-spot cache in authoritative DNS server")
     parser.add_option("-i", "--no-kill", action="store_true", dest="nokill",
     parser.add_option("-i", "--no-kill", action="store_true", dest="nokill",
                       default=False, help="do not send SIGTERM and SIGKILL signals to modules during shutdown")
                       default=False, help="do not send SIGTERM and SIGKILL signals to modules during shutdown")
     parser.add_option("-u", "--user", dest="user", type="string", default=None,
     parser.add_option("-u", "--user", dest="user", type="string", default=None,
@@ -1208,7 +1203,7 @@ def main():
         # Go bob!
         # Go bob!
         boss_of_bind = BoB(options.msgq_socket_file, options.data_path,
         boss_of_bind = BoB(options.msgq_socket_file, options.data_path,
                            options.config_file, options.clear_config,
                            options.config_file, options.clear_config,
-                           options.nocache, options.verbose, options.nokill,
+                           options.verbose, options.nokill,
                            setuid, setgid, username, options.cmdctl_port,
                            setuid, setgid, username, options.cmdctl_port,
                            options.wait_time)
                            options.wait_time)
         startup_result = boss_of_bind.startup()
         startup_result = boss_of_bind.startup()

+ 0 - 2
src/bin/bind10/tests/bind10_test.py.in

@@ -349,7 +349,6 @@ class TestBoB(unittest.TestCase):
         self.assertEqual(bob.runnable, False)
         self.assertEqual(bob.runnable, False)
         self.assertEqual(bob.uid, None)
         self.assertEqual(bob.uid, None)
         self.assertEqual(bob.username, None)
         self.assertEqual(bob.username, None)
-        self.assertEqual(bob.nocache, False)
         self.assertIsNone(bob._socket_cache)
         self.assertIsNone(bob._socket_cache)
 
 
     def test_set_creator(self):
     def test_set_creator(self):
@@ -377,7 +376,6 @@ class TestBoB(unittest.TestCase):
         self.assertEqual(bob.runnable, False)
         self.assertEqual(bob.runnable, False)
         self.assertEqual(bob.uid, None)
         self.assertEqual(bob.uid, None)
         self.assertEqual(bob.username, None)
         self.assertEqual(bob.username, None)
-        self.assertEqual(bob.nocache, False)
 
 
     def test_command_handler(self):
     def test_command_handler(self):
         class DummySession():
         class DummySession():

+ 2 - 2
src/bin/cfgmgr/plugins/Makefile.am

@@ -8,10 +8,10 @@ datasrc.spec: datasrc.spec.pre
 config_plugindir = @prefix@/share/@PACKAGE@/config_plugins
 config_plugindir = @prefix@/share/@PACKAGE@/config_plugins
 config_plugin_DATA = logging.spec tsig_keys.spec datasrc.spec
 config_plugin_DATA = logging.spec tsig_keys.spec datasrc.spec
 
 
-python_PYTHON = b10logging.py tsig_keys.py datasrc.py
+python_PYTHON = b10logging.py tsig_keys.py datasrc_config_plugin.py
 pythondir = $(config_plugindir)
 pythondir = $(config_plugindir)
 
 
-CLEANFILES = b10logging.pyc tsig_keys.pyc
+CLEANFILES = b10logging.pyc tsig_keys.pyc datasrc.spec
 CLEANDIRS = __pycache__
 CLEANDIRS = __pycache__
 
 
 clean-local:
 clean-local:

src/bin/cfgmgr/plugins/datasrc.py → src/bin/cfgmgr/plugins/datasrc_config_plugin.py


+ 4 - 4
src/bin/cfgmgr/plugins/tests/datasrc_test.py

@@ -18,7 +18,7 @@ import sys
 import os
 import os
 sys.path.extend(os.environ["B10_TEST_PLUGIN_DIR"].split(':'))
 sys.path.extend(os.environ["B10_TEST_PLUGIN_DIR"].split(':'))
 
 
-import datasrc
+import datasrc_config_plugin
 import unittest
 import unittest
 
 
 class DatasrcTest(unittest.TestCase):
 class DatasrcTest(unittest.TestCase):
@@ -26,11 +26,11 @@ class DatasrcTest(unittest.TestCase):
         """
         """
         Checks the entry point returns the correct values.
         Checks the entry point returns the correct values.
         """
         """
-        (spec, check) = datasrc.load()
+        (spec, check) = datasrc_config_plugin.load()
         # It returns the checking function
         # It returns the checking function
-        self.assertEqual(check, datasrc.check)
+        self.assertEqual(check, datasrc_config_plugin.check)
         # The plugin stores it's spec
         # The plugin stores it's spec
-        self.assertEqual(spec, datasrc.spec)
+        self.assertEqual(spec, datasrc_config_plugin.spec)
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
         unittest.main()
         unittest.main()

+ 17 - 21
src/bin/ddns/tests/ddns_test.py

@@ -1132,7 +1132,7 @@ class TestDDNSSession(unittest.TestCase):
         num_rrsets = len(self.__req_message.get_section(SECTION_PREREQUISITE))
         num_rrsets = len(self.__req_message.get_section(SECTION_PREREQUISITE))
         self.assertEqual(2, num_rrsets)
         self.assertEqual(2, num_rrsets)
 
 
-    def check_session_msg(self, result, expect_recv=1, notify_auth=False):
+    def check_session_msg(self, result, expect_recv=2):
         '''Check post update communication with other modules.'''
         '''Check post update communication with other modules.'''
         # iff the update succeeds, b10-ddns should tell interested other
         # iff the update succeeds, b10-ddns should tell interested other
         # modules the information about the update zone.  Possible modules
         # modules the information about the update zone.  Possible modules
@@ -1141,32 +1141,28 @@ class TestDDNSSession(unittest.TestCase):
         #                         'zone_class', <updated_zone_class>}]}
         #                         'zone_class', <updated_zone_class>}]}
         # for auth, it should be:
         # for auth, it should be:
         # {'command': ['loadzone', {'origin': <updated_zone_name>,
         # {'command': ['loadzone', {'origin': <updated_zone_name>,
-        #                           'class', <updated_zone_class>,
-        #                           'datasrc', <datasrc type, should be
-        #                                       "memory" in practice>}]}
+        #                           'class', <updated_zone_class>}]}
         # and expect an answer by calling group_recvmsg().
         # and expect an answer by calling group_recvmsg().
         #
         #
         # expect_recv indicates the expected number of calls to
         # expect_recv indicates the expected number of calls to
-        # group_recvmsg(), which is normally 1, but can be 0 if send fails;
+        # group_recvmsg(), which is normally 2, but can be 0 if send fails;
         # if the message is to be sent
         # if the message is to be sent
         if result == UPDATE_SUCCESS:
         if result == UPDATE_SUCCESS:
-            expected_sentmsg = 2 if notify_auth else 1
+            expected_sentmsg = 2
             self.assertEqual(expected_sentmsg,
             self.assertEqual(expected_sentmsg,
                              len(self.__cc_session._sent_msg))
                              len(self.__cc_session._sent_msg))
             self.assertEqual(expect_recv, self.__cc_session._recvmsg_called)
             self.assertEqual(expect_recv, self.__cc_session._recvmsg_called)
             msg_cnt = 0
             msg_cnt = 0
-            if notify_auth:
-                sent_msg, sent_group = self.__cc_session._sent_msg[msg_cnt]
-                sent_cmd = sent_msg['command']
-                self.assertEqual('Auth', sent_group)
-                self.assertEqual('loadzone', sent_cmd[0])
-                self.assertEqual(3, len(sent_cmd[1]))
-                self.assertEqual(TEST_ZONE_NAME.to_text(),
-                                 sent_cmd[1]['origin'])
-                self.assertEqual(TEST_RRCLASS.to_text(),
-                                 sent_cmd[1]['class'])
-                self.assertEqual('memory', sent_cmd[1]['datasrc'])
-                msg_cnt += 1
+            sent_msg, sent_group = self.__cc_session._sent_msg[msg_cnt]
+            sent_cmd = sent_msg['command']
+            self.assertEqual('Auth', sent_group)
+            self.assertEqual('loadzone', sent_cmd[0])
+            self.assertEqual(2, len(sent_cmd[1]))
+            self.assertEqual(TEST_ZONE_NAME.to_text(),
+                             sent_cmd[1]['origin'])
+            self.assertEqual(TEST_RRCLASS.to_text(),
+                             sent_cmd[1]['class'])
+            msg_cnt += 1
             sent_msg, sent_group = self.__cc_session._sent_msg[msg_cnt]
             sent_msg, sent_group = self.__cc_session._sent_msg[msg_cnt]
             sent_cmd = sent_msg['command']
             sent_cmd = sent_msg['command']
             self.assertEqual('Xfrout', sent_group)
             self.assertEqual('Xfrout', sent_group)
@@ -1232,21 +1228,21 @@ class TestDDNSSession(unittest.TestCase):
             [{'type': 'memory', 'class': 'IN', 'zones': [
             [{'type': 'memory', 'class': 'IN', 'zones': [
                     {'origin': TEST_ZONE_NAME_STR, 'filetype': 'sqlite3'}]}]
                     {'origin': TEST_ZONE_NAME_STR, 'filetype': 'sqlite3'}]}]
         self.check_session()
         self.check_session()
-        self.check_session_msg(UPDATE_SUCCESS, expect_recv=2, notify_auth=True)
+        self.check_session_msg(UPDATE_SUCCESS)
 
 
         # Let sendmsg() raise an exception.  The first exception shouldn't
         # Let sendmsg() raise an exception.  The first exception shouldn't
         # stop sending the second message.  There's just no recv calls.
         # stop sending the second message.  There's just no recv calls.
         self.__cc_session.clear_msg()
         self.__cc_session.clear_msg()
         self.__cc_session._sendmsg_exception = SessionError('send error')
         self.__cc_session._sendmsg_exception = SessionError('send error')
         self.check_session()
         self.check_session()
-        self.check_session_msg(UPDATE_SUCCESS, expect_recv=0, notify_auth=True)
+        self.check_session_msg(UPDATE_SUCCESS, expect_recv=0)
 
 
         # Likewise, in the case recvmsg() raises (and there should be recv
         # Likewise, in the case recvmsg() raises (and there should be recv
         # calls in this case)
         # calls in this case)
         self.__cc_session.clear_msg()
         self.__cc_session.clear_msg()
         self.__cc_session._recvmsg_exception = SessionError('recv error')
         self.__cc_session._recvmsg_exception = SessionError('recv error')
         self.check_session()
         self.check_session()
-        self.check_session_msg(UPDATE_SUCCESS, expect_recv=2, notify_auth=True)
+        self.check_session_msg(UPDATE_SUCCESS)
 
 
     def test_session_with_config(self):
     def test_session_with_config(self):
         '''Check a session with more realistic config setups.
         '''Check a session with more realistic config setups.

+ 7 - 143
src/bin/xfrin/tests/xfrin_test.py

@@ -2739,18 +2739,8 @@ class TestMain(unittest.TestCase):
 
 
 class TestXfrinProcessMockCC:
 class TestXfrinProcessMockCC:
     def __init__(self):
     def __init__(self):
-        self.get_called = False
-        self.get_called_correctly = False
         self.config = []
         self.config = []
 
 
-    def get_remote_config_value(self, module, identifier):
-        self.get_called = True
-        if module == 'Auth' and identifier == 'datasources':
-            self.get_called_correctly = True
-            return (self.config, False)
-        else:
-            return (None, True)
-
 class TestXfrinProcessMockCCSession:
 class TestXfrinProcessMockCCSession:
     def __init__(self):
     def __init__(self):
         self.send_called = False
         self.send_called = False
@@ -2869,22 +2859,17 @@ class TestXfrinProcess(unittest.TestCase):
         # Create a connection for each attempt
         # Create a connection for each attempt
         self.assertEqual(len(transfers), self.__created_connections)
         self.assertEqual(len(transfers), self.__created_connections)
         self.assertEqual([published], self.__published)
         self.assertEqual([published], self.__published)
-        if published == XFRIN_OK:
-            self.assertTrue(self._module_cc.get_called)
-            self.assertTrue(self._module_cc.get_called_correctly)
-        else:
-            self.assertFalse(self._module_cc.get_called)
-            self.assertFalse(self._module_cc.get_called_correctly)
 
 
     def test_ixfr_ok(self):
     def test_ixfr_ok(self):
         """
         """
         Everything OK the first time, over IXFR.
         Everything OK the first time, over IXFR.
         """
         """
         self.__do_test([XFRIN_OK], [RRType.IXFR()], RRType.IXFR())
         self.__do_test([XFRIN_OK], [RRType.IXFR()], RRType.IXFR())
-        self.assertFalse(self._send_cc_session.send_called)
-        self.assertFalse(self._send_cc_session.send_called_correctly)
-        self.assertFalse(self._send_cc_session.recv_called)
-        self.assertFalse(self._send_cc_session.recv_called_correctly)
+        # Check there was loadzone command
+        self.assertTrue(self._send_cc_session.send_called)
+        self.assertTrue(self._send_cc_session.send_called_correctly)
+        self.assertTrue(self._send_cc_session.recv_called)
+        self.assertTrue(self._send_cc_session.recv_called_correctly)
 
 
     def test_axfr_ok(self):
     def test_axfr_ok(self):
         """
         """
@@ -2916,137 +2901,16 @@ class TestXfrinProcess(unittest.TestCase):
         self.__do_test([XFRIN_FAIL, XFRIN_FAIL],
         self.__do_test([XFRIN_FAIL, XFRIN_FAIL],
                        [RRType.IXFR(), RRType.AXFR()], RRType.IXFR())
                        [RRType.IXFR(), RRType.AXFR()], RRType.IXFR())
 
 
-    def test_inmem_ok(self):
+    def test_send_loadzone(self):
         """
         """
-        Inmem configuration where all the configuration is just right
-        for loadzone to be sent to b10-auth (origin is the name received
-        by xfrin, filetype is sqlite3, type is memory and class is the
-        one received by xfrin).
+        Check the loadzone command is sent after successful transfer.
         """
         """
-        self._module_cc.config = [{'zones': [{'origin': 'example.org', 'filetype': 'sqlite3',
-                                              'file': 'data/inmem-xfrin.sqlite3'}],
-                                   'type': 'memory', 'class': 'IN'}]
         self.__do_test([XFRIN_OK], [RRType.IXFR()], RRType.IXFR())
         self.__do_test([XFRIN_OK], [RRType.IXFR()], RRType.IXFR())
         self.assertTrue(self._send_cc_session.send_called)
         self.assertTrue(self._send_cc_session.send_called)
         self.assertTrue(self._send_cc_session.send_called_correctly)
         self.assertTrue(self._send_cc_session.send_called_correctly)
         self.assertTrue(self._send_cc_session.recv_called)
         self.assertTrue(self._send_cc_session.recv_called)
         self.assertTrue(self._send_cc_session.recv_called_correctly)
         self.assertTrue(self._send_cc_session.recv_called_correctly)
 
 
-    def test_inmem_datasource_type_not_memory(self):
-        """
-        Inmem configuration where the datasource type is not memory. In
-        this case, loadzone should not be sent to b10-auth.
-        """
-        self._module_cc.config = [{'zones': [{'origin': 'example.org', 'filetype': 'sqlite3',
-                                              'file': 'data/inmem-xfrin.sqlite3'}],
-                                   'type': 'punched-card', 'class': 'IN'}]
-        self.__do_test([XFRIN_OK], [RRType.IXFR()], RRType.IXFR())
-        self.assertFalse(self._send_cc_session.send_called)
-        self.assertFalse(self._send_cc_session.send_called_correctly)
-        self.assertFalse(self._send_cc_session.recv_called)
-        self.assertFalse(self._send_cc_session.recv_called_correctly)
-
-    def test_inmem_datasource_type_is_missing(self):
-        """
-        Inmem configuration where the datasource type is missing. In
-        this case, loadzone should not be sent to b10-auth.
-        """
-        self._module_cc.config = [{'zones': [{'origin': 'example.org', 'filetype': 'sqlite3',
-                                              'file': 'data/inmem-xfrin.sqlite3'}],
-                                   'class': 'IN'}]
-        self.__do_test([XFRIN_OK], [RRType.IXFR()], RRType.IXFR())
-        self.assertFalse(self._send_cc_session.send_called)
-        self.assertFalse(self._send_cc_session.send_called_correctly)
-        self.assertFalse(self._send_cc_session.recv_called)
-        self.assertFalse(self._send_cc_session.recv_called_correctly)
-
-    def test_inmem_backend_type_not_sqlite3(self):
-        """
-        Inmem configuration where the datasource backing file is not of
-        type sqlite3. In this case, loadzone should not be sent to
-        b10-auth.
-        """
-        self._module_cc.config = [{'zones': [{'origin': 'example.org', 'filetype': 'postgresql',
-                                              'file': 'data/inmem-xfrin.db'}],
-                                   'type': 'memory', 'class': 'IN'}]
-        self.__do_test([XFRIN_OK], [RRType.IXFR()], RRType.IXFR())
-        self.assertFalse(self._send_cc_session.send_called)
-        self.assertFalse(self._send_cc_session.send_called_correctly)
-        self.assertFalse(self._send_cc_session.recv_called)
-        self.assertFalse(self._send_cc_session.recv_called_correctly)
-
-    def test_inmem_backend_type_is_missing(self):
-        """
-        Inmem configuration where the datasource backing file type is
-        not set. In this case, loadzone should not be sent to b10-auth.
-        """
-        self._module_cc.config = [{'zones': [{'origin': 'example.org',
-                                              'file': 'data/inmem-xfrin'}],
-                                   'type': 'memory', 'class': 'IN'}]
-        self.__do_test([XFRIN_OK], [RRType.IXFR()], RRType.IXFR())
-        self.assertFalse(self._send_cc_session.send_called)
-        self.assertFalse(self._send_cc_session.send_called_correctly)
-        self.assertFalse(self._send_cc_session.recv_called)
-        self.assertFalse(self._send_cc_session.recv_called_correctly)
-
-    def test_inmem_class_is_different(self):
-        """
-        Inmem configuration where the datasource class does not match
-        the received class. In this case, loadzone should not be sent to
-        b10-auth.
-        """
-        self._module_cc.config = [{'zones': [{'origin': 'example.org', 'filetype': 'sqlite3',
-                                              'file': 'data/inmem-xfrin.sqlite3'}],
-                                   'type': 'memory', 'class': 'XX'}]
-        self.__do_test([XFRIN_OK], [RRType.IXFR()], RRType.IXFR())
-        self.assertFalse(self._send_cc_session.send_called)
-        self.assertFalse(self._send_cc_session.send_called_correctly)
-        self.assertFalse(self._send_cc_session.recv_called)
-        self.assertFalse(self._send_cc_session.recv_called_correctly)
-
-    def test_inmem_class_is_missing(self):
-        """
-        Inmem configuration where the datasource class is missing. In
-        this case, we assume the IN class and loadzone may be sent to
-        b10-auth if everything else matches.
-        """
-        self._module_cc.config = [{'zones': [{'origin': 'example.org', 'filetype': 'sqlite3',
-                                              'file': 'data/inmem-xfrin.sqlite3'}],
-                                   'type': 'memory'}]
-        self.__do_test([XFRIN_OK], [RRType.IXFR()], RRType.IXFR())
-        self.assertTrue(self._send_cc_session.send_called)
-        self.assertTrue(self._send_cc_session.send_called_correctly)
-        self.assertTrue(self._send_cc_session.recv_called)
-        self.assertTrue(self._send_cc_session.recv_called_correctly)
-
-    def test_inmem_name_doesnt_match(self):
-        """
-        Inmem configuration where the origin does not match the received
-        name. In this case, loadzone should not be sent to b10-auth.
-        """
-        self._module_cc.config = [{'zones': [{'origin': 'isc.org', 'filetype': 'sqlite3',
-                                              'file': 'data/inmem-xfrin.sqlite3'}],
-                                   'type': 'memory', 'class': 'IN'}]
-        self.__do_test([XFRIN_OK], [RRType.IXFR()], RRType.IXFR())
-        self.assertFalse(self._send_cc_session.send_called)
-        self.assertFalse(self._send_cc_session.send_called_correctly)
-        self.assertFalse(self._send_cc_session.recv_called)
-        self.assertFalse(self._send_cc_session.recv_called_correctly)
-
-    def test_inmem_name_is_missing(self):
-        """
-        Inmem configuration where the origin is missing. In this case,
-        loadzone should not be sent to b10-auth.
-        """
-        self._module_cc.config = [{'zones': [{'filetype': 'sqlite3',
-                                              'file': 'data/inmem-xfrin.sqlite3'}],
-                                   'type': 'memory', 'class': 'IN'}]
-        self.__do_test([XFRIN_OK], [RRType.IXFR()], RRType.IXFR())
-        self.assertFalse(self._send_cc_session.send_called)
-        self.assertFalse(self._send_cc_session.send_called_correctly)
-        self.assertFalse(self._send_cc_session.recv_called)
-        self.assertFalse(self._send_cc_session.recv_called_correctly)
-
 class TestFormatting(unittest.TestCase):
 class TestFormatting(unittest.TestCase):
     # If the formatting functions are moved to a more general library
     # If the formatting functions are moved to a more general library
     # (ticket #1379), these tests should be moved with them.
     # (ticket #1379), these tests should be moved with them.

+ 1 - 1
src/bin/xfrin/xfrin.py.in

@@ -1252,7 +1252,7 @@ def _do_auth_loadzone(server, zone_name, zone_class):
     if msg is not None:
     if msg is not None:
         param = msg['command'][1]
         param = msg['command'][1]
         logger.debug(DBG_XFRIN_TRACE, XFRIN_AUTH_LOADZONE, param["origin"],
         logger.debug(DBG_XFRIN_TRACE, XFRIN_AUTH_LOADZONE, param["origin"],
-                     param["class"], param["datasrc"])
+                     param["class"])
         seq = server._send_cc_session.group_sendmsg(msg, AUTH_MODULE_NAME)
         seq = server._send_cc_session.group_sendmsg(msg, AUTH_MODULE_NAME)
         answer, env = server._send_cc_session.group_recvmsg(False, seq)
         answer, env = server._send_cc_session.group_recvmsg(False, seq)
 
 

+ 3 - 4
src/bin/xfrin/xfrin_messages.mes

@@ -15,10 +15,9 @@
 # No namespace declaration - these constants go in the global namespace
 # No namespace declaration - these constants go in the global namespace
 # of the xfrin messages python module.
 # of the xfrin messages python module.
 
 
-% XFRIN_AUTH_LOADZONE sending Auth loadzone for origin=%1, class=%2, datasrc=%3
-There was a successful zone transfer, and the zone is served by b10-auth
-in the in-memory data source using sqlite3 as a backend. We send the
-"loadzone" command for the zone to b10-auth.
+% XFRIN_AUTH_LOADZONE sending Auth loadzone for origin=%1, class=%2
+There was a successful zone transfer.  We send the "loadzone" command for the
+zone to b10-auth.
 
 
 % XFRIN_AXFR_INCONSISTENT_SOA AXFR SOAs are inconsistent for %1: %2 expected, %3 received
 % XFRIN_AXFR_INCONSISTENT_SOA AXFR SOAs are inconsistent for %1: %2 expected, %3 received
 The serial fields of the first and last SOAs of AXFR (including AXFR-style
 The serial fields of the first and last SOAs of AXFR (including AXFR-style

+ 0 - 3
src/lib/datasrc/client_list.cc

@@ -254,9 +254,6 @@ ConfigurableClientList::findInternal(MutableResult& candidate,
 
 
     // TODO: In case we have only the datasource and not the finder
     // TODO: In case we have only the datasource and not the finder
     // and the need_updater parameter is true, get the zone there.
     // and the need_updater parameter is true, get the zone there.
-
-    // Return the partial match we have. In case we didn't want a partial
-    // match, this surely contains the original empty result.
 }
 }
 
 
 ConfigurableClientList::ReloadResult
 ConfigurableClientList::ReloadResult

+ 6 - 1
src/lib/datasrc/client_list.h

@@ -192,7 +192,8 @@ public:
     /// \param rrclass For which class the list should work.
     /// \param rrclass For which class the list should work.
     ConfigurableClientList(const isc::dns::RRClass &rrclass) :
     ConfigurableClientList(const isc::dns::RRClass &rrclass) :
         rrclass_(rrclass),
         rrclass_(rrclass),
-        configuration_(new isc::data::ListElement)
+        configuration_(new isc::data::ListElement),
+        allow_cache_(false)
     {}
     {}
     /// \brief Exception thrown when there's an error in configuration.
     /// \brief Exception thrown when there's an error in configuration.
     class ConfigurationError : public Exception {
     class ConfigurationError : public Exception {
@@ -330,6 +331,10 @@ private:
     ///
     ///
     /// The result is returned as parameter because MutableResult is not
     /// The result is returned as parameter because MutableResult is not
     /// defined in the header file.
     /// defined in the header file.
+    ///
+    /// If there's no match, the result is not modified. Therefore, this
+    /// expects to get a fresh result object each time it is called, not
+    /// to reuse it.
     void findInternal(MutableResult& result, const dns::Name& name,
     void findInternal(MutableResult& result, const dns::Name& name,
                       bool want_exact_match, bool want_finder) const;
                       bool want_exact_match, bool want_finder) const;
     const isc::dns::RRClass rrclass_;
     const isc::dns::RRClass rrclass_;

+ 31 - 19
src/lib/datasrc/tests/client_list_unittest.cc

@@ -25,6 +25,7 @@
 #include <gtest/gtest.h>
 #include <gtest/gtest.h>
 
 
 #include <set>
 #include <set>
+#include <fstream>
 
 
 using namespace isc::datasrc;
 using namespace isc::datasrc;
 using namespace isc::data;
 using namespace isc::data;
@@ -255,7 +256,8 @@ public:
                                               0, 0, 0, 0, 0));
                                               0, 0, 0, 0, 0));
             finder->add(soa);
             finder->add(soa);
         }
         }
-        // We leave the zone empty, so we can check it was reloaded.
+        // If we don't do prefill, we leave the zone empty. This way,
+        // we can check when it was reloaded.
         cache->addZone(finder);
         cache->addZone(finder);
         list_->getDataSources()[index].cache_ = cache;
         list_->getDataSources()[index].cache_ = cache;
     }
     }
@@ -763,7 +765,8 @@ TEST_F(ListTest, masterFiles) {
     list_->configure(elem, true);
     list_->configure(elem, true);
 
 
     // It has only the cache
     // It has only the cache
-    EXPECT_EQ(NULL, list_->getDataSources()[0].data_src_client_);
+    EXPECT_EQ(static_cast<isc::datasrc::DataSourceClient*>(NULL),
+              list_->getDataSources()[0].data_src_client_);
 
 
     // And it can search
     // And it can search
     positiveResult(list_->find(Name(".")), ds_[0], Name("."), true, "com",
     positiveResult(list_->find(Name(".")), ds_[0], Name("."), true, "com",
@@ -810,7 +813,9 @@ TEST_F(ListTest, reloadNotEnabled) {
 TEST_F(ListTest, reloadNoSuchZone) {
 TEST_F(ListTest, reloadNoSuchZone) {
     list_->configure(config_elem_zones_, true);
     list_->configure(config_elem_zones_, true);
     Name name("example.org");
     Name name("example.org");
-    // We put the cache in even when not enabled. This won't confuse the thing.
+    // We put the cache in even when not enabled. This won't confuse the
+    // reload method, as that one looks at the real state of things, not
+    // at the configuration.
     prepareCache(0, Name("example.com"));
     prepareCache(0, Name("example.com"));
     // Not in the data sources
     // Not in the data sources
     EXPECT_EQ(ConfigurableClientList::ZONE_NOT_FOUND,
     EXPECT_EQ(ConfigurableClientList::ZONE_NOT_FOUND,
@@ -821,9 +826,12 @@ TEST_F(ListTest, reloadNoSuchZone) {
     EXPECT_EQ(ConfigurableClientList::ZONE_NOT_FOUND,
     EXPECT_EQ(ConfigurableClientList::ZONE_NOT_FOUND,
               list_->reload(Name("sub.example.com")));
               list_->reload(Name("sub.example.com")));
     // Nothing changed here - these zones don't exist
     // Nothing changed here - these zones don't exist
-    EXPECT_EQ(NULL, list_->find(name).dsrc_client_);
-    EXPECT_EQ(NULL, list_->find(Name("example.cz")).dsrc_client_);
-    EXPECT_EQ(NULL, list_->find(Name("sub.example.com"), true).dsrc_client_);
+    EXPECT_EQ(static_cast<isc::datasrc::DataSourceClient*>(NULL),
+              list_->find(name).dsrc_client_);
+    EXPECT_EQ(static_cast<isc::datasrc::DataSourceClient*>(NULL),
+              list_->find(Name("example.cz")).dsrc_client_);
+    EXPECT_EQ(static_cast<isc::datasrc::DataSourceClient*>(NULL),
+              list_->find(Name("sub.example.com"), true).dsrc_client_);
     // Not reloaded
     // Not reloaded
     EXPECT_EQ(ZoneFinder::NXRRSET,
     EXPECT_EQ(ZoneFinder::NXRRSET,
               list_->find(Name("example.com")).finder_->
               list_->find(Name("example.com")).finder_->
@@ -880,32 +888,36 @@ TEST_F(ListTest, reloadNullIterator) {
 
 
 // Test we can reload the master files too (special-cased)
 // Test we can reload the master files too (special-cased)
 TEST_F(ListTest, reloadMasterFile) {
 TEST_F(ListTest, reloadMasterFile) {
+    const char* const install_cmd = INSTALL_PROG " -c " TEST_DATA_DIR
+        "/root.zone " TEST_DATA_BUILDDIR "/root.zone.copied";
+    if (system(install_cmd) != 0) {
+        // any exception will do, this is failure in test setup, but
+        // nice to show the command that fails, and shouldn't be caught
+        isc_throw(isc::Exception,
+          "Error setting up; command failed: " << install_cmd);
+    }
+
     const ConstElementPtr elem(Element::fromJSON("["
     const ConstElementPtr elem(Element::fromJSON("["
         "{"
         "{"
         "   \"type\": \"MasterFiles\","
         "   \"type\": \"MasterFiles\","
         "   \"cache-enable\": true,"
         "   \"cache-enable\": true,"
         "   \"params\": {"
         "   \"params\": {"
-        "       \".\": \"" TEST_DATA_DIR "/root.zone\""
+        "       \".\": \"" TEST_DATA_BUILDDIR "/root.zone.copied\""
         "   }"
         "   }"
         "}]"));
         "}]"));
     list_->configure(elem, true);
     list_->configure(elem, true);
-    // Add an element there so it differs from the one in file.
+    // Add a record that is not in the zone
     EXPECT_EQ(ZoneFinder::NXDOMAIN,
     EXPECT_EQ(ZoneFinder::NXDOMAIN,
               list_->find(Name(".")).finder_->find(Name("nosuchdomain"),
               list_->find(Name(".")).finder_->find(Name("nosuchdomain"),
                                                    RRType::TXT())->code);
                                                    RRType::TXT())->code);
-    RRsetPtr txt(new RRset(Name("nosuchdomain"), RRClass::IN(), RRType::TXT(),
-                                RRTTL(3600)));
-    txt->addRdata(rdata::generic::TXT("test"));
-    dynamic_pointer_cast<InMemoryZoneFinder>(list_->find(Name(".")).finder_)->
-        add(txt);
-    // It is here now.
-    EXPECT_EQ(ZoneFinder::SUCCESS,
-              list_->find(Name(".")).finder_->find(Name("nosuchdomain"),
-                                                   RRType::TXT())->code);
+    ofstream f;
+    f.open(TEST_DATA_BUILDDIR "/root.zone.copied", ios::out | ios::app);
+    f << "nosuchdomain.\t\t3600\tIN\tTXT\ttest" << std::endl;
+    f.close();
     // Do the reload.
     // Do the reload.
     EXPECT_EQ(ConfigurableClientList::ZONE_RELOADED, list_->reload(Name(".")));
     EXPECT_EQ(ConfigurableClientList::ZONE_RELOADED, list_->reload(Name(".")));
-    // And our TXT record disappeared again, as it is not in the file.
-    EXPECT_EQ(ZoneFinder::NXDOMAIN,
+    // It is here now.
+    EXPECT_EQ(ZoneFinder::SUCCESS,
               list_->find(Name(".")).finder_->find(Name("nosuchdomain"),
               list_->find(Name(".")).finder_->find(Name("nosuchdomain"),
                                                    RRType::TXT())->code);
                                                    RRType::TXT())->code);
 }
 }

+ 10 - 43
src/lib/python/isc/server_common/auth_command.py

@@ -26,9 +26,7 @@ AUTH_MODULE_NAME = 'Auth'
 def auth_loadzone_command(module_cc, zone_name, zone_class):
 def auth_loadzone_command(module_cc, zone_name, zone_class):
     '''Create a 'loadzone' command with a given zone for Auth server.
     '''Create a 'loadzone' command with a given zone for Auth server.
 
 
-    This function checks the Auth module configuration to see if it
-    servers a given zone via an in-memory data source on top of SQLite3
-    data source, and, if so, generate an inter-module command for Auth
+    This function generates an inter-module command for Auth
     to force it to reload the zone.
     to force it to reload the zone.
 
 
     Parameters:
     Parameters:
@@ -38,9 +36,7 @@ def auth_loadzone_command(module_cc, zone_name, zone_class):
     zone_class (isc.dns.RRClass): the RR class of the zone to be possibly
     zone_class (isc.dns.RRClass): the RR class of the zone to be possibly
       reloaded.
       reloaded.
 
 
-    Return: a CC command message for the reload if the zone is found;
-      otherwise None.
-
+    Return: a CC command message for the reload.
     '''
     '''
     # Note: this function was originally a dedicated subroutine of xfrin,
     # Note: this function was originally a dedicated subroutine of xfrin,
     # but was moved here so it can be shared by some other modules
     # but was moved here so it can be shared by some other modules
@@ -50,41 +46,12 @@ def auth_loadzone_command(module_cc, zone_name, zone_class):
     # deprecated (which is a more likely scenario).  For this reason, the
     # deprecated (which is a more likely scenario).  For this reason, the
     # corresponding tests were still kept in xfrin.
     # corresponding tests were still kept in xfrin.
 
 
-    datasources, is_default =\
-        module_cc.get_remote_config_value(AUTH_MODULE_NAME, "datasources")
-    if is_default:
-        return None
-    for d in datasources:
-        if "type" not in d:
-            continue
-        try:
-            if "class" in d:
-                dclass = RRClass(d["class"])
-            else:
-                dclass = RRClass("IN")
-        except InvalidRRClass as err:
-            logger.info(PYSERVER_COMMON_AUTH_CONFIG_RRCLASS_ERROR, err)
-            continue
-
-        if d["type"].lower() == "memory" and dclass == zone_class:
-            for zone in d["zones"]:
-                if "filetype" not in zone:
-                    continue
-                if "origin" not in zone:
-                    continue
-                if "filetype" not in zone:
-                    continue
-                try:
-                    name = Name(zone["origin"])
-                except (EmptyLabel, TooLongLabel, BadLabelType, BadEscape,
-                        TooLongName, IncompleteName):
-                    logger.info(PYSERVER_COMMON_AUTH_CONFIG_NAME_PARSER_ERROR,
-                                err)
-                    continue
+    # Note: The function got very simplified by #1976. There's plan to move
+    # to notification-driven approach, at which point the function would
+    # be changed a lot.
 
 
-                if zone["filetype"].lower() == "sqlite3" and name == zone_name:
-                    param = {"origin": zone_name.to_text(),
-                             "class": zone_class.to_text(),
-                             "datasrc": d["type"]}
-                    return create_command("loadzone", param)
-    return None
+    param = {
+        "origin": zone_name.to_text(),
+        "class": zone_class.to_text()
+    }
+    return create_command("loadzone", param)

+ 0 - 6
src/lib/python/isc/server_common/server_common_messages.mes

@@ -21,12 +21,6 @@
 # have that at this moment. So when adding a message, make sure that
 # have that at this moment. So when adding a message, make sure that
 # the name is not already used in src/lib/config/config_messages.mes
 # the name is not already used in src/lib/config/config_messages.mes
 
 
-% PYSERVER_COMMON_AUTH_CONFIG_NAME_PARSER_ERROR Invalid name when parsing Auth configuration: %1
-There was an invalid name when parsing Auth configuration.
-
-% PYSERVER_COMMON_AUTH_CONFIG_RRCLASS_ERROR Invalid RRClass when parsing Auth configuration: %1
-There was an invalid RR class when parsing Auth configuration.
-
 % PYSERVER_COMMON_DNS_TCP_SEND_DONE completed sending TCP message to %1 (%2 bytes in total)
 % PYSERVER_COMMON_DNS_TCP_SEND_DONE completed sending TCP message to %1 (%2 bytes in total)
 Debug message.  A complete DNS message has been successfully
 Debug message.  A complete DNS message has been successfully
 transmitted over a TCP connection, possibly after multiple send
 transmitted over a TCP connection, possibly after multiple send

+ 12 - 0
tests/lettuce/configurations/ddns/ddns.config.orig

@@ -27,6 +27,18 @@
             }
             }
         ]
         ]
     },
     },
+    "data_sources": {
+        "classes": {
+            "IN": [
+                {
+                    "type": "sqlite3",
+                    "params": {
+                        "database_file": "data/ddns/example.org.sqlite3"
+                    }
+                }
+            ]
+        }
+    },
     "Boss": {
     "Boss": {
         "components": {
         "components": {
             "b10-xfrout": {
             "b10-xfrout": {

+ 16 - 13
tests/lettuce/configurations/ddns/noddns.config.orig

@@ -17,21 +17,24 @@
                 "port": 47806,
                 "port": 47806,
                 "address": "127.0.0.1"
                 "address": "127.0.0.1"
             }
             }
-        ],
-        "datasources": [
-            {
-                "type": "memory",
-                "class": "IN",
-                "zones": [
-                    {
-                        "origin": "example.org",
-                        "filetype": "sqlite3",
-                        "file": "data/ddns/example.org.sqlite3"
-                    }
-                ]
-            }
         ]
         ]
     },
     },
+    "data_sources": {
+        "classes": {
+            "IN": [
+                {
+                    "type": "sqlite3",
+                    "params": {
+                        "database_file": "data/ddns/example.org.sqlite3"
+                    },
+                    "cache-enable": true,
+                    "cache-zones": [
+                        "example.org"
+                    ]
+                }
+            ]
+        }
+    },
     "Boss": {
     "Boss": {
         "components": {
         "components": {
             "b10-xfrout": {"kind": "dispensable"},
             "b10-xfrout": {"kind": "dispensable"},

+ 12 - 0
tests/lettuce/configurations/example.org.config.orig

@@ -14,6 +14,18 @@
             "address": "127.0.0.1"
             "address": "127.0.0.1"
         } ]
         } ]
     },
     },
+    "data_sources": {
+        "classes": {
+            "IN": [
+                {
+                    "type": "sqlite3",
+                    "params": {
+                        "database_file": "data/example.org.sqlite3"
+                    }
+                }
+            ]
+        }
+    },
     "Boss": {
     "Boss": {
         "components": {
         "components": {
             "b10-auth": { "kind": "needed", "special": "auth" },
             "b10-auth": { "kind": "needed", "special": "auth" },

+ 28 - 1
tests/lettuce/configurations/example.org.inmem.config

@@ -1,4 +1,31 @@
-{"version": 2, "Logging": {"loggers": [{"severity": "DEBUG", "name": "*", "debuglevel": 99}]}, "Auth": {"database_file": "", "listen_on": [{"port": 47806, "address": "127.0.0.1"}], "datasources": [{"zones": [{"origin": "example.org", "file": "data/example.org"}], "type": "memory"}]},
+{
+    "version": 2,
+    "Logging": {
+        "loggers": [{
+            "severity": "DEBUG",
+            "name": "*",
+            "debuglevel": 99
+        }]
+    },
+    "Auth": {
+        "listen_on": [{
+            "port": 47806,
+            "address": "127.0.0.1"
+        }]
+    },
+    "data_sources": {
+        "classes": {
+            "IN": [
+                {
+                    "type": "MasterFiles",
+                    "cache-enable": true,
+                    "params": {
+                        "example.org": "data/example.org"
+                    }
+                }
+            ]
+        }
+    },
     "Boss": {
     "Boss": {
         "components": {
         "components": {
             "b10-auth": { "kind": "needed", "special": "auth" },
             "b10-auth": { "kind": "needed", "special": "auth" },

+ 12 - 0
tests/lettuce/configurations/example2.org.config

@@ -15,6 +15,18 @@
             "address": "::1"
             "address": "::1"
         } ]
         } ]
     },
     },
+    "data_sources": {
+        "classes": {
+            "IN": [
+                {
+                    "type": "sqlite3",
+                    "params": {
+                        "database_file": "data/example.org.sqlite3"
+                    }
+                }
+            ]
+        }
+    },
     "Boss": {
     "Boss": {
         "components": {
         "components": {
             "b10-auth": { "kind": "needed", "special": "auth" },
             "b10-auth": { "kind": "needed", "special": "auth" },

+ 16 - 8
tests/lettuce/configurations/inmemory_over_sqlite3/secondary.conf

@@ -8,19 +8,27 @@
         } ]
         } ]
     },
     },
     "Auth": {
     "Auth": {
-        "datasources": [ {
-            "type": "memory",
-            "zones": [ {
-                "origin": "example.org",
-                "file": "data/example.org.sqlite3",
-	        "filetype": "sqlite3"
-            } ]
-	} ],
         "listen_on": [ {
         "listen_on": [ {
             "port": 47806,
             "port": 47806,
             "address": "127.0.0.1"
             "address": "127.0.0.1"
         } ]
         } ]
     },
     },
+    "data_sources": {
+        "classes": {
+            "IN": [
+                {
+                    "type": "sqlite3",
+                    "params": {
+                        "database_file": "data/example.org.sqlite3"
+                    },
+                    "cache-enable": true,
+                    "cache-zones": [
+                        "example.org"
+                    ]
+                }
+            ]
+        }
+    },
     "Boss": {
     "Boss": {
         "components": {
         "components": {
             "b10-auth": { "kind": "needed", "special": "auth" },
             "b10-auth": { "kind": "needed", "special": "auth" },

+ 53 - 1
tests/lettuce/configurations/ixfr-out/testset1-config.db

@@ -1,4 +1,56 @@
-{"Xfrin": {"zones": [{"use_ixfr": true, "class": "IN", "name": "example.com.", "master_addr": "178.18.82.80"}]}, "version": 2, "Logging": {"loggers": [{"debuglevel": 99, "severity": "DEBUG", "output_options": [{"output": "stderr", "flush": true}], "name": "*"}]}, "Auth": {"database_file": "data/ixfr-out/zones.sqlite3", "listen_on": [{"port": 47806, "address": "::"}, {"port": 47806, "address": "0.0.0.0"}]},
+{
+    "Xfrin": {
+        "zones": [
+            {
+                "use_ixfr": true,
+                "class": "IN",
+                "name": "example.com.",
+                "master_addr": "178.18.82.80"
+            }
+        ]
+    },
+    "version": 2,
+    "Logging": {
+        "loggers":
+            [
+                {
+                    "debuglevel": 99,
+                    "severity": "DEBUG",
+                    "output_options": [
+                        {
+                            "output": "stderr",
+                            "flush": true
+                        }
+                    ],
+                    "name": "*"
+                }
+        ]
+    },
+    "Auth": {
+        "database_file": "data/ixfr-out/zones.sqlite3",
+        "listen_on": [
+            {
+                "port": 47806,
+                "address": "::"
+            },
+            {
+                "port": 47806,
+                "address": "0.0.0.0"
+            }
+        ]
+    },
+    "data_sources": {
+        "classes": {
+            "IN": [
+                {
+                    "type": "sqlite3",
+                    "params": {
+                        "database_file": "data/ixfr-out/zones.sqlite3"
+                    }
+                }
+            ]
+        }
+    },
     "Boss": {
     "Boss": {
         "components": {
         "components": {
             "b10-auth": { "kind": "needed", "special": "auth" },
             "b10-auth": { "kind": "needed", "special": "auth" },

+ 10 - 0
tests/lettuce/configurations/multi_instance/multi_auth.config.orig

@@ -14,6 +14,16 @@
             "address": "127.0.0.1"
             "address": "127.0.0.1"
         } ]
         } ]
     },
     },
+    "data_sources": {
+        "classes": {
+            "IN": [{
+                "type": "sqlite3",
+                "params": {
+                    "database_file": "data/test_nonexistent_db.sqlite3"
+                }
+            }]
+        }
+    },
     "Boss": {
     "Boss": {
         "components": {
         "components": {
             "b10-auth-2": {"kind": "dispensable", "special": "auth"},
             "b10-auth-2": {"kind": "dispensable", "special": "auth"},

+ 12 - 0
tests/lettuce/configurations/no_db_file.config

@@ -15,6 +15,18 @@
             "address": "127.0.0.1"
             "address": "127.0.0.1"
         } ]
         } ]
     },
     },
+    "data_sources": {
+        "classes": {
+            "IN": [
+                {
+                    "type": "sqlite3",
+                    "params": {
+                        "database_file": "data/test_nonexistent_db.sqlite3"
+                    }
+                }
+            ]
+        }
+    },
     "Boss": {
     "Boss": {
         "components": {
         "components": {
             "b10-auth": { "kind": "needed", "special": "auth" },
             "b10-auth": { "kind": "needed", "special": "auth" },

+ 36 - 1
tests/lettuce/configurations/nsec3/nsec3_auth.config

@@ -1 +1,36 @@
-{"version": 2, "Logging": {"loggers": [{"severity": "DEBUG", "name": "*", "debuglevel": 99}]}, "Auth": {"datasources": [{"zones": [{"origin": "example.", "file": "configurations/nsec3/rfc5155-example.zone.signed"}], "type": "memory"}], "listen_on": [{"port": 47806, "address": "0.0.0.0"}]}, "Boss": {"components": {"b10-auth": {"kind": "needed", "special": "auth"}, "b10-cmdctl": {"kind": "needed", "special": "cmdctl"}}}}
+{
+    "version": 2,
+    "Logging": {
+        "loggers": [
+            {
+                "severity": "DEBUG",
+                "name": "*", "debuglevel": 99
+            }
+        ]
+    },
+    "Auth": {
+        "datasources": [
+            {"zones": [{"origin": "example.", "file": "configurations/nsec3/rfc5155-example.zone.signed"}], "type": "memory"}],
+            "listen_on": [{"port": 47806, "address": "0.0.0.0"}
+        ]
+    },
+    "data_sources": {
+        "classes": {
+            "IN": [
+                {
+                    "type": "MasterFiles",
+                    "cache-enable": true,
+                    "params": {
+                        "example.": "configurations/nsec3/rfc5155-example.zone.signed"
+                    }
+                }
+            ]
+        }
+    },
+    "Boss": {
+        "components": {
+            "b10-auth": {"kind": "needed", "special": "auth"},
+            "b10-cmdctl": {"kind": "needed", "special": "cmdctl"}
+        }
+    }
+}

+ 16 - 9
tests/lettuce/configurations/xfrin/inmem_slave.conf

@@ -9,20 +9,27 @@
     },
     },
     "Auth": {
     "Auth": {
         "database_file": "data/inmem-xfrin.sqlite3",
         "database_file": "data/inmem-xfrin.sqlite3",
-        "datasources": [ {
-            "type": "memory",
-            "class": "IN",
-            "zones": [ {
-                "origin": "example.org",
-                "file": "data/inmem-xfrin.sqlite3",
-                "filetype": "sqlite3"
-            } ]
-        } ],
         "listen_on": [ {
         "listen_on": [ {
             "port": 47806,
             "port": 47806,
             "address": "127.0.0.1"
             "address": "127.0.0.1"
         } ]
         } ]
     },
     },
+    "data_sources": {
+        "classes": {
+            "IN": [
+                {
+                    "type": "sqlite3",
+                    "params": {
+                        "database_file": "data/inmem-xfrin.sqlite3"
+                    },
+                    "cache-enable": true,
+                    "cache-zones": [
+                        "example.org"
+                    ]
+                }
+            ]
+        }
+    },
     "Boss": {
     "Boss": {
         "components": {
         "components": {
             "b10-auth": { "kind": "needed", "special": "auth" },
             "b10-auth": { "kind": "needed", "special": "auth" },

+ 10 - 0
tests/lettuce/configurations/xfrin/retransfer_slave.conf

@@ -14,6 +14,16 @@
             "address": "127.0.0.1"
             "address": "127.0.0.1"
         } ]
         } ]
     },
     },
+    "data_sources": {
+        "classes": {
+            "IN": [{
+                "type": "sqlite3",
+                "params": {
+                    "database_file": "data/test_nonexistent_db.sqlite3"
+                }
+            }]
+        }
+    },
     "Boss": {
     "Boss": {
         "components": {
         "components": {
             "b10-auth": { "kind": "needed", "special": "auth" },
             "b10-auth": { "kind": "needed", "special": "auth" },

+ 6 - 6
tests/lettuce/features/example.feature

@@ -160,12 +160,12 @@ Feature: Example feature
 
 
         A query for www.example.org should have rcode NOERROR
         A query for www.example.org should have rcode NOERROR
         Wait for new bind10 stderr message AUTH_SEND_NORMAL_RESPONSE
         Wait for new bind10 stderr message AUTH_SEND_NORMAL_RESPONSE
-        Then set bind10 configuration Auth/database_file to data/empty_db.sqlite3
-        And wait for new bind10 stderr message DATASRC_SQLITE_OPEN
+        Then set bind10 configuration data_sources/classes/IN[0]/params to {"database_file": "data/empty_db.sqlite3"}
+        And wait for new bind10 stderr message DATASRC_SQLITE_CONNOPEN
         A query for www.example.org should have rcode REFUSED
         A query for www.example.org should have rcode REFUSED
         Wait for new bind10 stderr message AUTH_SEND_NORMAL_RESPONSE
         Wait for new bind10 stderr message AUTH_SEND_NORMAL_RESPONSE
-        Then set bind10 configuration Auth/database_file to data/example.org.sqlite3
-        And wait for new bind10 stderr message DATASRC_SQLITE_OPEN
+        Then set bind10 configuration data_sources/classes/IN[0]/params to {"database_file": "data/example.org.sqlite3"}
+        And wait for new bind10 stderr message DATASRC_SQLITE_CONNOPEN
         A query for www.example.org should have rcode NOERROR
         A query for www.example.org should have rcode NOERROR
 
 
     Scenario: two bind10 instances
     Scenario: two bind10 instances
@@ -186,8 +186,8 @@ Feature: Example feature
         The SOA serial for example.org at 127.0.0.1:47806 should be 1234
         The SOA serial for example.org at 127.0.0.1:47806 should be 1234
         The SOA serial for example.org at ::1:47807 should be 1234
         The SOA serial for example.org at ::1:47807 should be 1234
 
 
-        Then set bind10 configuration Auth/database_file to data/empty_db.sqlite3
-        And wait for bind10_one stderr message DATASRC_SQLITE_OPEN
+        Then set bind10 configuration data_sources/classes/IN[0]/params to {"database_file": "data/empty_db.sqlite3"}
+        And wait for bind10_one stderr message DATASRC_SQLITE_CONNOPEN
 
 
         A query for www.example.org to 127.0.0.1:47806 should have rcode REFUSED
         A query for www.example.org to 127.0.0.1:47806 should have rcode REFUSED
         A query for www.example.org to [::1]:47807 should have rcode NOERROR
         A query for www.example.org to [::1]:47807 should have rcode NOERROR

+ 1 - 1
tests/lettuce/features/terrain/bind10_control.py

@@ -52,7 +52,7 @@ def start_bind10(step, config_file, cmdctl_port, msgq_sockfile, process_name):
     It will also fail if there is a running process with the given process_name
     It will also fail if there is a running process with the given process_name
     already.
     already.
     """
     """
-    args = [ 'bind10', '-n', '-v' ]
+    args = [ 'bind10', '-v' ]
     if config_file is not None:
     if config_file is not None:
         args.append('-p')
         args.append('-p')
         args.append("configurations/")
         args.append("configurations/")

+ 20 - 0
tests/system/bindctl/nsx1/b10-config.db.template.in

@@ -3,5 +3,25 @@
    "listen_on": [{"address": "10.53.0.1", "port": 53210}],
    "listen_on": [{"address": "10.53.0.1", "port": 53210}],
    "database_file": "@abs_builddir@/zone.sqlite3",
    "database_file": "@abs_builddir@/zone.sqlite3",
    "statistics-interval": 1
    "statistics-interval": 1
+ },
+ "data_sources": {
+    "classes": {
+        "IN": [{
+            "type": "sqlite3",
+            "params": {
+                "database_file": "@abs_builddir@/zone.sqlite3"
+            }
+        }]
+    }
+ },
+ "Logging": {
+     "loggers": [
+        {
+            "name": "*",
+            "severity": "DEBUG",
+            "output_options": [],
+            "debuglevel": 99
+        }
+     ]
  }
  }
 }
 }

+ 3 - 3
tests/system/bindctl/tests.sh

@@ -108,9 +108,9 @@ if [ $status != 0 ]; then echo "I:failed"; fi
 n=`expr $n + 1`
 n=`expr $n + 1`
 
 
 echo "I:Changing the data source from sqlite3 to in-memory ($n)"
 echo "I:Changing the data source from sqlite3 to in-memory ($n)"
-DATASRC_SPEC='[{"type": "memory", "zones": [{"origin": "com","file":'
-DATASRC_SPEC="${DATASRC_SPEC} \"${TEST_TOP}/bindctl/nsx1/example-normalized.db\"}]}]"
-echo "config set Auth/datasources ${DATASRC_SPEC}
+DATASRC_SPEC='{"type": "MasterFiles", "cache-enable": true, "params": {"com":'
+DATASRC_SPEC="${DATASRC_SPEC} \"${TEST_TOP}/bindctl/nsx1/example-normalized.db\"}}"
+echo "config set data_sources/classes/IN[0] ${DATASRC_SPEC}
 config commit
 config commit
 quit
 quit
 " | $RUN_BINDCTL \
 " | $RUN_BINDCTL \

+ 5 - 2
tests/system/glue/example.good

@@ -15,5 +15,8 @@ example.			172800	IN	NS	NS.example.
 ;; ADDITIONAL SECTION:
 ;; ADDITIONAL SECTION:
 NS.example.		172800	IN	A	192.0.2.1
 NS.example.		172800	IN	A	192.0.2.1
 NS.example.		172800	IN	A	192.0.2.2
 NS.example.		172800	IN	A	192.0.2.2
-NS1.example.COM.	172800	IN	A	192.0.2.101
-NS1.example.COM.		172800	IN	AAAA	2001:db8::1
+NS1.example.COM.	172800	IN	A	192.0.2.3
+;; These are not used now - they are in a different master file
+;; than the answer.
+; NS1.example.COM.	172800	IN	A	192.0.2.101
+; NS1.example.COM.		172800	IN	AAAA	2001:db8::1

+ 20 - 0
tests/system/glue/nsx1/b10-config.db.in

@@ -3,6 +3,26 @@
    "listen_on": [{"address": "10.53.0.1", "port": 53210}],
    "listen_on": [{"address": "10.53.0.1", "port": 53210}],
    "database_file": "@abs_builddir@/zone.sqlite3"
    "database_file": "@abs_builddir@/zone.sqlite3"
  },
  },
+ "data_sources": {
+    "classes": {
+        "IN": [{
+            "type": "sqlite3",
+            "params": {
+                "database_file": "@abs_builddir@/zone.sqlite3"
+            }
+        }]
+    }
+ },
+ "Logging": {
+     "loggers": [
+        {
+            "name": "*",
+            "severity": "DEBUG",
+            "output_options": [],
+            "debuglevel": 99
+        }
+     ]
+ },
  "Boss": {
  "Boss": {
    "components": {
    "components": {
      "b10-auth": {"kind": "needed", "special": "auth" },
      "b10-auth": {"kind": "needed", "special": "auth" },

+ 0 - 2
tests/system/glue/nsx1/root.db

@@ -37,8 +37,6 @@ example.			172800	IN	NS	NS.example.
 example.			172800	IN	NS	NS1.example.COM.
 example.			172800	IN	NS	NS1.example.COM.
 NS.example.			172800	IN	A	192.0.2.1
 NS.example.			172800	IN	A	192.0.2.1
 NS.example.			172800	IN	A	192.0.2.2
 NS.example.			172800	IN	A	192.0.2.2
-; this "glue" is below a zone cut for com.  BIND 9 still uses it for
-; the delegation to example.  BIND 10 (with sqlite3 data source) doesn't.
 NS1.example.COM.		172800	IN	A	192.0.2.3
 NS1.example.COM.		172800	IN	A	192.0.2.3
 
 
 ;
 ;

+ 6 - 4
tests/system/glue/tests.sh

@@ -38,10 +38,12 @@ $DIG +norec @10.53.0.1 -p 53210 foo.bar.example. A >dig.out.$n || status=1
 $PERL $DIGCOMP example.good dig.out.$n || status=1
 $PERL $DIGCOMP example.good dig.out.$n || status=1
 n=`expr $n + 1`
 n=`expr $n + 1`
 
 
-echo "I:testing that we find glue A RRs we are authoritative for ($n)"
-$DIG +norec @10.53.0.1 -p 53210 foo.bar.example.org. a >dig.out.$n || status=1
-$PERL $DIGCOMP auth.good dig.out.$n || status=1
-n=`expr $n + 1`
+# Disabling this test, as it checks for looking up glue in a different zone
+# finder than the answer is from. This is not supported now.
+#echo "I:testing that we find glue A RRs we are authoritative for ($n)"
+#$DIG +norec @10.53.0.1 -p 53210 foo.bar.example.org. a >dig.out.$n || status=1
+#$PERL $DIGCOMP auth.good dig.out.$n || status=1
+#n=`expr $n + 1`
 
 
 # We cannot do this test for BIND 10 because b10-auth doesn't act as a
 # We cannot do this test for BIND 10 because b10-auth doesn't act as a
 # recursive (caching) server (by design)
 # recursive (caching) server (by design)

+ 18 - 0
tests/system/ixfr/b10-config.db.in

@@ -14,6 +14,24 @@
         }],
         }],
         "database_file": "@abs_builddir@/zone.sqlite3"
         "database_file": "@abs_builddir@/zone.sqlite3"
     },
     },
+    "data_sources": {
+        "classes": {
+            "IN": [{
+                "type": "sqlite3",
+                "params": {
+                    "database_file": "@abs_builddir@/zone.sqlite3"
+                }
+            }]
+        }
+    },
+    "Logging": {
+        "loggers": [{
+            "name": "*",
+            "severity": "DEBUG",
+            "output_options": [],
+            "debuglevel": 99
+        }]
+    },
     "Zonemgr": {
     "Zonemgr": {
         "secondary_zones": [{
         "secondary_zones": [{
             "name": "example.",
             "name": "example.",