Skip to content

Instantly share code, notes, and snippets.

@gizmoguy
Created April 30, 2017 03:24
Show Gist options
  • Save gizmoguy/867deb42c9da2b92276d0ddc63f0a180 to your computer and use it in GitHub Desktop.
Save gizmoguy/867deb42c9da2b92276d0ddc63f0a180 to your computer and use it in GitHub Desktop.
Python inspect module parsing faucet config options
#!/usr/bin/env python3
import inspect
import pprint
from dp import DP
from vlan import VLAN
from port import Port
pp = pprint.PrettyPrinter(indent=4)
dp_members = dict(inspect.getmembers(DP))
vlan_members = dict(inspect.getmembers(VLAN))
port_members = dict(inspect.getmembers(Port))
print("DP config options:")
pp.pprint(dp_members['defaults'])
print("VLAN config options:")
pp.pprint(vlan_members['defaults'])
print("Port config options:")
pp.pprint(port_members['defaults'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment