@@ -515,46 +515,37 @@ def list_subnets(self, identifier=None, datacenter=None, version=0,
515
515
kwargs ['iter' ] = True
516
516
return self .client .call ('Account' , 'getSubnets' , ** kwargs )
517
517
518
- def list_vlans (self , datacenter = None , vlan_number = None , name = None , limit = 100 , ** kwargs ):
518
+ def list_vlans (self , datacenter = None , vlan_number = None , name = None , limit = 100 , mask = None , _filter = {} ):
519
519
"""Display a list of all VLANs on the account.
520
520
521
521
This provides a quick overview of all VLANs including information about
522
522
data center residence and the number of devices attached.
523
523
524
- :param string datacenter: If specified, the list will only contain
525
- VLANs in the specified data center.
526
- :param int vlan_number: If specified, the list will only contain the
527
- VLAN matching this VLAN number.
528
- :param int name: If specified, the list will only contain the
529
- VLAN matching this VLAN name.
524
+ :param string datacenter: If specified, the list will only contain VLANs in the specified data center.
525
+ :param int vlan_number: If specified, the list will only contain the VLAN matching this VLAN number.
526
+ :param int name: If specified, the list will only contain the VLAN matching this VLAN name.
530
527
:param dict \\ *\\ *kwargs: response-level options (mask, limit, etc.)
531
528
532
529
"""
533
- _filter = utils .NestedDict (kwargs . get ( 'filter' ) or {} )
530
+ _filter = utils .NestedDict (_filter )
534
531
535
532
_filter ['networkVlans' ]['id' ] = utils .query_filter_orderby ()
536
533
537
534
if vlan_number :
538
- _filter ['networkVlans' ]['vlanNumber' ] = (
539
- utils .query_filter (vlan_number ))
535
+ _filter ['networkVlans' ]['vlanNumber' ] = (utils .query_filter (vlan_number ))
540
536
541
537
if name :
542
538
_filter ['networkVlans' ]['name' ] = utils .query_filter (name )
543
539
544
540
if datacenter :
545
- _filter ['networkVlans' ]['primaryRouter' ]['datacenter' ]['name' ] = (
546
- utils .query_filter (datacenter ))
547
-
548
- kwargs ['filter' ] = _filter .to_dict ()
541
+ _filter ['networkVlans' ]['primaryRouter' ]['datacenter' ]['name' ] = (utils .query_filter (datacenter ))
549
542
550
- if ' mask' not in kwargs :
551
- kwargs [ ' mask' ] = DEFAULT_VLAN_MASK
543
+ if mask is None :
544
+ mask = DEFAULT_VLAN_MASK
552
545
553
- kwargs ['iter' ] = True
554
- if limit > 0 :
555
- return self .account .getNetworkVlans (mask = kwargs ['mask' ], filter = _filter .to_dict (), limit = limit , iter = True )
556
- else :
557
- return self .account .getNetworkVlans (mask = kwargs ['mask' ], filter = _filter .to_dict (), iter = True )
546
+ # cf_call uses threads to get all results.
547
+ return self .client .cf_call ('SoftLayer_Account' , 'getNetworkVlans' ,
548
+ mask = mask , filter = _filter .to_dict (), limit = limit )
558
549
559
550
def list_securitygroups (self , ** kwargs ):
560
551
"""List security groups."""
0 commit comments