def testPut(): #连接参数 dataConnect = DataConnect() dataConnect.ip = "10.0.0.100" dataConnect.port = "8080" dataConnect.account = "admin" dataConnect.password = "******" apiKey = "wce/api/vms/{0}" params = "" placeholder = "449" data = "{'state':'OK'}" RestHandler.putRest(dataConnect, apiKey, params, placeholder, data);
def testDelete(): #连接参数 dataConnect = DataConnect() dataConnect.ip = "10.0.0.100" dataConnect.port = "8080" dataConnect.account = "admin" dataConnect.password = "******" apiKey = "wce/api/vms/{0}" params = "" placeholder = "515" data = "" RestHandler.deleteRest(dataConnect, apiKey, params, placeholder, data);
def testGet(): #连接参数 dataConnect = DataConnect() dataConnect.ip = "10.0.0.100" dataConnect.port = "8080" dataConnect.account = "admin" dataConnect.password = "******" apiKey = "wce/api/vms" params = "name=服务器" placeholder = "" data = "" RestHandler.getRest(dataConnect, apiKey, params, placeholder, data);
def testPost(): #连接参数 dataConnect = DataConnect() dataConnect.ip = "10.0.0.100" dataConnect.port = "8080" dataConnect.account = "admin" dataConnect.password = "******" apiKey = "wce/api/vms" params = "" placeholder = "" data = '{"name":"kee_vm_中文","targetId":"17","state":"EXECUTING","targetType":"host","vcpu":"1","cpu":0.3,"memory":1024,"disk":"8","storagePoolId":"91","ip":"192.168.100.17","templateId":"169","vnetConfig":{ "vnetwokrId":"171", "gateway":"192.168.100.1", "netmask":"255.255.255.0", "qos":""},"customization": {"cpuWeight":384}}' RestHandler.postRest(dataConnect, apiKey, params, placeholder, data);