1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-23 23:38:21 +00:00

Set console type to "none" by default for Ethernet switches and add a warning if trying to use "telnet". Fixes https://github.com/GNS3/gns3-gui/issues/2776

This commit is contained in:
grossmj 2019-05-18 14:28:20 +07:00
parent a7e449ff0e
commit 6edcbd0461
3 changed files with 9 additions and 3 deletions

View File

@ -79,7 +79,7 @@ class EthernetSwitch(Device):
:param hypervisor: Dynamips hypervisor instance
"""
def __init__(self, name, node_id, project, manager, console=None, console_type="telnet", ports=None, hypervisor=None):
def __init__(self, name, node_id, project, manager, console=None, console_type="none", ports=None, hypervisor=None):
super().__init__(name, node_id, project, manager, hypervisor)
self._nios = {}
@ -131,6 +131,10 @@ class EthernetSwitch(Device):
@console_type.setter
def console_type(self, console_type):
if console_type == "telnet":
self.project.emit("log.warning", {
"message": '"{name}": Telnet access for switches is not available in this version of GNS3'.format(name=self._name)})
self._console_type = console_type
@property
@ -184,6 +188,8 @@ class EthernetSwitch(Device):
# self._telnet_server = (await asyncio.start_server(self._telnet.run, self._manager.port_manager.console_host, self.console))
#except OSError as e:
# self.project.emit("log.warning", {"message": "Could not start Telnet server on socket {}:{}: {}".format(self._manager.port_manager.console_host, self.console, e)})
if self._console_type == "telnet":
self.project.emit("log.warning", {"message": '"{name}": Telnet access for switches is not available in this version of GNS3'.format(name=self._name)})
self._hypervisor.devices.append(self)
async def set_name(self, new_name):

View File

@ -63,7 +63,7 @@ class TemplateManager:
builtins.append(Template(uuid.uuid3(uuid.NAMESPACE_DNS, "cloud"), {"template_type": "cloud", "name": "Cloud", "category": 2, "symbol": ":/symbols/cloud.svg"}, builtin=True))
builtins.append(Template(uuid.uuid3(uuid.NAMESPACE_DNS, "nat"), {"template_type": "nat", "name": "NAT", "category": 2, "symbol": ":/symbols/cloud.svg"}, builtin=True))
builtins.append(Template(uuid.uuid3(uuid.NAMESPACE_DNS, "vpcs"), {"template_type": "vpcs", "name": "VPCS", "default_name_format": "PC-{0}", "category": 2, "symbol": ":/symbols/vpcs_guest.svg", "properties": {"base_script_file": "vpcs_base_config.txt"}}, builtin=True))
builtins.append(Template(uuid.uuid3(uuid.NAMESPACE_DNS, "ethernet_switch"), {"template_type": "ethernet_switch", "console_type": "telnet", "name": "Ethernet switch", "category": 1, "symbol": ":/symbols/ethernet_switch.svg"}, builtin=True))
builtins.append(Template(uuid.uuid3(uuid.NAMESPACE_DNS, "ethernet_switch"), {"template_type": "ethernet_switch", "console_type": "none", "name": "Ethernet switch", "category": 1, "symbol": ":/symbols/ethernet_switch.svg"}, builtin=True))
builtins.append(Template(uuid.uuid3(uuid.NAMESPACE_DNS, "ethernet_hub"), {"template_type": "ethernet_hub", "name": "Ethernet hub", "category": 1, "symbol": ":/symbols/hub.svg"}, builtin=True))
builtins.append(Template(uuid.uuid3(uuid.NAMESPACE_DNS, "frame_relay_switch"), {"template_type": "frame_relay_switch", "name": "Frame Relay switch", "category": 1, "symbol": ":/symbols/frame_relay_switch.svg"}, builtin=True))
builtins.append(Template(uuid.uuid3(uuid.NAMESPACE_DNS, "atm_switch"), {"template_type": "atm_switch", "name": "ATM switch", "category": 1, "symbol": ":/symbols/atm_switch.svg"}, builtin=True))

View File

@ -109,7 +109,7 @@ ETHERNET_SWITCH_TEMPLATE_PROPERTIES = {
"console_type": {
"description": "Console type",
"enum": ["telnet", "none"],
"default": "telnet"
"default": "none"
},
}