Beispiel #1
0
  parser.add_argument('--generate', action='store_true',
    help='generate the configs')

  parser.add_argument('--template', action='store',
    help='override the template')

  args = parser.parse_args()

  config = ConfigParser.ConfigParser()
  if not config.read("/etc/emf-gdata.conf"):
    print "Warning: config file /etc/emf-gdata.conf could not be found or read"

  spreadsheet = config.get('gdata', 'noc_combined')

  if args.listws or args.download or args.dumpws:
    spr_client = login("emfcamp Cisco config generator", config)

  done_something = False

  if args.listws:
    print_worksheets(spr_client, spreadsheet)
    done_something = True
  
  if args.download:
    download(spr_client, spreadsheet)
    done_something = True

  if args.dumpws:
    dump_worksheet(spr_client, spreadsheet, args.dumpws[0])
    done_something = True
  
Beispiel #2
0
                        help='generate the configs')

    parser.add_argument('--template',
                        action='store',
                        help='override the template')

    args = parser.parse_args()

    config = ConfigParser.ConfigParser()
    if not config.read("/etc/emf-gdata.conf"):
        print "Warning: config file /etc/emf-gdata.conf could not be found or read"

    spreadsheet = config.get('gdata', 'noc_combined')

    if args.listws or args.download or args.dumpws:
        spr_client = login("emfcamp Cisco config generator", config)

    done_something = False

    if args.listws:
        print_worksheets(spr_client, spreadsheet)
        done_something = True

    if args.download:
        download(spr_client, spreadsheet)
        done_something = True

    if args.dumpws:
        dump_worksheet(spr_client, spreadsheet, args.dumpws[0])
        done_something = True
Beispiel #3
0
config = ConfigParser.ConfigParser()
if not config.read("/etc/emf-gdata.conf"):
  print "Warning: config file /etc/emf-gdata.conf could not be found or read"


parser = argparse.ArgumentParser(description='Generate cisco IOS config files from gdocs.')

parser.add_argument('--deploy', action='store_true',
                    help='deploy zone files after generating')

args = parser.parse_args()


spreadsheet = config.get('gdata', 'noc_combined')

spr_client = login("emfcamp DNS zone generator", config)

print "downloading Addressing"
addressing = get_worksheet_data(spr_client, spreadsheet, "Addressing")

print "downloading codenames"
codenames = get_worksheet_data(spr_client, spreadsheet, "Codenames")

#for x in range(0, 2560000):
#  print pretty_host("gchq.org.uk", None)

sshfps = get_sshfps()
zones = {}

for row in addressing:
  if "Domain" in row:
Beispiel #4
0
#!/usr/bin/python

# EMF roundup user generator

import ipaddr, time, os, sys, ConfigParser

from nocsheet import login, get_worksheets, get_worksheet_data

config = ConfigParser.ConfigParser()
if not config.read("/etc/emf-gdata.conf"):
  print "Warning: config file /etc/emf-gdata.conf could not be found or read"

spreadsheet = config.get('gdata', 'noc_combined')

spr_client = login("emfcamp Roundup config generator", config)

print "downloading Users"
users = get_worksheet_data(spr_client, spreadsheet, "Users")

for user in users:
  if "uid" in user and user["uid"].isdigit():
    print "create user username="******"Username"] + " address=" + user["E-mail"] + " roles=Admin"
Beispiel #5
0
#!/usr/bin/python

# EMF roundup user generator

import ipaddr, time, os, sys, ConfigParser

from nocsheet import login, get_worksheets, get_worksheet_data

config = ConfigParser.ConfigParser()
if not config.read("/etc/emf-gdata.conf"):
    print "Warning: config file /etc/emf-gdata.conf could not be found or read"

spreadsheet = config.get('gdata', 'noc_combined')

spr_client = login("emfcamp Roundup config generator", config)

print "downloading Users"
users = get_worksheet_data(spr_client, spreadsheet, "Users")

for user in users:
    if "uid" in user and user["uid"].isdigit():
        print "create user username="******"Username"] + " address=" + user[
            "E-mail"] + " roles=Admin"
Beispiel #6
0
from nocsheet import login, get_worksheets, get_worksheet_data

if not os.path.exists('out'):
  os.mkdir('out')

if not os.path.exists('out/icinga'):
  os.mkdir('out/icinga')

config = ConfigParser.ConfigParser()
if not config.read("/etc/emf-gdata.conf"):
  print "Warning: config file /etc/emf-gdata.conf could not be found or read"

spreadsheet = config.get('gdata', 'noc_combined')

spr_client = login("emfcamp DHCP config generator", config)

print "downloading Switches"
switches = get_worksheet_data(spr_client, spreadsheet, "Switches")

print "downloading Links"
links = get_worksheet_data(spr_client, spreadsheet, "Links")

print "downloading VMs"
vms = get_worksheet_data(spr_client, spreadsheet, "VMs")

po_index = {}

def short_port(port):
  return port.replace("TenGigabitEthernet", "Te").replace("GigabitEthernet", "Gi").replace("FastEthernet", "Fa")
Beispiel #7
0
from nocsheet import login, get_worksheets, get_worksheet_data

if not os.path.exists('out'):
    os.mkdir('out')

if not os.path.exists('out/icinga'):
    os.mkdir('out/icinga')

config = ConfigParser.ConfigParser()
if not config.read("/etc/emf-gdata.conf"):
    print "Warning: config file /etc/emf-gdata.conf could not be found or read"

spreadsheet = config.get('gdata', 'noc_combined')

spr_client = login("emfcamp DHCP config generator", config)

print "downloading Switches"
switches = get_worksheet_data(spr_client, spreadsheet, "Switches")

print "downloading AP placement"
aps = get_worksheet_data(spr_client, spreadsheet, "AP placement")

print "downloading Links"
links = get_worksheet_data(spr_client, spreadsheet, "Links")

print "downloading VMs"
vms = get_worksheet_data(spr_client, spreadsheet, "VMs")

po_index = {}
Beispiel #8
0
    description='Generate cisco IOS config files from gdocs.')

parser.add_argument('--deploy',
                    action='store_true',
                    help='deploy zone files after generating')

parser.add_argument(
    '--diff',
    action='store_true',
    help='diff zone files against live versions after generating')

args = parser.parse_args()

spreadsheet = config.get('gdata', 'noc_combined')

spr_client = login("emfcamp DNS zone generator", config)

print "downloading Addressing"
addressing = get_worksheet_data(spr_client, spreadsheet, "Addressing")

print "downloading codenames"
codenames = get_worksheet_data(spr_client, spreadsheet, "Codenames")

#for x in range(0, 2560000):
#  print pretty_host("gchq.org.uk", None)

sshfps = get_sshfps()
zones = {}

for row in addressing:
    if "Domain" in row: