Scott Baker | 1a5fab3 | 2015-02-06 17:05:17 -0800 | [diff] [blame] | 1 | import os |
| 2 | import sys |
| 3 | sys.path.append("/opt/xos") |
Scott Baker | 86e132c | 2015-02-11 21:38:09 -0800 | [diff] [blame] | 4 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings") |
Scott Baker | 1a5fab3 | 2015-02-06 17:05:17 -0800 | [diff] [blame] | 5 | import django |
| 6 | from core.models import * |
| 7 | django.setup() |
| 8 | |
| 9 | # python ./manage.py sqlflush | python ./manage.py dbshell |
| 10 | |
| 11 | os.system("python /opt/xos/manage.py sqlflush | python /opt/xos/manage.py dbshell") |
| 12 | |
| 13 | ADMIN_USERNAME = "padmin@vicci.org" |
| 14 | ADMIN_PASSWORD = "letmein" |
| 15 | FLAVORS = ["m1.small", "m1.medium", "m1.large"] |
| 16 | SITE_ROLES = ["admin", "pi", "tech"] |
| 17 | SLICE_ROLES = ["admin", "access"] |
| 18 | DEPLOYMENT_ROLES = ["admin"] |
| 19 | |
Scott Baker | 1ebc723 | 2015-02-17 14:39:47 -0800 | [diff] [blame] | 20 | d = Deployment(name="MyDeployment") |
Scott Baker | 1a5fab3 | 2015-02-06 17:05:17 -0800 | [diff] [blame] | 21 | d.save() |
| 22 | |
| 23 | s = Site(name="MySite", enabled=True, login_base="mysite", is_public=True, abbreviated_name="mysite") |
| 24 | s.save() |
| 25 | |
| 26 | sd = SiteDeployment(site=s, deployment=d) |
| 27 | sd.save(); |
| 28 | |
Scott Baker | 1ebc723 | 2015-02-17 14:39:47 -0800 | [diff] [blame] | 29 | u = User(email = ADMIN_USERNAME, password=ADMIN_PASSWORD, is_admin=True, is_active=True, site=s, firstname="XOS", |
Scott Baker | 1a5fab3 | 2015-02-06 17:05:17 -0800 | [diff] [blame] | 30 | lastname="admin") |
| 31 | u.save() |
| 32 | |
| 33 | for flavor_name in FLAVORS: |
| 34 | f = Flavor(name=flavor_name, flavor=flavor_name) |
| 35 | f.save() |
| 36 | f.deployments.add(d) |
| 37 | f.save() |
| 38 | |
| 39 | for site_role_name in SITE_ROLES: |
| 40 | sr = SiteRole(role=site_role_name) |
| 41 | sr.save() |
| 42 | |
| 43 | for slice_role_name in SLICE_ROLES: |
| 44 | sr = SliceRole(role=slice_role_name) |
| 45 | sr.save() |
| 46 | |
| 47 | for deployment_role_name in DEPLOYMENT_ROLES: |
| 48 | dr = DeploymentRole(role=deployment_role_name) |
| 49 | dr.save() |
| 50 | |
| 51 | DashboardView(name="xsh", url="template:xsh", enabled=True).save() |
| 52 | DashboardView(name="Customize", url="template:customize", enabled=True).save() |
Scott Baker | 1ebc723 | 2015-02-17 14:39:47 -0800 | [diff] [blame] | 53 | tv=DashboardView(name="Tenant", url="template:xosTenant", enabled=True) |
| 54 | tv.save() |
| 55 | tv.deployments.add(d) |
| 56 | tv.save() |
Scott Baker | 1a5fab3 | 2015-02-06 17:05:17 -0800 | [diff] [blame] | 57 | DashboardView(name="Developer", url="template:xosDeveloper_datatables", enabled=True).save() |
| 58 | |
| 59 | ServiceClass(name="Best Effort", description="Best Effort").save() |
| 60 | |
Scott Baker | 85aaa43 | 2015-02-11 22:36:07 -0800 | [diff] [blame] | 61 | NetworkTemplate(name="Private", description="A private virtual network", visibility="private", translation="none", topology_kind="bigswitch", controller_kind="none").save() |
| 62 | NetworkTemplate(name="Public shared IPv4", description="Connect a sliver to the public network", visibility="private", translation="NAT", shared_network_name="nat-net", topology_kind="bigswitch", controller_kind="none").save() |
| 63 | NetworkTemplate(name="Public dedicated IPv4", description="Connect a sliver to the public network", visibility="public", translation="none", shared_network_name="ext-net", topology_kind="bigswitch", controller_kind="none").save() |
| 64 | |