feat(Common):"testClentIP"变量动态获取
This commit is contained in:
@@ -2,12 +2,17 @@
|
|||||||
Resource ../../03-Variable/BifangApiVariable.txt
|
Resource ../../03-Variable/BifangApiVariable.txt
|
||||||
Library REST http://${host}:${port}
|
Library REST http://${host}:${port}
|
||||||
Library Collections
|
Library Collections
|
||||||
|
Library ExtensionLibrary
|
||||||
Resource ../tsg_bfapi/LoginLogout.robot
|
Resource ../tsg_bfapi/LoginLogout.robot
|
||||||
Resource ../tsg_ui/Logout/Logout.robot
|
Resource ../tsg_ui/Logout/Logout.robot
|
||||||
Resource ../tsg_ui/Login/Login.robot
|
Resource ../tsg_ui/Login/Login.robot
|
||||||
|
|
||||||
*** Keywords ***
|
*** Keywords ***
|
||||||
LoginAndAddLocalIP
|
LoginAndAddLocalIP
|
||||||
|
# 获取主机IP
|
||||||
|
${ip} Get Host IP
|
||||||
|
Set Global Variable ${testClentIP} ${ip}
|
||||||
|
|
||||||
Run Keyword If '${loginType}' == 'api' ApiLoginAndAddLocalIP aa
|
Run Keyword If '${loginType}' == 'api' ApiLoginAndAddLocalIP aa
|
||||||
... ELSE IF '${loginType}' == 'cli' CliLogin
|
... ELSE IF '${loginType}' == 'cli' CliLogin
|
||||||
... ELSE UiLoginAndAaddLocalIP bb
|
... ELSE UiLoginAndAaddLocalIP bb
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#coding=utf-8
|
||||||
|
from mytool import mytool
|
||||||
|
|
||||||
|
version = '1.0'
|
||||||
|
|
||||||
|
class ExtensionLibrary(mytool):
|
||||||
|
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#coding=utf-8
|
||||||
|
import socket
|
||||||
|
|
||||||
|
""" 获取主机信息 """
|
||||||
|
class mytool():
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_host_IP(self):
|
||||||
|
try:
|
||||||
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
|
s.connect(('8.8.8.8', 80))
|
||||||
|
ip = s.getsockname()[0]
|
||||||
|
finally:
|
||||||
|
s.close()
|
||||||
|
return ip
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
#coding=utf-8
|
#coding=utf-8
|
||||||
import sys
|
|
||||||
reload(sys)
|
|
||||||
sys.setdefaultencoding("utf-8")
|
|
||||||
|
|
||||||
""" 变量文件操作 """
|
""" 变量文件操作 """
|
||||||
|
|
||||||
class filetool():
|
class filetool():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
2
04-CustomLibrary/ExtensionPackages/extensionLibrary.pth
Normal file
2
04-CustomLibrary/ExtensionPackages/extensionLibrary.pth
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ExtensionLibrary
|
||||||
|
FileLibrary
|
||||||
Reference in New Issue
Block a user