repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
GNS3/gns3-server
gns3server/compute/qemu/qemu_vm.py
QemuVM._control_vm
def _control_vm(self, command, expected=None): """ Executes a command with QEMU monitor when this VM is running. :param command: QEMU monitor command (e.g. info status, stop etc.) :param expected: An array of expected strings :returns: result of the command (matched object or N...
python
def _control_vm(self, command, expected=None): """ Executes a command with QEMU monitor when this VM is running. :param command: QEMU monitor command (e.g. info status, stop etc.) :param expected: An array of expected strings :returns: result of the command (matched object or N...
[ "def", "_control_vm", "(", "self", ",", "command", ",", "expected", "=", "None", ")", ":", "result", "=", "None", "if", "self", ".", "is_running", "(", ")", "and", "self", ".", "_monitor", ":", "log", ".", "debug", "(", "\"Execute QEMU monitor command: {}\...
Executes a command with QEMU monitor when this VM is running. :param command: QEMU monitor command (e.g. info status, stop etc.) :param expected: An array of expected strings :returns: result of the command (matched object or None)
[ "Executes", "a", "command", "with", "QEMU", "monitor", "when", "this", "VM", "is", "running", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L995-L1033
train
GNS3/gns3-server
gns3server/compute/qemu/qemu_vm.py
QemuVM.close
def close(self): """ Closes this QEMU VM. """ if not (yield from super().close()): return False self.acpi_shutdown = False yield from self.stop() for adapter in self._ethernet_adapters: if adapter is not None: for nio in ...
python
def close(self): """ Closes this QEMU VM. """ if not (yield from super().close()): return False self.acpi_shutdown = False yield from self.stop() for adapter in self._ethernet_adapters: if adapter is not None: for nio in ...
[ "def", "close", "(", "self", ")", ":", "if", "not", "(", "yield", "from", "super", "(", ")", ".", "close", "(", ")", ")", ":", "return", "False", "self", ".", "acpi_shutdown", "=", "False", "yield", "from", "self", ".", "stop", "(", ")", "for", "...
Closes this QEMU VM.
[ "Closes", "this", "QEMU", "VM", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1036-L1056
train
GNS3/gns3-server
gns3server/compute/qemu/qemu_vm.py
QemuVM._get_vm_status
def _get_vm_status(self): """ Returns this VM suspend status. Status are extracted from: https://github.com/qemu/qemu/blob/master/qapi-schema.json#L152 :returns: status (string) """ result = yield from self._control_vm("info status", [ b"debug", b...
python
def _get_vm_status(self): """ Returns this VM suspend status. Status are extracted from: https://github.com/qemu/qemu/blob/master/qapi-schema.json#L152 :returns: status (string) """ result = yield from self._control_vm("info status", [ b"debug", b...
[ "def", "_get_vm_status", "(", "self", ")", ":", "result", "=", "yield", "from", "self", ".", "_control_vm", "(", "\"info status\"", ",", "[", "b\"debug\"", ",", "b\"inmigrate\"", ",", "b\"internal-error\"", ",", "b\"io-error\"", ",", "b\"paused\"", ",", "b\"post...
Returns this VM suspend status. Status are extracted from: https://github.com/qemu/qemu/blob/master/qapi-schema.json#L152 :returns: status (string)
[ "Returns", "this", "VM", "suspend", "status", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1059-L1084
train
GNS3/gns3-server
gns3server/compute/qemu/qemu_vm.py
QemuVM.suspend
def suspend(self): """ Suspends this QEMU VM. """ if self.is_running(): vm_status = yield from self._get_vm_status() if vm_status is None: raise QemuError("Suspending a QEMU VM is not supported") elif vm_status == "running" or vm_statu...
python
def suspend(self): """ Suspends this QEMU VM. """ if self.is_running(): vm_status = yield from self._get_vm_status() if vm_status is None: raise QemuError("Suspending a QEMU VM is not supported") elif vm_status == "running" or vm_statu...
[ "def", "suspend", "(", "self", ")", ":", "if", "self", ".", "is_running", "(", ")", ":", "vm_status", "=", "yield", "from", "self", ".", "_get_vm_status", "(", ")", "if", "vm_status", "is", "None", ":", "raise", "QemuError", "(", "\"Suspending a QEMU VM is...
Suspends this QEMU VM.
[ "Suspends", "this", "QEMU", "VM", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1087-L1101
train
GNS3/gns3-server
gns3server/compute/qemu/qemu_vm.py
QemuVM.resume
def resume(self): """ Resumes this QEMU VM. """ vm_status = yield from self._get_vm_status() if vm_status is None: raise QemuError("Resuming a QEMU VM is not supported") elif vm_status == "paused": yield from self._control_vm("cont") l...
python
def resume(self): """ Resumes this QEMU VM. """ vm_status = yield from self._get_vm_status() if vm_status is None: raise QemuError("Resuming a QEMU VM is not supported") elif vm_status == "paused": yield from self._control_vm("cont") l...
[ "def", "resume", "(", "self", ")", ":", "vm_status", "=", "yield", "from", "self", ".", "_get_vm_status", "(", ")", "if", "vm_status", "is", "None", ":", "raise", "QemuError", "(", "\"Resuming a QEMU VM is not supported\"", ")", "elif", "vm_status", "==", "\"p...
Resumes this QEMU VM.
[ "Resumes", "this", "QEMU", "VM", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1113-L1125
train
GNS3/gns3-server
gns3server/compute/qemu/qemu_vm.py
QemuVM.read_stdout
def read_stdout(self): """ Reads the standard output of the QEMU process. Only use when the process has been stopped or has crashed. """ output = "" if self._stdout_file: try: with open(self._stdout_file, "rb") as file: out...
python
def read_stdout(self): """ Reads the standard output of the QEMU process. Only use when the process has been stopped or has crashed. """ output = "" if self._stdout_file: try: with open(self._stdout_file, "rb") as file: out...
[ "def", "read_stdout", "(", "self", ")", ":", "output", "=", "\"\"", "if", "self", ".", "_stdout_file", ":", "try", ":", "with", "open", "(", "self", ".", "_stdout_file", ",", "\"rb\"", ")", "as", "file", ":", "output", "=", "file", ".", "read", "(", ...
Reads the standard output of the QEMU process. Only use when the process has been stopped or has crashed.
[ "Reads", "the", "standard", "output", "of", "the", "QEMU", "process", ".", "Only", "use", "when", "the", "process", "has", "been", "stopped", "or", "has", "crashed", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1275-L1288
train
GNS3/gns3-server
gns3server/compute/qemu/qemu_vm.py
QemuVM.read_qemu_img_stdout
def read_qemu_img_stdout(self): """ Reads the standard output of the QEMU-IMG process. """ output = "" if self._qemu_img_stdout_file: try: with open(self._qemu_img_stdout_file, "rb") as file: output = file.read().decode("utf-8", er...
python
def read_qemu_img_stdout(self): """ Reads the standard output of the QEMU-IMG process. """ output = "" if self._qemu_img_stdout_file: try: with open(self._qemu_img_stdout_file, "rb") as file: output = file.read().decode("utf-8", er...
[ "def", "read_qemu_img_stdout", "(", "self", ")", ":", "output", "=", "\"\"", "if", "self", ".", "_qemu_img_stdout_file", ":", "try", ":", "with", "open", "(", "self", ".", "_qemu_img_stdout_file", ",", "\"rb\"", ")", "as", "file", ":", "output", "=", "file...
Reads the standard output of the QEMU-IMG process.
[ "Reads", "the", "standard", "output", "of", "the", "QEMU", "-", "IMG", "process", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1290-L1302
train
GNS3/gns3-server
gns3server/compute/qemu/qemu_vm.py
QemuVM.is_running
def is_running(self): """ Checks if the QEMU process is running :returns: True or False """ if self._process: if self._process.returncode is None: return True else: self._process = None return False
python
def is_running(self): """ Checks if the QEMU process is running :returns: True or False """ if self._process: if self._process.returncode is None: return True else: self._process = None return False
[ "def", "is_running", "(", "self", ")", ":", "if", "self", ".", "_process", ":", "if", "self", ".", "_process", ".", "returncode", "is", "None", ":", "return", "True", "else", ":", "self", ".", "_process", "=", "None", "return", "False" ]
Checks if the QEMU process is running :returns: True or False
[ "Checks", "if", "the", "QEMU", "process", "is", "running" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1304-L1316
train
GNS3/gns3-server
gns3server/compute/qemu/qemu_vm.py
QemuVM._get_qemu_img
def _get_qemu_img(self): """ Search the qemu-img binary in the same binary of the qemu binary for avoiding version incompatibily. :returns: qemu-img path or raise an error """ qemu_img_path = "" qemu_path_dir = os.path.dirname(self.qemu_path) try: ...
python
def _get_qemu_img(self): """ Search the qemu-img binary in the same binary of the qemu binary for avoiding version incompatibily. :returns: qemu-img path or raise an error """ qemu_img_path = "" qemu_path_dir = os.path.dirname(self.qemu_path) try: ...
[ "def", "_get_qemu_img", "(", "self", ")", ":", "qemu_img_path", "=", "\"\"", "qemu_path_dir", "=", "os", ".", "path", ".", "dirname", "(", "self", ".", "qemu_path", ")", "try", ":", "for", "f", "in", "os", ".", "listdir", "(", "qemu_path_dir", ")", ":"...
Search the qemu-img binary in the same binary of the qemu binary for avoiding version incompatibily. :returns: qemu-img path or raise an error
[ "Search", "the", "qemu", "-", "img", "binary", "in", "the", "same", "binary", "of", "the", "qemu", "binary", "for", "avoiding", "version", "incompatibily", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1364-L1383
train
GNS3/gns3-server
gns3server/compute/qemu/qemu_vm.py
QemuVM._graphic
def _graphic(self): """ Adds the correct graphic options depending of the OS """ if sys.platform.startswith("win"): return [] if len(os.environ.get("DISPLAY", "")) > 0: return [] if "-nographic" not in self._options: return ["-nographi...
python
def _graphic(self): """ Adds the correct graphic options depending of the OS """ if sys.platform.startswith("win"): return [] if len(os.environ.get("DISPLAY", "")) > 0: return [] if "-nographic" not in self._options: return ["-nographi...
[ "def", "_graphic", "(", "self", ")", ":", "if", "sys", ".", "platform", ".", "startswith", "(", "\"win\"", ")", ":", "return", "[", "]", "if", "len", "(", "os", ".", "environ", ".", "get", "(", "\"DISPLAY\"", ",", "\"\"", ")", ")", ">", "0", ":",...
Adds the correct graphic options depending of the OS
[ "Adds", "the", "correct", "graphic", "options", "depending", "of", "the", "OS" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1603-L1614
train
GNS3/gns3-server
gns3server/compute/qemu/qemu_vm.py
QemuVM._run_with_kvm
def _run_with_kvm(self, qemu_path, options): """ Check if we could run qemu with KVM :param qemu_path: Path to qemu :param options: String of qemu user options :returns: Boolean True if we need to enable KVM """ if sys.platform.startswith("linux") and self.manag...
python
def _run_with_kvm(self, qemu_path, options): """ Check if we could run qemu with KVM :param qemu_path: Path to qemu :param options: String of qemu user options :returns: Boolean True if we need to enable KVM """ if sys.platform.startswith("linux") and self.manag...
[ "def", "_run_with_kvm", "(", "self", ",", "qemu_path", ",", "options", ")", ":", "if", "sys", ".", "platform", ".", "startswith", "(", "\"linux\"", ")", "and", "self", ".", "manager", ".", "config", ".", "get_section_config", "(", "\"Qemu\"", ")", ".", "...
Check if we could run qemu with KVM :param qemu_path: Path to qemu :param options: String of qemu user options :returns: Boolean True if we need to enable KVM
[ "Check", "if", "we", "could", "run", "qemu", "with", "KVM" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qemu_vm.py#L1616-L1638
train
GNS3/gns3-server
gns3server/controller/gns3vm/__init__.py
GNS3VM.update_settings
def update_settings(self, settings): """ Update settings and will restart the VM if require """ new_settings = copy.copy(self._settings) new_settings.update(settings) if self.settings != new_settings: yield from self._stop() self._settings = settin...
python
def update_settings(self, settings): """ Update settings and will restart the VM if require """ new_settings = copy.copy(self._settings) new_settings.update(settings) if self.settings != new_settings: yield from self._stop() self._settings = settin...
[ "def", "update_settings", "(", "self", ",", "settings", ")", ":", "new_settings", "=", "copy", ".", "copy", "(", "self", ".", "_settings", ")", "new_settings", ".", "update", "(", "settings", ")", "if", "self", ".", "settings", "!=", "new_settings", ":", ...
Update settings and will restart the VM if require
[ "Update", "settings", "and", "will", "restart", "the", "VM", "if", "require" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L183-L198
train
GNS3/gns3-server
gns3server/controller/gns3vm/__init__.py
GNS3VM._get_engine
def _get_engine(self, engine): """ Load an engine """ if engine in self._engines: return self._engines[engine] if engine == "vmware": self._engines["vmware"] = VMwareGNS3VM(self._controller) return self._engines["vmware"] elif engine =...
python
def _get_engine(self, engine): """ Load an engine """ if engine in self._engines: return self._engines[engine] if engine == "vmware": self._engines["vmware"] = VMwareGNS3VM(self._controller) return self._engines["vmware"] elif engine =...
[ "def", "_get_engine", "(", "self", ",", "engine", ")", ":", "if", "engine", "in", "self", ".", "_engines", ":", "return", "self", ".", "_engines", "[", "engine", "]", "if", "engine", "==", "\"vmware\"", ":", "self", ".", "_engines", "[", "\"vmware\"", ...
Load an engine
[ "Load", "an", "engine" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L200-L216
train
GNS3/gns3-server
gns3server/controller/gns3vm/__init__.py
GNS3VM.list
def list(self, engine): """ List VMS for an engine """ engine = self._get_engine(engine) vms = [] try: for vm in (yield from engine.list()): vms.append({"vmname": vm["vmname"]}) except GNS3VMError as e: # We raise error only...
python
def list(self, engine): """ List VMS for an engine """ engine = self._get_engine(engine) vms = [] try: for vm in (yield from engine.list()): vms.append({"vmname": vm["vmname"]}) except GNS3VMError as e: # We raise error only...
[ "def", "list", "(", "self", ",", "engine", ")", ":", "engine", "=", "self", ".", "_get_engine", "(", "engine", ")", "vms", "=", "[", "]", "try", ":", "for", "vm", "in", "(", "yield", "from", "engine", ".", "list", "(", ")", ")", ":", "vms", "."...
List VMS for an engine
[ "List", "VMS", "for", "an", "engine" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L222-L236
train
GNS3/gns3-server
gns3server/controller/gns3vm/__init__.py
GNS3VM.auto_start_vm
def auto_start_vm(self): """ Auto start the GNS3 VM if require """ if self.enable: try: yield from self.start() except GNS3VMError as e: # User will receive the error later when they will try to use the node try: ...
python
def auto_start_vm(self): """ Auto start the GNS3 VM if require """ if self.enable: try: yield from self.start() except GNS3VMError as e: # User will receive the error later when they will try to use the node try: ...
[ "def", "auto_start_vm", "(", "self", ")", ":", "if", "self", ".", "enable", ":", "try", ":", "yield", "from", "self", ".", "start", "(", ")", "except", "GNS3VMError", "as", "e", ":", "# User will receive the error later when they will try to use the node", "try", ...
Auto start the GNS3 VM if require
[ "Auto", "start", "the", "GNS3", "VM", "if", "require" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L239-L255
train
GNS3/gns3-server
gns3server/controller/gns3vm/__init__.py
GNS3VM.start
def start(self): """ Start the GNS3 VM """ engine = self.current_engine() if not engine.running: if self._settings["vmname"] is None: return log.info("Start the GNS3 VM") engine.vmname = self._settings["vmname"] engi...
python
def start(self): """ Start the GNS3 VM """ engine = self.current_engine() if not engine.running: if self._settings["vmname"] is None: return log.info("Start the GNS3 VM") engine.vmname = self._settings["vmname"] engi...
[ "def", "start", "(", "self", ")", ":", "engine", "=", "self", ".", "current_engine", "(", ")", "if", "not", "engine", ".", "running", ":", "if", "self", ".", "_settings", "[", "\"vmname\"", "]", "is", "None", ":", "return", "log", ".", "info", "(", ...
Start the GNS3 VM
[ "Start", "the", "GNS3", "VM" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L269-L305
train
GNS3/gns3-server
gns3server/controller/gns3vm/__init__.py
GNS3VM._check_network
def _check_network(self, compute): """ Check that the VM is in the same subnet as the local server """ try: vm_interfaces = yield from compute.interfaces() vm_interface_netmask = None for interface in vm_interfaces: if interface["ip_ad...
python
def _check_network(self, compute): """ Check that the VM is in the same subnet as the local server """ try: vm_interfaces = yield from compute.interfaces() vm_interface_netmask = None for interface in vm_interfaces: if interface["ip_ad...
[ "def", "_check_network", "(", "self", ",", "compute", ")", ":", "try", ":", "vm_interfaces", "=", "yield", "from", "compute", ".", "interfaces", "(", ")", "vm_interface_netmask", "=", "None", "for", "interface", "in", "vm_interfaces", ":", "if", "interface", ...
Check that the VM is in the same subnet as the local server
[ "Check", "that", "the", "VM", "is", "in", "the", "same", "subnet", "as", "the", "local", "server" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L308-L338
train
GNS3/gns3-server
gns3server/controller/gns3vm/__init__.py
GNS3VM._suspend
def _suspend(self): """ Suspend the GNS3 VM """ engine = self.current_engine() if "vm" in self._controller.computes: yield from self._controller.delete_compute("vm") if engine.running: log.info("Suspend the GNS3 VM") yield from engine.s...
python
def _suspend(self): """ Suspend the GNS3 VM """ engine = self.current_engine() if "vm" in self._controller.computes: yield from self._controller.delete_compute("vm") if engine.running: log.info("Suspend the GNS3 VM") yield from engine.s...
[ "def", "_suspend", "(", "self", ")", ":", "engine", "=", "self", ".", "current_engine", "(", ")", "if", "\"vm\"", "in", "self", ".", "_controller", ".", "computes", ":", "yield", "from", "self", ".", "_controller", ".", "delete_compute", "(", "\"vm\"", "...
Suspend the GNS3 VM
[ "Suspend", "the", "GNS3", "VM" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L341-L350
train
GNS3/gns3-server
gns3server/controller/gns3vm/__init__.py
GNS3VM._stop
def _stop(self): """ Stop the GNS3 VM """ engine = self.current_engine() if "vm" in self._controller.computes: yield from self._controller.delete_compute("vm") if engine.running: log.info("Stop the GNS3 VM") yield from engine.stop()
python
def _stop(self): """ Stop the GNS3 VM """ engine = self.current_engine() if "vm" in self._controller.computes: yield from self._controller.delete_compute("vm") if engine.running: log.info("Stop the GNS3 VM") yield from engine.stop()
[ "def", "_stop", "(", "self", ")", ":", "engine", "=", "self", ".", "current_engine", "(", ")", "if", "\"vm\"", "in", "self", ".", "_controller", ".", "computes", ":", "yield", "from", "self", ".", "_controller", ".", "delete_compute", "(", "\"vm\"", ")",...
Stop the GNS3 VM
[ "Stop", "the", "GNS3", "VM" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/__init__.py#L353-L362
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router._convert_before_2_0_0_b3
def _convert_before_2_0_0_b3(self, dynamips_id): """ Before 2.0.0 beta3 the node didn't have a folder by node when we start we move the file, we can't do it in the topology conversion due to case of remote servers """ dynamips_dir = self.project.module_working_directory(s...
python
def _convert_before_2_0_0_b3(self, dynamips_id): """ Before 2.0.0 beta3 the node didn't have a folder by node when we start we move the file, we can't do it in the topology conversion due to case of remote servers """ dynamips_dir = self.project.module_working_directory(s...
[ "def", "_convert_before_2_0_0_b3", "(", "self", ",", "dynamips_id", ")", ":", "dynamips_dir", "=", "self", ".", "project", ".", "module_working_directory", "(", "self", ".", "manager", ".", "module_name", ".", "lower", "(", ")", ")", "for", "path", "in", "gl...
Before 2.0.0 beta3 the node didn't have a folder by node when we start we move the file, we can't do it in the topology conversion due to case of remote servers
[ "Before", "2", ".", "0", ".", "0", "beta3", "the", "node", "didn", "t", "have", "a", "folder", "by", "node", "when", "we", "start", "we", "move", "the", "file", "we", "can", "t", "do", "it", "in", "the", "topology", "conversion", "due", "to", "case...
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L121-L141
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.get_status
def get_status(self): """ Returns the status of this router :returns: inactive, shutting down, running or suspended. """ status = yield from self._hypervisor.send('vm get_status "{name}"'.format(name=self._name)) if len(status) == 0: raise DynamipsError("Can...
python
def get_status(self): """ Returns the status of this router :returns: inactive, shutting down, running or suspended. """ status = yield from self._hypervisor.send('vm get_status "{name}"'.format(name=self._name)) if len(status) == 0: raise DynamipsError("Can...
[ "def", "get_status", "(", "self", ")", ":", "status", "=", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm get_status \"{name}\"'", ".", "format", "(", "name", "=", "self", ".", "_name", ")", ")", "if", "len", "(", "status", ")", "=...
Returns the status of this router :returns: inactive, shutting down, running or suspended.
[ "Returns", "the", "status", "of", "this", "router" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L241-L251
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.start
def start(self): """ Starts this router. At least the IOS image must be set before it can start. """ status = yield from self.get_status() if status == "suspended": yield from self.resume() elif status == "inactive": if not os.path.isfile...
python
def start(self): """ Starts this router. At least the IOS image must be set before it can start. """ status = yield from self.get_status() if status == "suspended": yield from self.resume() elif status == "inactive": if not os.path.isfile...
[ "def", "start", "(", "self", ")", ":", "status", "=", "yield", "from", "self", ".", "get_status", "(", ")", "if", "status", "==", "\"suspended\"", ":", "yield", "from", "self", ".", "resume", "(", ")", "elif", "status", "==", "\"inactive\"", ":", "if",...
Starts this router. At least the IOS image must be set before it can start.
[ "Starts", "this", "router", ".", "At", "least", "the", "IOS", "image", "must", "be", "set", "before", "it", "can", "start", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L254-L304
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.stop
def stop(self): """ Stops this router. """ status = yield from self.get_status() if status != "inactive": try: yield from self._hypervisor.send('vm stop "{name}"'.format(name=self._name)) except DynamipsError as e: log.warn...
python
def stop(self): """ Stops this router. """ status = yield from self.get_status() if status != "inactive": try: yield from self._hypervisor.send('vm stop "{name}"'.format(name=self._name)) except DynamipsError as e: log.warn...
[ "def", "stop", "(", "self", ")", ":", "status", "=", "yield", "from", "self", ".", "get_status", "(", ")", "if", "status", "!=", "\"inactive\"", ":", "try", ":", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm stop \"{name}\"'", ".", ...
Stops this router.
[ "Stops", "this", "router", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L321-L337
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.suspend
def suspend(self): """ Suspends this router. """ status = yield from self.get_status() if status == "running": yield from self._hypervisor.send('vm suspend "{name}"'.format(name=self._name)) self.status = "suspended" log.info('Router "{name}" ...
python
def suspend(self): """ Suspends this router. """ status = yield from self.get_status() if status == "running": yield from self._hypervisor.send('vm suspend "{name}"'.format(name=self._name)) self.status = "suspended" log.info('Router "{name}" ...
[ "def", "suspend", "(", "self", ")", ":", "status", "=", "yield", "from", "self", ".", "get_status", "(", ")", "if", "status", "==", "\"running\"", ":", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm suspend \"{name}\"'", ".", "format",...
Suspends this router.
[ "Suspends", "this", "router", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L349-L358
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_image
def set_image(self, image): """ Sets the IOS image for this router. There is no default. :param image: path to IOS image file """ image = self.manager.get_abs_image_path(image) yield from self._hypervisor.send('vm set_ios "{name}" "{image}"'.format(name=self._n...
python
def set_image(self, image): """ Sets the IOS image for this router. There is no default. :param image: path to IOS image file """ image = self.manager.get_abs_image_path(image) yield from self._hypervisor.send('vm set_ios "{name}" "{image}"'.format(name=self._n...
[ "def", "set_image", "(", "self", ",", "image", ")", ":", "image", "=", "self", ".", "manager", ".", "get_abs_image_path", "(", "image", ")", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm set_ios \"{name}\" \"{image}\"'", ".", "format", ...
Sets the IOS image for this router. There is no default. :param image: path to IOS image file
[ "Sets", "the", "IOS", "image", "for", "this", "router", ".", "There", "is", "no", "default", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L491-L507
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_ram
def set_ram(self, ram): """ Sets amount of RAM allocated to this router :param ram: amount of RAM in Mbytes (integer) """ if self._ram == ram: return yield from self._hypervisor.send('vm set_ram "{name}" {ram}'.format(name=self._name, ram=ram)) log....
python
def set_ram(self, ram): """ Sets amount of RAM allocated to this router :param ram: amount of RAM in Mbytes (integer) """ if self._ram == ram: return yield from self._hypervisor.send('vm set_ram "{name}" {ram}'.format(name=self._name, ram=ram)) log....
[ "def", "set_ram", "(", "self", ",", "ram", ")", ":", "if", "self", ".", "_ram", "==", "ram", ":", "return", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm set_ram \"{name}\" {ram}'", ".", "format", "(", "name", "=", "self", ".", "_...
Sets amount of RAM allocated to this router :param ram: amount of RAM in Mbytes (integer)
[ "Sets", "amount", "of", "RAM", "allocated", "to", "this", "router" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L520-L535
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_nvram
def set_nvram(self, nvram): """ Sets amount of NVRAM allocated to this router :param nvram: amount of NVRAM in Kbytes (integer) """ if self._nvram == nvram: return yield from self._hypervisor.send('vm set_nvram "{name}" {nvram}'.format(name=self._name, nvra...
python
def set_nvram(self, nvram): """ Sets amount of NVRAM allocated to this router :param nvram: amount of NVRAM in Kbytes (integer) """ if self._nvram == nvram: return yield from self._hypervisor.send('vm set_nvram "{name}" {nvram}'.format(name=self._name, nvra...
[ "def", "set_nvram", "(", "self", ",", "nvram", ")", ":", "if", "self", ".", "_nvram", "==", "nvram", ":", "return", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm set_nvram \"{name}\" {nvram}'", ".", "format", "(", "name", "=", "self",...
Sets amount of NVRAM allocated to this router :param nvram: amount of NVRAM in Kbytes (integer)
[ "Sets", "amount", "of", "NVRAM", "allocated", "to", "this", "router" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L548-L563
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_clock_divisor
def set_clock_divisor(self, clock_divisor): """ Sets the clock divisor value. The higher is the value, the faster is the clock in the virtual machine. The default is 4, but it is often required to adjust it. :param clock_divisor: clock divisor value (integer) """ yield ...
python
def set_clock_divisor(self, clock_divisor): """ Sets the clock divisor value. The higher is the value, the faster is the clock in the virtual machine. The default is 4, but it is often required to adjust it. :param clock_divisor: clock divisor value (integer) """ yield ...
[ "def", "set_clock_divisor", "(", "self", ",", "clock_divisor", ")", ":", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm set_clock_divisor \"{name}\" {clock}'", ".", "format", "(", "name", "=", "self", ".", "_name", ",", "clock", "=", "cloc...
Sets the clock divisor value. The higher is the value, the faster is the clock in the virtual machine. The default is 4, but it is often required to adjust it. :param clock_divisor: clock divisor value (integer)
[ "Sets", "the", "clock", "divisor", "value", ".", "The", "higher", "is", "the", "value", "the", "faster", "is", "the", "clock", "in", "the", "virtual", "machine", ".", "The", "default", "is", "4", "but", "it", "is", "often", "required", "to", "adjust", ...
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L638-L651
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.get_idle_pc_prop
def get_idle_pc_prop(self): """ Gets the idle PC proposals. Takes 1000 measurements and records up to 10 idle PC proposals. There is a 10ms wait between each measurement. :returns: list of idle PC proposal """ is_running = yield from self.is_running() wa...
python
def get_idle_pc_prop(self): """ Gets the idle PC proposals. Takes 1000 measurements and records up to 10 idle PC proposals. There is a 10ms wait between each measurement. :returns: list of idle PC proposal """ is_running = yield from self.is_running() wa...
[ "def", "get_idle_pc_prop", "(", "self", ")", ":", "is_running", "=", "yield", "from", "self", ".", "is_running", "(", ")", "was_auto_started", "=", "False", "if", "not", "is_running", ":", "yield", "from", "self", ".", "start", "(", ")", "was_auto_started", ...
Gets the idle PC proposals. Takes 1000 measurements and records up to 10 idle PC proposals. There is a 10ms wait between each measurement. :returns: list of idle PC proposal
[ "Gets", "the", "idle", "PC", "proposals", ".", "Takes", "1000", "measurements", "and", "records", "up", "to", "10", "idle", "PC", "proposals", ".", "There", "is", "a", "10ms", "wait", "between", "each", "measurement", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L685-L709
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_idlemax
def set_idlemax(self, idlemax): """ Sets CPU idle max value :param idlemax: idle max value (integer) """ is_running = yield from self.is_running() if is_running: # router is running yield from self._hypervisor.send('vm set_idle_max "{name}" 0 {idlemax}'.for...
python
def set_idlemax(self, idlemax): """ Sets CPU idle max value :param idlemax: idle max value (integer) """ is_running = yield from self.is_running() if is_running: # router is running yield from self._hypervisor.send('vm set_idle_max "{name}" 0 {idlemax}'.for...
[ "def", "set_idlemax", "(", "self", ",", "idlemax", ")", ":", "is_running", "=", "yield", "from", "self", ".", "is_running", "(", ")", "if", "is_running", ":", "# router is running", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm set_idle...
Sets CPU idle max value :param idlemax: idle max value (integer)
[ "Sets", "CPU", "idle", "max", "value" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L738-L754
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_idlesleep
def set_idlesleep(self, idlesleep): """ Sets CPU idle sleep time value. :param idlesleep: idle sleep value (integer) """ is_running = yield from self.is_running() if is_running: # router is running yield from self._hypervisor.send('vm set_idle_sleep_time "{...
python
def set_idlesleep(self, idlesleep): """ Sets CPU idle sleep time value. :param idlesleep: idle sleep value (integer) """ is_running = yield from self.is_running() if is_running: # router is running yield from self._hypervisor.send('vm set_idle_sleep_time "{...
[ "def", "set_idlesleep", "(", "self", ",", "idlesleep", ")", ":", "is_running", "=", "yield", "from", "self", ".", "is_running", "(", ")", "if", "is_running", ":", "# router is running", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm set_...
Sets CPU idle sleep time value. :param idlesleep: idle sleep value (integer)
[ "Sets", "CPU", "idle", "sleep", "time", "value", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L767-L784
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_ghost_file
def set_ghost_file(self, ghost_file): """ Sets ghost RAM file :ghost_file: path to ghost file """ yield from self._hypervisor.send('vm set_ghost_file "{name}" {ghost_file}'.format(name=self._name, ...
python
def set_ghost_file(self, ghost_file): """ Sets ghost RAM file :ghost_file: path to ghost file """ yield from self._hypervisor.send('vm set_ghost_file "{name}" {ghost_file}'.format(name=self._name, ...
[ "def", "set_ghost_file", "(", "self", ",", "ghost_file", ")", ":", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm set_ghost_file \"{name}\" {ghost_file}'", ".", "format", "(", "name", "=", "self", ".", "_name", ",", "ghost_file", "=", "shl...
Sets ghost RAM file :ghost_file: path to ghost file
[ "Sets", "ghost", "RAM", "file" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L797-L811
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.formatted_ghost_file
def formatted_ghost_file(self): """ Returns a properly formatted ghost file name. :returns: formatted ghost_file name (string) """ # replace specials characters in 'drive:\filename' in Linux and Dynamips in MS Windows or viceversa. ghost_file = "{}-{}.ghost".format(os.p...
python
def formatted_ghost_file(self): """ Returns a properly formatted ghost file name. :returns: formatted ghost_file name (string) """ # replace specials characters in 'drive:\filename' in Linux and Dynamips in MS Windows or viceversa. ghost_file = "{}-{}.ghost".format(os.p...
[ "def", "formatted_ghost_file", "(", "self", ")", ":", "# replace specials characters in 'drive:\\filename' in Linux and Dynamips in MS Windows or viceversa.", "ghost_file", "=", "\"{}-{}.ghost\"", ".", "format", "(", "os", ".", "path", ".", "basename", "(", "self", ".", "_i...
Returns a properly formatted ghost file name. :returns: formatted ghost_file name (string)
[ "Returns", "a", "properly", "formatted", "ghost", "file", "name", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L813-L823
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_ghost_status
def set_ghost_status(self, ghost_status): """ Sets ghost RAM status :param ghost_status: state flag indicating status 0 => Do not use IOS ghosting 1 => This is a ghost instance 2 => Use an existing ghost instance """ yield from self._hypervisor.send('vm ...
python
def set_ghost_status(self, ghost_status): """ Sets ghost RAM status :param ghost_status: state flag indicating status 0 => Do not use IOS ghosting 1 => This is a ghost instance 2 => Use an existing ghost instance """ yield from self._hypervisor.send('vm ...
[ "def", "set_ghost_status", "(", "self", ",", "ghost_status", ")", ":", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm set_ghost_status \"{name}\" {ghost_status}'", ".", "format", "(", "name", "=", "self", ".", "_name", ",", "ghost_status", "...
Sets ghost RAM status :param ghost_status: state flag indicating status 0 => Do not use IOS ghosting 1 => This is a ghost instance 2 => Use an existing ghost instance
[ "Sets", "ghost", "RAM", "status" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L835-L851
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_console
def set_console(self, console): """ Sets the TCP console port. :param console: console port (integer) """ self.console = console yield from self._hypervisor.send('vm set_con_tcp_port "{name}" {console}'.format(name=self._name, console=self.console))
python
def set_console(self, console): """ Sets the TCP console port. :param console: console port (integer) """ self.console = console yield from self._hypervisor.send('vm set_con_tcp_port "{name}" {console}'.format(name=self._name, console=self.console))
[ "def", "set_console", "(", "self", ",", "console", ")", ":", "self", ".", "console", "=", "console", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm set_con_tcp_port \"{name}\" {console}'", ".", "format", "(", "name", "=", "self", ".", "_...
Sets the TCP console port. :param console: console port (integer)
[ "Sets", "the", "TCP", "console", "port", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L960-L968
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_aux
def set_aux(self, aux): """ Sets the TCP auxiliary port. :param aux: console auxiliary port (integer) """ self.aux = aux yield from self._hypervisor.send('vm set_aux_tcp_port "{name}" {aux}'.format(name=self._name, aux=aux))
python
def set_aux(self, aux): """ Sets the TCP auxiliary port. :param aux: console auxiliary port (integer) """ self.aux = aux yield from self._hypervisor.send('vm set_aux_tcp_port "{name}" {aux}'.format(name=self._name, aux=aux))
[ "def", "set_aux", "(", "self", ",", "aux", ")", ":", "self", ".", "aux", "=", "aux", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm set_aux_tcp_port \"{name}\" {aux}'", ".", "format", "(", "name", "=", "self", ".", "_name", ",", "aux...
Sets the TCP auxiliary port. :param aux: console auxiliary port (integer)
[ "Sets", "the", "TCP", "auxiliary", "port", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L971-L979
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.get_cpu_usage
def get_cpu_usage(self, cpu_id=0): """ Shows cpu usage in seconds, "cpu_id" is ignored. :returns: cpu usage in seconds """ cpu_usage = yield from self._hypervisor.send('vm cpu_usage "{name}" {cpu_id}'.format(name=self._name, cpu_id=cpu_id)) return int(cpu_usage[0])
python
def get_cpu_usage(self, cpu_id=0): """ Shows cpu usage in seconds, "cpu_id" is ignored. :returns: cpu usage in seconds """ cpu_usage = yield from self._hypervisor.send('vm cpu_usage "{name}" {cpu_id}'.format(name=self._name, cpu_id=cpu_id)) return int(cpu_usage[0])
[ "def", "get_cpu_usage", "(", "self", ",", "cpu_id", "=", "0", ")", ":", "cpu_usage", "=", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm cpu_usage \"{name}\" {cpu_id}'", ".", "format", "(", "name", "=", "self", ".", "_name", ",", "cpu_...
Shows cpu usage in seconds, "cpu_id" is ignored. :returns: cpu usage in seconds
[ "Shows", "cpu", "usage", "in", "seconds", "cpu_id", "is", "ignored", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L982-L990
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_mac_addr
def set_mac_addr(self, mac_addr): """ Sets the MAC address. :param mac_addr: a MAC address (hexadecimal format: hh:hh:hh:hh:hh:hh) """ yield from self._hypervisor.send('{platform} set_mac_addr "{name}" {mac_addr}'.format(platform=self._platform, ...
python
def set_mac_addr(self, mac_addr): """ Sets the MAC address. :param mac_addr: a MAC address (hexadecimal format: hh:hh:hh:hh:hh:hh) """ yield from self._hypervisor.send('{platform} set_mac_addr "{name}" {mac_addr}'.format(platform=self._platform, ...
[ "def", "set_mac_addr", "(", "self", ",", "mac_addr", ")", ":", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'{platform} set_mac_addr \"{name}\" {mac_addr}'", ".", "format", "(", "platform", "=", "self", ".", "_platform", ",", "name", "=", "s...
Sets the MAC address. :param mac_addr: a MAC address (hexadecimal format: hh:hh:hh:hh:hh:hh)
[ "Sets", "the", "MAC", "address", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1003-L1018
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_system_id
def set_system_id(self, system_id): """ Sets the system ID. :param system_id: a system ID (also called board processor ID) """ yield from self._hypervisor.send('{platform} set_system_id "{name}" {system_id}'.format(platform=self._platform, ...
python
def set_system_id(self, system_id): """ Sets the system ID. :param system_id: a system ID (also called board processor ID) """ yield from self._hypervisor.send('{platform} set_system_id "{name}" {system_id}'.format(platform=self._platform, ...
[ "def", "set_system_id", "(", "self", ",", "system_id", ")", ":", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'{platform} set_system_id \"{name}\" {system_id}'", ".", "format", "(", "platform", "=", "self", ".", "_platform", ",", "name", "=", ...
Sets the system ID. :param system_id: a system ID (also called board processor ID)
[ "Sets", "the", "system", "ID", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1031-L1046
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.get_slot_bindings
def get_slot_bindings(self): """ Returns slot bindings. :returns: slot bindings (adapter names) list """ slot_bindings = yield from self._hypervisor.send('vm slot_bindings "{}"'.format(self._name)) return slot_bindings
python
def get_slot_bindings(self): """ Returns slot bindings. :returns: slot bindings (adapter names) list """ slot_bindings = yield from self._hypervisor.send('vm slot_bindings "{}"'.format(self._name)) return slot_bindings
[ "def", "get_slot_bindings", "(", "self", ")", ":", "slot_bindings", "=", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm slot_bindings \"{}\"'", ".", "format", "(", "self", ".", "_name", ")", ")", "return", "slot_bindings" ]
Returns slot bindings. :returns: slot bindings (adapter names) list
[ "Returns", "slot", "bindings", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1049-L1057
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.uninstall_wic
def uninstall_wic(self, wic_slot_number): """ Uninstalls a WIC adapter from this router. :param wic_slot_number: WIC slot number """ # WICs are always installed on adapters in slot 0 slot_number = 0 # Do not check if slot has an adapter because adapters with WI...
python
def uninstall_wic(self, wic_slot_number): """ Uninstalls a WIC adapter from this router. :param wic_slot_number: WIC slot number """ # WICs are always installed on adapters in slot 0 slot_number = 0 # Do not check if slot has an adapter because adapters with WI...
[ "def", "uninstall_wic", "(", "self", ",", "wic_slot_number", ")", ":", "# WICs are always installed on adapters in slot 0", "slot_number", "=", "0", "# Do not check if slot has an adapter because adapters with WICs interfaces", "# must be inserted by default in the router and cannot be rem...
Uninstalls a WIC adapter from this router. :param wic_slot_number: WIC slot number
[ "Uninstalls", "a", "WIC", "adapter", "from", "this", "router", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1193-L1224
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.get_slot_nio_bindings
def get_slot_nio_bindings(self, slot_number): """ Returns slot NIO bindings. :param slot_number: slot number :returns: list of NIO bindings """ nio_bindings = yield from self._hypervisor.send('vm slot_nio_bindings "{name}" {slot_number}'.format(name=self._name, ...
python
def get_slot_nio_bindings(self, slot_number): """ Returns slot NIO bindings. :param slot_number: slot number :returns: list of NIO bindings """ nio_bindings = yield from self._hypervisor.send('vm slot_nio_bindings "{name}" {slot_number}'.format(name=self._name, ...
[ "def", "get_slot_nio_bindings", "(", "self", ",", "slot_number", ")", ":", "nio_bindings", "=", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'vm slot_nio_bindings \"{name}\" {slot_number}'", ".", "format", "(", "name", "=", "self", ".", "_name",...
Returns slot NIO bindings. :param slot_number: slot number :returns: list of NIO bindings
[ "Returns", "slot", "NIO", "bindings", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1227-L1238
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.slot_add_nio_binding
def slot_add_nio_binding(self, slot_number, port_number, nio): """ Adds a slot NIO binding. :param slot_number: slot number :param port_number: port number :param nio: NIO instance to add to the slot/port """ try: adapter = self._slots[slot_number] ...
python
def slot_add_nio_binding(self, slot_number, port_number, nio): """ Adds a slot NIO binding. :param slot_number: slot number :param port_number: port number :param nio: NIO instance to add to the slot/port """ try: adapter = self._slots[slot_number] ...
[ "def", "slot_add_nio_binding", "(", "self", ",", "slot_number", ",", "port_number", ",", "nio", ")", ":", "try", ":", "adapter", "=", "self", ".", "_slots", "[", "slot_number", "]", "except", "IndexError", ":", "raise", "DynamipsError", "(", "'Slot {slot_numbe...
Adds a slot NIO binding. :param slot_number: slot number :param port_number: port number :param nio: NIO instance to add to the slot/port
[ "Adds", "a", "slot", "NIO", "binding", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1241-L1285
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.slot_remove_nio_binding
def slot_remove_nio_binding(self, slot_number, port_number): """ Removes a slot NIO binding. :param slot_number: slot number :param port_number: port number :returns: removed NIO instance """ try: adapter = self._slots[slot_number] except In...
python
def slot_remove_nio_binding(self, slot_number, port_number): """ Removes a slot NIO binding. :param slot_number: slot number :param port_number: port number :returns: removed NIO instance """ try: adapter = self._slots[slot_number] except In...
[ "def", "slot_remove_nio_binding", "(", "self", ",", "slot_number", ",", "port_number", ")", ":", "try", ":", "adapter", "=", "self", ".", "_slots", "[", "slot_number", "]", "except", "IndexError", ":", "raise", "DynamipsError", "(", "'Slot {slot_number} does not e...
Removes a slot NIO binding. :param slot_number: slot number :param port_number: port number :returns: removed NIO instance
[ "Removes", "a", "slot", "NIO", "binding", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1299-L1339
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.slot_enable_nio
def slot_enable_nio(self, slot_number, port_number): """ Enables a slot NIO binding. :param slot_number: slot number :param port_number: port number """ is_running = yield from self.is_running() if is_running: # running router yield from self._hyper...
python
def slot_enable_nio(self, slot_number, port_number): """ Enables a slot NIO binding. :param slot_number: slot number :param port_number: port number """ is_running = yield from self.is_running() if is_running: # running router yield from self._hyper...
[ "def", "slot_enable_nio", "(", "self", ",", "slot_number", ",", "port_number", ")", ":", "is_running", "=", "yield", "from", "self", ".", "is_running", "(", ")", "if", "is_running", ":", "# running router", "yield", "from", "self", ".", "_hypervisor", ".", "...
Enables a slot NIO binding. :param slot_number: slot number :param port_number: port number
[ "Enables", "a", "slot", "NIO", "binding", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1342-L1359
train
GNS3/gns3-server
gns3server/compute/dynamips/nodes/router.py
Router.set_name
def set_name(self, new_name): """ Renames this router. :param new_name: new name string """ # change the hostname in the startup-config if os.path.isfile(self.startup_config_path): try: with open(self.startup_config_path, "r+", encoding="utf-...
python
def set_name(self, new_name): """ Renames this router. :param new_name: new name string """ # change the hostname in the startup-config if os.path.isfile(self.startup_config_path): try: with open(self.startup_config_path, "r+", encoding="utf-...
[ "def", "set_name", "(", "self", ",", "new_name", ")", ":", "# change the hostname in the startup-config", "if", "os", ".", "path", ".", "isfile", "(", "self", ".", "startup_config_path", ")", ":", "try", ":", "with", "open", "(", "self", ".", "startup_config_p...
Renames this router. :param new_name: new name string
[ "Renames", "this", "router", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/router.py#L1495-L1526
train
GNS3/gns3-server
gns3server/utils/__init__.py
parse_version
def parse_version(version): """ Return a comparable tuple from a version string. We try to force tuple to semver with version like 1.2.0 Replace pkg_resources.parse_version which now display a warning when use for comparing version with tuple :returns: Version string as comparable tuple """ r...
python
def parse_version(version): """ Return a comparable tuple from a version string. We try to force tuple to semver with version like 1.2.0 Replace pkg_resources.parse_version which now display a warning when use for comparing version with tuple :returns: Version string as comparable tuple """ r...
[ "def", "parse_version", "(", "version", ")", ":", "release_type_found", "=", "False", "version_infos", "=", "re", ".", "split", "(", "'(\\.|[a-z]+)'", ",", "version", ")", "version", "=", "[", "]", "for", "info", "in", "version_infos", ":", "if", "info", "...
Return a comparable tuple from a version string. We try to force tuple to semver with version like 1.2.0 Replace pkg_resources.parse_version which now display a warning when use for comparing version with tuple :returns: Version string as comparable tuple
[ "Return", "a", "comparable", "tuple", "from", "a", "version", "string", ".", "We", "try", "to", "force", "tuple", "to", "semver", "with", "version", "like", "1", ".", "2", ".", "0" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/utils/__init__.py#L52-L90
train
GNS3/gns3-server
gns3server/controller/gns3vm/virtualbox_gns3_vm.py
VirtualBoxGNS3VM._look_for_interface
def _look_for_interface(self, network_backend): """ Look for an interface with a specific network backend. :returns: interface number or -1 if none is found """ result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"]) interface = -1 f...
python
def _look_for_interface(self, network_backend): """ Look for an interface with a specific network backend. :returns: interface number or -1 if none is found """ result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"]) interface = -1 f...
[ "def", "_look_for_interface", "(", "self", ",", "network_backend", ")", ":", "result", "=", "yield", "from", "self", ".", "_execute", "(", "\"showvminfo\"", ",", "[", "self", ".", "_vmname", ",", "\"--machinereadable\"", "]", ")", "interface", "=", "-", "1",...
Look for an interface with a specific network backend. :returns: interface number or -1 if none is found
[ "Look", "for", "an", "interface", "with", "a", "specific", "network", "backend", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L68-L86
train
GNS3/gns3-server
gns3server/controller/gns3vm/virtualbox_gns3_vm.py
VirtualBoxGNS3VM._look_for_vboxnet
def _look_for_vboxnet(self, interface_number): """ Look for the VirtualBox network name associated with a host only interface. :returns: None or vboxnet name """ result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"]) for info in result.spli...
python
def _look_for_vboxnet(self, interface_number): """ Look for the VirtualBox network name associated with a host only interface. :returns: None or vboxnet name """ result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"]) for info in result.spli...
[ "def", "_look_for_vboxnet", "(", "self", ",", "interface_number", ")", ":", "result", "=", "yield", "from", "self", ".", "_execute", "(", "\"showvminfo\"", ",", "[", "self", ".", "_vmname", ",", "\"--machinereadable\"", "]", ")", "for", "info", "in", "result...
Look for the VirtualBox network name associated with a host only interface. :returns: None or vboxnet name
[ "Look", "for", "the", "VirtualBox", "network", "name", "associated", "with", "a", "host", "only", "interface", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L89-L102
train
GNS3/gns3-server
gns3server/controller/gns3vm/virtualbox_gns3_vm.py
VirtualBoxGNS3VM._check_dhcp_server
def _check_dhcp_server(self, vboxnet): """ Check if the DHCP server associated with a vboxnet is enabled. :param vboxnet: vboxnet name :returns: boolean """ properties = yield from self._execute("list", ["dhcpservers"]) flag_dhcp_server_found = False fo...
python
def _check_dhcp_server(self, vboxnet): """ Check if the DHCP server associated with a vboxnet is enabled. :param vboxnet: vboxnet name :returns: boolean """ properties = yield from self._execute("list", ["dhcpservers"]) flag_dhcp_server_found = False fo...
[ "def", "_check_dhcp_server", "(", "self", ",", "vboxnet", ")", ":", "properties", "=", "yield", "from", "self", ".", "_execute", "(", "\"list\"", ",", "[", "\"dhcpservers\"", "]", ")", "flag_dhcp_server_found", "=", "False", "for", "prop", "in", "properties", ...
Check if the DHCP server associated with a vboxnet is enabled. :param vboxnet: vboxnet name :returns: boolean
[ "Check", "if", "the", "DHCP", "server", "associated", "with", "a", "vboxnet", "is", "enabled", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L105-L126
train
GNS3/gns3-server
gns3server/controller/gns3vm/virtualbox_gns3_vm.py
VirtualBoxGNS3VM._check_vbox_port_forwarding
def _check_vbox_port_forwarding(self): """ Checks if the NAT port forwarding rule exists. :returns: boolean """ result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"]) for info in result.splitlines(): if '=' in info: ...
python
def _check_vbox_port_forwarding(self): """ Checks if the NAT port forwarding rule exists. :returns: boolean """ result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"]) for info in result.splitlines(): if '=' in info: ...
[ "def", "_check_vbox_port_forwarding", "(", "self", ")", ":", "result", "=", "yield", "from", "self", ".", "_execute", "(", "\"showvminfo\"", ",", "[", "self", ".", "_vmname", ",", "\"--machinereadable\"", "]", ")", "for", "info", "in", "result", ".", "splitl...
Checks if the NAT port forwarding rule exists. :returns: boolean
[ "Checks", "if", "the", "NAT", "port", "forwarding", "rule", "exists", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L129-L142
train
GNS3/gns3-server
gns3server/controller/gns3vm/virtualbox_gns3_vm.py
VirtualBoxGNS3VM.start
def start(self): """ Start the GNS3 VM. """ # get a NAT interface number nat_interface_number = yield from self._look_for_interface("nat") if nat_interface_number < 0: raise GNS3VMError("The GNS3 VM: {} must have a NAT interface configured in order to start"....
python
def start(self): """ Start the GNS3 VM. """ # get a NAT interface number nat_interface_number = yield from self._look_for_interface("nat") if nat_interface_number < 0: raise GNS3VMError("The GNS3 VM: {} must have a NAT interface configured in order to start"....
[ "def", "start", "(", "self", ")", ":", "# get a NAT interface number", "nat_interface_number", "=", "yield", "from", "self", ".", "_look_for_interface", "(", "\"nat\"", ")", "if", "nat_interface_number", "<", "0", ":", "raise", "GNS3VMError", "(", "\"The GNS3 VM: {}...
Start the GNS3 VM.
[ "Start", "the", "GNS3", "VM", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L153-L212
train
GNS3/gns3-server
gns3server/controller/gns3vm/virtualbox_gns3_vm.py
VirtualBoxGNS3VM._get_ip
def _get_ip(self, hostonly_interface_number, api_port): """ Get the IP from VirtualBox. Due to VirtualBox limitation the only way is to send request each second to a GNS3 endpoint in order to get the list of the interfaces and their IP and after that match it with VirtualBox hos...
python
def _get_ip(self, hostonly_interface_number, api_port): """ Get the IP from VirtualBox. Due to VirtualBox limitation the only way is to send request each second to a GNS3 endpoint in order to get the list of the interfaces and their IP and after that match it with VirtualBox hos...
[ "def", "_get_ip", "(", "self", ",", "hostonly_interface_number", ",", "api_port", ")", ":", "remaining_try", "=", "300", "while", "remaining_try", ">", "0", ":", "json_data", "=", "None", "session", "=", "aiohttp", ".", "ClientSession", "(", ")", "try", ":",...
Get the IP from VirtualBox. Due to VirtualBox limitation the only way is to send request each second to a GNS3 endpoint in order to get the list of the interfaces and their IP and after that match it with VirtualBox host only.
[ "Get", "the", "IP", "from", "VirtualBox", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L215-L250
train
GNS3/gns3-server
gns3server/controller/gns3vm/virtualbox_gns3_vm.py
VirtualBoxGNS3VM.stop
def stop(self): """ Stops the GNS3 VM. """ vm_state = yield from self._get_state() if vm_state == "poweroff": self.running = False return yield from self._execute("controlvm", [self._vmname, "acpipowerbutton"], timeout=3) trial = 120 ...
python
def stop(self): """ Stops the GNS3 VM. """ vm_state = yield from self._get_state() if vm_state == "poweroff": self.running = False return yield from self._execute("controlvm", [self._vmname, "acpipowerbutton"], timeout=3) trial = 120 ...
[ "def", "stop", "(", "self", ")", ":", "vm_state", "=", "yield", "from", "self", ".", "_get_state", "(", ")", "if", "vm_state", "==", "\"poweroff\"", ":", "self", ".", "running", "=", "False", "return", "yield", "from", "self", ".", "_execute", "(", "\"...
Stops the GNS3 VM.
[ "Stops", "the", "GNS3", "VM", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L263-L290
train
GNS3/gns3-server
gns3server/controller/gns3vm/virtualbox_gns3_vm.py
VirtualBoxGNS3VM.set_vcpus
def set_vcpus(self, vcpus): """ Set the number of vCPU cores for the GNS3 VM. :param vcpus: number of vCPU cores """ yield from self._execute("modifyvm", [self._vmname, "--cpus", str(vcpus)], timeout=3) log.info("GNS3 VM vCPU count set to {}".format(vcpus))
python
def set_vcpus(self, vcpus): """ Set the number of vCPU cores for the GNS3 VM. :param vcpus: number of vCPU cores """ yield from self._execute("modifyvm", [self._vmname, "--cpus", str(vcpus)], timeout=3) log.info("GNS3 VM vCPU count set to {}".format(vcpus))
[ "def", "set_vcpus", "(", "self", ",", "vcpus", ")", ":", "yield", "from", "self", ".", "_execute", "(", "\"modifyvm\"", ",", "[", "self", ".", "_vmname", ",", "\"--cpus\"", ",", "str", "(", "vcpus", ")", "]", ",", "timeout", "=", "3", ")", "log", "...
Set the number of vCPU cores for the GNS3 VM. :param vcpus: number of vCPU cores
[ "Set", "the", "number", "of", "vCPU", "cores", "for", "the", "GNS3", "VM", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L293-L301
train
GNS3/gns3-server
gns3server/controller/gns3vm/virtualbox_gns3_vm.py
VirtualBoxGNS3VM.set_ram
def set_ram(self, ram): """ Set the RAM amount for the GNS3 VM. :param ram: amount of memory """ yield from self._execute("modifyvm", [self._vmname, "--memory", str(ram)], timeout=3) log.info("GNS3 VM RAM amount set to {}".format(ram))
python
def set_ram(self, ram): """ Set the RAM amount for the GNS3 VM. :param ram: amount of memory """ yield from self._execute("modifyvm", [self._vmname, "--memory", str(ram)], timeout=3) log.info("GNS3 VM RAM amount set to {}".format(ram))
[ "def", "set_ram", "(", "self", ",", "ram", ")", ":", "yield", "from", "self", ".", "_execute", "(", "\"modifyvm\"", ",", "[", "self", ".", "_vmname", ",", "\"--memory\"", ",", "str", "(", "ram", ")", "]", ",", "timeout", "=", "3", ")", "log", ".", ...
Set the RAM amount for the GNS3 VM. :param ram: amount of memory
[ "Set", "the", "RAM", "amount", "for", "the", "GNS3", "VM", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/virtualbox_gns3_vm.py#L304-L312
train
GNS3/gns3-server
gns3server/compute/port_manager.py
PortManager.console_host
def console_host(self, new_host): """ If allow remote connection we need to bind console host to 0.0.0.0 """ server_config = Config.instance().get_section_config("Server") remote_console_connections = server_config.getboolean("allow_remote_console") if remote_console_conn...
python
def console_host(self, new_host): """ If allow remote connection we need to bind console host to 0.0.0.0 """ server_config = Config.instance().get_section_config("Server") remote_console_connections = server_config.getboolean("allow_remote_console") if remote_console_conn...
[ "def", "console_host", "(", "self", ",", "new_host", ")", ":", "server_config", "=", "Config", ".", "instance", "(", ")", ".", "get_section_config", "(", "\"Server\"", ")", "remote_console_connections", "=", "server_config", ".", "getboolean", "(", "\"allow_remote...
If allow remote connection we need to bind console host to 0.0.0.0
[ "If", "allow", "remote", "connection", "we", "need", "to", "bind", "console", "host", "to", "0", ".", "0", ".", "0", ".", "0" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/port_manager.py#L76-L86
train
GNS3/gns3-server
gns3server/compute/port_manager.py
PortManager.find_unused_port
def find_unused_port(start_port, end_port, host="127.0.0.1", socket_type="TCP", ignore_ports=None): """ Finds an unused port in a range. :param start_port: first port in the range :param end_port: last port in the range :param host: host/address for bind() :param socket_...
python
def find_unused_port(start_port, end_port, host="127.0.0.1", socket_type="TCP", ignore_ports=None): """ Finds an unused port in a range. :param start_port: first port in the range :param end_port: last port in the range :param host: host/address for bind() :param socket_...
[ "def", "find_unused_port", "(", "start_port", ",", "end_port", ",", "host", "=", "\"127.0.0.1\"", ",", "socket_type", "=", "\"TCP\"", ",", "ignore_ports", "=", "None", ")", ":", "if", "end_port", "<", "start_port", ":", "raise", "HTTPConflict", "(", "text", ...
Finds an unused port in a range. :param start_port: first port in the range :param end_port: last port in the range :param host: host/address for bind() :param socket_type: TCP (default) or UDP :param ignore_ports: list of port to ignore within the range
[ "Finds", "an", "unused", "port", "in", "a", "range", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/port_manager.py#L131-L165
train
GNS3/gns3-server
gns3server/compute/port_manager.py
PortManager._check_port
def _check_port(host, port, socket_type): """ Check if an a port is available and raise an OSError if port is not available :returns: boolean """ if socket_type == "UDP": socket_type = socket.SOCK_DGRAM else: socket_type = socket.SOCK_STREAM ...
python
def _check_port(host, port, socket_type): """ Check if an a port is available and raise an OSError if port is not available :returns: boolean """ if socket_type == "UDP": socket_type = socket.SOCK_DGRAM else: socket_type = socket.SOCK_STREAM ...
[ "def", "_check_port", "(", "host", ",", "port", ",", "socket_type", ")", ":", "if", "socket_type", "==", "\"UDP\"", ":", "socket_type", "=", "socket", ".", "SOCK_DGRAM", "else", ":", "socket_type", "=", "socket", ".", "SOCK_STREAM", "for", "res", "in", "so...
Check if an a port is available and raise an OSError if port is not available :returns: boolean
[ "Check", "if", "an", "a", "port", "is", "available", "and", "raise", "an", "OSError", "if", "port", "is", "not", "available" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/port_manager.py#L168-L184
train
GNS3/gns3-server
gns3server/compute/port_manager.py
PortManager.get_free_tcp_port
def get_free_tcp_port(self, project, port_range_start=None, port_range_end=None): """ Get an available TCP port and reserve it :param project: Project instance """ # use the default range is not specific one is given if port_range_start is None and port_range_end is Non...
python
def get_free_tcp_port(self, project, port_range_start=None, port_range_end=None): """ Get an available TCP port and reserve it :param project: Project instance """ # use the default range is not specific one is given if port_range_start is None and port_range_end is Non...
[ "def", "get_free_tcp_port", "(", "self", ",", "project", ",", "port_range_start", "=", "None", ",", "port_range_end", "=", "None", ")", ":", "# use the default range is not specific one is given", "if", "port_range_start", "is", "None", "and", "port_range_end", "is", ...
Get an available TCP port and reserve it :param project: Project instance
[ "Get", "an", "available", "TCP", "port", "and", "reserve", "it" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/port_manager.py#L186-L207
train
GNS3/gns3-server
gns3server/compute/port_manager.py
PortManager.reserve_tcp_port
def reserve_tcp_port(self, port, project, port_range_start=None, port_range_end=None): """ Reserve a specific TCP port number. If not available replace it by another. :param port: TCP port number :param project: Project instance :param port_range_start: Port range to use...
python
def reserve_tcp_port(self, port, project, port_range_start=None, port_range_end=None): """ Reserve a specific TCP port number. If not available replace it by another. :param port: TCP port number :param project: Project instance :param port_range_start: Port range to use...
[ "def", "reserve_tcp_port", "(", "self", ",", "port", ",", "project", ",", "port_range_start", "=", "None", ",", "port_range_end", "=", "None", ")", ":", "# use the default range is not specific one is given", "if", "port_range_start", "is", "None", "and", "port_range_...
Reserve a specific TCP port number. If not available replace it by another. :param port: TCP port number :param project: Project instance :param port_range_start: Port range to use :param port_range_end: Port range to use :returns: The TCP port
[ "Reserve", "a", "specific", "TCP", "port", "number", ".", "If", "not", "available", "replace", "it", "by", "another", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/port_manager.py#L209-L253
train
GNS3/gns3-server
gns3server/compute/port_manager.py
PortManager.release_tcp_port
def release_tcp_port(self, port, project): """ Release a specific TCP port number :param port: TCP port number :param project: Project instance """ if port in self._used_tcp_ports: self._used_tcp_ports.remove(port) project.remove_tcp_port(port) ...
python
def release_tcp_port(self, port, project): """ Release a specific TCP port number :param port: TCP port number :param project: Project instance """ if port in self._used_tcp_ports: self._used_tcp_ports.remove(port) project.remove_tcp_port(port) ...
[ "def", "release_tcp_port", "(", "self", ",", "port", ",", "project", ")", ":", "if", "port", "in", "self", ".", "_used_tcp_ports", ":", "self", ".", "_used_tcp_ports", ".", "remove", "(", "port", ")", "project", ".", "remove_tcp_port", "(", "port", ")", ...
Release a specific TCP port number :param port: TCP port number :param project: Project instance
[ "Release", "a", "specific", "TCP", "port", "number" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/port_manager.py#L255-L266
train
GNS3/gns3-server
gns3server/compute/port_manager.py
PortManager.get_free_udp_port
def get_free_udp_port(self, project): """ Get an available UDP port and reserve it :param project: Project instance """ port = self.find_unused_port(self._udp_port_range[0], self._udp_port_range[1], host=s...
python
def get_free_udp_port(self, project): """ Get an available UDP port and reserve it :param project: Project instance """ port = self.find_unused_port(self._udp_port_range[0], self._udp_port_range[1], host=s...
[ "def", "get_free_udp_port", "(", "self", ",", "project", ")", ":", "port", "=", "self", ".", "find_unused_port", "(", "self", ".", "_udp_port_range", "[", "0", "]", ",", "self", ".", "_udp_port_range", "[", "1", "]", ",", "host", "=", "self", ".", "_ud...
Get an available UDP port and reserve it :param project: Project instance
[ "Get", "an", "available", "UDP", "port", "and", "reserve", "it" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/port_manager.py#L268-L283
train
GNS3/gns3-server
gns3server/compute/port_manager.py
PortManager.reserve_udp_port
def reserve_udp_port(self, port, project): """ Reserve a specific UDP port number :param port: UDP port number :param project: Project instance """ if port in self._used_udp_ports: raise HTTPConflict(text="UDP port {} already in use on host {}".format(port, ...
python
def reserve_udp_port(self, port, project): """ Reserve a specific UDP port number :param port: UDP port number :param project: Project instance """ if port in self._used_udp_ports: raise HTTPConflict(text="UDP port {} already in use on host {}".format(port, ...
[ "def", "reserve_udp_port", "(", "self", ",", "port", ",", "project", ")", ":", "if", "port", "in", "self", ".", "_used_udp_ports", ":", "raise", "HTTPConflict", "(", "text", "=", "\"UDP port {} already in use on host {}\"", ".", "format", "(", "port", ",", "se...
Reserve a specific UDP port number :param port: UDP port number :param project: Project instance
[ "Reserve", "a", "specific", "UDP", "port", "number" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/port_manager.py#L285-L299
train
GNS3/gns3-server
gns3server/compute/port_manager.py
PortManager.release_udp_port
def release_udp_port(self, port, project): """ Release a specific UDP port number :param port: UDP port number :param project: Project instance """ if port in self._used_udp_ports: self._used_udp_ports.remove(port) project.remove_udp_port(port) ...
python
def release_udp_port(self, port, project): """ Release a specific UDP port number :param port: UDP port number :param project: Project instance """ if port in self._used_udp_ports: self._used_udp_ports.remove(port) project.remove_udp_port(port) ...
[ "def", "release_udp_port", "(", "self", ",", "port", ",", "project", ")", ":", "if", "port", "in", "self", ".", "_used_udp_ports", ":", "self", ".", "_used_udp_ports", ".", "remove", "(", "port", ")", "project", ".", "remove_udp_port", "(", "port", ")", ...
Release a specific UDP port number :param port: UDP port number :param project: Project instance
[ "Release", "a", "specific", "UDP", "port", "number" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/port_manager.py#L301-L312
train
GNS3/gns3-server
gns3server/compute/iou/__init__.py
IOU.create_node
def create_node(self, *args, **kwargs): """ Creates a new IOU VM. :returns: IOUVM instance """ with (yield from self._iou_id_lock): # wait for a node to be completely created before adding a new one # this is important otherwise we allocate the same appl...
python
def create_node(self, *args, **kwargs): """ Creates a new IOU VM. :returns: IOUVM instance """ with (yield from self._iou_id_lock): # wait for a node to be completely created before adding a new one # this is important otherwise we allocate the same appl...
[ "def", "create_node", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "(", "yield", "from", "self", ".", "_iou_id_lock", ")", ":", "# wait for a node to be completely created before adding a new one", "# this is important otherwise we allocate ...
Creates a new IOU VM. :returns: IOUVM instance
[ "Creates", "a", "new", "IOU", "VM", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/__init__.py#L45-L58
train
GNS3/gns3-server
scripts/random_query.py
create_link
async def create_link(project, nodes): """ Create all possible link of a node """ node1 = random.choice(list(nodes.values())) for port in range(0, 8): node2 = random.choice(list(nodes.values())) if node1 == node2: continue data = {"nodes": [ ...
python
async def create_link(project, nodes): """ Create all possible link of a node """ node1 = random.choice(list(nodes.values())) for port in range(0, 8): node2 = random.choice(list(nodes.values())) if node1 == node2: continue data = {"nodes": [ ...
[ "async", "def", "create_link", "(", "project", ",", "nodes", ")", ":", "node1", "=", "random", ".", "choice", "(", "list", "(", "nodes", ".", "values", "(", ")", ")", ")", "for", "port", "in", "range", "(", "0", ",", "8", ")", ":", "node2", "=", ...
Create all possible link of a node
[ "Create", "all", "possible", "link", "of", "a", "node" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/scripts/random_query.py#L155-L184
train
GNS3/gns3-server
gns3server/utils/asyncio/pool.py
Pool.join
def join(self): """ Wait for all task to finish """ pending = set() exceptions = set() while len(self._tasks) > 0 or len(pending) > 0: while len(self._tasks) > 0 and len(pending) < self._concurrency: task, args, kwargs = self._tasks.pop(0) ...
python
def join(self): """ Wait for all task to finish """ pending = set() exceptions = set() while len(self._tasks) > 0 or len(pending) > 0: while len(self._tasks) > 0 and len(pending) < self._concurrency: task, args, kwargs = self._tasks.pop(0) ...
[ "def", "join", "(", "self", ")", ":", "pending", "=", "set", "(", ")", "exceptions", "=", "set", "(", ")", "while", "len", "(", "self", ".", "_tasks", ")", ">", "0", "or", "len", "(", "pending", ")", ">", "0", ":", "while", "len", "(", "self", ...
Wait for all task to finish
[ "Wait", "for", "all", "task", "to", "finish" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/utils/asyncio/pool.py#L34-L49
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.name
def name(self, new_name): """ Sets the name of this node. :param new_name: name """ log.info("{module}: {name} [{id}] renamed to {new_name}".format(module=self.manager.module_name, name=self.name, ...
python
def name(self, new_name): """ Sets the name of this node. :param new_name: name """ log.info("{module}: {name} [{id}] renamed to {new_name}".format(module=self.manager.module_name, name=self.name, ...
[ "def", "name", "(", "self", ",", "new_name", ")", ":", "log", ".", "info", "(", "\"{module}: {name} [{id}] renamed to {new_name}\"", ".", "format", "(", "module", "=", "self", ".", "manager", ".", "module_name", ",", "name", "=", "self", ".", "name", ",", ...
Sets the name of this node. :param new_name: name
[ "Sets", "the", "name", "of", "this", "node", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L176-L187
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.create
def create(self): """ Creates the node. """ log.info("{module}: {name} [{id}] created".format(module=self.manager.module_name, name=self.name, id=self.id))
python
def create(self): """ Creates the node. """ log.info("{module}: {name} [{id}] created".format(module=self.manager.module_name, name=self.name, id=self.id))
[ "def", "create", "(", "self", ")", ":", "log", ".", "info", "(", "\"{module}: {name} [{id}] created\"", ".", "format", "(", "module", "=", "self", ".", "manager", ".", "module_name", ",", "name", "=", "self", ".", "name", ",", "id", "=", "self", ".", "...
Creates the node.
[ "Creates", "the", "node", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L254-L261
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.stop
def stop(self): """ Stop the node process. """ if self._wrapper_telnet_server: self._wrapper_telnet_server.close() yield from self._wrapper_telnet_server.wait_closed() self.status = "stopped"
python
def stop(self): """ Stop the node process. """ if self._wrapper_telnet_server: self._wrapper_telnet_server.close() yield from self._wrapper_telnet_server.wait_closed() self.status = "stopped"
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "_wrapper_telnet_server", ":", "self", ".", "_wrapper_telnet_server", ".", "close", "(", ")", "yield", "from", "self", ".", "_wrapper_telnet_server", ".", "wait_closed", "(", ")", "self", ".", "status"...
Stop the node process.
[ "Stop", "the", "node", "process", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L286-L293
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.close
def close(self): """ Close the node process. """ if self._closed: return False log.info("{module}: '{name}' [{id}]: is closing".format(module=self.manager.module_name, name=self.name, ...
python
def close(self): """ Close the node process. """ if self._closed: return False log.info("{module}: '{name}' [{id}]: is closing".format(module=self.manager.module_name, name=self.name, ...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_closed", ":", "return", "False", "log", ".", "info", "(", "\"{module}: '{name}' [{id}]: is closing\"", ".", "format", "(", "module", "=", "self", ".", "manager", ".", "module_name", ",", "name", "...
Close the node process.
[ "Close", "the", "node", "process", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L303-L327
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.start_wrap_console
def start_wrap_console(self): """ Start a telnet proxy for the console allowing multiple client connected at the same time """ if not self._wrap_console or self._console_type != "telnet": return remaining_trial = 60 while True: try: ...
python
def start_wrap_console(self): """ Start a telnet proxy for the console allowing multiple client connected at the same time """ if not self._wrap_console or self._console_type != "telnet": return remaining_trial = 60 while True: try: ...
[ "def", "start_wrap_console", "(", "self", ")", ":", "if", "not", "self", ".", "_wrap_console", "or", "self", ".", "_console_type", "!=", "\"telnet\"", ":", "return", "remaining_trial", "=", "60", "while", "True", ":", "try", ":", "(", "reader", ",", "write...
Start a telnet proxy for the console allowing multiple client connected at the same time
[ "Start", "a", "telnet", "proxy", "for", "the", "console", "allowing", "multiple", "client", "connected", "at", "the", "same", "time" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L330-L349
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.aux
def aux(self, aux): """ Changes the aux port :params aux: Console port (integer) or None to free the port """ if aux == self._aux: return if self._aux: self._manager.port_manager.release_tcp_port(self._aux, self._project) self._aux =...
python
def aux(self, aux): """ Changes the aux port :params aux: Console port (integer) or None to free the port """ if aux == self._aux: return if self._aux: self._manager.port_manager.release_tcp_port(self._aux, self._project) self._aux =...
[ "def", "aux", "(", "self", ",", "aux", ")", ":", "if", "aux", "==", "self", ".", "_aux", ":", "return", "if", "self", ".", "_aux", ":", "self", ".", "_manager", ".", "port_manager", ".", "release_tcp_port", "(", "self", ".", "_aux", ",", "self", "....
Changes the aux port :params aux: Console port (integer) or None to free the port
[ "Changes", "the", "aux", "port" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L376-L394
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.console
def console(self, console): """ Changes the console port :params console: Console port (integer) or None to free the port """ if console == self._console: return if self._console_type == "vnc" and console is not None and console < 5900: raise No...
python
def console(self, console): """ Changes the console port :params console: Console port (integer) or None to free the port """ if console == self._console: return if self._console_type == "vnc" and console is not None and console < 5900: raise No...
[ "def", "console", "(", "self", ",", "console", ")", ":", "if", "console", "==", "self", ".", "_console", ":", "return", "if", "self", ".", "_console_type", "==", "\"vnc\"", "and", "console", "is", "not", "None", "and", "console", "<", "5900", ":", "rai...
Changes the console port :params console: Console port (integer) or None to free the port
[ "Changes", "the", "console", "port" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L407-L432
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.console_type
def console_type(self, console_type): """ Sets the console type for this node. :param console_type: console type (string) """ if console_type != self._console_type: # get a new port if the console type change self._manager.port_manager.release_tcp_port(s...
python
def console_type(self, console_type): """ Sets the console type for this node. :param console_type: console type (string) """ if console_type != self._console_type: # get a new port if the console type change self._manager.port_manager.release_tcp_port(s...
[ "def", "console_type", "(", "self", ",", "console_type", ")", ":", "if", "console_type", "!=", "self", ".", "_console_type", ":", "# get a new port if the console type change", "self", ".", "_manager", ".", "port_manager", ".", "release_tcp_port", "(", "self", ".", ...
Sets the console type for this node. :param console_type: console type (string)
[ "Sets", "the", "console", "type", "for", "this", "node", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L445-L465
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.ubridge
def ubridge(self): """ Returns the uBridge hypervisor. :returns: instance of uBridge """ if self._ubridge_hypervisor and not self._ubridge_hypervisor.is_running(): self._ubridge_hypervisor = None return self._ubridge_hypervisor
python
def ubridge(self): """ Returns the uBridge hypervisor. :returns: instance of uBridge """ if self._ubridge_hypervisor and not self._ubridge_hypervisor.is_running(): self._ubridge_hypervisor = None return self._ubridge_hypervisor
[ "def", "ubridge", "(", "self", ")", ":", "if", "self", ".", "_ubridge_hypervisor", "and", "not", "self", ".", "_ubridge_hypervisor", ".", "is_running", "(", ")", ":", "self", ".", "_ubridge_hypervisor", "=", "None", "return", "self", ".", "_ubridge_hypervisor"...
Returns the uBridge hypervisor. :returns: instance of uBridge
[ "Returns", "the", "uBridge", "hypervisor", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L468-L477
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.ubridge_path
def ubridge_path(self): """ Returns the uBridge executable path. :returns: path to uBridge """ path = self._manager.config.get_section_config("Server").get("ubridge_path", "ubridge") path = shutil.which(path) return path
python
def ubridge_path(self): """ Returns the uBridge executable path. :returns: path to uBridge """ path = self._manager.config.get_section_config("Server").get("ubridge_path", "ubridge") path = shutil.which(path) return path
[ "def", "ubridge_path", "(", "self", ")", ":", "path", "=", "self", ".", "_manager", ".", "config", ".", "get_section_config", "(", "\"Server\"", ")", ".", "get", "(", "\"ubridge_path\"", ",", "\"ubridge\"", ")", "path", "=", "shutil", ".", "which", "(", ...
Returns the uBridge executable path. :returns: path to uBridge
[ "Returns", "the", "uBridge", "executable", "path", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L490-L499
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode._ubridge_send
def _ubridge_send(self, command): """ Sends a command to uBridge hypervisor. :param command: command to send """ if not self._ubridge_hypervisor or not self._ubridge_hypervisor.is_running(): yield from self._start_ubridge() if not self._ubridge_hypervisor or...
python
def _ubridge_send(self, command): """ Sends a command to uBridge hypervisor. :param command: command to send """ if not self._ubridge_hypervisor or not self._ubridge_hypervisor.is_running(): yield from self._start_ubridge() if not self._ubridge_hypervisor or...
[ "def", "_ubridge_send", "(", "self", ",", "command", ")", ":", "if", "not", "self", ".", "_ubridge_hypervisor", "or", "not", "self", ".", "_ubridge_hypervisor", ".", "is_running", "(", ")", ":", "yield", "from", "self", ".", "_start_ubridge", "(", ")", "if...
Sends a command to uBridge hypervisor. :param command: command to send
[ "Sends", "a", "command", "to", "uBridge", "hypervisor", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L502-L516
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode._stop_ubridge
def _stop_ubridge(self): """ Stops uBridge. """ if self._ubridge_hypervisor and self._ubridge_hypervisor.is_running(): log.info("Stopping uBridge hypervisor {}:{}".format(self._ubridge_hypervisor.host, self._ubridge_hypervisor.port)) yield from self._ubridge_hype...
python
def _stop_ubridge(self): """ Stops uBridge. """ if self._ubridge_hypervisor and self._ubridge_hypervisor.is_running(): log.info("Stopping uBridge hypervisor {}:{}".format(self._ubridge_hypervisor.host, self._ubridge_hypervisor.port)) yield from self._ubridge_hype...
[ "def", "_stop_ubridge", "(", "self", ")", ":", "if", "self", ".", "_ubridge_hypervisor", "and", "self", ".", "_ubridge_hypervisor", ".", "is_running", "(", ")", ":", "log", ".", "info", "(", "\"Stopping uBridge hypervisor {}:{}\"", ".", "format", "(", "self", ...
Stops uBridge.
[ "Stops", "uBridge", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L545-L553
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.add_ubridge_udp_connection
def add_ubridge_udp_connection(self, bridge_name, source_nio, destination_nio): """ Creates an UDP connection in uBridge. :param bridge_name: bridge name in uBridge :param source_nio: source NIO instance :param destination_nio: destination NIO instance """ yield...
python
def add_ubridge_udp_connection(self, bridge_name, source_nio, destination_nio): """ Creates an UDP connection in uBridge. :param bridge_name: bridge name in uBridge :param source_nio: source NIO instance :param destination_nio: destination NIO instance """ yield...
[ "def", "add_ubridge_udp_connection", "(", "self", ",", "bridge_name", ",", "source_nio", ",", "destination_nio", ")", ":", "yield", "from", "self", ".", "_ubridge_send", "(", "\"bridge create {name}\"", ".", "format", "(", "name", "=", "bridge_name", ")", ")", "...
Creates an UDP connection in uBridge. :param bridge_name: bridge name in uBridge :param source_nio: source NIO instance :param destination_nio: destination NIO instance
[ "Creates", "an", "UDP", "connection", "in", "uBridge", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L556-L585
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode._ubridge_apply_filters
def _ubridge_apply_filters(self, bridge_name, filters): """ Apply packet filters :param bridge_name: bridge name in uBridge :param filters: Array of filter dictionary """ yield from self._ubridge_send('bridge reset_packet_filters ' + bridge_name) for packet_filte...
python
def _ubridge_apply_filters(self, bridge_name, filters): """ Apply packet filters :param bridge_name: bridge name in uBridge :param filters: Array of filter dictionary """ yield from self._ubridge_send('bridge reset_packet_filters ' + bridge_name) for packet_filte...
[ "def", "_ubridge_apply_filters", "(", "self", ",", "bridge_name", ",", "filters", ")", ":", "yield", "from", "self", ".", "_ubridge_send", "(", "'bridge reset_packet_filters '", "+", "bridge_name", ")", "for", "packet_filter", "in", "self", ".", "_build_filter_list"...
Apply packet filters :param bridge_name: bridge name in uBridge :param filters: Array of filter dictionary
[ "Apply", "packet", "filters" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L600-L619
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode._add_ubridge_ethernet_connection
def _add_ubridge_ethernet_connection(self, bridge_name, ethernet_interface, block_host_traffic=False): """ Creates a connection with an Ethernet interface in uBridge. :param bridge_name: bridge name in uBridge :param ethernet_interface: Ethernet interface name :param block_host_...
python
def _add_ubridge_ethernet_connection(self, bridge_name, ethernet_interface, block_host_traffic=False): """ Creates a connection with an Ethernet interface in uBridge. :param bridge_name: bridge name in uBridge :param ethernet_interface: Ethernet interface name :param block_host_...
[ "def", "_add_ubridge_ethernet_connection", "(", "self", ",", "bridge_name", ",", "ethernet_interface", ",", "block_host_traffic", "=", "False", ")", ":", "if", "sys", ".", "platform", ".", "startswith", "(", "\"linux\"", ")", "and", "block_host_traffic", "is", "Fa...
Creates a connection with an Ethernet interface in uBridge. :param bridge_name: bridge name in uBridge :param ethernet_interface: Ethernet interface name :param block_host_traffic: block network traffic originating from the host OS (Windows only)
[ "Creates", "a", "connection", "with", "an", "Ethernet", "interface", "in", "uBridge", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L643-L689
train
GNS3/gns3-server
gns3server/compute/base_node.py
BaseNode.check_available_ram
def check_available_ram(self, requested_ram): """ Sends a warning notification if there is not enough RAM on the system to allocate requested RAM. :param requested_ram: requested amount of RAM in MB """ available_ram = int(psutil.virtual_memory().available / (1024 * 1024)) ...
python
def check_available_ram(self, requested_ram): """ Sends a warning notification if there is not enough RAM on the system to allocate requested RAM. :param requested_ram: requested amount of RAM in MB """ available_ram = int(psutil.virtual_memory().available / (1024 * 1024)) ...
[ "def", "check_available_ram", "(", "self", ",", "requested_ram", ")", ":", "available_ram", "=", "int", "(", "psutil", ".", "virtual_memory", "(", ")", ".", "available", "/", "(", "1024", "*", "1024", ")", ")", "percentage_left", "=", "psutil", ".", "virtu...
Sends a warning notification if there is not enough RAM on the system to allocate requested RAM. :param requested_ram: requested amount of RAM in MB
[ "Sends", "a", "warning", "notification", "if", "there", "is", "not", "enough", "RAM", "on", "the", "system", "to", "allocate", "requested", "RAM", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/base_node.py#L722-L737
train
GNS3/gns3-server
gns3server/compute/qemu/qcow2.py
Qcow2.backing_file
def backing_file(self): """ When using linked clone this will return the path to the base image :returns: None if it's not a linked clone, the path otherwise """ with open(self._path, 'rb') as f: f.seek(self.backing_file_offset) content = f.read(self.bac...
python
def backing_file(self): """ When using linked clone this will return the path to the base image :returns: None if it's not a linked clone, the path otherwise """ with open(self._path, 'rb') as f: f.seek(self.backing_file_offset) content = f.read(self.bac...
[ "def", "backing_file", "(", "self", ")", ":", "with", "open", "(", "self", ".", "_path", ",", "'rb'", ")", "as", "f", ":", "f", ".", "seek", "(", "self", ".", "backing_file_offset", ")", "content", "=", "f", ".", "read", "(", "self", ".", "backing_...
When using linked clone this will return the path to the base image :returns: None if it's not a linked clone, the path otherwise
[ "When", "using", "linked", "clone", "this", "will", "return", "the", "path", "to", "the", "base", "image" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qcow2.py#L74-L88
train
GNS3/gns3-server
gns3server/compute/qemu/qcow2.py
Qcow2.rebase
def rebase(self, qemu_img, base_image): """ Rebase a linked clone in order to use the correct disk :param qemu_img: Path to the qemu-img binary :param base_image: Path to the base image """ if not os.path.exists(base_image): raise FileNotFoundError(base_imag...
python
def rebase(self, qemu_img, base_image): """ Rebase a linked clone in order to use the correct disk :param qemu_img: Path to the qemu-img binary :param base_image: Path to the base image """ if not os.path.exists(base_image): raise FileNotFoundError(base_imag...
[ "def", "rebase", "(", "self", ",", "qemu_img", ",", "base_image", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "base_image", ")", ":", "raise", "FileNotFoundError", "(", "base_image", ")", "command", "=", "[", "qemu_img", ",", "\"rebase\...
Rebase a linked clone in order to use the correct disk :param qemu_img: Path to the qemu-img binary :param base_image: Path to the base image
[ "Rebase", "a", "linked", "clone", "in", "order", "to", "use", "the", "correct", "disk" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/qemu/qcow2.py#L91-L106
train
GNS3/gns3-server
gns3server/utils/qt.py
qt_font_to_style
def qt_font_to_style(font, color): """ Convert a Qt font to CSS style """ if font is None: font = "TypeWriter,10,-1,5,75,0,0,0,0,0" font_info = font.split(",") style = "font-family: {};font-size: {};".format(font_info[0], font_info[1]) if font_info[4] == "75": style += "font-...
python
def qt_font_to_style(font, color): """ Convert a Qt font to CSS style """ if font is None: font = "TypeWriter,10,-1,5,75,0,0,0,0,0" font_info = font.split(",") style = "font-family: {};font-size: {};".format(font_info[0], font_info[1]) if font_info[4] == "75": style += "font-...
[ "def", "qt_font_to_style", "(", "font", ",", "color", ")", ":", "if", "font", "is", "None", ":", "font", "=", "\"TypeWriter,10,-1,5,75,0,0,0,0,0\"", "font_info", "=", "font", ".", "split", "(", "\",\"", ")", "style", "=", "\"font-family: {};font-size: {};\"", "....
Convert a Qt font to CSS style
[ "Convert", "a", "Qt", "font", "to", "CSS", "style" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/utils/qt.py#L23-L44
train
GNS3/gns3-server
gns3server/controller/gns3vm/remote_gns3_vm.py
RemoteGNS3VM.list
def list(self): """ List all VMs """ res = [] for compute in self._controller.computes.values(): if compute.id not in ["local", "vm"]: res.append({"vmname": compute.name}) return res
python
def list(self): """ List all VMs """ res = [] for compute in self._controller.computes.values(): if compute.id not in ["local", "vm"]: res.append({"vmname": compute.name}) return res
[ "def", "list", "(", "self", ")", ":", "res", "=", "[", "]", "for", "compute", "in", "self", ".", "_controller", ".", "computes", ".", "values", "(", ")", ":", "if", "compute", ".", "id", "not", "in", "[", "\"local\"", ",", "\"vm\"", "]", ":", "re...
List all VMs
[ "List", "all", "VMs" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/gns3vm/remote_gns3_vm.py#L36-L46
train
GNS3/gns3-server
gns3server/compute/dynamips/__init__.py
Dynamips.take_dynamips_id
def take_dynamips_id(self, project_id, dynamips_id): """ Reserve a dynamips id or raise an error :param project_id: UUID of the project :param dynamips_id: Asked id """ self._dynamips_ids.setdefault(project_id, set()) if dynamips_id in self._dynamips_ids[project_...
python
def take_dynamips_id(self, project_id, dynamips_id): """ Reserve a dynamips id or raise an error :param project_id: UUID of the project :param dynamips_id: Asked id """ self._dynamips_ids.setdefault(project_id, set()) if dynamips_id in self._dynamips_ids[project_...
[ "def", "take_dynamips_id", "(", "self", ",", "project_id", ",", "dynamips_id", ")", ":", "self", ".", "_dynamips_ids", ".", "setdefault", "(", "project_id", ",", "set", "(", ")", ")", "if", "dynamips_id", "in", "self", ".", "_dynamips_ids", "[", "project_id"...
Reserve a dynamips id or raise an error :param project_id: UUID of the project :param dynamips_id: Asked id
[ "Reserve", "a", "dynamips", "id", "or", "raise", "an", "error" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/__init__.py#L145-L155
train
GNS3/gns3-server
gns3server/compute/dynamips/__init__.py
Dynamips.release_dynamips_id
def release_dynamips_id(self, project_id, dynamips_id): """ A Dynamips id can be reused by another VM :param project_id: UUID of the project :param dynamips_id: Asked id """ self._dynamips_ids.setdefault(project_id, set()) if dynamips_id in self._dynamips_ids[pro...
python
def release_dynamips_id(self, project_id, dynamips_id): """ A Dynamips id can be reused by another VM :param project_id: UUID of the project :param dynamips_id: Asked id """ self._dynamips_ids.setdefault(project_id, set()) if dynamips_id in self._dynamips_ids[pro...
[ "def", "release_dynamips_id", "(", "self", ",", "project_id", ",", "dynamips_id", ")", ":", "self", ".", "_dynamips_ids", ".", "setdefault", "(", "project_id", ",", "set", "(", ")", ")", "if", "dynamips_id", "in", "self", ".", "_dynamips_ids", "[", "project_...
A Dynamips id can be reused by another VM :param project_id: UUID of the project :param dynamips_id: Asked id
[ "A", "Dynamips", "id", "can", "be", "reused", "by", "another", "VM" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/__init__.py#L157-L166
train
GNS3/gns3-server
gns3server/compute/dynamips/__init__.py
Dynamips.project_closing
def project_closing(self, project): """ Called when a project is about to be closed. :param project: Project instance """ yield from super().project_closing(project) # delete the Dynamips devices corresponding to the project tasks = [] for device in self...
python
def project_closing(self, project): """ Called when a project is about to be closed. :param project: Project instance """ yield from super().project_closing(project) # delete the Dynamips devices corresponding to the project tasks = [] for device in self...
[ "def", "project_closing", "(", "self", ",", "project", ")", ":", "yield", "from", "super", "(", ")", ".", "project_closing", "(", "project", ")", "# delete the Dynamips devices corresponding to the project", "tasks", "=", "[", "]", "for", "device", "in", "self", ...
Called when a project is about to be closed. :param project: Project instance
[ "Called", "when", "a", "project", "is", "about", "to", "be", "closed", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/__init__.py#L187-L207
train
GNS3/gns3-server
gns3server/compute/dynamips/__init__.py
Dynamips.start_new_hypervisor
def start_new_hypervisor(self, working_dir=None): """ Creates a new Dynamips process and start it. :param working_dir: working directory :returns: the new hypervisor instance """ if not self._dynamips_path: self.find_dynamips() if not working_dir: ...
python
def start_new_hypervisor(self, working_dir=None): """ Creates a new Dynamips process and start it. :param working_dir: working directory :returns: the new hypervisor instance """ if not self._dynamips_path: self.find_dynamips() if not working_dir: ...
[ "def", "start_new_hypervisor", "(", "self", ",", "working_dir", "=", "None", ")", ":", "if", "not", "self", ".", "_dynamips_path", ":", "self", ".", "find_dynamips", "(", ")", "if", "not", "working_dir", ":", "working_dir", "=", "tempfile", ".", "gettempdir"...
Creates a new Dynamips process and start it. :param working_dir: working directory :returns: the new hypervisor instance
[ "Creates", "a", "new", "Dynamips", "process", "and", "start", "it", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/__init__.py#L270-L314
train
GNS3/gns3-server
gns3server/compute/dynamips/__init__.py
Dynamips._set_ghost_ios
def _set_ghost_ios(self, vm): """ Manages Ghost IOS support. :param vm: VM instance """ if not vm.mmap: raise DynamipsError("mmap support is required to enable ghost IOS support") if vm.platform == "c7200" and vm.npe == "npe-g2": log.warning("Gh...
python
def _set_ghost_ios(self, vm): """ Manages Ghost IOS support. :param vm: VM instance """ if not vm.mmap: raise DynamipsError("mmap support is required to enable ghost IOS support") if vm.platform == "c7200" and vm.npe == "npe-g2": log.warning("Gh...
[ "def", "_set_ghost_ios", "(", "self", ",", "vm", ")", ":", "if", "not", "vm", ".", "mmap", ":", "raise", "DynamipsError", "(", "\"mmap support is required to enable ghost IOS support\"", ")", "if", "vm", ".", "platform", "==", "\"c7200\"", "and", "vm", ".", "n...
Manages Ghost IOS support. :param vm: VM instance
[ "Manages", "Ghost", "IOS", "support", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/__init__.py#L398-L440
train
GNS3/gns3-server
gns3server/compute/dynamips/__init__.py
Dynamips.set_vm_configs
def set_vm_configs(self, vm, settings): """ Set VM configs from pushed content or existing config files. :param vm: VM instance :param settings: VM settings """ startup_config_content = settings.get("startup_config_content") if startup_config_content: ...
python
def set_vm_configs(self, vm, settings): """ Set VM configs from pushed content or existing config files. :param vm: VM instance :param settings: VM settings """ startup_config_content = settings.get("startup_config_content") if startup_config_content: ...
[ "def", "set_vm_configs", "(", "self", ",", "vm", ",", "settings", ")", ":", "startup_config_content", "=", "settings", ".", "get", "(", "\"startup_config_content\"", ")", "if", "startup_config_content", ":", "self", ".", "_create_config", "(", "vm", ",", "vm", ...
Set VM configs from pushed content or existing config files. :param vm: VM instance :param settings: VM settings
[ "Set", "VM", "configs", "from", "pushed", "content", "or", "existing", "config", "files", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/__init__.py#L505-L518
train
GNS3/gns3-server
gns3server/compute/dynamips/__init__.py
Dynamips.auto_idlepc
def auto_idlepc(self, vm): """ Try to find the best possible idle-pc value. :param vm: VM instance """ yield from vm.set_idlepc("0x0") was_auto_started = False try: status = yield from vm.get_status() if status != "running": ...
python
def auto_idlepc(self, vm): """ Try to find the best possible idle-pc value. :param vm: VM instance """ yield from vm.set_idlepc("0x0") was_auto_started = False try: status = yield from vm.get_status() if status != "running": ...
[ "def", "auto_idlepc", "(", "self", ",", "vm", ")", ":", "yield", "from", "vm", ".", "set_idlepc", "(", "\"0x0\"", ")", "was_auto_started", "=", "False", "try", ":", "status", "=", "yield", "from", "vm", ".", "get_status", "(", ")", "if", "status", "!="...
Try to find the best possible idle-pc value. :param vm: VM instance
[ "Try", "to", "find", "the", "best", "possible", "idle", "-", "pc", "value", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/__init__.py#L555-L605
train
GNS3/gns3-server
gns3server/web/documentation.py
Documentation.write_documentation
def write_documentation(self, doc_type): """ Build all the doc page for handlers :param doc_type: Type of doc to generate (controller, compute) """ for handler_name in sorted(self._documentation): if "controller." in handler_name: server_type = "contr...
python
def write_documentation(self, doc_type): """ Build all the doc page for handlers :param doc_type: Type of doc to generate (controller, compute) """ for handler_name in sorted(self._documentation): if "controller." in handler_name: server_type = "contr...
[ "def", "write_documentation", "(", "self", ",", "doc_type", ")", ":", "for", "handler_name", "in", "sorted", "(", "self", ".", "_documentation", ")", ":", "if", "\"controller.\"", "in", "handler_name", ":", "server_type", "=", "\"controller\"", "elif", "\"comput...
Build all the doc page for handlers :param doc_type: Type of doc to generate (controller, compute)
[ "Build", "all", "the", "doc", "page", "for", "handlers" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/web/documentation.py#L48-L108
train
GNS3/gns3-server
gns3server/web/documentation.py
Documentation._create_handler_directory
def _create_handler_directory(self, handler_name, api_version, server_type): """Create a directory for the handler and add an index inside""" directory = "{}/api/v{}/{}/{}".format(self._directory, api_version, server_type, handler_name) os.makedirs(directory, exist_ok=True) with open("...
python
def _create_handler_directory(self, handler_name, api_version, server_type): """Create a directory for the handler and add an index inside""" directory = "{}/api/v{}/{}/{}".format(self._directory, api_version, server_type, handler_name) os.makedirs(directory, exist_ok=True) with open("...
[ "def", "_create_handler_directory", "(", "self", ",", "handler_name", ",", "api_version", ",", "server_type", ")", ":", "directory", "=", "\"{}/api/v{}/{}/{}\"", ".", "format", "(", "self", ".", "_directory", ",", "api_version", ",", "server_type", ",", "handler_n...
Create a directory for the handler and add an index inside
[ "Create", "a", "directory", "for", "the", "handler", "and", "add", "an", "index", "inside" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/web/documentation.py#L110-L119
train
GNS3/gns3-server
gns3server/web/documentation.py
Documentation._include_query_example
def _include_query_example(self, f, method, path, api_version, server_type): """If a sample session is available we include it in documentation""" m = method["method"].lower() query_path = "{}_{}_{}.txt".format(server_type, m, self._file_path(path)) if os.path.isfile(os.path.join(self._d...
python
def _include_query_example(self, f, method, path, api_version, server_type): """If a sample session is available we include it in documentation""" m = method["method"].lower() query_path = "{}_{}_{}.txt".format(server_type, m, self._file_path(path)) if os.path.isfile(os.path.join(self._d...
[ "def", "_include_query_example", "(", "self", ",", "f", ",", "method", ",", "path", ",", "api_version", ",", "server_type", ")", ":", "m", "=", "method", "[", "\"method\"", "]", ".", "lower", "(", ")", "query_path", "=", "\"{}_{}_{}.txt\"", ".", "format", ...
If a sample session is available we include it in documentation
[ "If", "a", "sample", "session", "is", "available", "we", "include", "it", "in", "documentation" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/web/documentation.py#L121-L127
train
GNS3/gns3-server
gns3server/web/documentation.py
Documentation._write_json_schema_object
def _write_json_schema_object(self, f, obj): """ obj is current object in JSON schema schema is the whole schema including definitions """ for name in sorted(obj.get("properties", {})): prop = obj["properties"][name] mandatory = " " if ...
python
def _write_json_schema_object(self, f, obj): """ obj is current object in JSON schema schema is the whole schema including definitions """ for name in sorted(obj.get("properties", {})): prop = obj["properties"][name] mandatory = " " if ...
[ "def", "_write_json_schema_object", "(", "self", ",", "f", ",", "obj", ")", ":", "for", "name", "in", "sorted", "(", "obj", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", ")", ":", "prop", "=", "obj", "[", "\"properties\"", "]", "[", "name", ...
obj is current object in JSON schema schema is the whole schema including definitions
[ "obj", "is", "current", "object", "in", "JSON", "schema", "schema", "is", "the", "whole", "schema", "including", "definitions" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/web/documentation.py#L143-L173
train
GNS3/gns3-server
gns3server/controller/compute.py
Compute._set_auth
def _set_auth(self, user, password): """ Set authentication parameters """ if user is None or len(user.strip()) == 0: self._user = None self._password = None self._auth = None else: self._user = user.strip() if password:...
python
def _set_auth(self, user, password): """ Set authentication parameters """ if user is None or len(user.strip()) == 0: self._user = None self._password = None self._auth = None else: self._user = user.strip() if password:...
[ "def", "_set_auth", "(", "self", ",", "user", ",", "password", ")", ":", "if", "user", "is", "None", "or", "len", "(", "user", ".", "strip", "(", ")", ")", "==", "0", ":", "self", ".", "_user", "=", "None", "self", ".", "_password", "=", "None", ...
Set authentication parameters
[ "Set", "authentication", "parameters" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/compute.py#L120-L138
train