import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ipv6util.settings')

import django
django.setup()

from ipv6app.models import Prefix

myDetails = []

def populate():
    myDetails = setdetails()
    #print myDetails
    for myArray in myDetails:
        add_prefix(ip=myArray[0],
            mask=myArray[1],
            name=myArray[2],
            possible=myArray[3],
            flag=myArray[4])
            
def add_prefix(ip, mask, name, possible, flag):
    p = Prefix.objects.get_or_create(ip=ip, mask=mask, name=name, possible=possible, flag=flag)[0]
    print ip, mask, name, possible, flag
    p.save()
    return p

def setdetails():
    myDetails = [
		["::/8","","Unassigned*<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",49,""],
		["100::/8","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["200::/7","","Reserved for NSAP<a href='http://www.ietf.org/rfc/rfc1888.txt?number1888'>[RFC1888]</a>",100,""],
		["400::/6","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["800::/5","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["1000::/4","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["2000::/3","","Globally routable address space<a href='http://www.ietf.org/rfc/rfc2374.txt?number2374'>[RFC2374]</a>",100,""],
		["4000::/3","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["6000::/3","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["8000::/3","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["a000::/3","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["c000::/3","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["e000::/4","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["f000::/5","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["f800::/6","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["fc00::/7","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["fe00::/9","","Unassigned<a href='http://www.ietf.org/rfc/rfc3513.txt?number3513'>[RFC3513]</a>",100,""],
		["fe80::/10","","Link Local Address<a href='http://www.ietf.org/rfc/rfc2460.txt?number2460'>[RFC2460]</a>",100,""],
		["fec0::/10","","Site Local Address<a href='http://www.ietf.org/rfc/rfc3879.txt?number3879'>[RFC3879]</a>",100,""],
		["ff00::/8","","Multicast address <a href='http://www.ietf.org/rfc/rfc2373.txt?number2373'>[RFC2373]</a>",100,""],
		
		["::/128","","Unspecified",100,""],
		["::1/128","","Loopback Address",100,""],
		
		["2000::/16","","Reserved TLA",100,""],
		["2001::/16","","Sub-TLA Assignements <a href='http://www.ietf.org/rfc/rfc2450.txt?number2450'>[RFC2450]",100,""],
		["2002::/16","","6to4 Transition Site <a href='http://www.ietf.org/rfc/rfc3056.txt?number3056'>[RFC3056]",100,"6to4"],
		["3ffe::/16","","6bone Prefix (deprecated 06/06/2006)",100,""],

		["ff01::/16","","Multicast address Interface-local scope <a href='http://www.ietf.org/rfc/rfc2373.txt?number2373'>[RFC2373]</a>",100,""],
		["ff02::/16","","Multicast address Link-local scope <a href='http://www.ietf.org/rfc/rfc2373.txt?number2373'>[RFC2373]</a>",100,""],
		["ff05::/16","","Multicast address Site-local scope <a href='http://www.ietf.org/rfc/rfc2373.txt?number2373'>[RFC2373]</a>",100,""],
		["ff08::/16","","Multicast address Organization-local scope <a href='http://www.ietf.org/rfc/rfc2373.txt?number2373'>[RFC2373]</a>",100,""],
		["ff0e::/16","","Multicast address Global scope <a href='http://www.ietf.org/rfc/rfc2373.txt?number2373'>[RFC2373]</a>",100,""],

		["ff01::1/128","","All Nodes <a href='http://www.ietf.org/rfc/rfc2373.txt?number2373'>[RFC2373]</a>",100,""],
		["ff01::2/128","","All Routers<a href='http://www.ietf.org/rfc/rfc2373.txt?number2373'>[RFC2373]</a>",100,""],
		
		["ff02::1/128","","All Nodes<a href='http://www.ietf.org/rfc/rfc2373.txt?number2373'>[RFC2373]</a>",100,""],
		["ff02::2/128","","All Routers<a href='http://www.ietf.org/rfc/rfc2373.txt?number2373'>[RFC2373]</a>",100,""],
		["ff02::3/128","","Unassigned",100,""],
		["ff02::4/128","","DVMRP Routers<a href='http://www.ietf.org/rfc/rfc1075.txt?number1075'>[RFC1075]",100,""],
		["ff02::5/128","","OSPFIGP<a href='http://www.ietf.org/rfc/rfc2328.txt?number2328'>[RFC2328]",100,""],
		["ff02::6/128","","OSPFIGP Designated Routers<a href='http://www.ietf.org/rfc/rfc2328.txt?number2328'>[RFC2328]",100,""],
		["ff02::7/128","","ST Routers<a href='http://www.ietf.org/rfc/rfc1190.txt?number1190'>[RFC1190]</a>",100,""],
		["ff02::8/128","","ST Hosts<a href='http://www.ietf.org/rfc/rfc1190.txt?number1190'>[RFC1190]</a>",100,""],
		["ff02::9/128","","RIP Routers<a href='http://www.ietf.org/rfc/rfc2080.txt?number2080'>[RFC2080]</a>",100,""],
		["ff02::A/128","","EIGRP Routers",100,""],
		["ff02::B/128","","Mobile-Agents",100,""],
        # ["ff02::C/128","","SSDP",100,""],
		["ff02::D/128","","All PIM Routers",100,""],
		["ff02::E/128","","RSVP-ENCAPSULATION",100,""],
		["ff02::16/128","","All MLDv2-capable routers<a href='http://www.ietf.org/rfc/rfc3810.txt?number3810'>[RFC3810]</a>",100,""],
		["ff02::1:1/128","","Link Name",100,""],
		["ff02::1:2/128","","All-dhcp-agents<a href='http://www.ietf.org/rfc/rfc3315.txt?number3315'>[RFC3315]</a>",100,""],
		["ff02::1:3/128","","Link-Local Multicast Name Resolution",100,""],
		["ff02::1:4/128","","DTCP Announcement",100,""],
		["ff02::1:ff00:0/104","","Solicited Node multicast<a href='http://www.ietf.org/rfc/rfc2373.txt?number2373'>[RFC2373]</a>",100,"SNM"],
		
		["ff05::2/128","","All Routers<a href='http://www.ietf.org/rfc/rfc2373.txt?number2373'>[RFC2373]</a>",100,""],
		["ff05::1:3/128","","All-dhcp-servers<a href='http://www.ietf.org/rfc/rfc3315.txt?number3315'>[RFC3315]</a>",100,""],
		["ff05::1:4/128","","Deprecated (2003-03-12)",100,""],

		["ff00::1:1000","ffff:ffff:ffff:ffff:ffff:ffff:ffff:fc00","Service Location, Version 2<a href='http://www.ietf.org/rfc/rfc3111.txt?number3111'>[RFC3111]</a>",50,"anyscope"],
		["ff00::100","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","VMTP Managers Group<a href='http://www.ietf.org/rfc/rfc1045.txt?number1045'>[RFC1045]</a>",100,"anyscope"],
		["ff00::c","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","SSDP",100,"anyscope"],
		["ff00::101","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","Network Time Protocol<a href='http://www.ietf.org/rfc/rfc1119.txt?number1119'>[RFC1119]</a>",100,"anyscope"],
		["ff00::102","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","SGI-Dogfight",100,"anyscope"],
		["ff00::103","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","Rwhod",100,"anyscope"],
		["ff00::104","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","VNP",100,"anyscope"],
		["ff00::105","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","Artificial Horizons - Aviator",100,"anyscope"],
		["ff00::106","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","NSS - Name Service Server",100,"anyscope"],
		["ff00::107","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","UDIONEWS - Audio News Multicast",100,"anyscope"],
		["ff00::108","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","SUN NIS+ Information Service",100,"anyscope"],
		["ff00::109","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","MTP Multicast Transport Protocol",100,"anyscope"],
		["ff00::10a","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","IETF-1-LOW-AUDIO",100,"anyscope"],
		["ff00::10b","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","IETF-1-AUDIO",100,"anyscope"],
		["ff00::10c","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","IETF-1-VIDEO",100,"anyscope"],
		["ff00::10d","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","IETF-2-LOW-AUDIO",100,"anyscope"],
		["ff00::10e","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","IETF-2-AUDIO",100,"anyscope"],
		["ff00::10f","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","IETF-2-VIDEO",100,"anyscope"],
		["ff00::110","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","MUSIC-SERVICE",100,"anyscope"],
		["ff00::111","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","SEANET-TELEMETRY",100,"anyscope"],
		["ff00::112","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","SEANET-IMAGE",100,"anyscope"],
		["ff00::113","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","MLOADD",100,"anyscope"],
		["ff00::114","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","any private experiment",100,"anyscope"],
		["ff00::115","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","DVMRP on MOSPF",100,"anyscope"],
		["ff00::116","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","SVRLOC",100,"anyscope"],
		["ff00::117","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","XINGTV",100,"anyscope"],
		["ff00::118","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","microsoft-ds",100,"anyscope"],
		["ff00::119","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","nbc-pro",100,"anyscope"],
		["ff00::11a","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","nbc-pfn",100,"anyscope"],
		["ff00::11b","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","lmsc-calren-1",100,"anyscope"],
		["ff00::11c","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","lmsc-calren-2",100,"anyscope"],
		["ff00::11d","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","lmsc-calren-3",100,"anyscope"],
		["ff00::11e","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","lmsc-calren-4",100,"anyscope"],
		["ff00::11f","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","ampr-info",100,"anyscope"],

		["ff00::120","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","mtrace",100,"anyscope"],
		["ff00::121","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","RSVP-encap-1",100,"anyscope"],
		["ff00::122","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","RSVP-encap-2",100,"anyscope"],
		["ff00::123","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","SVRLOC-DA",100,"anyscope"],
		["ff00::124","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","rln-server",100,"anyscope"],
		["ff00::125","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","proshare-mc",100,"anyscope"],
		["ff00::126","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","dantz",100,"anyscope"],
		["ff00::127","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","cisco-rp-announce",100,"anyscope"],
		["ff00::128","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","cisco-rp-discovery",100,"anyscope"],
		["ff00::129","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","gatekeeper",100,"anyscope"],
		["ff00::12a","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","iberiagames",100,"anyscope"],
		["ff00::12b","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","X Display",100,"anyscope"],

		["ff00::201","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","rwho Group (BSD) unofficial",100,"anyscope"],
		["ff00::202","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","SUN RPC PMAPPROC_CALLIT",100,"anyscope"],

		["ff00::300","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","Mbus/IPv6<a href='http://www.ietf.org/rfc/rfc3259.txt?number3259'>[RFC3259]</a>",100,"anyscope"],

		["ff00::2:7ffe","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","SAPv1 Announcements",100,"anyscope"],
		["ff00::2:7fff","fff0:ffff:ffff:ffff:ffff:ffff:ffff:ffff","SAPv0 Announcements (deprecated)",100,"anyscope"],
		
		["ff00::2:7000","ffff:ffff:ffff:ffff:ffff:ffff:ffff:8000","Multimedia Conference Calls",50,"anyscope"],
		["ff00::2:8000","ffff:ffff:ffff:ffff:ffff:ffff:ffff:8000","SAP Dynamic Assignments",50,"anyscope"],

		["2001:0000::/23","","IANA",100,""],
		["2001:0200::/23","","APNIC",100,""],
		["2001:0400::/23","","ARIN",100,""],
		["2001:0600::/23","","RIPE NCC",100,""],
		["2001:0800::/23","","RIPE NCC",100,""],
		["2001:0A00::/23","","RIPE NCC",100,""],
		["2001:0C00::/23","","APNIC",100,""],
		["2001:0E00::/23","","APNIC",100,""],
		["2001:1000::/23","","future",100,""],
		["2001:1200::/23","","LACNIC",100,""],
		["2001:1400::/23","","RIPE NCC",100,""],
		["2001:1600::/23","","RIPE NCC",100,""],
		["2001:1800::/23","","ARIN",100,""],
		["2001:1A00::/23","","RIPE NCC",100,""],
		["2001:1C00::/23","","RIPE NCC",100,""],
		["2001:1E00::/23","","RIPE NCC",100,""],
		["2001:2000::/23","","RIPE NCC",100,""],
		["2001:2200::/23","","RIPE NCC",100,""],
		["2001:2400::/23","","RIPE NCC",100,""],
		["2001:2600::/23","","RIPE NCC",100,""],
		["2001:2800::/23","","RIPE NCC",100,""],
		["2001:2A00::/23","","RIPE NCC",100,""],
		["2001:2C00::/23","","RIPE NCC",100,""],
		["2001:2E00::/23","","RIPE NCC",100,""],
		["2001:3000::/23","","RIPE NCC",100,""],
		["2001:3200::/23","","RIPE NCC",100,""],
		["2001:3400::/23","","RIPE NCC",100,""],
		["2001:3600::/23","","RIPE NCC",100,""],
		["2001:3800::/23","","RIPE NCC",100,""],
		["2001:3A00::/23","","RIPE NCC",100,""],
		["2001:3C00::/23","","reserved",100,""],
		["2001:3E00::/23","","reserved",100,""],
		["2001:4000::/23","","RIPE NCC",100,""],
		["2001:4200::/23","","ARIN",100,""],
		["2001:4400::/23","","APNIC",100,""],
		["2001:4600::/23","","RIPE NCC",100,""],
		["2001:4800::/23","","ARIN",100,""],
		["2001:4A00::/23","","RIPE NCC",100,""],
		["2001:4C00::/23","","RIPE NCC",100,""],
		["2001:4E00::/23","","?Brian?",100,""],
		["2001:5000::/23","","RIPE NCC",100,""],
		["2001:5200::/23","","RIPE NCC",100,""],
		["2001:5400::/23","","RIPE NCC",100,""],
		["2001:5600::/23","","RIPE NCC",100,""],
		["2001:5800::/23","","RIPE NCC",100,""],
		["2001:5A00::/23","","RIPE NCC",100,""],
		["2001:5C00::/23","","RIPE NCC",100,""],
		["2001:5E00::/23","","RIPE NCC",100,""],
		["2001:6000::/23","","?Brian?",100,""],
		["2001:6200::/23","","?Brian?",100,""],
		["2001:6400::/23","","?Brian?",100,""],
		["2001:6600::/23","","?Brian?",100,""],
		["2001:6800::/23","","?Brian?",100,""],
		["2001:6A00::/23","","?Brian?",100,""],
		["2001:6C00::/23","","?Brian?",100,""],
		["2001:6E00::/23","","?Brian?",100,""],
		["2001:7000::/23","","?Brian?",100,""],
		["2001:7200::/23","","?Brian?",100,""],
		["2001:7400::/23","","?Brian?",100,""],
		["2001:7600::/23","","?Brian?",100,""],
		["2001:7800::/23","","?Brian?",100,""],
		["2001:7A00::/23","","?Brian?",100,""],
		["2001:7C00::/23","","?Brian?",100,""],
		["2001:7E00::/23","","?Brian?",100,""],
		["2001:8000::/23","","APNIC",100,""],
		["2001:8200::/23","","APNIC",100,""],
		["2001:8400::/23","","APNIC",100,""],
		["2001:8600::/23","","APNIC",100,""],
		["2001:8800::/23","","APNIC",100,""],
		["2001:8A00::/23","","APNIC",100,""],
		["2001:8C00::/23","","APNIC",100,""],
		["2001:8E00::/23","","APNIC",100,""],
		["2001:9000::/23","","APNIC",100,""],
		["2001:9200::/23","","APNIC",100,""],
		["2001:9400::/23","","APNIC",100,""],
		["2001:9600::/23","","APNIC",100,""],
		["2001:9800::/23","","APNIC",100,""],
		["2001:9A00::/23","","APNIC",100,""],
		["2001:9C00::/23","","APNIC",100,""],
		["2001:9E00::/23","","APNIC",100,""],
		["2001:A000::/23","","APNIC",100,""],
		["2001:A200::/23","","APNIC",100,""],
		["2001:A400::/23","","APNIC",100,""],
		["2001:A600::/23","","APNIC",100,""],
		["2001:A800::/23","","APNIC",100,""],
		["2001:AA00::/23","","APNIC",100,""],
		["2001:AC00::/23","","APNIC",100,""],
		["2001:AE00::/23","","APNIC",100,""],
		["2001:B000::/23","","future",100,""],
		["2001:B200::/23","","future",100,""],
		["2001:B400::/23","","future",100,""],
		["2001:B600::/23","","future",100,""],
		["2001:B800::/23","","future",100,""],
		["2001:BA00::/23","","future",100,""],
		["2001:BC00::/23","","future",100,""],
		["2001:BE00::/23","","future",100,""],
		["2001:C000::/23","","future",100,""],
		["2001:C200::/23","","future",100,""],
		["2001:C400::/23","","future",100,""],
		["2001:C600::/23","","future",100,""],
		["2001:C800::/23","","future",100,""],
		["2001:CA00::/23","","future",100,""],
		["2001:CC00::/23","","future",100,""],
		["2001:CE00::/23","","future",100,""],
		["2001:D000::/23","","future",100,""],
		["2001:D200::/23","","future",100,""],
		["2001:D400::/23","","future",100,""],
		["2001:D600::/23","","future",100,""],
		["2001:D800::/23","","future",100,""],
		["2001:DA00::/23","","future",100,""],
		["2001:DC00::/23","","future",100,""],
		["2001:DE00::/23","","future",100,""],
		["2001:E000::/23","","future",100,""],
		["2001:E200::/23","","future",100,""],
		["2001:E400::/23","","future",100,""],
		["2001:E600::/23","","future",100,""],
		["2001:E800::/23","","future",100,""],
		["2001:EA00::/23","","future",100,""],
		["2001:EC00::/23","","future",100,""],
		["2001:EE00::/23","","future",100,""],
		["2001:F000::/23","","future",100,""],
		["2001:F200::/23","","future",100,""],
		["2001:F400::/23","","future",100,""],
		["2001:F600::/23","","future",100,""],
		["2001:F800::/23","","future",100,""],
		["2001:FA00::/23","","future",100,""],
		["2001:FC00::/23","","future",100,""],
		["2001:FE00::/23","","future",100,""],

		["::5efe:0:0","::ffff:0:0","ISATAP Interface Identifier",49,"ISATAP"],
		["::FF:FE00:0","::FF:FF00:0","IEEE 802 MAC >to> EUI-64 Interface Identifier",49,"EUI64"],
		["::/96","","v4 Compatible Address",49,"v4compat"],
		["::ffff:0:0/96","","v4 Mapped Address",49,"v4map"],
    ]
    return myDetails

if __name__ == '__main__':
    print "Starting DB population script..."
    populate()



