本文整理匯總了Python中gns3.ports.ethernet_port.EthernetPort.setAdapterNumber方法的典型用法代碼示例。如果您正苦於以下問題:Python EthernetPort.setAdapterNumber方法的具體用法?Python EthernetPort.setAdapterNumber怎麽用?Python EthernetPort.setAdapterNumber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gns3.ports.ethernet_port.EthernetPort
的用法示例。
在下文中一共展示了EthernetPort.setAdapterNumber方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: devices
# 需要導入模塊: from gns3.ports.ethernet_port import EthernetPort [as 別名]
# 或者: from gns3.ports.ethernet_port.EthernetPort import setAdapterNumber [as 別名]
def devices(local_server, project):
"""
Create two VPCS for test
"""
device1 = VPCSNode(VPCS(), local_server, project)
device1._vpcs_id = str(uuid.uuid4())
device1._settings = {"name": "VPCS 1", "script_file": "", "console": None, "startup_script": None}
device1.setInitialized(True)
port = EthernetPort("E1")
port.setAdapterNumber(0)
port.setPortNumber(0)
device1._ports.append(port)
device2 = VPCSNode(VPCS(), local_server, project)
device2._vpcs_id = str(uuid.uuid4())
device2._settings = {"name": "VPCS 2", "script_file": "", "console": None, "startup_script": None}
device2.setInitialized(True)
port = EthernetPort("E2")
port.setAdapterNumber(0)
port.setPortNumber(0)
device2._ports.append(port)
return (device1, device2)
示例2: _addAdapters
# 需要導入模塊: from gns3.ports.ethernet_port import EthernetPort [as 別名]
# 或者: from gns3.ports.ethernet_port.EthernetPort import setAdapterNumber [as 別名]
def _addAdapters(self, adapters):
"""
Adds adapters.
:param adapters: number of adapters
"""
interface_number = segment_number = 0
for adapter_number in range(0, adapters):
if self._first_port_name and adapter_number == 0:
port_name = self._first_port_name
else:
port_name = self._port_name_format.format(
interface_number,
segment_number,
port0 = interface_number,
port1 = 1 + interface_number,
segment0 = segment_number,
segment1 = 1 + segment_number
)
interface_number += 1
if self._port_segment_size and interface_number % self._port_segment_size == 0:
segment_number += 1
interface_number = 0
if self._settings["use_ubridge"]:
new_port = EthernetPort(port_name)
else:
new_port = EthernetPort(port_name, nio=NIOVMNET)
new_port.setAdapterNumber(adapter_number)
new_port.setPortNumber(0)
new_port.setPacketCaptureSupported(True)
self._ports.append(new_port)
log.debug("Adapter {} with port {} has been added".format(adapter_number, port_name))
示例3: __init__
# 需要導入模塊: from gns3.ports.ethernet_port import EthernetPort [as 別名]
# 或者: from gns3.ports.ethernet_port.EthernetPort import setAdapterNumber [as 別名]
def __init__(self, module, server, project):
VM.__init__(self, module, server, project)
log.info("VPCS instance is being created")
self._vm_id = None
self._defaults = {}
self._export_directory = None
self._loading = False
self._ports = []
self._settings = {"name": "",
"script_file": "",
"startup_script": None,
"startup_script_path": None,
"console": None}
port_name = EthernetPort.longNameType() + str(0)
short_name = EthernetPort.shortNameType() + str(0)
# VPCS devices have only one Ethernet port
port = EthernetPort(port_name)
port.setShortName(short_name)
port.setAdapterNumber(0)
port.setPortNumber(0)
self._ports.append(port)
log.debug("port {} has been added".format(port_name))
# save the default settings
self._defaults = self._settings.copy()
示例4: _addAdapters
# 需要導入模塊: from gns3.ports.ethernet_port import EthernetPort [as 別名]
# 或者: from gns3.ports.ethernet_port.EthernetPort import setAdapterNumber [as 別名]
def _addAdapters(self, adapters):
"""
Adds adapters.
:param adapters: number of adapters
"""
interface_number = segment_number = 0
for adapter_number in range(0, adapters):
if self._first_port_name and adapter_number == 0:
port_name = self._first_port_name
else:
port_name = self._port_name_format.format(
interface_number,
segment_number,
port0=interface_number,
port1=1 + interface_number,
segment0=segment_number,
segment1=1 + segment_number
)
interface_number += 1
if self._port_segment_size and interface_number % self._port_segment_size == 0:
segment_number += 1
interface_number = 0
new_port = EthernetPort(port_name)
new_port.setAdapterNumber(adapter_number)
new_port.setPortNumber(0)
new_port.setHotPluggable(False)
self._ports.append(new_port)
log.debug("Adapter {} with port {} has been added".format(adapter_number, port_name))
示例5: _addAdapters
# 需要導入模塊: from gns3.ports.ethernet_port import EthernetPort [as 別名]
# 或者: from gns3.ports.ethernet_port.EthernetPort import setAdapterNumber [as 別名]
def _addAdapters(self, adapters):
"""Adds adapters.
:param adapters: number of adapters
"""
for adapter_number in range(0, adapters):
adapter_name = EthernetPort.longNameType() + str(adapter_number)
short_name = EthernetPort.shortNameType() + str(adapter_number)
new_port = EthernetPort(adapter_name)
new_port.setShortName(short_name)
new_port.setAdapterNumber(adapter_number)
new_port.setPortNumber(0)
self._ports.append(new_port)
log.debug("Adapter {} has been added".format(adapter_name))
示例6: _addAdapters
# 需要導入模塊: from gns3.ports.ethernet_port import EthernetPort [as 別名]
# 或者: from gns3.ports.ethernet_port.EthernetPort import setAdapterNumber [as 別名]
def _addAdapters(self, adapters):
"""Adds adapters.
:param adapters: number of adapters
"""
for adapter_number in range(0, adapters):
adapter_name = "eth" + str(adapter_number)
short_name = EthernetPort.shortNameType() + str(adapter_number)
new_port = EthernetPort(adapter_name)
new_port.setShortName(short_name)
new_port.setAdapterNumber(adapter_number)
new_port.setPortNumber(0)
new_port.setHotPluggable(False)
new_port.setPacketCaptureSupported(True)
self._ports.append(new_port)
log.debug("Adapter {} has been added".format(adapter_name))
示例7: __init__
# 需要導入模塊: from gns3.ports.ethernet_port import EthernetPort [as 別名]
# 或者: from gns3.ports.ethernet_port.EthernetPort import setAdapterNumber [as 別名]
def __init__(self, module, server, project):
super().__init__(module, server, project)
log.info("VPCS instance is being created")
self._vm_id = None
self._settings = {"name": "",
"startup_script": None,
"startup_script_path": None,
"console": None}
port_name = EthernetPort.longNameType() + str(0)
short_name = EthernetPort.shortNameType() + str(0)
# VPCS devices have only one fixed Ethernet port
port = EthernetPort(port_name)
port.setShortName(short_name)
port.setAdapterNumber(0)
port.setPortNumber(0)
self._ports.append(port)
log.debug("port {} has been added".format(port_name))