Commit 9e27e899 by sanshi

资产创建

parent ea0bc58f
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
<w>graphids</w> <w>graphids</w>
<w>groupid</w> <w>groupid</w>
<w>groupids</w> <w>groupids</w>
<w>hostdiscovery</w>
<w>hostgroup</w> <w>hostgroup</w>
<w>hostid</w> <w>hostid</w>
<w>hostids</w> <w>hostids</w>
......
from WorkApi.APP.Api.api_login import ApiLogin
from WorkApi.APP.Device.device_create import DeviceCreate
import allure
from WorkUtils.UtilsResponse import UtilsResponse
class AppBase(object):
def __init__(self, host):
self.host = host
self.token = None
self.host_id = None
@allure.step("调用接口:api.login")
def api_login(self, name=None, password=None):
api = ApiLogin(_host=self.host)
api.name = name
api.password = password
api.get_response()
return api.response
@allure.step("获取token")
def get_base_token(self, login_name, base_password):
response = self.api_login(name=login_name, password=base_password)
self.token = UtilsResponse().get_data(response=response)
return self.token
@allure.step("调用接口:device.create")
def device_create(self, token=None, hostName=None, hostType=None, manageLevel=None, iplist=None, dns=None,
monitorInterface=None, monitorType=None, parentHost=None, businessIds=None,
businessTree=None, opsPerson=None, snmpCommunity=None, ipmiAuthtype=None,
ipmiPrivilege=None, ipmiUsername=None, ipmiPassword=None,
factoryId=None, model=None, version=None, serialnumber=None,
description=None, monitorStatus=None):
api = DeviceCreate(_host=self.host)
api.token = token
api.hostName = hostName
api.hostType = hostType
api.manageLevel = manageLevel
api.iplist = iplist
api.dns = dns
api.monitorInterface = monitorInterface
api.monitorType = monitorType
api.parentHost = parentHost
api.businessIds = businessIds
api.businessTree = businessTree
api.opsPerson = opsPerson
api.snmpCommunity = snmpCommunity
api.ipmiAuthtype = ipmiAuthtype
api.ipmiPrivilege = ipmiPrivilege
api.ipmiUsername = ipmiUsername
api.ipmiPassword = ipmiPassword
api.factoryId = factoryId
api.model = model
api.version = version
api.serialnumber = serialnumber
api.description = description
api.monitorStatus = monitorStatus
api.get_response()
return api.response
@allure.step("创建测试数据")
def case_create(self, base_name, num, host_type, iplist, port, businessIds):
name = base_name + num
response = self.device_create(
token=self.token, hostName=name, hostType=host_type, iplist=iplist, monitorInterface=port,
monitorType=1, manageLevel=1, parentHost=1, businessIds=businessIds,
opsPerson=11, snmpCommunity="snmpCommunity",
ipmiAuthtype=1, ipmiPrivilege=1, ipmiUsername="ipmiUsername", ipmiPassword="ipmiPassword",
factoryId=1, model="model", version="version", serialnumber="serialnumber", description="description",
monitorStatus=1)
self.host_id = UtilsResponse().get_data(response=response)
return self.host_id
...@@ -9,17 +9,17 @@ class CaseBase: ...@@ -9,17 +9,17 @@ class CaseBase:
self.environment = { self.environment = {
# "host": "http://10.0.0.12:7070", # "host": "http://10.0.0.12:7070",
# "db_url": "10.0.0.153", "db_url": "172.16.2.153",
# "db_port": 3306,
# "db_user": "zmops",
# "db_pw": "0VMoH%W7|h",
# "db_base": "zabbix",
"host": "http://172.16.3.197:7070",
"db_url": "172.16.2.155",
"db_port": 3306, "db_port": 3306,
"db_user": "root", "db_user": "zmops",
"db_pw": "123456", "db_pw": "0VMoH%W7|h",
"db_base": "zabbix" "db_base": "zabbix",
"host": "http://172.16.3.197:7070",
# "db_url": "172.16.2.155",
# "db_port": 3306,
# "db_user": "root",
# "db_pw": "123456",
# "db_base": "zabbix"
} }
self.app_environment = { self.app_environment = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment