Skip to content

Instantly share code, notes, and snippets.

@underscorephil
Created August 27, 2013 21:39
Show Gist options
  • Save underscorephil/6359513 to your computer and use it in GitHub Desktop.
Save underscorephil/6359513 to your computer and use it in GitHub Desktop.
import SoftLayer.API
from pprint import pprint as pp
apiUsername = ''
apiKey = ''
client = SoftLayer.Client(
username=apiUsername,
api_key=apiKey,
)
vlans = client['Account'].getNetworkVlans(
mask='mask.firewallInterfaces.firewallContextAccessControlLists')
def has_inbound(vlan):
intf = vlan.get('firewallInterfaces')
if not intf:
return False
for context in intf:
if context['name'] != 'outside':
continue
in_rules = filter(lambda x: x['direction'] == 'in',
context['firewallContextAccessControlLists'])
if in_rules:
return True
return False
filtered_vlans = filter(has_inbound, vlans)
pp(filtered_vlans)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment