Skip to content

Instantly share code, notes, and snippets.

@sudorandom
sudorandom / network_graphs.py
Last active December 12, 2015 02:38
Generates graphs of VLANs/hardware/CCIs/firewalls from data in the SoftLayer API.
#!/usr/bin/env python
"""
Generates graphs of VLANs and connected hardware/CCIs from data in the
SoftLayer API.
"""
import argparse
import time
import math
import matplotlib.pyplot as plt
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
#
# Generate an API key at the SoftLayer Customer Portal:
# https://manage.softlayer.com/Administrative/apiKeychain
api_username = ''
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
#
# Generate an API key at the SoftLayer Customer Portal:
# https://manage.softlayer.com/Administrative/apiKeychain
apiUsername = ''
import SoftLayer
from pprint import pprint as pp
client = SoftLayer.Client(username=apiUsername, api_key=apiKey)
mask = {
'hardware': {
'datacenter': {},
'privateIpAddress': {},
'primaryNetworkComponent': {
import SoftLayer
from pprint import pprint as pp
api_username = ''
api_key = ''
guestId = 1234
hostname = 'host1'
domain_name = 'example.com'
operating_system = 'CENTOS_5_64'
import SoftLayer.API
from pprint import pprint as pp
api_username = ''
api_key = ''
image_template_name = ''
guestId = 1234
hostname = 'host1'
domain_name = 'example.com'
#!/usr/bin/env python
def ticket_iter(client, start_date, end_date):
mask = """
mask[
id,
billableFlag,
createDate,
groupId,
import SoftLayer.API
from pprint import pprint as pp
apiUsername = ''
apiKey = ''
client = SoftLayer.Client(username=apiUsername, api_key=apiKey)
def updatePassword(server):
import SoftLayer.API
from pprint import pprint as pp
apiUsername = ''
apiKey = ''
passwordClient = SoftLayer.API.Client(
'SoftLayer_Software_Component_Password', None, apiUsername, apiKey)
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
#
# Generate an API key at the SoftLayer Customer Portal:
# https://manage.softlayer.com/Administrative/apiKeychain
apiUsername = ''