Parcourir la source

[2025] Add a way to specify slaves for use in lettuce tests

Normally, notify_out finds A/AAAA records for the rdata in NS records
and uses the non-primary ones as slaves. For these, it uses a hardcoded
port value of 53 which won't work in lettuce as these tests use
non-standard ports.
Mukund Sivaraman il y a 13 ans
Parent
commit
8e376a021e

+ 2 - 0
src/bin/xfrout/xfrout.py.in

@@ -952,6 +952,8 @@ class XfroutServer:
     def _start_notifier(self):
         datasrc = self._unix_socket_server.get_db_file()
         self._notifier = notify_out.NotifyOut(datasrc)
+        for slave in self._config_data['test_notify_slaves']:
+            self._notifier.add_slave(slave['address'], slave['port'])
         self._notifier.dispatcher()
 
     def send_notify(self, zone_name, zone_class):

+ 39 - 0
src/bin/xfrout/xfrout.spec.pre.in

@@ -21,6 +21,45 @@
          }
        },
        {
+         "item_name": "test_notify_slaves",
+         "item_type": "list",
+         "item_optional": true,
+         "item_default": [],
+         "list_item_spec":
+         {
+             "item_name": "test_notify_slaves_element",
+             "item_type": "map",
+             "item_optional": true,
+             "item_default": {},
+             "map_item_spec": [
+               {
+                   "item_name": "address",
+                   "item_type": "string",
+                   "item_optional": false,
+                   "item_default": ""
+               },
+               {
+                   "item_name": "port",
+                   "item_type": "integer",
+                   "item_optional": false,
+                   "item_default": 0
+               },
+               {
+                   "item_name": "transfer_acl",
+                   "item_type": "list",
+                   "item_optional": true,
+                   "item_default": [{"action": "ACCEPT"}],
+                   "list_item_spec":
+                   {
+                       "item_name": "acl_element",
+                       "item_type": "any",
+                       "item_optional": true
+                   }
+               }
+             ]
+         }
+       },
+       {
          "item_name": "zone_config",
          "item_type": "list",
          "item_optional": true,

+ 7 - 0
src/lib/python/isc/notify/notify_out.py

@@ -161,6 +161,13 @@ class NotifyOut:
             for item in slaves:
                 self._notify_infos[zone_id].notify_slaves.append((item, 53))
 
+    def add_slave(self, address, port):
+        for zone_name, zone_class in sqlite3_ds.get_zones_info(self._db_file):
+            zone_id = (zone_name, zone_class)
+            if zone_id not in self._notify_infos:
+                return False
+            self._notify_infos[zone_id].notify_slaves.append((address, port))
+
     def send_notify(self, zone_name, zone_class='IN'):
         '''Send notify to one zone's slaves, this function is
         the only interface for class NotifyOut which can be called

+ 4 - 0
tests/lettuce/configurations/xfrin/retransfer_master.conf

@@ -17,6 +17,10 @@
     "Xfrout": {
         "zone_config": [ {
             "origin": "example.org"
+        } ],
+        "test_notify_slaves": [ {
+            "address": "127.0.0.1",
+            "port": 47806
         } ]
     },
     "Boss": {