Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zmops-test
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sanshi
zmops-test
Commits
9b0930ae
Commit
9b0930ae
authored
Dec 04, 2019
by
sanshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新主机
parent
72fd8898
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
5 deletions
+34
-5
Administrator.xml
.idea/dictionaries/Administrator.xml
+1
-0
host_update.py
WorkApi/API/Host/host_update.py
+2
-0
test_host_update.py
WorkCase/API/Host/test_host_update.py
+31
-5
No files found.
.idea/dictionaries/Administrator.xml
View file @
9b0930ae
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
<w>
hostids
</w>
<w>
hostids
</w>
<w>
hostinterface
</w>
<w>
hostinterface
</w>
<w>
hostmacro
</w>
<w>
hostmacro
</w>
<w>
hostmacroid
</w>
<w>
hostmonitor
</w>
<w>
hostmonitor
</w>
<w>
hostprototype
</w>
<w>
hostprototype
</w>
<w>
hosttype
</w>
<w>
hosttype
</w>
...
...
WorkApi/API/Host/host_update.py
View file @
9b0930ae
...
@@ -77,6 +77,7 @@ class HostUpdate(object):
...
@@ -77,6 +77,7 @@ class HostUpdate(object):
self
.
interfaces_ip
=
None
self
.
interfaces_ip
=
None
self
.
interfaces_dns
=
None
self
.
interfaces_dns
=
None
self
.
interfaces_port
=
None
self
.
interfaces_port
=
None
self
.
interfaces_bulk
=
None
self
.
api
=
UtilsRequest
()
self
.
api
=
UtilsRequest
()
...
@@ -91,6 +92,7 @@ class HostUpdate(object):
...
@@ -91,6 +92,7 @@ class HostUpdate(object):
base
.
dict_add_key
(
_key
=
"ip"
,
value
=
self
.
interfaces_ip
[
x
])
base
.
dict_add_key
(
_key
=
"ip"
,
value
=
self
.
interfaces_ip
[
x
])
base
.
dict_add_key
(
_key
=
"dns"
,
value
=
self
.
interfaces_dns
[
x
])
base
.
dict_add_key
(
_key
=
"dns"
,
value
=
self
.
interfaces_dns
[
x
])
base
.
dict_add_key
(
_key
=
"port"
,
value
=
self
.
interfaces_port
[
x
])
base
.
dict_add_key
(
_key
=
"port"
,
value
=
self
.
interfaces_port
[
x
])
base
.
dict_add_key
(
_key
=
"bulk"
,
value
=
self
.
interfaces_bulk
[
x
])
self
.
interfaces
.
append
(
base
.
_json
)
self
.
interfaces
.
append
(
base
.
_json
)
else
:
else
:
pass
pass
...
...
WorkCase/API/Host/test_host_update.py
View file @
9b0930ae
...
@@ -12,6 +12,7 @@ from WorkApi.API.Host.host_create import HostCreate
...
@@ -12,6 +12,7 @@ from WorkApi.API.Host.host_create import HostCreate
from
WorkApi.API.Host.host_update
import
HostUpdate
from
WorkApi.API.Host.host_update
import
HostUpdate
from
WorkData.Zabbix.hosts
import
DataHosts
from
WorkData.Zabbix.hosts
import
DataHosts
from
WorkData.Zabbix.interface
import
DataInterface
from
WorkData.Zabbix.items
import
DataItems
from
WorkData.Zabbix.items
import
DataItems
from
WorkData.Zabbix.hostmacro
import
DataHostsMacro
from
WorkData.Zabbix.hostmacro
import
DataHostsMacro
...
@@ -34,6 +35,7 @@ class TestHostUpdate(object):
...
@@ -34,6 +35,7 @@ class TestHostUpdate(object):
base_groupid
=
101
base_groupid
=
101
base_name
=
"SS TEST HOST UPDATE"
base_name
=
"SS TEST HOST UPDATE"
base_ip
=
"10.0.0.10"
base_ip
=
"10.0.0.10"
base_port
=
100
base_description
=
"SS自动化测试主机描述, 请勿删除"
base_description
=
"SS自动化测试主机描述, 请勿删除"
@classmethod
@classmethod
...
@@ -85,7 +87,8 @@ class TestHostUpdate(object):
...
@@ -85,7 +87,8 @@ class TestHostUpdate(object):
def
host_update
(
self
,
groupids
=
None
,
hostid
=
None
,
countOutput
=
None
,
editable
=
None
,
excludeSearch
=
None
,
def
host_update
(
self
,
groupids
=
None
,
hostid
=
None
,
countOutput
=
None
,
editable
=
None
,
excludeSearch
=
None
,
_filter
=
None
,
limit
=
None
,
output
=
None
,
preservekeys
=
None
,
interfaces
=
None
,
macros_macro
=
None
,
macros_value
=
None
,
_filter
=
None
,
limit
=
None
,
output
=
None
,
preservekeys
=
None
,
interfaces
=
None
,
macros_macro
=
None
,
macros_value
=
None
,
ipmi_authtype
=
None
,
ipmi_privilege
=
None
,
ipmi_username
=
None
,
ipmi_password
=
None
,
ipmi_authtype
=
None
,
ipmi_privilege
=
None
,
ipmi_username
=
None
,
ipmi_password
=
None
,
interfaces_type
=
None
,
interfaces_main
=
None
,
interfaces_useip
=
None
):
interfaces_type
=
None
,
interfaces_main
=
None
,
interfaces_useip
=
None
,
interfaces_ip
=
None
,
interfaces_dns
=
None
,
interfaces_port
=
None
,
interfaces_bulk
=
None
):
api
=
HostUpdate
(
_host
=
self
.
host
)
api
=
HostUpdate
(
_host
=
self
.
host
)
api
.
groupids
=
groupids
api
.
groupids
=
groupids
api
.
hostid
=
hostid
api
.
hostid
=
hostid
...
@@ -106,7 +109,10 @@ class TestHostUpdate(object):
...
@@ -106,7 +109,10 @@ class TestHostUpdate(object):
api
.
interfaces_type
=
interfaces_type
api
.
interfaces_type
=
interfaces_type
api
.
interfaces_main
=
interfaces_main
api
.
interfaces_main
=
interfaces_main
api
.
interfaces_useip
=
interfaces_useip
api
.
interfaces_useip
=
interfaces_useip
# api.int
api
.
interfaces_ip
=
interfaces_ip
api
.
interfaces_dns
=
interfaces_dns
api
.
interfaces_port
=
interfaces_port
api
.
interfaces_bulk
=
interfaces_bulk
api
.
get_response
()
api
.
get_response
()
return
api
.
response
return
api
.
response
...
@@ -121,6 +127,12 @@ class TestHostUpdate(object):
...
@@ -121,6 +127,12 @@ class TestHostUpdate(object):
sql
=
DataHosts
()
.
select_all_from_allKeys
(
session
=
session
,
hostid
=
hostid
)
sql
=
DataHosts
()
.
select_all_from_allKeys
(
session
=
session
,
hostid
=
hostid
)
return
sql
return
sql
@allure.step
(
"查询表:interface"
)
def
select_interface
(
self
,
hostid
):
session
=
self
.
db_session
()
sql
=
DataInterface
()
.
select_all_from_allKeys
(
session
=
session
,
hostid
=
hostid
)
return
sql
@allure.step
(
"查询表:hosts_macro"
)
@allure.step
(
"查询表:hosts_macro"
)
def
select_macro
(
self
,
hostid
):
def
select_macro
(
self
,
hostid
):
session
=
self
.
db_session
()
session
=
self
.
db_session
()
...
@@ -175,21 +187,35 @@ class TestHostUpdate(object):
...
@@ -175,21 +187,35 @@ class TestHostUpdate(object):
assert
y
.
ipmi_privilege
==
3
assert
y
.
ipmi_privilege
==
3
assert
y
.
ipmi_username
==
"ipmi_username"
assert
y
.
ipmi_username
==
"ipmi_username"
assert
y
.
ipmi_password
==
"ipmi_password"
assert
y
.
ipmi_password
==
"ipmi_password"
assert
x
==
0
sql
=
self
.
select_macro
(
hostid
=
self
.
hostid
)
sql
=
self
.
select_macro
(
hostid
=
self
.
hostid
)
for
x
,
y
in
enumerate
(
sql
):
for
x
,
y
in
enumerate
(
sql
):
assert
y
.
macro
==
"{$SNMP_COMMUNITY}"
assert
y
.
macro
==
"{$SNMP_COMMUNITY}"
assert
y
.
value
==
"public"
assert
y
.
value
==
"public"
assert
x
==
0
@allure.title
(
"host.update:无参数调用"
)
sql
=
self
.
select_interface
(
hostid
=
self
.
hostid
)
@allure.story
(
"更新主机:无参数调用"
)
for
x
,
y
in
enumerate
(
sql
):
assert
y
.
type
==
1
assert
y
.
main
==
1
assert
y
.
useip
==
1
assert
y
.
ip
==
self
.
base_ip
assert
y
.
dns
==
""
assert
int
(
y
.
port
)
==
self
.
base_port
assert
x
==
0
@allure.title
(
"host.update:需要的字段"
)
@allure.story
(
"更新主机:需要的字段"
)
@allure.severity
(
"blocker"
)
@allure.severity
(
"blocker"
)
def
test_case_01
(
self
):
def
test_case_01
(
self
):
self
.
case_create
(
num
=
"01"
)
self
.
case_create
(
num
=
"01"
)
response
=
self
.
host_update
(
hostid
=
self
.
hostid
,
macros_macro
=
[
"{$SNMP_COMMUNITY}"
],
macros_value
=
[
"public"
],
response
=
self
.
host_update
(
hostid
=
self
.
hostid
,
macros_macro
=
[
"{$SNMP_COMMUNITY}"
],
macros_value
=
[
"public"
],
ipmi_authtype
=
2
,
ipmi_password
=
"ipmi_password"
,
ipmi_authtype
=
2
,
ipmi_password
=
"ipmi_password"
,
ipmi_privilege
=
3
,
ipmi_username
=
"ipmi_username"
,
ipmi_privilege
=
3
,
ipmi_username
=
"ipmi_username"
,
)
interfaces_type
=
[
1
],
interfaces_main
=
[
1
],
interfaces_ip
=
[
self
.
base_ip
],
interfaces_dns
=
[
""
],
interfaces_useip
=
[
1
],
interfaces_port
=
[
self
.
base_port
],
interfaces_bulk
=
[
1
])
self
.
check_code
(
response
=
response
,
code
=
0
)
self
.
check_code
(
response
=
response
,
code
=
0
)
self
.
check_sql
()
self
.
check_sql
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment