@@ -167,7 +167,7 @@ def _init_subnet_variables(self):
167167 subnet_v2 .AllocationPoolsColumn (self ._subnet .allocation_pools ),
168168 self ._subnet .cidr ,
169169 self ._subnet .description ,
170- format_columns . ListColumn (self ._subnet .dns_nameservers ),
170+ subnet_v2 . UnsortedListColumn (self ._subnet .dns_nameservers ),
171171 self ._subnet .enable_dhcp ,
172172 self ._subnet .gateway_ip ,
173173 subnet_v2 .HostRoutesColumn (self ._subnet .host_routes ),
@@ -190,7 +190,9 @@ def _init_subnet_variables(self):
190190 ),
191191 self ._subnet_from_pool .cidr ,
192192 self ._subnet_from_pool .description ,
193- format_columns .ListColumn (self ._subnet_from_pool .dns_nameservers ),
193+ subnet_v2 .UnsortedListColumn (
194+ self ._subnet_from_pool .dns_nameservers
195+ ),
194196 self ._subnet_from_pool .enable_dhcp ,
195197 self ._subnet_from_pool .gateway_ip ,
196198 subnet_v2 .HostRoutesColumn (self ._subnet_from_pool .host_routes ),
@@ -213,7 +215,7 @@ def _init_subnet_variables(self):
213215 ),
214216 self ._subnet_ipv6 .cidr ,
215217 self ._subnet_ipv6 .description ,
216- format_columns . ListColumn (self ._subnet_ipv6 .dns_nameservers ),
218+ subnet_v2 . UnsortedListColumn (self ._subnet_ipv6 .dns_nameservers ),
217219 self ._subnet_ipv6 .enable_dhcp ,
218220 self ._subnet_ipv6 .gateway_ip ,
219221 subnet_v2 .HostRoutesColumn (self ._subnet_ipv6 .host_routes ),
@@ -236,7 +238,7 @@ def _init_subnet_variables(self):
236238 ),
237239 self ._subnet_ipv6_pd .cidr ,
238240 self ._subnet_ipv6_pd .description ,
239- format_columns . ListColumn (self ._subnet_ipv6_pd .dns_nameservers ),
241+ subnet_v2 . UnsortedListColumn (self ._subnet_ipv6_pd .dns_nameservers ),
240242 self ._subnet_ipv6_pd .enable_dhcp ,
241243 self ._subnet_ipv6_pd .gateway_ip ,
242244 subnet_v2 .HostRoutesColumn (self ._subnet_ipv6_pd .host_routes ),
@@ -837,7 +839,7 @@ class TestListSubnet(TestSubnet):
837839 subnet .cidr ,
838840 subnet .project_id ,
839841 subnet .enable_dhcp ,
840- format_columns . ListColumn (subnet .dns_nameservers ),
842+ subnet_v2 . UnsortedListColumn (subnet .dns_nameservers ),
841843 subnet_v2 .AllocationPoolsColumn (subnet .allocation_pools ),
842844 subnet_v2 .HostRoutesColumn (subnet .host_routes ),
843845 subnet .ip_version ,
@@ -1489,7 +1491,7 @@ class TestShowSubnet(TestSubnet):
14891491 subnet_v2 .AllocationPoolsColumn (_subnet .allocation_pools ),
14901492 _subnet .cidr ,
14911493 _subnet .description ,
1492- format_columns . ListColumn (_subnet .dns_nameservers ),
1494+ subnet_v2 . UnsortedListColumn (_subnet .dns_nameservers ),
14931495 _subnet .enable_dhcp ,
14941496 _subnet .gateway_ip ,
14951497 subnet_v2 .HostRoutesColumn (_subnet .host_routes ),
@@ -1550,9 +1552,10 @@ def test_show_all_options(self):
15501552class TestUnsetSubnet (TestSubnet ):
15511553 def setUp (self ):
15521554 super (TestUnsetSubnet , self ).setUp ()
1555+ # Add three dns_nameserver entries so we can verify ordering
15531556 self ._testsubnet = network_fakes .FakeSubnet .create_one_subnet (
15541557 {
1555- 'dns_nameservers' : ['8.8.8.8' , '8.8.8.4' ],
1558+ 'dns_nameservers' : ['8.8.8.8' , '8.8.8.4' , '8.8.4.4' ],
15561559 'host_routes' : [
15571560 {'destination' : '10.20.20.0/24' , 'nexthop' : '10.20.20.1' },
15581561 {'destination' : '10.30.30.30/24' , 'nexthop' : '10.30.30.1' },
@@ -1578,9 +1581,10 @@ def setUp(self):
15781581 self .cmd = subnet_v2 .UnsetSubnet (self .app , self .namespace )
15791582
15801583 def test_unset_subnet_params (self ):
1584+ # Remove just the middle dns_nameserver entry, verify still in order
15811585 arglist = [
15821586 '--dns-nameserver' ,
1583- '8.8.8.8 ' ,
1587+ '8.8.8.4 ' ,
15841588 '--host-route' ,
15851589 'destination=10.30.30.30/24,gateway=10.30.30.1' ,
15861590 '--allocation-pool' ,
@@ -1591,7 +1595,7 @@ def test_unset_subnet_params(self):
15911595 self ._testsubnet .name ,
15921596 ]
15931597 verifylist = [
1594- ('dns_nameservers' , ['8.8.8.8 ' ]),
1598+ ('dns_nameservers' , ['8.8.8.4 ' ]),
15951599 (
15961600 'host_routes' ,
15971601 [{"destination" : "10.30.30.30/24" , "gateway" : "10.30.30.1" }],
@@ -1605,7 +1609,7 @@ def test_unset_subnet_params(self):
16051609 result = self .cmd .take_action (parsed_args )
16061610
16071611 attrs = {
1608- 'dns_nameservers' : ['8.8.8.4' ],
1612+ 'dns_nameservers' : ['8.8.8.8' , '8.8.4. 4' ],
16091613 'host_routes' : [
16101614 {"destination" : "10.20.20.0/24" , "nexthop" : "10.20.20.1" }
16111615 ],
0 commit comments