#coding:utf-8
'''
Created on 2016��1��13��

@author: mass
'''
import requestinfo
import time

serverIp = "192.168.106.44"
mac = "aa:bb:aa:ee:cc:ff"
terminalName ="Student-076"
vmname = "about"
action = "reboot"
payload = {'name':"Student-076", "ip":"192.168.7.49", "mac":mac, \
                   "bootproto":"dhcp", "netmask":"255.255.255.0", "gateway":"192.168.7.254", "dns":"8.8.8.8"}
coursepayload = {"mac":mac,"vmnam":vmname}


#get获取上课状态下虚拟机信息
url = "https://%s:8001/vms/%s" % (serverIp, vmname)

#get获取虚拟机的类型
url = "https://%s:8001/infoconfigstates/getAuthType" % (serverIp)

#get获取证在上课的课程名称
url = "https://%s:8001/infoconfigstates/getLessonName" % (serverIp)

#get获取授权信息
url = "https://%s:8001/licences/checkLicenseDate" % (serverIp)

#get获取USB状态
url = "https://%s:8001/infoconfigstates/getUsbState" % (serverIp)

#get获取课程列表信息
courseurl = "https://%s:8001/courselibs/showCourseLibs" % serverIp

#post获取离线列表信息
url = "https://%s:8001/courselibs/OnlineCourseLibs" % serverIp

#post发送离线虚拟机运行信息
url = "https://%s:8001/clouddesktops/saveOfflineVmStat" % serverIp

#post注册学生机信息
url = "https://%s:8001/terminals/sign" % serverIp

#get获取所有虚拟机列表信息
url = "https://%s:8001/vms" % serverIp

#get主机获取配置信息
url = "https://%s:8001/infoconfigstates" % serverIp

#get获取正在上课虚拟机名称
url = "https://%s:8001/terminalvms/%s" % (serverIp, mac)

#get获取云主机的运行状态，是禁用还是启用
localurl = "https://%s:8001/cloudhostings/getlocal" % serverIp

#post控制虚拟机开关机
url = "https://%s:8001/vms/%s/%s" % (serverIp, vmname, action)

#post创建虚拟机
url = "https://%s:8001/clouddesktops" % serverIp

#postTest
url = "https://%s:8001/clouddesktops/mountPersonalDisk" % serverIp


#post请求一般需要加参数


# terminalName = requestinfo.Requests.instance().getTerminalRequestInfo(url, payload)
#          
# print terminalName
#         infoValue = requestinfo.Requests.instance().getRequestInfo(vmurl)
#          
#         classinfo = requestinfo.Requests.instance().getRequestInfo(classinfourl)
#         
#         offinfoValue = requestinfo.Requests.instance().postRequestInfo(offcourseurl, offpayload, True)
     
# start = time.time()
# print start
# vminfo = requestinfo.Requests.instance().getRequestInfo(vminfourl)
# end = time.time()
# print end
# print end-start
# print vminfo
#         
#         vmtype = requestinfo.Requests.instance().getRequestInfo(vmtypeurl)
#          
#         state = requestinfo.Requests.instance().getRequestInfo(stateurl)
#     

url = "https://%s:8001/infoconfigstates/setDiskState" % serverIp
url = "https://%s:8001/infoconfigstates/getDiskState" % serverIp
spayload = {"vmname":"aab005","state":"False"}
#infoValue = requestinfo.Requests.instance().postRequestInfo(url, spayload, True)
#print infoValue

infoValue = requestinfo.Requests.instance().getRequestInfo(url)
print infoValue
#     time.sleep(1)

# {u'port': 5900}
# 5900
# <type 'int'>



        
