本文整理匯總了Python中model.hosts.Interface.addService方法的典型用法代碼示例。如果您正苦於以下問題:Python Interface.addService方法的具體用法?Python Interface.addService怎麽用?Python Interface.addService使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類model.hosts.Interface
的用法示例。
在下文中一共展示了Interface.addService方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test
# 需要導入模塊: from model.hosts import Interface [as 別名]
# 或者: from model.hosts.Interface import addService [as 別名]
def test(self):
"""
DELETE THIS BEFORE RELEASE
used for internal testing (not correct way but we need to use it like
this for now)
"""
global test_count
test_count += 1
model.api.showPopup("Creating test host %d" % test_count)
from utils.error_report import exception_handler
def raiser():
sys.excepthook = exception_handler
time.sleep(3)
raise Exception("Exception from a secondary thread...")
from model.hosts import Host
from model.hosts import Interface
from model.hosts import Service
from model.hosts import HostApplication
self._main_app.getLogger().log("testing..")
self._main_app.getLogger().log("creating test host %d" % test_count)
host = Host("TestHost-%d" % test_count, "Windows 2003")
service = Service( "TestService-%d" % test_count, "TCP", [80,8080], "running")
interface = Interface("eth%d" % test_count, mac = "00:00:00:00:00:00",
ipv4_address = "10.1.1.%d" % test_count, ipv4_mask = "255.255.0.0",
ipv4_gateway = "10.1.1.%d" % (test_count+1),
hostname_resolution = "TestHost-%d" % test_count)
app = HostApplication( "AppTest-%d" % test_count, "running", "1.0 beta")
host.addInterface(interface)
host.addService(service)
host.addApplication(app)
interface.addService(service)
app.addService(service)
service.addInterface(interface)
self._model_controller.addHostASYNC(host)