@@ -221,6 +221,32 @@ def test_create_address_scope_option(self):
221221 self .assertEqual (self .columns , columns )
222222 self .assertEqual (self .data , data )
223223
224+ def test_create_default_and_shared_options (self ):
225+ arglist = [
226+ '--pool-prefix' , '10.0.10.0/24' ,
227+ '--default' ,
228+ '--share' ,
229+ self ._subnet_pool .name ,
230+ ]
231+ verifylist = [
232+ ('prefixes' , ['10.0.10.0/24' ]),
233+ ('default' , True ),
234+ ('share' , True ),
235+ ('name' , self ._subnet_pool .name ),
236+ ]
237+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
238+
239+ columns , data = (self .cmd .take_action (parsed_args ))
240+
241+ self .network .create_subnet_pool .assert_called_once_with (** {
242+ 'is_default' : True ,
243+ 'name' : self ._subnet_pool .name ,
244+ 'prefixes' : ['10.0.10.0/24' ],
245+ 'shared' : True ,
246+ })
247+ self .assertEqual (self .columns , columns )
248+ self .assertEqual (self .data , data )
249+
224250
225251class TestDeleteSubnetPool (TestSubnetPool ):
226252
@@ -267,6 +293,8 @@ class TestListSubnetPool(TestSubnetPool):
267293 columns_long = columns + (
268294 'Default Prefix Length' ,
269295 'Address Scope' ,
296+ 'Default Subnet Pool' ,
297+ 'Shared' ,
270298 )
271299
272300 data = []
@@ -285,6 +313,8 @@ class TestListSubnetPool(TestSubnetPool):
285313 utils .format_list (pool .prefixes ),
286314 pool .default_prefixlen ,
287315 pool .address_scope_id ,
316+ pool .is_default ,
317+ pool .shared ,
288318 ))
289319
290320 def setUp (self ):
@@ -474,6 +504,62 @@ def test_set_no_address_scope_conflict(self):
474504 self .assertRaises (tests_utils .ParserException , self .check_parser ,
475505 self .cmd , arglist , verifylist )
476506
507+ def test_set_default (self ):
508+ arglist = [
509+ '--default' ,
510+ self ._subnet_pool .name ,
511+ ]
512+ verifylist = [
513+ ('default' , True ),
514+ ('subnet_pool' , self ._subnet_pool .name ),
515+ ]
516+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
517+
518+ result = self .cmd .take_action (parsed_args )
519+
520+ attrs = {
521+ 'is_default' : True
522+ }
523+ self .network .update_subnet_pool .assert_called_once_with (
524+ self ._subnet_pool , ** attrs )
525+ self .assertIsNone (result )
526+
527+ def test_set_no_default (self ):
528+ arglist = [
529+ '--no-default' ,
530+ self ._subnet_pool .name ,
531+ ]
532+ verifylist = [
533+ ('no_default' , True ),
534+ ('subnet_pool' , self ._subnet_pool .name ),
535+ ]
536+ parsed_args = self .check_parser (self .cmd , arglist , verifylist )
537+
538+ result = self .cmd .take_action (parsed_args )
539+
540+ attrs = {
541+ 'is_default' : False ,
542+ }
543+ self .network .update_subnet_pool .assert_called_once_with (
544+ self ._subnet_pool , ** attrs )
545+ self .assertIsNone (result )
546+
547+ def test_set_no_default_conflict (self ):
548+ arglist = [
549+ '--default' ,
550+ '--no-default' ,
551+ self ._subnet_pool .name ,
552+ ]
553+ verifylist = [
554+ ('default' , True ),
555+ ('no_default' , True ),
556+ ('subnet_pool' , self ._subnet_pool .name ),
557+ ]
558+
559+ # Exclusive arguments will conflict here.
560+ self .assertRaises (tests_utils .ParserException , self .check_parser ,
561+ self .cmd , arglist , verifylist )
562+
477563
478564class TestShowSubnetPool (TestSubnetPool ):
479565
0 commit comments