本文整理汇总了Python中model.hosts.Host.addInterface方法的典型用法代码示例。如果您正苦于以下问题:Python Host.addInterface方法的具体用法?Python Host.addInterface怎么用?Python Host.addInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.hosts.Host
的用法示例。
在下文中一共展示了Host.addInterface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from model.hosts import Host [as 别名]
# 或者: from model.hosts.Host import addInterface [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)