-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Adding support for Private DNS Public Preview #5757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -159,6 +159,84 @@ def test_dns(self, resource_group): | |
| self.cmd('network dns zone delete -g {rg} -n {zone} -y', | ||
| checks=self.is_empty()) | ||
|
|
||
| @ResourceGroupPreparer(name_prefix='cli_test_dns') | ||
| def test_private_dns(self, resource_group): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a couple lines to test the |
||
|
|
||
| self.kwargs['zone'] = 'myprivatezone.com' | ||
| self.kwargs['regvnet'] = 'regvnet' | ||
| self.kwargs['resvnet'] = 'resvnet' | ||
|
|
||
| self.cmd('network vnet create -n {regvnet} -g {rg}') | ||
| self.cmd('network vnet create -n {resvnet} -g {rg}') | ||
|
|
||
| self.cmd('network dns zone list') # just verify is works (no Exception raised) | ||
| self.cmd('network dns zone create -n {zone} -g {rg} --zone-type Private --registration-vnets {regvnet} --resolution-vnets {resvnet}') | ||
| self.cmd('network dns zone list -g {rg}', | ||
| checks=self.check('length(@)', 1)) | ||
|
|
||
| base_record_sets = 1 | ||
| self.cmd('network dns zone show -n {zone} -g {rg}', | ||
| checks=self.check('numberOfRecordSets', base_record_sets)) | ||
|
|
||
| args = { | ||
| 'a': '--ipv4-address 10.0.0.10', | ||
| 'aaaa': '--ipv6-address 2001:db8:0:1:1:1:1:1', | ||
| 'caa': '--flags 0 --tag foo --value "my value"', | ||
| 'cname': '--cname mycname', | ||
| 'mx': '--exchange 12 --preference 13', | ||
| 'ptr': '--ptrdname foobar.com', | ||
| 'soa': '--email foo.com --expire-time 30 --minimum-ttl 20 --refresh-time 60 --retry-time 90 --serial-number 123', | ||
| 'srv': '--port 1234 --priority 1 --target target.com --weight 50', | ||
| 'txt': '--value some_text' | ||
| } | ||
|
|
||
| # Private Zones do NOT support delegation through NS records | ||
| record_types = ['a', 'aaaa', 'caa', 'cname', 'mx', 'ptr', 'srv', 'txt'] | ||
|
|
||
| for t in record_types: | ||
| # test creating the record set and then adding records | ||
| self.cmd('network dns record-set {0} create -n myrs{0} -g {{rg}} --zone-name {{zone}}'.format(t)) | ||
| add_command = 'set-record' if t == 'cname' else 'add-record' | ||
| self.cmd('network dns record-set {0} {2} -g {{rg}} --zone-name {{zone}} --record-set-name myrs{0} {1}'.format(t, args[t], add_command)) | ||
| # test creating the record set at the same time you add records | ||
| self.cmd('network dns record-set {0} {2} -g {{rg}} --zone-name {{zone}} --record-set-name myrs{0}alt {1}'.format(t, args[t], add_command)) | ||
|
|
||
| self.cmd('network dns record-set a add-record -g {rg} --zone-name {zone} --record-set-name myrsa --ipv4-address 10.0.0.11') | ||
| self.cmd('network dns record-set soa update -g {{rg}} --zone-name {{zone}} {0}'.format(args['soa'])) | ||
|
|
||
| long_value = '0123456789' * 50 | ||
| self.cmd('network dns record-set txt add-record -g {{rg}} -z {{zone}} -n longtxt -v {0}'.format(long_value)) | ||
|
|
||
| typed_record_sets = 2 * len(record_types) + 1 | ||
| self.cmd('network dns zone show -n {zone} -g {rg}', | ||
| checks=self.check('numberOfRecordSets', base_record_sets + typed_record_sets)) | ||
| self.cmd('network dns record-set a show -n myrsa -g {rg} --zone-name {zone}', | ||
| checks=self.check('length(arecords)', 2)) | ||
|
|
||
| # test list vs. list type | ||
| self.cmd('network dns record-set list -g {rg} -z {zone}', | ||
| checks=self.check('length(@)', base_record_sets + typed_record_sets)) | ||
|
|
||
| self.cmd('network dns record-set txt list -g {rg} -z {zone}', | ||
| checks=self.check('length(@)', 3)) | ||
|
|
||
| for t in record_types: | ||
| self.cmd('network dns record-set {0} remove-record -g {{rg}} --zone-name {{zone}} --record-set-name myrs{0} {1}'.format(t, args[t])) | ||
|
|
||
| self.cmd('network dns record-set a show -n myrsa -g {rg} --zone-name {zone}', | ||
| checks=self.check('length(arecords)', 1)) | ||
|
|
||
| self.cmd('network dns record-set a remove-record -g {rg} --zone-name {zone} --record-set-name myrsa --ipv4-address 10.0.0.11') | ||
|
|
||
| self.cmd('network dns record-set a show -n myrsa -g {rg} --zone-name {zone}', | ||
| checks=self.is_empty()) | ||
|
|
||
| self.cmd('network dns record-set a delete -n myrsa -g {rg} --zone-name {zone} -y') | ||
| self.cmd('network dns record-set a show -n myrsa -g {rg} --zone-name {zone}') | ||
|
|
||
| self.cmd('network dns zone delete -g {rg} -n {zone} -y', | ||
| checks=self.is_empty()) | ||
|
|
||
|
|
||
| class DnsParseZoneFiles(unittest.TestCase): | ||
| def _check_soa(self, zone, zone_name, ttl, serial_number, refresh, retry, expire, min_ttl): | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also just say
network dns zone create/update.