-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 31a52a3
Showing
723 changed files
with
148,123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.pyc | ||
*.log | ||
*.idea/ | ||
*.ova | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
''' | ||
********************************************************* | ||
Copyright @ 2015 EMC Corporation All Rights Reserved | ||
********************************************************* | ||
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
''' | ||
********************************************************* | ||
Copyright @ 2015 EMC Corporation All Rights Reserved | ||
********************************************************* | ||
''' | ||
|
||
from django.db import models | ||
|
||
class ESXi(models.Model): | ||
esxiIP = models.GenericIPAddressField(max_length=32, unique=True) | ||
username = models.CharField(max_length=32) | ||
password = models.CharField(max_length=32) | ||
|
||
class Meta: | ||
ordering = ["id"] | ||
|
||
def __unicode__(self): | ||
return u'%s %s %s' % (self.esxiIP, self.username, self.password) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
''' | ||
********************************************************* | ||
Copyright @ 2015 EMC Corporation All Rights Reserved | ||
********************************************************* | ||
''' | ||
|
||
__author__ = 'wuy1' | ||
import datetime | ||
|
||
from rest_framework import serializers | ||
from django.contrib.auth.models import User, Group | ||
from AutoDeployUI.models import ESXi | ||
|
||
class ESXiSerializer(serializers.HyperlinkedModelSerializer): | ||
class Meta: | ||
model = ESXi | ||
fields = ('id', 'esxiIP', 'username', 'password') | ||
|
||
class UserSerializer(serializers.HyperlinkedModelSerializer): | ||
class Meta: | ||
model = User | ||
fields = ('id', 'username', 'email', 'is_staff', 'is_superuser','is_active', 'last_login') | ||
|
||
class GroupSerializer(serializers.HyperlinkedModelSerializer): | ||
class Meta: | ||
model = Group | ||
fields = ('id', 'name') | ||
|
||
class NodeDeploySerializer(serializers.Serializer): | ||
datastore = serializers.CharField() | ||
power = serializers.CharField() | ||
type = serializers.CharField() | ||
duration = serializers.CharField() | ||
count = serializers.CharField() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
''' | ||
********************************************************* | ||
Copyright @ 2015 EMC Corporation All Rights Reserved | ||
********************************************************* | ||
''' | ||
|
||
""" | ||
Django settings for AutoDeployUI project. | ||
Generated by 'django-admin startproject' using Django 1.8.3. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/1.8/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/1.8/ref/settings/ | ||
""" | ||
|
||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | ||
import os | ||
from os import path | ||
|
||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
|
||
PROJECT_ROOT = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) | ||
|
||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = 'ved(xc99@qz*#d^y2%*qaf9b0lp^36gk6v5531#(=rs++majc*' | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
TEMPLATE_DEBUG = DEBUG | ||
|
||
ALLOWED_HOSTS = [] | ||
|
||
LOGIN_URL = '/login' | ||
|
||
from django.core.urlresolvers import reverse_lazy | ||
# LOGIN_REDIRECT_URL setting refers to the URL to which the user will be redirected | ||
# after a successful login. | ||
LOGIN_REDIRECT_URL = reverse_lazy('home') | ||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = ( | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
'AutoDeployUI', | ||
'app', | ||
'rest_framework', | ||
'rest_framework_swagger', | ||
) | ||
|
||
REST_FRAMEWORK = { | ||
'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAdminUser',) | ||
} | ||
|
||
SWAGGER_SETTINGS = { | ||
'exclude_namespaces': [], | ||
'api_version': 'v1', | ||
'api_path': '/', | ||
'enabled_methods': [ | ||
'get', | ||
'post', | ||
'put', | ||
'patch', | ||
'delete' | ||
], | ||
'api_key': '', | ||
'is_authenticated': False, | ||
'is_superuser': False, | ||
'permission_denied_handler': None, | ||
'resource_access_handler': None, | ||
'info': { | ||
'contact': '', | ||
'description': 'v1', | ||
'license': '', | ||
'licenseUrl': '', | ||
'termsOfServiceUrl': '', | ||
'title': 'vRackSystem APIs', | ||
}, | ||
'doc_expansion': 'none', | ||
} | ||
|
||
MIDDLEWARE_CLASSES = ( | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.common.CommonMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
'django.middleware.security.SecurityMiddleware', | ||
) | ||
|
||
ROOT_URLCONF = 'AutoDeployUI.urls' | ||
|
||
TEMPLATES_ROOT = os.path.join(PROJECT_ROOT, 'app', 'templates').replace('\\', '/') | ||
|
||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [], | ||
'APP_DIRS': True, | ||
'OPTIONS': { | ||
'context_processors': [ | ||
'django.template.context_processors.debug', | ||
'django.template.context_processors.request', | ||
'django.contrib.auth.context_processors.auth', | ||
'django.contrib.messages.context_processors.messages', | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
WSGI_APPLICATION = 'AutoDeployUI.wsgi.application' | ||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.mysql', | ||
'NAME': 'AutoDeployUI', | ||
'USER': 'root', | ||
'PASSWORD': 'root', | ||
'HOST':'localhost', | ||
} | ||
} | ||
|
||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/1.8/topics/i18n/ | ||
|
||
LANGUAGE_CODE = 'en-us' | ||
|
||
TIME_ZONE = 'UTC' | ||
|
||
USE_I18N = True | ||
|
||
USE_L10N = True | ||
|
||
USE_TZ = True | ||
|
||
# Absolute path to the directory static files should be collected to. | ||
# Don't put anything in this directory yourself; store your static files | ||
# in apps' "static/" subdirectories and in STATICFILES_DIRS. | ||
# Example: "/home/media/media.lawrence.com/static/" | ||
STATIC_ROOT = path.join(PROJECT_ROOT, 'static').replace('\\', '/') | ||
|
||
# URL prefix for static files. | ||
# Example: "http://media.lawrence.com/static/" | ||
STATIC_URL = '/static/' | ||
|
||
# Additional locations of static files | ||
STATICFILES_DIRS = ( | ||
# Put strings here, like "/home/html/static" or "C:/www/django/static". | ||
# Always use forward slashes, even on Windows. | ||
# Don't forget to use absolute paths, not relative paths. | ||
) | ||
|
||
# List of finder classes that know how to find static files in | ||
# various locations. | ||
STATICFILES_FINDERS = ( | ||
'django.contrib.staticfiles.finders.FileSystemFinder', | ||
'django.contrib.staticfiles.finders.AppDirectoriesFinder', | ||
# 'django.contrib.staticfiles.finders.DefaultStorageFinder', | ||
) | ||
|
||
# List of callables that know how to import templates from various sources. | ||
TEMPLATE_LOADERS = ( | ||
'django.template.loaders.filesystem.Loader', | ||
'django.template.loaders.app_directories.Loader', | ||
# 'django.template.loaders.eggs.Loader', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
''' | ||
********************************************************* | ||
Copyright @ 2015 EMC Corporation All Rights Reserved | ||
********************************************************* | ||
''' | ||
|
||
"""AutoDeployUI URL Configuration | ||
The `urlpatterns` list routes URLs to views. For more information please see: | ||
https://docs.djangoproject.com/en/1.8/topics/http/urls/ | ||
Examples: | ||
Function views | ||
1. Add an import: from my_app import views | ||
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') | ||
Class-based views | ||
1. Add an import: from other_app.views import Home | ||
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') | ||
Including another URLconf | ||
1. Add an import: from blog import urls as blog_urls | ||
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) | ||
""" | ||
from datetime import datetime | ||
|
||
from django.conf.urls import include, url | ||
from rest_framework.urlpatterns import format_suffix_patterns | ||
from app.view import views | ||
|
||
from django.contrib import admin | ||
from app.module.forms import BootstrapAuthenticationForm | ||
|
||
urlpatterns = [ | ||
################################### Rest APIs ############################################### | ||
url(r'^api/v1/esxi/$', views.ESXiList.as_view(), name="esxi_list"), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/$', views.ESXiDetail.as_view(), name="esxi_detail"), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/getvms$', 'app.view.views.esxi_get_all_vms', name='esxi_get_all_vms'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/getvminfo$', 'app.view.views.esxi_get_vm_info', name='esxi_get_vm_info'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/poweronvm$', 'app.view.views.esxi_poweron_vm', name='esxi_poweron_vm'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/poweroffvm$', 'app.view.views.esxi_poweroff_vm', name='esxi_poweroff_vm'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/resetvm$', 'app.view.views.esxi_reset_vm', name='esxi_reset_vm'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/destroyvm$', 'app.view.views.esxi_destroy_vm', name='esxi_destroy_vm'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/hardware$', 'app.view.views.esxi_list_hardware', name='esxi_list_hardware'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/datastores$', 'app.view.views.esxi_datastore', name='esxi_get_datastore'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/networks$', 'app.view.views.esxi_network', name='esxi_get_network'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/deploy$', 'app.view.views.esxi_deploy', name='esxi_deploy'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/adddrive$', 'app.view.views.esxi_add_drive', name='esxi_add_drive'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/addnic$', 'app.view.views.esxi_add_nic', name='esxi_add_nic'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/vpduhostlist$', 'app.view.views.esxi_vpdu_host_config_list', name='esxi_vpdu_host_config_list'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/vpdusetpduinfo$', 'app.view.views.esxi_vpdu_set_pdu_info', name='esxi_vpdu_set_pdu_info'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/vpduhostadd$', 'app.view.views.esxi_vpdu_host_config_add', name='esxi_vpdu_host_config_add'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/vpduhostdel$', 'app.view.views.esxi_vpdu_host_config_del', name='esxi_vpdu_host_config_del'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/vpdumapadd$', 'app.view.views.esxi_vpdu_map_add', name='esxi_vpdu_map_add'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/vpdumapupdate$', 'app.view.views.esxi_vpdu_map_update', name='esxi_vpdu_map_update'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/vpdumaplist$', 'app.view.views.esxi_vpdu_map_list', name='esxi_vpdu_map_list'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/vpdumapdelete$', 'app.view.views.esxi_vpdu_map_delete', name='esxi_vpdu_map_delete'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/vpdupwdadd$', 'app.view.views.esxi_vpdu_pwd_add', name='esxi_vpdu_pwd_add'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/vpdupwdlist$', 'app.view.views.esxi_vpdu_pwd_list', name='esxi_vpdu_pwd_list'), | ||
url(r'^api/v1/esxi/(?P<id>[0-9]+)/vpdurestart$', 'app.view.views.esxi_vpdu_restart', name='esxi_vpdu_restart'), | ||
|
||
# url(r'^api/v1/users/$', views.UserList.as_view(), name="user_list"), | ||
# url(r'^api/v1/users/(?P<id>[0-9]+)/$', views.UserDetail.as_view(), name="user_detail"), | ||
# url(r'^api/v1/groups/$', views.GroupList.as_view(), name="group_list"), | ||
# url(r'^api/v1/groups/(?P<id>[0-9]+)/$', views.GroupDetail.as_view(), name="group_detail"), | ||
|
||
url(r'^api-auth/', include('rest_framework.urls',namespace='rest_framework')), | ||
|
||
url(r'^api/v1/ova/list$', 'app.view.views.list_ova', name='listova'), | ||
url(r'^api/v1/ova/upload$', 'app.view.views.upload_ova', name='uploadova'), | ||
|
||
################################### Web Pages ############################################### | ||
# Home page: | ||
url(r'^home/$', 'app.view.index.home', name='home'), | ||
url(r'^$', 'app.view.index.index', name='index'), | ||
|
||
# ESXi related pages: | ||
url(r'^esxi$', 'app.view.esxi.esxi', name='esxi'), | ||
url(r'^esxi/add$', 'app.view.esxi.esxiadd', name='esxiadd'), | ||
url(r'^esxi/update$', 'app.view.esxi.esxiupdate', name='esxiupdate'), | ||
url(r'^esxi/delete$', 'app.view.esxi.esxidelete', name='esxidelete'), | ||
# url(r'^esxi/deploy$', 'app.view.esxi.esxideploy', name='esxideploy'), | ||
|
||
# KVM page | ||
url(r'^kvm$', 'app.view.kvm.kvm', name='kvm'), | ||
|
||
# Docker page | ||
url(r'^docker$', 'app.view.docker.docker', name='docker'), | ||
|
||
# vNode Deploy | ||
url(r'^vnode/deploy$', 'app.view.vnode.vnodedeploy', name='vnodedeploy'), | ||
url(r'^vnode/control$', 'app.view.vnode.vnodecontrol', name='vnodecontrol'), | ||
url(r'^vnode/uploadova', 'app.view.vnode.uploadova', name='uploadova'), | ||
|
||
# vPDU | ||
url(r'^vpdu/basic$', 'app.view.vpdu.getbasic', name='vpdubasic'), | ||
url(r'^vpdu/esxihost$', 'app.view.vpdu.getesxihost', name='vpduesxi'), | ||
url(r'^vpdu/password$', 'app.view.vpdu.getpassword', name='vpdupassword'), | ||
url(r'^vpdu/mapping$', 'app.view.vpdu.getmapping', name='vpdumapping'), | ||
|
||
# vRack Builder | ||
url(r'^vrackdeploy$', 'app.view.vrackdeploy.vrackdeploy', name='vrackdeploy'), | ||
|
||
# vNode Customization | ||
url(r'^vnodecustom/adddrive$', 'app.view.vnodecustom.adddrive', name='adddrive'), | ||
url(r'^vnodecustom/addnic$', 'app.view.vnodecustom.addnic', name='addnic'), | ||
|
||
# Support Page | ||
url(r'^support$', 'app.view.support.support', name='support'), | ||
|
||
url(r'^login/$', | ||
'django.contrib.auth.views.login', | ||
{ | ||
'template_name': 'app/login.html', | ||
'authentication_form': BootstrapAuthenticationForm, | ||
'extra_context': | ||
{ | ||
'title': 'Log in', | ||
'year': datetime.now().year, | ||
} | ||
}, | ||
name='login'), | ||
url(r'^logout$', | ||
'django.contrib.auth.views.logout', | ||
{ | ||
'next_page': '/', | ||
}, | ||
name='logout'), | ||
|
||
# Uncomment the admin/doc line below to enable admin documentation: | ||
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')), | ||
|
||
# Uncomment the next line to enable the admin: | ||
url(r'^admin/', include(admin.site.urls)), | ||
url(r'^docs/', include('rest_framework_swagger.urls')), | ||
] | ||
|
||
urlpatterns = format_suffix_patterns(urlpatterns) |
Oops, something went wrong.