Skip to content

Commit bdb57e8

Browse files
Merge pull request #1801 from caberos/issue1800
Remove default filter on subnet list and fix the subnet detail
2 parents 0656879 + 6091974 commit bdb57e8

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

SoftLayer/CLI/subnet/detail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def cli(env, identifier, no_vs, no_hardware):
3838
table.add_row(['identifier',
3939
'%s/%s' % (subnet['networkIdentifier'],
4040
str(subnet['cidr']))])
41-
table.add_row(['subnet type', subnet['subnetType']])
41+
table.add_row(['subnet type', subnet.get('subnetType', formatting.blank())])
4242
table.add_row(['network space',
4343
utils.lookup(subnet, 'networkVlan', 'networkSpace')])
4444
table.add_row(['gateway', subnet.get('gateway', formatting.blank())])

SoftLayer/managers/network.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,7 @@ def list_subnets(self, identifier=None, datacenter=None, version=0,
503503
_filter['subnets']['version'] = utils.query_filter(version)
504504
if subnet_type:
505505
_filter['subnets']['subnetType'] = utils.query_filter(subnet_type)
506-
else:
507-
# This filters out global IPs from the subnet listing.
508-
_filter['subnets']['subnetType'] = {'operation': '!= GLOBAL_IP'}
506+
509507
if network_space:
510508
_filter['subnets']['networkVlan']['networkSpace'] = (
511509
utils.query_filter(network_space))
@@ -698,7 +696,7 @@ def _list_subnets_by_identifier(self, identifier):
698696
"""
699697
identifier = identifier.split('/', 1)[0]
700698

701-
results = self.list_subnets(identifier=identifier, mask='id')
699+
results = self.list_subnets()
702700
return [result['id'] for result in results]
703701

704702
def _list_vlans_by_name(self, name):

tests/CLI/modules/account_tests.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ def test_invoice_detail_csv_output_format(self):
7171
result_output = result.output.replace('\r', '').split('\n')
7272
self.assert_no_fail(result)
7373
self.assertEqual(result_output[0], 'Item Id,Category,Description,Single,Monthly,Create Date,Location')
74-
self.assertEqual(result_output[1], '724951323,Private (only) Secondary VLAN IP Addresses,64 Portable Private'
75-
' IP Addresses (bleg.beh.com),$0.00,$0.00,2018-04-04,fra02')
74+
self.assertEqual(result_output[1], '724951323,Private (only) Secondary VLAN IP Addresses,'
75+
'64 Portable Private IP Addresses (bleg.beh.com),'
76+
'$0.00,$0.00,2018-04-04,fra02')
7677

7778
# slcli account invoices
7879
def test_invoices(self):

tests/managers/network_tests.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -310,23 +310,13 @@ def test_list_global_ips_with_filter(self):
310310
filter=_filter)
311311

312312
def test_list_subnets_default(self):
313-
result = self.network.list_subnets()
314-
315-
self.assertEqual(result, fixtures.SoftLayer_Account.getSubnets)
316-
_filter = {'subnets': {'subnetType': {'operation': '!= GLOBAL_IP'}}}
317-
self.assert_called_with('SoftLayer_Account', 'getSubnets',
318-
mask='mask[%s]' % network.DEFAULT_SUBNET_MASK,
319-
filter=_filter)
320-
321-
def test_list_subnets_with_filters(self):
322313
result = self.network.list_subnets(
323314
identifier='10.0.0.1',
324315
datacenter='dal00',
325316
version=4,
326317
subnet_type='PRIMARY',
327318
network_space='PUBLIC',
328319
)
329-
330320
self.assertEqual(result, fixtures.SoftLayer_Account.getSubnets)
331321
_filter = {
332322
'subnets': {
@@ -344,6 +334,14 @@ def test_list_subnets_with_filters(self):
344334
mask='mask[%s]' % network.DEFAULT_SUBNET_MASK,
345335
filter=_filter)
346336

337+
def test_list_subnets_with_filters(self):
338+
result = self.network.list_subnets()
339+
340+
self.assertEqual(result, fixtures.SoftLayer_Account.getSubnets)
341+
342+
self.assert_called_with('SoftLayer_Account', 'getSubnets',
343+
mask='mask[%s]' % network.DEFAULT_SUBNET_MASK)
344+
347345
def test_list_vlans_default(self):
348346
result = self.network.list_vlans()
349347

0 commit comments

Comments
 (0)