Browse Source

Enable IPv6 for AAAA NS1 monitors

pull/763/head
Viranch Mehta 4 years ago
parent
commit
b19c68fe0e
No known key found for this signature in database GPG Key ID: D83D1392AE9F93B4
2 changed files with 59 additions and 0 deletions
  1. +3
    -0
      octodns/provider/ns1.py
  2. +56
    -0
      tests/test_octodns_provider_ns1.py

+ 3
- 0
octodns/provider/ns1.py View File

@ -1047,6 +1047,9 @@ class Ns1Provider(BaseProvider):
'regions': self.monitor_regions,
}
if _type == 'AAAA':
ret['config']['v6'] = True
if record.healthcheck_protocol != 'TCP':
# IF it's HTTP we need to send the request string
path = record.healthcheck_path


+ 56
- 0
tests/test_octodns_provider_ns1.py View File

@ -608,6 +608,54 @@ class TestNs1ProviderDynamic(TestCase):
'meta': {},
})
def aaaa_record(self):
return Record.new(self.zone, '', {
'dynamic': {
'pools': {
'lhr': {
'fallback': 'iad',
'values': [{
'value': '::ffff:3.4.5.6',
}],
},
'iad': {
'values': [{
'value': '::ffff:1.2.3.4',
}, {
'value': '::ffff:2.3.4.5',
}],
},
},
'rules': [{
'geos': [
'AF',
'EU-GB',
'NA-US-FL'
],
'pool': 'lhr',
}, {
'geos': [
'AF-ZW',
],
'pool': 'iad',
}, {
'pool': 'iad',
}],
},
'octodns': {
'healthcheck': {
'host': 'send.me',
'path': '/_ping',
'port': 80,
'protocol': 'HTTP',
}
},
'ttl': 32,
'type': 'AAAA',
'value': '::ffff:1.2.3.4',
'meta': {},
})
def cname_record(self):
return Record.new(self.zone, 'foo', {
'dynamic': {
@ -872,6 +920,14 @@ class TestNs1ProviderDynamic(TestCase):
# No http response expected
self.assertFalse('rules' in monitor)
def test_monitor_gen_AAAA(self):
provider = Ns1Provider('test', 'api-key')
value = '::ffff:3.4.5.6'
record = self.aaaa_record()
monitor = provider._monitor_gen(record, value)
self.assertTrue(monitor['config']['v6'])
def test_monitor_gen_CNAME(self):
provider = Ns1Provider('test', 'api-key')


Loading…
Cancel
Save