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/controller/__init__.py | Controller.add_project | def add_project(self, project_id=None, name=None, **kwargs):
"""
Creates a project or returns an existing project
:param project_id: Project ID
:param name: Project name
:param kwargs: See the documentation of Project
"""
if project_id not in self._projects:
... | python | def add_project(self, project_id=None, name=None, **kwargs):
"""
Creates a project or returns an existing project
:param project_id: Project ID
:param name: Project name
:param kwargs: See the documentation of Project
"""
if project_id not in self._projects:
... | [
"def",
"add_project",
"(",
"self",
",",
"project_id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"project_id",
"not",
"in",
"self",
".",
"_projects",
":",
"for",
"project",
"in",
"self",
".",
"_projects",
".",
"va... | Creates a project or returns an existing project
:param project_id: Project ID
:param name: Project name
:param kwargs: See the documentation of Project | [
"Creates",
"a",
"project",
"or",
"returns",
"an",
"existing",
"project"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L515-L531 | train |
GNS3/gns3-server | gns3server/controller/__init__.py | Controller.load_project | def load_project(self, path, load=True):
"""
Load a project from a .gns3
:param path: Path of the .gns3
:param load: Load the topology
"""
topo_data = load_topology(path)
topo_data.pop("topology")
topo_data.pop("version")
topo_data.pop("revision")... | python | def load_project(self, path, load=True):
"""
Load a project from a .gns3
:param path: Path of the .gns3
:param load: Load the topology
"""
topo_data = load_topology(path)
topo_data.pop("topology")
topo_data.pop("version")
topo_data.pop("revision")... | [
"def",
"load_project",
"(",
"self",
",",
"path",
",",
"load",
"=",
"True",
")",
":",
"topo_data",
"=",
"load_topology",
"(",
"path",
")",
"topo_data",
".",
"pop",
"(",
"\"topology\"",
")",
"topo_data",
".",
"pop",
"(",
"\"version\"",
")",
"topo_data",
".... | Load a project from a .gns3
:param path: Path of the .gns3
:param load: Load the topology | [
"Load",
"a",
"project",
"from",
"a",
".",
"gns3"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L558-L577 | train |
GNS3/gns3-server | gns3server/controller/__init__.py | Controller._project_auto_open | def _project_auto_open(self):
"""
Auto open the project with auto open enable
"""
for project in self._projects.values():
if project.auto_open:
yield from project.open() | python | def _project_auto_open(self):
"""
Auto open the project with auto open enable
"""
for project in self._projects.values():
if project.auto_open:
yield from project.open() | [
"def",
"_project_auto_open",
"(",
"self",
")",
":",
"for",
"project",
"in",
"self",
".",
"_projects",
".",
"values",
"(",
")",
":",
"if",
"project",
".",
"auto_open",
":",
"yield",
"from",
"project",
".",
"open",
"(",
")"
] | Auto open the project with auto open enable | [
"Auto",
"open",
"the",
"project",
"with",
"auto",
"open",
"enable"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L580-L586 | train |
GNS3/gns3-server | gns3server/controller/__init__.py | Controller.get_free_project_name | def get_free_project_name(self, base_name):
"""
Generate a free project name base on the base name
"""
names = [p.name for p in self._projects.values()]
if base_name not in names:
return base_name
i = 1
projects_path = self.projects_directory()
... | python | def get_free_project_name(self, base_name):
"""
Generate a free project name base on the base name
"""
names = [p.name for p in self._projects.values()]
if base_name not in names:
return base_name
i = 1
projects_path = self.projects_directory()
... | [
"def",
"get_free_project_name",
"(",
"self",
",",
"base_name",
")",
":",
"names",
"=",
"[",
"p",
".",
"name",
"for",
"p",
"in",
"self",
".",
"_projects",
".",
"values",
"(",
")",
"]",
"if",
"base_name",
"not",
"in",
"names",
":",
"return",
"base_name",... | Generate a free project name base on the base name | [
"Generate",
"a",
"free",
"project",
"name",
"base",
"on",
"the",
"base",
"name"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L588-L606 | train |
GNS3/gns3-server | gns3server/controller/__init__.py | Controller.instance | def instance():
"""
Singleton to return only on instance of Controller.
:returns: instance of Controller
"""
if not hasattr(Controller, '_instance') or Controller._instance is None:
Controller._instance = Controller()
return Controller._instance | python | def instance():
"""
Singleton to return only on instance of Controller.
:returns: instance of Controller
"""
if not hasattr(Controller, '_instance') or Controller._instance is None:
Controller._instance = Controller()
return Controller._instance | [
"def",
"instance",
"(",
")",
":",
"if",
"not",
"hasattr",
"(",
"Controller",
",",
"'_instance'",
")",
"or",
"Controller",
".",
"_instance",
"is",
"None",
":",
"Controller",
".",
"_instance",
"=",
"Controller",
"(",
")",
"return",
"Controller",
".",
"_insta... | Singleton to return only on instance of Controller.
:returns: instance of Controller | [
"Singleton",
"to",
"return",
"only",
"on",
"instance",
"of",
"Controller",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L634-L643 | train |
GNS3/gns3-server | gns3server/controller/__init__.py | Controller.autoidlepc | def autoidlepc(self, compute_id, platform, image, ram):
"""
Compute and IDLE PC value for an image
:param compute_id: ID of the compute where the idlepc operation need to run
:param platform: Platform type
:param image: Image to use
:param ram: amount of RAM to use
... | python | def autoidlepc(self, compute_id, platform, image, ram):
"""
Compute and IDLE PC value for an image
:param compute_id: ID of the compute where the idlepc operation need to run
:param platform: Platform type
:param image: Image to use
:param ram: amount of RAM to use
... | [
"def",
"autoidlepc",
"(",
"self",
",",
"compute_id",
",",
"platform",
",",
"image",
",",
"ram",
")",
":",
"compute",
"=",
"self",
".",
"get_compute",
"(",
"compute_id",
")",
"for",
"project",
"in",
"list",
"(",
"self",
".",
"_projects",
".",
"values",
... | Compute and IDLE PC value for an image
:param compute_id: ID of the compute where the idlepc operation need to run
:param platform: Platform type
:param image: Image to use
:param ram: amount of RAM to use | [
"Compute",
"and",
"IDLE",
"PC",
"value",
"for",
"an",
"image"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L646-L665 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM._control_vm | def _control_vm(self, params):
"""
Change setting in this VM when running.
:param params: params to use with sub-command controlvm
:returns: result of the command.
"""
args = shlex.split(params)
result = yield from self.manager.execute("controlvm", [self._vmnam... | python | def _control_vm(self, params):
"""
Change setting in this VM when running.
:param params: params to use with sub-command controlvm
:returns: result of the command.
"""
args = shlex.split(params)
result = yield from self.manager.execute("controlvm", [self._vmnam... | [
"def",
"_control_vm",
"(",
"self",
",",
"params",
")",
":",
"args",
"=",
"shlex",
".",
"split",
"(",
"params",
")",
"result",
"=",
"yield",
"from",
"self",
".",
"manager",
".",
"execute",
"(",
"\"controlvm\"",
",",
"[",
"self",
".",
"_vmname",
"]",
"... | Change setting in this VM when running.
:param params: params to use with sub-command controlvm
:returns: result of the command. | [
"Change",
"setting",
"in",
"this",
"VM",
"when",
"running",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L129-L140 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM._patch_vm_uuid | def _patch_vm_uuid(self):
"""
Fix the VM uuid in the case of linked clone
"""
if os.path.exists(self._linked_vbox_file()):
try:
tree = ET.parse(self._linked_vbox_file())
except ET.ParseError:
raise VirtualBoxError("Cannot modify Vir... | python | def _patch_vm_uuid(self):
"""
Fix the VM uuid in the case of linked clone
"""
if os.path.exists(self._linked_vbox_file()):
try:
tree = ET.parse(self._linked_vbox_file())
except ET.ParseError:
raise VirtualBoxError("Cannot modify Vir... | [
"def",
"_patch_vm_uuid",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_linked_vbox_file",
"(",
")",
")",
":",
"try",
":",
"tree",
"=",
"ET",
".",
"parse",
"(",
"self",
".",
"_linked_vbox_file",
"(",
")",
")",
"e... | Fix the VM uuid in the case of linked clone | [
"Fix",
"the",
"VM",
"uuid",
"in",
"the",
"case",
"of",
"linked",
"clone"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L210-L233 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM.start | def start(self):
"""
Starts this VirtualBox VM.
"""
if self.status == "started":
return
# resume the VM if it is paused
vm_state = yield from self._get_vm_state()
if vm_state == "paused":
yield from self.resume()
return
... | python | def start(self):
"""
Starts this VirtualBox VM.
"""
if self.status == "started":
return
# resume the VM if it is paused
vm_state = yield from self._get_vm_state()
if vm_state == "paused":
yield from self.resume()
return
... | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"self",
".",
"status",
"==",
"\"started\"",
":",
"return",
"# resume the VM if it is paused",
"vm_state",
"=",
"yield",
"from",
"self",
".",
"_get_vm_state",
"(",
")",
"if",
"vm_state",
"==",
"\"paused\"",
":",
"y... | Starts this VirtualBox VM. | [
"Starts",
"this",
"VirtualBox",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L249-L297 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM.stop | def stop(self):
"""
Stops this VirtualBox VM.
"""
self._hw_virtualization = False
yield from self._stop_ubridge()
yield from self._stop_remote_console()
vm_state = yield from self._get_vm_state()
if vm_state == "running" or vm_state == "paused" or vm_stat... | python | def stop(self):
"""
Stops this VirtualBox VM.
"""
self._hw_virtualization = False
yield from self._stop_ubridge()
yield from self._stop_remote_console()
vm_state = yield from self._get_vm_state()
if vm_state == "running" or vm_state == "paused" or vm_stat... | [
"def",
"stop",
"(",
"self",
")",
":",
"self",
".",
"_hw_virtualization",
"=",
"False",
"yield",
"from",
"self",
".",
"_stop_ubridge",
"(",
")",
"yield",
"from",
"self",
".",
"_stop_remote_console",
"(",
")",
"vm_state",
"=",
"yield",
"from",
"self",
".",
... | Stops this VirtualBox VM. | [
"Stops",
"this",
"VirtualBox",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L300-L345 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM.suspend | def suspend(self):
"""
Suspends this VirtualBox VM.
"""
vm_state = yield from self._get_vm_state()
if vm_state == "running":
yield from self._control_vm("pause")
self.status = "suspended"
log.info("VirtualBox VM '{name}' [{id}] suspended".form... | python | def suspend(self):
"""
Suspends this VirtualBox VM.
"""
vm_state = yield from self._get_vm_state()
if vm_state == "running":
yield from self._control_vm("pause")
self.status = "suspended"
log.info("VirtualBox VM '{name}' [{id}] suspended".form... | [
"def",
"suspend",
"(",
"self",
")",
":",
"vm_state",
"=",
"yield",
"from",
"self",
".",
"_get_vm_state",
"(",
")",
"if",
"vm_state",
"==",
"\"running\"",
":",
"yield",
"from",
"self",
".",
"_control_vm",
"(",
"\"pause\"",
")",
"self",
".",
"status",
"=",... | Suspends this VirtualBox VM. | [
"Suspends",
"this",
"VirtualBox",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L348-L361 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM.resume | def resume(self):
"""
Resumes this VirtualBox VM.
"""
yield from self._control_vm("resume")
self.status = "started"
log.info("VirtualBox VM '{name}' [{id}] resumed".format(name=self.name, id=self.id)) | python | def resume(self):
"""
Resumes this VirtualBox VM.
"""
yield from self._control_vm("resume")
self.status = "started"
log.info("VirtualBox VM '{name}' [{id}] resumed".format(name=self.name, id=self.id)) | [
"def",
"resume",
"(",
"self",
")",
":",
"yield",
"from",
"self",
".",
"_control_vm",
"(",
"\"resume\"",
")",
"self",
".",
"status",
"=",
"\"started\"",
"log",
".",
"info",
"(",
"\"VirtualBox VM '{name}' [{id}] resumed\"",
".",
"format",
"(",
"name",
"=",
"se... | Resumes this VirtualBox VM. | [
"Resumes",
"this",
"VirtualBox",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L364-L371 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM.reload | def reload(self):
"""
Reloads this VirtualBox VM.
"""
result = yield from self._control_vm("reset")
log.info("VirtualBox VM '{name}' [{id}] reloaded".format(name=self.name, id=self.id))
log.debug("Reload result: {}".format(result)) | python | def reload(self):
"""
Reloads this VirtualBox VM.
"""
result = yield from self._control_vm("reset")
log.info("VirtualBox VM '{name}' [{id}] reloaded".format(name=self.name, id=self.id))
log.debug("Reload result: {}".format(result)) | [
"def",
"reload",
"(",
"self",
")",
":",
"result",
"=",
"yield",
"from",
"self",
".",
"_control_vm",
"(",
"\"reset\"",
")",
"log",
".",
"info",
"(",
"\"VirtualBox VM '{name}' [{id}] reloaded\"",
".",
"format",
"(",
"name",
"=",
"self",
".",
"name",
",",
"id... | Reloads this VirtualBox VM. | [
"Reloads",
"this",
"VirtualBox",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L374-L381 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM._reattach_linked_hdds | def _reattach_linked_hdds(self):
"""
Reattach linked cloned hard disks.
"""
hdd_info_file = os.path.join(self.working_dir, self._vmname, "hdd_info.json")
try:
with open(hdd_info_file, "r", encoding="utf-8") as f:
hdd_table = json.load(f)
excep... | python | def _reattach_linked_hdds(self):
"""
Reattach linked cloned hard disks.
"""
hdd_info_file = os.path.join(self.working_dir, self._vmname, "hdd_info.json")
try:
with open(hdd_info_file, "r", encoding="utf-8") as f:
hdd_table = json.load(f)
excep... | [
"def",
"_reattach_linked_hdds",
"(",
"self",
")",
":",
"hdd_info_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"working_dir",
",",
"self",
".",
"_vmname",
",",
"\"hdd_info.json\"",
")",
"try",
":",
"with",
"open",
"(",
"hdd_info_file",
",",... | Reattach linked cloned hard disks. | [
"Reattach",
"linked",
"cloned",
"hard",
"disks",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L398-L435 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM.save_linked_hdds_info | def save_linked_hdds_info(self):
"""
Save linked cloned hard disks information.
:returns: disk table information
"""
hdd_table = []
if self.linked_clone:
if os.path.exists(self.working_dir):
hdd_files = yield from self._get_all_hdd_files()
... | python | def save_linked_hdds_info(self):
"""
Save linked cloned hard disks information.
:returns: disk table information
"""
hdd_table = []
if self.linked_clone:
if os.path.exists(self.working_dir):
hdd_files = yield from self._get_all_hdd_files()
... | [
"def",
"save_linked_hdds_info",
"(",
"self",
")",
":",
"hdd_table",
"=",
"[",
"]",
"if",
"self",
".",
"linked_clone",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"working_dir",
")",
":",
"hdd_files",
"=",
"yield",
"from",
"self",
"."... | Save linked cloned hard disks information.
:returns: disk table information | [
"Save",
"linked",
"cloned",
"hard",
"disks",
"information",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L438-L481 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM.close | def close(self):
"""
Closes this VirtualBox VM.
"""
if self._closed:
# VM is already closed
return
if not (yield from super().close()):
return False
log.debug("VirtualBox VM '{name}' [{id}] is closing".format(name=self.name, id=self.... | python | def close(self):
"""
Closes this VirtualBox VM.
"""
if self._closed:
# VM is already closed
return
if not (yield from super().close()):
return False
log.debug("VirtualBox VM '{name}' [{id}] is closing".format(name=self.name, id=self.... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"# VM is already closed",
"return",
"if",
"not",
"(",
"yield",
"from",
"super",
"(",
")",
".",
"close",
"(",
")",
")",
":",
"return",
"False",
"log",
".",
"debug",
"(",
"\"Virt... | Closes this VirtualBox VM. | [
"Closes",
"this",
"VirtualBox",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L484-L540 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM.set_ram | def set_ram(self, ram):
"""
Set the amount of RAM allocated to this VirtualBox VM.
:param ram: amount RAM in MB (integer)
"""
if ram == 0:
return
yield from self._modify_vm('--memory {}'.format(ram))
log.info("VirtualBox VM '{name}' [{id}] has set ... | python | def set_ram(self, ram):
"""
Set the amount of RAM allocated to this VirtualBox VM.
:param ram: amount RAM in MB (integer)
"""
if ram == 0:
return
yield from self._modify_vm('--memory {}'.format(ram))
log.info("VirtualBox VM '{name}' [{id}] has set ... | [
"def",
"set_ram",
"(",
"self",
",",
"ram",
")",
":",
"if",
"ram",
"==",
"0",
":",
"return",
"yield",
"from",
"self",
".",
"_modify_vm",
"(",
"'--memory {}'",
".",
"format",
"(",
"ram",
")",
")",
"log",
".",
"info",
"(",
"\"VirtualBox VM '{name}' [{id}] h... | Set the amount of RAM allocated to this VirtualBox VM.
:param ram: amount RAM in MB (integer) | [
"Set",
"the",
"amount",
"of",
"RAM",
"allocated",
"to",
"this",
"VirtualBox",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L601-L614 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM.set_vmname | def set_vmname(self, vmname):
"""
Renames the VirtualBox VM.
:param vmname: VirtualBox VM name
"""
if vmname == self._vmname:
return
if self.linked_clone:
if self.status == "started":
raise VirtualBoxError("You can't change the n... | python | def set_vmname(self, vmname):
"""
Renames the VirtualBox VM.
:param vmname: VirtualBox VM name
"""
if vmname == self._vmname:
return
if self.linked_clone:
if self.status == "started":
raise VirtualBoxError("You can't change the n... | [
"def",
"set_vmname",
"(",
"self",
",",
"vmname",
")",
":",
"if",
"vmname",
"==",
"self",
".",
"_vmname",
":",
"return",
"if",
"self",
".",
"linked_clone",
":",
"if",
"self",
".",
"status",
"==",
"\"started\"",
":",
"raise",
"VirtualBoxError",
"(",
"\"You... | Renames the VirtualBox VM.
:param vmname: VirtualBox VM name | [
"Renames",
"the",
"VirtualBox",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L627-L647 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM.set_adapters | def set_adapters(self, adapters):
"""
Sets the number of Ethernet adapters for this VirtualBox VM instance.
:param adapters: number of adapters
"""
# check for the maximum adapters supported by the VM
vm_info = yield from self._get_vm_info()
chipset = "piix3" #... | python | def set_adapters(self, adapters):
"""
Sets the number of Ethernet adapters for this VirtualBox VM instance.
:param adapters: number of adapters
"""
# check for the maximum adapters supported by the VM
vm_info = yield from self._get_vm_info()
chipset = "piix3" #... | [
"def",
"set_adapters",
"(",
"self",
",",
"adapters",
")",
":",
"# check for the maximum adapters supported by the VM",
"vm_info",
"=",
"yield",
"from",
"self",
".",
"_get_vm_info",
"(",
")",
"chipset",
"=",
"\"piix3\"",
"# default chipset for VirtualBox VMs",
"self",
".... | Sets the number of Ethernet adapters for this VirtualBox VM instance.
:param adapters: number of adapters | [
"Sets",
"the",
"number",
"of",
"Ethernet",
"adapters",
"for",
"this",
"VirtualBox",
"VM",
"instance",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L660-L697 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM._get_vm_info | def _get_vm_info(self):
"""
Returns this VM info.
:returns: dict of info
"""
vm_info = {}
results = yield from self.manager.execute("showvminfo", [self._vmname, "--machinereadable"])
for info in results:
try:
name, value = info.split(... | python | def _get_vm_info(self):
"""
Returns this VM info.
:returns: dict of info
"""
vm_info = {}
results = yield from self.manager.execute("showvminfo", [self._vmname, "--machinereadable"])
for info in results:
try:
name, value = info.split(... | [
"def",
"_get_vm_info",
"(",
"self",
")",
":",
"vm_info",
"=",
"{",
"}",
"results",
"=",
"yield",
"from",
"self",
".",
"manager",
".",
"execute",
"(",
"\"showvminfo\"",
",",
"[",
"self",
".",
"_vmname",
",",
"\"--machinereadable\"",
"]",
")",
"for",
"info... | Returns this VM info.
:returns: dict of info | [
"Returns",
"this",
"VM",
"info",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L747-L762 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM._storage_attach | def _storage_attach(self, params):
"""
Change storage medium in this VM.
:param params: params to use with sub-command storageattach
"""
args = shlex.split(params)
yield from self.manager.execute("storageattach", [self._vmname] + args) | python | def _storage_attach(self, params):
"""
Change storage medium in this VM.
:param params: params to use with sub-command storageattach
"""
args = shlex.split(params)
yield from self.manager.execute("storageattach", [self._vmname] + args) | [
"def",
"_storage_attach",
"(",
"self",
",",
"params",
")",
":",
"args",
"=",
"shlex",
".",
"split",
"(",
"params",
")",
"yield",
"from",
"self",
".",
"manager",
".",
"execute",
"(",
"\"storageattach\"",
",",
"[",
"self",
".",
"_vmname",
"]",
"+",
"args... | Change storage medium in this VM.
:param params: params to use with sub-command storageattach | [
"Change",
"storage",
"medium",
"in",
"this",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L796-L804 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM._get_nic_attachements | def _get_nic_attachements(self, maximum_adapters):
"""
Returns NIC attachements.
:param maximum_adapters: maximum number of supported adapters
:returns: list of adapters with their Attachment setting (NAT, bridged etc.)
"""
nics = []
vm_info = yield from self._g... | python | def _get_nic_attachements(self, maximum_adapters):
"""
Returns NIC attachements.
:param maximum_adapters: maximum number of supported adapters
:returns: list of adapters with their Attachment setting (NAT, bridged etc.)
"""
nics = []
vm_info = yield from self._g... | [
"def",
"_get_nic_attachements",
"(",
"self",
",",
"maximum_adapters",
")",
":",
"nics",
"=",
"[",
"]",
"vm_info",
"=",
"yield",
"from",
"self",
".",
"_get_vm_info",
"(",
")",
"for",
"adapter_number",
"in",
"range",
"(",
"0",
",",
"maximum_adapters",
")",
"... | Returns NIC attachements.
:param maximum_adapters: maximum number of supported adapters
:returns: list of adapters with their Attachment setting (NAT, bridged etc.) | [
"Returns",
"NIC",
"attachements",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L807-L824 | train |
GNS3/gns3-server | gns3server/compute/virtualbox/virtualbox_vm.py | VirtualBoxVM._create_linked_clone | def _create_linked_clone(self):
"""
Creates a new linked clone.
"""
gns3_snapshot_exists = False
vm_info = yield from self._get_vm_info()
for entry, value in vm_info.items():
if entry.startswith("SnapshotName") and value == "GNS3 Linked Base for clones":
... | python | def _create_linked_clone(self):
"""
Creates a new linked clone.
"""
gns3_snapshot_exists = False
vm_info = yield from self._get_vm_info()
for entry, value in vm_info.items():
if entry.startswith("SnapshotName") and value == "GNS3 Linked Base for clones":
... | [
"def",
"_create_linked_clone",
"(",
"self",
")",
":",
"gns3_snapshot_exists",
"=",
"False",
"vm_info",
"=",
"yield",
"from",
"self",
".",
"_get_vm_info",
"(",
")",
"for",
"entry",
",",
"value",
"in",
"vm_info",
".",
"items",
"(",
")",
":",
"if",
"entry",
... | Creates a new linked clone. | [
"Creates",
"a",
"new",
"linked",
"clone",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/virtualbox_vm.py#L890-L933 | train |
GNS3/gns3-server | gns3server/ubridge/hypervisor.py | Hypervisor._check_ubridge_version | def _check_ubridge_version(self, env=None):
"""
Checks if the ubridge executable version
"""
try:
output = yield from subprocess_check_output(self._path, "-v", cwd=self._working_dir, env=env)
match = re.search("ubridge version ([0-9a-z\.]+)", output)
i... | python | def _check_ubridge_version(self, env=None):
"""
Checks if the ubridge executable version
"""
try:
output = yield from subprocess_check_output(self._path, "-v", cwd=self._working_dir, env=env)
match = re.search("ubridge version ([0-9a-z\.]+)", output)
i... | [
"def",
"_check_ubridge_version",
"(",
"self",
",",
"env",
"=",
"None",
")",
":",
"try",
":",
"output",
"=",
"yield",
"from",
"subprocess_check_output",
"(",
"self",
".",
"_path",
",",
"\"-v\"",
",",
"cwd",
"=",
"self",
".",
"_working_dir",
",",
"env",
"=... | Checks if the ubridge executable version | [
"Checks",
"if",
"the",
"ubridge",
"executable",
"version"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/ubridge/hypervisor.py#L132-L152 | train |
GNS3/gns3-server | gns3server/ubridge/hypervisor.py | Hypervisor.start | def start(self):
"""
Starts the uBridge hypervisor process.
"""
env = os.environ.copy()
if sys.platform.startswith("win"):
# add the Npcap directory to $PATH to force uBridge to use npcap DLL instead of Winpcap (if installed)
system_root = os.path.join(os... | python | def start(self):
"""
Starts the uBridge hypervisor process.
"""
env = os.environ.copy()
if sys.platform.startswith("win"):
# add the Npcap directory to $PATH to force uBridge to use npcap DLL instead of Winpcap (if installed)
system_root = os.path.join(os... | [
"def",
"start",
"(",
"self",
")",
":",
"env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"\"win\"",
")",
":",
"# add the Npcap directory to $PATH to force uBridge to use npcap DLL instead of Winpcap (if in... | Starts the uBridge hypervisor process. | [
"Starts",
"the",
"uBridge",
"hypervisor",
"process",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/ubridge/hypervisor.py#L155-L183 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware.find_vmrun | def find_vmrun(self):
"""
Searches for vmrun.
:returns: path to vmrun
"""
# look for vmrun
vmrun_path = self.config.get_section_config("VMware").get("vmrun_path")
if not vmrun_path:
if sys.platform.startswith("win"):
vmrun_path = shut... | python | def find_vmrun(self):
"""
Searches for vmrun.
:returns: path to vmrun
"""
# look for vmrun
vmrun_path = self.config.get_section_config("VMware").get("vmrun_path")
if not vmrun_path:
if sys.platform.startswith("win"):
vmrun_path = shut... | [
"def",
"find_vmrun",
"(",
"self",
")",
":",
"# look for vmrun",
"vmrun_path",
"=",
"self",
".",
"config",
".",
"get_section_config",
"(",
"\"VMware\"",
")",
".",
"get",
"(",
"\"vmrun_path\"",
")",
"if",
"not",
"vmrun_path",
":",
"if",
"sys",
".",
"platform",... | Searches for vmrun.
:returns: path to vmrun | [
"Searches",
"for",
"vmrun",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L87-L123 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware._check_vmware_player_requirements | def _check_vmware_player_requirements(self, player_version):
"""
Check minimum requirements to use VMware Player.
VIX 1.13 was the release for Player 6.
VIX 1.14 was the release for Player 7.
VIX 1.15 was the release for Workstation Player 12.
:param player_version: VMw... | python | def _check_vmware_player_requirements(self, player_version):
"""
Check minimum requirements to use VMware Player.
VIX 1.13 was the release for Player 6.
VIX 1.14 was the release for Player 7.
VIX 1.15 was the release for Workstation Player 12.
:param player_version: VMw... | [
"def",
"_check_vmware_player_requirements",
"(",
"self",
",",
"player_version",
")",
":",
"player_version",
"=",
"int",
"(",
"player_version",
")",
"if",
"player_version",
"<",
"6",
":",
"raise",
"VMwareError",
"(",
"\"Using VMware Player requires version 6 or above\"",
... | Check minimum requirements to use VMware Player.
VIX 1.13 was the release for Player 6.
VIX 1.14 was the release for Player 7.
VIX 1.15 was the release for Workstation Player 12.
:param player_version: VMware Player major version. | [
"Check",
"minimum",
"requirements",
"to",
"use",
"VMware",
"Player",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L144-L164 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware._check_vmware_workstation_requirements | def _check_vmware_workstation_requirements(self, ws_version):
"""
Check minimum requirements to use VMware Workstation.
VIX 1.13 was the release for Workstation 10.
VIX 1.14 was the release for Workstation 11.
VIX 1.15 was the release for Workstation Pro 12.
:param ws_v... | python | def _check_vmware_workstation_requirements(self, ws_version):
"""
Check minimum requirements to use VMware Workstation.
VIX 1.13 was the release for Workstation 10.
VIX 1.14 was the release for Workstation 11.
VIX 1.15 was the release for Workstation Pro 12.
:param ws_v... | [
"def",
"_check_vmware_workstation_requirements",
"(",
"self",
",",
"ws_version",
")",
":",
"ws_version",
"=",
"int",
"(",
"ws_version",
")",
"if",
"ws_version",
"<",
"10",
":",
"raise",
"VMwareError",
"(",
"\"Using VMware Workstation requires version 10 or above\"",
")"... | Check minimum requirements to use VMware Workstation.
VIX 1.13 was the release for Workstation 10.
VIX 1.14 was the release for Workstation 11.
VIX 1.15 was the release for Workstation Pro 12.
:param ws_version: VMware Workstation major version. | [
"Check",
"minimum",
"requirements",
"to",
"use",
"VMware",
"Workstation",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L167-L187 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware.check_vmware_version | def check_vmware_version(self):
"""
Check VMware version
"""
if sys.platform.startswith("win"):
# look for vmrun.exe using the directory listed in the registry
ws_version = self._find_vmware_version_registry(r"SOFTWARE\Wow6432Node\VMware, Inc.\VMware Workstation"... | python | def check_vmware_version(self):
"""
Check VMware version
"""
if sys.platform.startswith("win"):
# look for vmrun.exe using the directory listed in the registry
ws_version = self._find_vmware_version_registry(r"SOFTWARE\Wow6432Node\VMware, Inc.\VMware Workstation"... | [
"def",
"check_vmware_version",
"(",
"self",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"\"win\"",
")",
":",
"# look for vmrun.exe using the directory listed in the registry",
"ws_version",
"=",
"self",
".",
"_find_vmware_version_registry",
"(",
"r\"... | Check VMware version | [
"Check",
"VMware",
"version"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L190-L240 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware.check_vmrun_version | def check_vmrun_version(self, minimum_required_version="1.13.0"):
"""
Checks the vmrun version.
VMware VIX library version must be at least >= 1.13 by default
VIX 1.13 was the release for VMware Fusion 6, Workstation 10, and Player 6.
VIX 1.14 was the release for VMware Fusion 7... | python | def check_vmrun_version(self, minimum_required_version="1.13.0"):
"""
Checks the vmrun version.
VMware VIX library version must be at least >= 1.13 by default
VIX 1.13 was the release for VMware Fusion 6, Workstation 10, and Player 6.
VIX 1.14 was the release for VMware Fusion 7... | [
"def",
"check_vmrun_version",
"(",
"self",
",",
"minimum_required_version",
"=",
"\"1.13.0\"",
")",
":",
"vmrun_path",
"=",
"self",
".",
"vmrun_path",
"if",
"not",
"vmrun_path",
":",
"vmrun_path",
"=",
"self",
".",
"find_vmrun",
"(",
")",
"try",
":",
"output",... | Checks the vmrun version.
VMware VIX library version must be at least >= 1.13 by default
VIX 1.13 was the release for VMware Fusion 6, Workstation 10, and Player 6.
VIX 1.14 was the release for VMware Fusion 7, Workstation 11 and Player 7.
VIX 1.15 was the release for VMware Fusion 8, W... | [
"Checks",
"the",
"vmrun",
"version",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L409-L439 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware.remove_from_vmware_inventory | def remove_from_vmware_inventory(self, vmx_path):
"""
Removes a linked clone from the VMware inventory file.
:param vmx_path: path of the linked clone VMX file
"""
with (yield from self._vmware_inventory_lock):
inventory_path = self.get_vmware_inventory_path()
... | python | def remove_from_vmware_inventory(self, vmx_path):
"""
Removes a linked clone from the VMware inventory file.
:param vmx_path: path of the linked clone VMX file
"""
with (yield from self._vmware_inventory_lock):
inventory_path = self.get_vmware_inventory_path()
... | [
"def",
"remove_from_vmware_inventory",
"(",
"self",
",",
"vmx_path",
")",
":",
"with",
"(",
"yield",
"from",
"self",
".",
"_vmware_inventory_lock",
")",
":",
"inventory_path",
"=",
"self",
".",
"get_vmware_inventory_path",
"(",
")",
"if",
"os",
".",
"path",
".... | Removes a linked clone from the VMware inventory file.
:param vmx_path: path of the linked clone VMX file | [
"Removes",
"a",
"linked",
"clone",
"from",
"the",
"VMware",
"inventory",
"file",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L442-L472 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware.write_vmx_file | def write_vmx_file(path, pairs):
"""
Write a VMware VMX file.
:param path: path to the VMX file
:param pairs: settings to write
"""
encoding = "utf-8"
if ".encoding" in pairs:
file_encoding = pairs[".encoding"]
try:
codecs... | python | def write_vmx_file(path, pairs):
"""
Write a VMware VMX file.
:param path: path to the VMX file
:param pairs: settings to write
"""
encoding = "utf-8"
if ".encoding" in pairs:
file_encoding = pairs[".encoding"]
try:
codecs... | [
"def",
"write_vmx_file",
"(",
"path",
",",
"pairs",
")",
":",
"encoding",
"=",
"\"utf-8\"",
"if",
"\".encoding\"",
"in",
"pairs",
":",
"file_encoding",
"=",
"pairs",
"[",
"\".encoding\"",
"]",
"try",
":",
"codecs",
".",
"lookup",
"(",
"file_encoding",
")",
... | Write a VMware VMX file.
:param path: path to the VMX file
:param pairs: settings to write | [
"Write",
"a",
"VMware",
"VMX",
"file",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L537-L561 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware._get_vms_from_inventory | def _get_vms_from_inventory(self, inventory_path):
"""
Searches for VMs by parsing a VMware inventory file.
:param inventory_path: path to the inventory file
:returns: list of VMs
"""
vm_entries = {}
vmware_vms = []
log.info('Searching for VMware VMs in... | python | def _get_vms_from_inventory(self, inventory_path):
"""
Searches for VMs by parsing a VMware inventory file.
:param inventory_path: path to the inventory file
:returns: list of VMs
"""
vm_entries = {}
vmware_vms = []
log.info('Searching for VMware VMs in... | [
"def",
"_get_vms_from_inventory",
"(",
"self",
",",
"inventory_path",
")",
":",
"vm_entries",
"=",
"{",
"}",
"vmware_vms",
"=",
"[",
"]",
"log",
".",
"info",
"(",
"'Searching for VMware VMs in inventory file \"{}\"'",
".",
"format",
"(",
"inventory_path",
")",
")"... | Searches for VMs by parsing a VMware inventory file.
:param inventory_path: path to the inventory file
:returns: list of VMs | [
"Searches",
"for",
"VMs",
"by",
"parsing",
"a",
"VMware",
"inventory",
"file",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L563-L594 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware._get_vms_from_directory | def _get_vms_from_directory(self, directory):
"""
Searches for VMs in a given directory.
:param directory: path to the directory
:returns: list of VMs
"""
vmware_vms = []
log.info('Searching for VMware VMs in directory "{}"'.format(directory))
for path,... | python | def _get_vms_from_directory(self, directory):
"""
Searches for VMs in a given directory.
:param directory: path to the directory
:returns: list of VMs
"""
vmware_vms = []
log.info('Searching for VMware VMs in directory "{}"'.format(directory))
for path,... | [
"def",
"_get_vms_from_directory",
"(",
"self",
",",
"directory",
")",
":",
"vmware_vms",
"=",
"[",
"]",
"log",
".",
"info",
"(",
"'Searching for VMware VMs in directory \"{}\"'",
".",
"format",
"(",
"directory",
")",
")",
"for",
"path",
",",
"_",
",",
"filenam... | Searches for VMs in a given directory.
:param directory: path to the directory
:returns: list of VMs | [
"Searches",
"for",
"VMs",
"in",
"a",
"given",
"directory",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L596-L620 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware.get_vmware_inventory_path | def get_vmware_inventory_path():
"""
Returns VMware inventory file path.
:returns: path to the inventory file
"""
if sys.platform.startswith("win"):
return os.path.expandvars(r"%APPDATA%\Vmware\Inventory.vmls")
elif sys.platform.startswith("darwin"):
... | python | def get_vmware_inventory_path():
"""
Returns VMware inventory file path.
:returns: path to the inventory file
"""
if sys.platform.startswith("win"):
return os.path.expandvars(r"%APPDATA%\Vmware\Inventory.vmls")
elif sys.platform.startswith("darwin"):
... | [
"def",
"get_vmware_inventory_path",
"(",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"\"win\"",
")",
":",
"return",
"os",
".",
"path",
".",
"expandvars",
"(",
"r\"%APPDATA%\\Vmware\\Inventory.vmls\"",
")",
"elif",
"sys",
".",
"platform",
".... | Returns VMware inventory file path.
:returns: path to the inventory file | [
"Returns",
"VMware",
"inventory",
"file",
"path",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L623-L635 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware.get_vmware_preferences_path | def get_vmware_preferences_path():
"""
Returns VMware preferences file path.
:returns: path to the preferences file
"""
if sys.platform.startswith("win"):
return os.path.expandvars(r"%APPDATA%\VMware\preferences.ini")
elif sys.platform.startswith("darwin"):
... | python | def get_vmware_preferences_path():
"""
Returns VMware preferences file path.
:returns: path to the preferences file
"""
if sys.platform.startswith("win"):
return os.path.expandvars(r"%APPDATA%\VMware\preferences.ini")
elif sys.platform.startswith("darwin"):
... | [
"def",
"get_vmware_preferences_path",
"(",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"\"win\"",
")",
":",
"return",
"os",
".",
"path",
".",
"expandvars",
"(",
"r\"%APPDATA%\\VMware\\preferences.ini\"",
")",
"elif",
"sys",
".",
"platform",
... | Returns VMware preferences file path.
:returns: path to the preferences file | [
"Returns",
"VMware",
"preferences",
"file",
"path",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L638-L650 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware.get_vmware_default_vm_paths | def get_vmware_default_vm_paths():
"""
Returns VMware default VM directory paths.
:returns: path to the default VM directory
"""
if sys.platform.startswith("win"):
import ctypes
import ctypes.wintypes
path = ctypes.create_unicode_buffer(ctype... | python | def get_vmware_default_vm_paths():
"""
Returns VMware default VM directory paths.
:returns: path to the default VM directory
"""
if sys.platform.startswith("win"):
import ctypes
import ctypes.wintypes
path = ctypes.create_unicode_buffer(ctype... | [
"def",
"get_vmware_default_vm_paths",
"(",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"\"win\"",
")",
":",
"import",
"ctypes",
"import",
"ctypes",
".",
"wintypes",
"path",
"=",
"ctypes",
".",
"create_unicode_buffer",
"(",
"ctypes",
".",
... | Returns VMware default VM directory paths.
:returns: path to the default VM directory | [
"Returns",
"VMware",
"default",
"VM",
"directory",
"paths",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L653-L670 | train |
GNS3/gns3-server | gns3server/compute/vmware/__init__.py | VMware.list_vms | def list_vms(self):
"""
Gets VMware VM list.
"""
# check for the right VMware version
yield from self.check_vmware_version()
vmware_vms = []
inventory_path = self.get_vmware_inventory_path()
if os.path.exists(inventory_path) and self.host_type != "player"... | python | def list_vms(self):
"""
Gets VMware VM list.
"""
# check for the right VMware version
yield from self.check_vmware_version()
vmware_vms = []
inventory_path = self.get_vmware_inventory_path()
if os.path.exists(inventory_path) and self.host_type != "player"... | [
"def",
"list_vms",
"(",
"self",
")",
":",
"# check for the right VMware version",
"yield",
"from",
"self",
".",
"check_vmware_version",
"(",
")",
"vmware_vms",
"=",
"[",
"]",
"inventory_path",
"=",
"self",
".",
"get_vmware_inventory_path",
"(",
")",
"if",
"os",
... | Gets VMware VM list. | [
"Gets",
"VMware",
"VM",
"list",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vmware/__init__.py#L673-L724 | train |
GNS3/gns3-server | gns3server/compute/dynamips/nodes/atm_switch.py | ATMSwitch.remove_nio | def remove_nio(self, port_number):
"""
Removes the specified NIO as member of this ATM switch.
:param port_number: allocated port number
"""
if port_number not in self._nios:
raise DynamipsError("Port {} is not allocated".format(port_number))
# remove VCs m... | python | def remove_nio(self, port_number):
"""
Removes the specified NIO as member of this ATM switch.
:param port_number: allocated port number
"""
if port_number not in self._nios:
raise DynamipsError("Port {} is not allocated".format(port_number))
# remove VCs m... | [
"def",
"remove_nio",
"(",
"self",
",",
"port_number",
")",
":",
"if",
"port_number",
"not",
"in",
"self",
".",
"_nios",
":",
"raise",
"DynamipsError",
"(",
"\"Port {} is not allocated\"",
".",
"format",
"(",
"port_number",
")",
")",
"# remove VCs mapped with the p... | Removes the specified NIO as member of this ATM switch.
:param port_number: allocated port number | [
"Removes",
"the",
"specified",
"NIO",
"as",
"member",
"of",
"this",
"ATM",
"switch",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/atm_switch.py#L180-L230 | train |
GNS3/gns3-server | gns3server/compute/dynamips/nodes/atm_switch.py | ATMSwitch.map_vp | def map_vp(self, port1, vpi1, port2, vpi2):
"""
Creates a new Virtual Path connection.
:param port1: input port
:param vpi1: input vpi
:param port2: output port
:param vpi2: output vpi
"""
if port1 not in self._nios:
return
if port2 ... | python | def map_vp(self, port1, vpi1, port2, vpi2):
"""
Creates a new Virtual Path connection.
:param port1: input port
:param vpi1: input vpi
:param port2: output port
:param vpi2: output vpi
"""
if port1 not in self._nios:
return
if port2 ... | [
"def",
"map_vp",
"(",
"self",
",",
"port1",
",",
"vpi1",
",",
"port2",
",",
"vpi2",
")",
":",
"if",
"port1",
"not",
"in",
"self",
".",
"_nios",
":",
"return",
"if",
"port2",
"not",
"in",
"self",
".",
"_nios",
":",
"return",
"nio1",
"=",
"self",
"... | Creates a new Virtual Path connection.
:param port1: input port
:param vpi1: input vpi
:param port2: output port
:param vpi2: output vpi | [
"Creates",
"a",
"new",
"Virtual",
"Path",
"connection",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/atm_switch.py#L279-L311 | train |
GNS3/gns3-server | gns3server/web/response.py | Response.file | def file(self, path, status=200, set_content_length=True):
"""
Return a file as a response
"""
ct, encoding = mimetypes.guess_type(path)
if not ct:
ct = 'application/octet-stream'
if encoding:
self.headers[aiohttp.hdrs.CONTENT_ENCODING] = encoding
... | python | def file(self, path, status=200, set_content_length=True):
"""
Return a file as a response
"""
ct, encoding = mimetypes.guess_type(path)
if not ct:
ct = 'application/octet-stream'
if encoding:
self.headers[aiohttp.hdrs.CONTENT_ENCODING] = encoding
... | [
"def",
"file",
"(",
"self",
",",
"path",
",",
"status",
"=",
"200",
",",
"set_content_length",
"=",
"True",
")",
":",
"ct",
",",
"encoding",
"=",
"mimetypes",
".",
"guess_type",
"(",
"path",
")",
"if",
"not",
"ct",
":",
"ct",
"=",
"'application/octet-s... | Return a file as a response | [
"Return",
"a",
"file",
"as",
"a",
"response"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/web/response.py#L116-L150 | train |
GNS3/gns3-server | gns3server/controller/snapshot.py | Snapshot.restore | def restore(self):
"""
Restore the snapshot
"""
yield from self._project.delete_on_computes()
# We don't send close notif to clients because the close / open dance is purely internal
yield from self._project.close(ignore_notification=True)
self._project.controlle... | python | def restore(self):
"""
Restore the snapshot
"""
yield from self._project.delete_on_computes()
# We don't send close notif to clients because the close / open dance is purely internal
yield from self._project.close(ignore_notification=True)
self._project.controlle... | [
"def",
"restore",
"(",
"self",
")",
":",
"yield",
"from",
"self",
".",
"_project",
".",
"delete_on_computes",
"(",
")",
"# We don't send close notif to clients because the close / open dance is purely internal",
"yield",
"from",
"self",
".",
"_project",
".",
"close",
"(... | Restore the snapshot | [
"Restore",
"the",
"snapshot"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/snapshot.py#L75-L92 | train |
GNS3/gns3-server | gns3server/utils/get_resource.py | get_resource | def get_resource(resource_name):
"""
Return a resource in current directory or in frozen package
"""
resource_path = None
if hasattr(sys, "frozen"):
resource_path = os.path.normpath(os.path.join(os.path.dirname(sys.executable), resource_name))
elif not hasattr(sys, "frozen") and pkg_res... | python | def get_resource(resource_name):
"""
Return a resource in current directory or in frozen package
"""
resource_path = None
if hasattr(sys, "frozen"):
resource_path = os.path.normpath(os.path.join(os.path.dirname(sys.executable), resource_name))
elif not hasattr(sys, "frozen") and pkg_res... | [
"def",
"get_resource",
"(",
"resource_name",
")",
":",
"resource_path",
"=",
"None",
"if",
"hasattr",
"(",
"sys",
",",
"\"frozen\"",
")",
":",
"resource_path",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
"."... | Return a resource in current directory or in frozen package | [
"Return",
"a",
"resource",
"in",
"current",
"directory",
"or",
"in",
"frozen",
"package"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/utils/get_resource.py#L46-L57 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM._nvram_changed | def _nvram_changed(self, path):
"""
Called when the NVRAM file has changed
"""
log.debug("NVRAM changed: {}".format(path))
self.save_configs()
self.updated() | python | def _nvram_changed(self, path):
"""
Called when the NVRAM file has changed
"""
log.debug("NVRAM changed: {}".format(path))
self.save_configs()
self.updated() | [
"def",
"_nvram_changed",
"(",
"self",
",",
"path",
")",
":",
"log",
".",
"debug",
"(",
"\"NVRAM changed: {}\"",
".",
"format",
"(",
"path",
")",
")",
"self",
".",
"save_configs",
"(",
")",
"self",
".",
"updated",
"(",
")"
] | Called when the NVRAM file has changed | [
"Called",
"when",
"the",
"NVRAM",
"file",
"has",
"changed"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L95-L101 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.close | def close(self):
"""
Closes this IOU VM.
"""
if not (yield from super().close()):
return False
adapters = self._ethernet_adapters + self._serial_adapters
for adapter in adapters:
if adapter is not None:
for nio in adapter.ports.va... | python | def close(self):
"""
Closes this IOU VM.
"""
if not (yield from super().close()):
return False
adapters = self._ethernet_adapters + self._serial_adapters
for adapter in adapters:
if adapter is not None:
for nio in adapter.ports.va... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"not",
"(",
"yield",
"from",
"super",
"(",
")",
".",
"close",
"(",
")",
")",
":",
"return",
"False",
"adapters",
"=",
"self",
".",
"_ethernet_adapters",
"+",
"self",
".",
"_serial_adapters",
"for",
"adapter"... | Closes this IOU VM. | [
"Closes",
"this",
"IOU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L104-L119 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.path | def path(self, path):
"""
Path of the IOU executable.
:param path: path to the IOU image executable
"""
self._path = self.manager.get_abs_image_path(path)
log.info('IOU "{name}" [{id}]: IOU image updated to "{path}"'.format(name=self._name, id=self._id, path=self._path)... | python | def path(self, path):
"""
Path of the IOU executable.
:param path: path to the IOU image executable
"""
self._path = self.manager.get_abs_image_path(path)
log.info('IOU "{name}" [{id}]: IOU image updated to "{path}"'.format(name=self._name, id=self._id, path=self._path)... | [
"def",
"path",
"(",
"self",
",",
"path",
")",
":",
"self",
".",
"_path",
"=",
"self",
".",
"manager",
".",
"get_abs_image_path",
"(",
"path",
")",
"log",
".",
"info",
"(",
"'IOU \"{name}\" [{id}]: IOU image updated to \"{path}\"'",
".",
"format",
"(",
"name",
... | Path of the IOU executable.
:param path: path to the IOU image executable | [
"Path",
"of",
"the",
"IOU",
"executable",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L132-L140 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.use_default_iou_values | def use_default_iou_values(self, state):
"""
Sets if this device uses the default IOU image values.
:param state: boolean
"""
self._use_default_iou_values = state
if state:
log.info('IOU "{name}" [{id}]: uses the default IOU image values'.format(name=self._n... | python | def use_default_iou_values(self, state):
"""
Sets if this device uses the default IOU image values.
:param state: boolean
"""
self._use_default_iou_values = state
if state:
log.info('IOU "{name}" [{id}]: uses the default IOU image values'.format(name=self._n... | [
"def",
"use_default_iou_values",
"(",
"self",
",",
"state",
")",
":",
"self",
".",
"_use_default_iou_values",
"=",
"state",
"if",
"state",
":",
"log",
".",
"info",
"(",
"'IOU \"{name}\" [{id}]: uses the default IOU image values'",
".",
"format",
"(",
"name",
"=",
... | Sets if this device uses the default IOU image values.
:param state: boolean | [
"Sets",
"if",
"this",
"device",
"uses",
"the",
"default",
"IOU",
"image",
"values",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L153-L164 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.update_default_iou_values | def update_default_iou_values(self):
"""
Finds the default RAM and NVRAM values for the IOU image.
"""
try:
output = yield from gns3server.utils.asyncio.subprocess_check_output(self._path, "-h", cwd=self.working_dir, stderr=True)
match = re.search("-n <n>\s+Size ... | python | def update_default_iou_values(self):
"""
Finds the default RAM and NVRAM values for the IOU image.
"""
try:
output = yield from gns3server.utils.asyncio.subprocess_check_output(self._path, "-h", cwd=self.working_dir, stderr=True)
match = re.search("-n <n>\s+Size ... | [
"def",
"update_default_iou_values",
"(",
"self",
")",
":",
"try",
":",
"output",
"=",
"yield",
"from",
"gns3server",
".",
"utils",
".",
"asyncio",
".",
"subprocess_check_output",
"(",
"self",
".",
"_path",
",",
"\"-h\"",
",",
"cwd",
"=",
"self",
".",
"work... | Finds the default RAM and NVRAM values for the IOU image. | [
"Finds",
"the",
"default",
"RAM",
"and",
"NVRAM",
"values",
"for",
"the",
"IOU",
"image",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L167-L181 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM._check_requirements | def _check_requirements(self):
"""
Checks the IOU image.
"""
if not self._path:
raise IOUError("IOU image is not configured")
if not os.path.isfile(self._path) or not os.path.exists(self._path):
if os.path.islink(self._path):
raise IOUErro... | python | def _check_requirements(self):
"""
Checks the IOU image.
"""
if not self._path:
raise IOUError("IOU image is not configured")
if not os.path.isfile(self._path) or not os.path.exists(self._path):
if os.path.islink(self._path):
raise IOUErro... | [
"def",
"_check_requirements",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_path",
":",
"raise",
"IOUError",
"(",
"\"IOU image is not configured\"",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"_path",
")",
"or",
"not",
"os... | Checks the IOU image. | [
"Checks",
"the",
"IOU",
"image",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L188-L214 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.iourc_path | def iourc_path(self):
"""
Returns the IOURC file path.
:returns: path to IOURC
"""
iourc_path = self._config().get("iourc_path")
if not iourc_path:
# look for the iourc file in the temporary dir.
path = os.path.join(self.temporary_directory, "io... | python | def iourc_path(self):
"""
Returns the IOURC file path.
:returns: path to IOURC
"""
iourc_path = self._config().get("iourc_path")
if not iourc_path:
# look for the iourc file in the temporary dir.
path = os.path.join(self.temporary_directory, "io... | [
"def",
"iourc_path",
"(",
"self",
")",
":",
"iourc_path",
"=",
"self",
".",
"_config",
"(",
")",
".",
"get",
"(",
"\"iourc_path\"",
")",
"if",
"not",
"iourc_path",
":",
"# look for the iourc file in the temporary dir.",
"path",
"=",
"os",
".",
"path",
".",
... | Returns the IOURC file path.
:returns: path to IOURC | [
"Returns",
"the",
"IOURC",
"file",
"path",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L241-L262 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.name | def name(self, new_name):
"""
Sets the name of this IOU VM.
:param new_name: name
"""
if self.startup_config_file:
content = self.startup_config_content
content = re.sub(r"^hostname .+$", "hostname " + new_name, content, flags=re.MULTILINE)
s... | python | def name(self, new_name):
"""
Sets the name of this IOU VM.
:param new_name: name
"""
if self.startup_config_file:
content = self.startup_config_content
content = re.sub(r"^hostname .+$", "hostname " + new_name, content, flags=re.MULTILINE)
s... | [
"def",
"name",
"(",
"self",
",",
"new_name",
")",
":",
"if",
"self",
".",
"startup_config_file",
":",
"content",
"=",
"self",
".",
"startup_config_content",
"content",
"=",
"re",
".",
"sub",
"(",
"r\"^hostname .+$\"",
",",
"\"hostname \"",
"+",
"new_name",
"... | Sets the name of this IOU VM.
:param new_name: name | [
"Sets",
"the",
"name",
"of",
"this",
"IOU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L320-L332 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM._library_check | def _library_check(self):
"""
Checks for missing shared library dependencies in the IOU image.
"""
try:
output = yield from gns3server.utils.asyncio.subprocess_check_output("ldd", self._path)
except (FileNotFoundError, subprocess.SubprocessError) as e:
lo... | python | def _library_check(self):
"""
Checks for missing shared library dependencies in the IOU image.
"""
try:
output = yield from gns3server.utils.asyncio.subprocess_check_output("ldd", self._path)
except (FileNotFoundError, subprocess.SubprocessError) as e:
lo... | [
"def",
"_library_check",
"(",
"self",
")",
":",
"try",
":",
"output",
"=",
"yield",
"from",
"gns3server",
".",
"utils",
".",
"asyncio",
".",
"subprocess_check_output",
"(",
"\"ldd\"",
",",
"self",
".",
"_path",
")",
"except",
"(",
"FileNotFoundError",
",",
... | Checks for missing shared library dependencies in the IOU image. | [
"Checks",
"for",
"missing",
"shared",
"library",
"dependencies",
"in",
"the",
"IOU",
"image",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L364-L379 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM._nvram_file | def _nvram_file(self):
"""
Path to the nvram file
"""
return os.path.join(self.working_dir, "nvram_{:05d}".format(self.application_id)) | python | def _nvram_file(self):
"""
Path to the nvram file
"""
return os.path.join(self.working_dir, "nvram_{:05d}".format(self.application_id)) | [
"def",
"_nvram_file",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"working_dir",
",",
"\"nvram_{:05d}\"",
".",
"format",
"(",
"self",
".",
"application_id",
")",
")"
] | Path to the nvram file | [
"Path",
"to",
"the",
"nvram",
"file"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L441-L445 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM._push_configs_to_nvram | def _push_configs_to_nvram(self):
"""
Push the startup-config and private-config content to the NVRAM.
"""
startup_config_content = self.startup_config_content
if startup_config_content:
nvram_file = self._nvram_file()
try:
if not os.path.... | python | def _push_configs_to_nvram(self):
"""
Push the startup-config and private-config content to the NVRAM.
"""
startup_config_content = self.startup_config_content
if startup_config_content:
nvram_file = self._nvram_file()
try:
if not os.path.... | [
"def",
"_push_configs_to_nvram",
"(",
"self",
")",
":",
"startup_config_content",
"=",
"self",
".",
"startup_config_content",
"if",
"startup_config_content",
":",
"nvram_file",
"=",
"self",
".",
"_nvram_file",
"(",
")",
"try",
":",
"if",
"not",
"os",
".",
"path"... | Push the startup-config and private-config content to the NVRAM. | [
"Push",
"the",
"startup",
"-",
"config",
"and",
"private",
"-",
"config",
"content",
"to",
"the",
"NVRAM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L447-L477 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.start | def start(self):
"""
Starts the IOU process.
"""
self._check_requirements()
if not self.is_running():
yield from self._library_check()
try:
self._rename_nvram_file()
except OSError as e:
raise IOUError("Could ... | python | def start(self):
"""
Starts the IOU process.
"""
self._check_requirements()
if not self.is_running():
yield from self._library_check()
try:
self._rename_nvram_file()
except OSError as e:
raise IOUError("Could ... | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"_check_requirements",
"(",
")",
"if",
"not",
"self",
".",
"is_running",
"(",
")",
":",
"yield",
"from",
"self",
".",
"_library_check",
"(",
")",
"try",
":",
"self",
".",
"_rename_nvram_file",
"(",
")... | Starts the IOU process. | [
"Starts",
"the",
"IOU",
"process",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L480-L547 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM._networking | def _networking(self):
"""
Configures the IOL bridge in uBridge.
"""
bridge_name = "IOL-BRIDGE-{}".format(self.application_id + 512)
try:
# delete any previous bridge if it exists
yield from self._ubridge_send("iol_bridge delete {name}".format(name=bridge... | python | def _networking(self):
"""
Configures the IOL bridge in uBridge.
"""
bridge_name = "IOL-BRIDGE-{}".format(self.application_id + 512)
try:
# delete any previous bridge if it exists
yield from self._ubridge_send("iol_bridge delete {name}".format(name=bridge... | [
"def",
"_networking",
"(",
"self",
")",
":",
"bridge_name",
"=",
"\"IOL-BRIDGE-{}\"",
".",
"format",
"(",
"self",
".",
"application_id",
"+",
"512",
")",
"try",
":",
"# delete any previous bridge if it exists",
"yield",
"from",
"self",
".",
"_ubridge_send",
"(",
... | Configures the IOL bridge in uBridge. | [
"Configures",
"the",
"IOL",
"bridge",
"in",
"uBridge",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L550-L585 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM._rename_nvram_file | def _rename_nvram_file(self):
"""
Before starting the VM, rename the nvram and vlan.dat files with the correct IOU application identifier.
"""
destination = self._nvram_file()
for file_path in glob.glob(os.path.join(glob.escape(self.working_dir), "nvram_*")):
shutil.... | python | def _rename_nvram_file(self):
"""
Before starting the VM, rename the nvram and vlan.dat files with the correct IOU application identifier.
"""
destination = self._nvram_file()
for file_path in glob.glob(os.path.join(glob.escape(self.working_dir), "nvram_*")):
shutil.... | [
"def",
"_rename_nvram_file",
"(",
"self",
")",
":",
"destination",
"=",
"self",
".",
"_nvram_file",
"(",
")",
"for",
"file_path",
"in",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"glob",
".",
"escape",
"(",
"self",
".",
"working_dir... | Before starting the VM, rename the nvram and vlan.dat files with the correct IOU application identifier. | [
"Before",
"starting",
"the",
"VM",
"rename",
"the",
"nvram",
"and",
"vlan",
".",
"dat",
"files",
"with",
"the",
"correct",
"IOU",
"application",
"identifier",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L608-L618 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.stop | def stop(self):
"""
Stops the IOU process.
"""
yield from self._stop_ubridge()
if self._nvram_watcher:
self._nvram_watcher.close()
self._nvram_watcher = None
if self._telnet_server:
self._telnet_server.close()
self._telnet... | python | def stop(self):
"""
Stops the IOU process.
"""
yield from self._stop_ubridge()
if self._nvram_watcher:
self._nvram_watcher.close()
self._nvram_watcher = None
if self._telnet_server:
self._telnet_server.close()
self._telnet... | [
"def",
"stop",
"(",
"self",
")",
":",
"yield",
"from",
"self",
".",
"_stop_ubridge",
"(",
")",
"if",
"self",
".",
"_nvram_watcher",
":",
"self",
".",
"_nvram_watcher",
".",
"close",
"(",
")",
"self",
".",
"_nvram_watcher",
"=",
"None",
"if",
"self",
".... | Stops the IOU process. | [
"Stops",
"the",
"IOU",
"process",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L621-L650 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM._terminate_process_iou | def _terminate_process_iou(self):
"""
Terminate the IOU process if running
"""
if self._iou_process:
log.info('Stopping IOU process for IOU VM "{}" PID={}'.format(self.name, self._iou_process.pid))
try:
self._iou_process.terminate()
# ... | python | def _terminate_process_iou(self):
"""
Terminate the IOU process if running
"""
if self._iou_process:
log.info('Stopping IOU process for IOU VM "{}" PID={}'.format(self.name, self._iou_process.pid))
try:
self._iou_process.terminate()
# ... | [
"def",
"_terminate_process_iou",
"(",
"self",
")",
":",
"if",
"self",
".",
"_iou_process",
":",
"log",
".",
"info",
"(",
"'Stopping IOU process for IOU VM \"{}\" PID={}'",
".",
"format",
"(",
"self",
".",
"name",
",",
"self",
".",
"_iou_process",
".",
"pid",
"... | Terminate the IOU process if running | [
"Terminate",
"the",
"IOU",
"process",
"if",
"running"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L652-L665 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM._create_netmap_config | def _create_netmap_config(self):
"""
Creates the NETMAP file.
"""
netmap_path = os.path.join(self.working_dir, "NETMAP")
try:
with open(netmap_path, "w", encoding="utf-8") as f:
for bay in range(0, 16):
for unit in range(0, 4):
... | python | def _create_netmap_config(self):
"""
Creates the NETMAP file.
"""
netmap_path = os.path.join(self.working_dir, "NETMAP")
try:
with open(netmap_path, "w", encoding="utf-8") as f:
for bay in range(0, 16):
for unit in range(0, 4):
... | [
"def",
"_create_netmap_config",
"(",
"self",
")",
":",
"netmap_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"working_dir",
",",
"\"NETMAP\"",
")",
"try",
":",
"with",
"open",
"(",
"netmap_path",
",",
"\"w\"",
",",
"encoding",
"=",
"\"utf... | Creates the NETMAP file. | [
"Creates",
"the",
"NETMAP",
"file",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L687-L704 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.read_iou_stdout | def read_iou_stdout(self):
"""
Reads the standard output of the IOU process.
Only use when the process has been stopped or has crashed.
"""
output = ""
if self._iou_stdout_file:
try:
with open(self._iou_stdout_file, "rb") as file:
... | python | def read_iou_stdout(self):
"""
Reads the standard output of the IOU process.
Only use when the process has been stopped or has crashed.
"""
output = ""
if self._iou_stdout_file:
try:
with open(self._iou_stdout_file, "rb") as file:
... | [
"def",
"read_iou_stdout",
"(",
"self",
")",
":",
"output",
"=",
"\"\"",
"if",
"self",
".",
"_iou_stdout_file",
":",
"try",
":",
"with",
"open",
"(",
"self",
".",
"_iou_stdout_file",
",",
"\"rb\"",
")",
"as",
"file",
":",
"output",
"=",
"file",
".",
"re... | Reads the standard output of the IOU process.
Only use when the process has been stopped or has crashed. | [
"Reads",
"the",
"standard",
"output",
"of",
"the",
"IOU",
"process",
".",
"Only",
"use",
"when",
"the",
"process",
"has",
"been",
"stopped",
"or",
"has",
"crashed",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L756-L769 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.ethernet_adapters | def ethernet_adapters(self, ethernet_adapters):
"""
Sets the number of Ethernet adapters for this IOU VM.
:param ethernet_adapters: number of adapters
"""
self._ethernet_adapters.clear()
for _ in range(0, ethernet_adapters):
self._ethernet_adapters.append(Et... | python | def ethernet_adapters(self, ethernet_adapters):
"""
Sets the number of Ethernet adapters for this IOU VM.
:param ethernet_adapters: number of adapters
"""
self._ethernet_adapters.clear()
for _ in range(0, ethernet_adapters):
self._ethernet_adapters.append(Et... | [
"def",
"ethernet_adapters",
"(",
"self",
",",
"ethernet_adapters",
")",
":",
"self",
".",
"_ethernet_adapters",
".",
"clear",
"(",
")",
"for",
"_",
"in",
"range",
"(",
"0",
",",
"ethernet_adapters",
")",
":",
"self",
".",
"_ethernet_adapters",
".",
"append",... | Sets the number of Ethernet adapters for this IOU VM.
:param ethernet_adapters: number of adapters | [
"Sets",
"the",
"number",
"of",
"Ethernet",
"adapters",
"for",
"this",
"IOU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L786-L801 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.serial_adapters | def serial_adapters(self, serial_adapters):
"""
Sets the number of Serial adapters for this IOU VM.
:param serial_adapters: number of adapters
"""
self._serial_adapters.clear()
for _ in range(0, serial_adapters):
self._serial_adapters.append(SerialAdapter(in... | python | def serial_adapters(self, serial_adapters):
"""
Sets the number of Serial adapters for this IOU VM.
:param serial_adapters: number of adapters
"""
self._serial_adapters.clear()
for _ in range(0, serial_adapters):
self._serial_adapters.append(SerialAdapter(in... | [
"def",
"serial_adapters",
"(",
"self",
",",
"serial_adapters",
")",
":",
"self",
".",
"_serial_adapters",
".",
"clear",
"(",
")",
"for",
"_",
"in",
"range",
"(",
"0",
",",
"serial_adapters",
")",
":",
"self",
".",
"_serial_adapters",
".",
"append",
"(",
... | Sets the number of Serial adapters for this IOU VM.
:param serial_adapters: number of adapters | [
"Sets",
"the",
"number",
"of",
"Serial",
"adapters",
"for",
"this",
"IOU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L814-L829 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.adapter_add_nio_binding | def adapter_add_nio_binding(self, adapter_number, port_number, nio):
"""
Adds a adapter NIO binding.
:param adapter_number: adapter number
:param port_number: port number
:param nio: NIO instance to add to the adapter/port
"""
try:
adapter = self._ad... | python | def adapter_add_nio_binding(self, adapter_number, port_number, nio):
"""
Adds a adapter NIO binding.
:param adapter_number: adapter number
:param port_number: port number
:param nio: NIO instance to add to the adapter/port
"""
try:
adapter = self._ad... | [
"def",
"adapter_add_nio_binding",
"(",
"self",
",",
"adapter_number",
",",
"port_number",
",",
"nio",
")",
":",
"try",
":",
"adapter",
"=",
"self",
".",
"_adapters",
"[",
"adapter_number",
"]",
"except",
"IndexError",
":",
"raise",
"IOUError",
"(",
"'Adapter {... | Adds a adapter NIO binding.
:param adapter_number: adapter number
:param port_number: port number
:param nio: NIO instance to add to the adapter/port | [
"Adds",
"a",
"adapter",
"NIO",
"binding",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L832-L867 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM._ubridge_apply_filters | def _ubridge_apply_filters(self, adapter_number, port_number, filters):
"""
Apply filter like rate limiting
:param adapter_number: adapter number
:param port_number: port number
:param filters: Array of filter dictionnary
"""
bridge_name = "IOL-BRIDGE-{}".format(... | python | def _ubridge_apply_filters(self, adapter_number, port_number, filters):
"""
Apply filter like rate limiting
:param adapter_number: adapter number
:param port_number: port number
:param filters: Array of filter dictionnary
"""
bridge_name = "IOL-BRIDGE-{}".format(... | [
"def",
"_ubridge_apply_filters",
"(",
"self",
",",
"adapter_number",
",",
"port_number",
",",
"filters",
")",
":",
"bridge_name",
"=",
"\"IOL-BRIDGE-{}\"",
".",
"format",
"(",
"self",
".",
"application_id",
"+",
"512",
")",
"location",
"=",
"'{bridge_name} {bay} {... | Apply filter like rate limiting
:param adapter_number: adapter number
:param port_number: port number
:param filters: Array of filter dictionnary | [
"Apply",
"filter",
"like",
"rate",
"limiting"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L883-L901 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.l1_keepalives | def l1_keepalives(self, state):
"""
Enables or disables layer 1 keepalive messages.
:param state: boolean
"""
self._l1_keepalives = state
if state:
log.info('IOU "{name}" [{id}]: has activated layer 1 keepalive messages'.format(name=self._name, id=self._id))... | python | def l1_keepalives(self, state):
"""
Enables or disables layer 1 keepalive messages.
:param state: boolean
"""
self._l1_keepalives = state
if state:
log.info('IOU "{name}" [{id}]: has activated layer 1 keepalive messages'.format(name=self._name, id=self._id))... | [
"def",
"l1_keepalives",
"(",
"self",
",",
"state",
")",
":",
"self",
".",
"_l1_keepalives",
"=",
"state",
"if",
"state",
":",
"log",
".",
"info",
"(",
"'IOU \"{name}\" [{id}]: has activated layer 1 keepalive messages'",
".",
"format",
"(",
"name",
"=",
"self",
"... | Enables or disables layer 1 keepalive messages.
:param state: boolean | [
"Enables",
"or",
"disables",
"layer",
"1",
"keepalive",
"messages",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L952-L963 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM._enable_l1_keepalives | def _enable_l1_keepalives(self, command):
"""
Enables L1 keepalive messages if supported.
:param command: command line
"""
env = os.environ.copy()
if "IOURC" not in os.environ:
env["IOURC"] = self.iourc_path
try:
output = yield from gns3s... | python | def _enable_l1_keepalives(self, command):
"""
Enables L1 keepalive messages if supported.
:param command: command line
"""
env = os.environ.copy()
if "IOURC" not in os.environ:
env["IOURC"] = self.iourc_path
try:
output = yield from gns3s... | [
"def",
"_enable_l1_keepalives",
"(",
"self",
",",
"command",
")",
":",
"env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"if",
"\"IOURC\"",
"not",
"in",
"os",
".",
"environ",
":",
"env",
"[",
"\"IOURC\"",
"]",
"=",
"self",
".",
"iourc_path",
"... | Enables L1 keepalive messages if supported.
:param command: command line | [
"Enables",
"L1",
"keepalive",
"messages",
"if",
"supported",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L966-L983 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.startup_config_content | def startup_config_content(self):
"""
Returns the content of the current startup-config file.
"""
config_file = self.startup_config_file
if config_file is None:
return None
try:
with open(config_file, "rb") as f:
return f.read().d... | python | def startup_config_content(self):
"""
Returns the content of the current startup-config file.
"""
config_file = self.startup_config_file
if config_file is None:
return None
try:
with open(config_file, "rb") as f:
return f.read().d... | [
"def",
"startup_config_content",
"(",
"self",
")",
":",
"config_file",
"=",
"self",
".",
"startup_config_file",
"if",
"config_file",
"is",
"None",
":",
"return",
"None",
"try",
":",
"with",
"open",
"(",
"config_file",
",",
"\"rb\"",
")",
"as",
"f",
":",
"r... | Returns the content of the current startup-config file. | [
"Returns",
"the",
"content",
"of",
"the",
"current",
"startup",
"-",
"config",
"file",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L986-L999 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.startup_config_content | def startup_config_content(self, startup_config):
"""
Update the startup config
:param startup_config: content of the startup configuration file
"""
try:
startup_config_path = os.path.join(self.working_dir, "startup-config.cfg")
if startup_config is Non... | python | def startup_config_content(self, startup_config):
"""
Update the startup config
:param startup_config: content of the startup configuration file
"""
try:
startup_config_path = os.path.join(self.working_dir, "startup-config.cfg")
if startup_config is Non... | [
"def",
"startup_config_content",
"(",
"self",
",",
"startup_config",
")",
":",
"try",
":",
"startup_config_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"working_dir",
",",
"\"startup-config.cfg\"",
")",
"if",
"startup_config",
"is",
"None",
":... | Update the startup config
:param startup_config: content of the startup configuration file | [
"Update",
"the",
"startup",
"config"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L1002-L1034 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.private_config_content | def private_config_content(self):
"""
Returns the content of the current private-config file.
"""
config_file = self.private_config_file
if config_file is None:
return None
try:
with open(config_file, "rb") as f:
return f.read().d... | python | def private_config_content(self):
"""
Returns the content of the current private-config file.
"""
config_file = self.private_config_file
if config_file is None:
return None
try:
with open(config_file, "rb") as f:
return f.read().d... | [
"def",
"private_config_content",
"(",
"self",
")",
":",
"config_file",
"=",
"self",
".",
"private_config_file",
"if",
"config_file",
"is",
"None",
":",
"return",
"None",
"try",
":",
"with",
"open",
"(",
"config_file",
",",
"\"rb\"",
")",
"as",
"f",
":",
"r... | Returns the content of the current private-config file. | [
"Returns",
"the",
"content",
"of",
"the",
"current",
"private",
"-",
"config",
"file",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L1037-L1050 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.private_config_content | def private_config_content(self, private_config):
"""
Update the private config
:param private_config: content of the private configuration file
"""
try:
private_config_path = os.path.join(self.working_dir, "private-config.cfg")
if private_config is Non... | python | def private_config_content(self, private_config):
"""
Update the private config
:param private_config: content of the private configuration file
"""
try:
private_config_path = os.path.join(self.working_dir, "private-config.cfg")
if private_config is Non... | [
"def",
"private_config_content",
"(",
"self",
",",
"private_config",
")",
":",
"try",
":",
"private_config_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"working_dir",
",",
"\"private-config.cfg\"",
")",
"if",
"private_config",
"is",
"None",
":... | Update the private config
:param private_config: content of the private configuration file | [
"Update",
"the",
"private",
"config"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L1053-L1077 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.startup_config_file | def startup_config_file(self):
"""
Returns the startup-config file for this IOU VM.
:returns: path to config file. None if the file doesn't exist
"""
path = os.path.join(self.working_dir, 'startup-config.cfg')
if os.path.exists(path):
return path
els... | python | def startup_config_file(self):
"""
Returns the startup-config file for this IOU VM.
:returns: path to config file. None if the file doesn't exist
"""
path = os.path.join(self.working_dir, 'startup-config.cfg')
if os.path.exists(path):
return path
els... | [
"def",
"startup_config_file",
"(",
"self",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"working_dir",
",",
"'startup-config.cfg'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"return",
"path",
"else"... | Returns the startup-config file for this IOU VM.
:returns: path to config file. None if the file doesn't exist | [
"Returns",
"the",
"startup",
"-",
"config",
"file",
"for",
"this",
"IOU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L1080-L1091 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.private_config_file | def private_config_file(self):
"""
Returns the private-config file for this IOU VM.
:returns: path to config file. None if the file doesn't exist
"""
path = os.path.join(self.working_dir, 'private-config.cfg')
if os.path.exists(path):
return path
els... | python | def private_config_file(self):
"""
Returns the private-config file for this IOU VM.
:returns: path to config file. None if the file doesn't exist
"""
path = os.path.join(self.working_dir, 'private-config.cfg')
if os.path.exists(path):
return path
els... | [
"def",
"private_config_file",
"(",
"self",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"working_dir",
",",
"'private-config.cfg'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"return",
"path",
"else"... | Returns the private-config file for this IOU VM.
:returns: path to config file. None if the file doesn't exist | [
"Returns",
"the",
"private",
"-",
"config",
"file",
"for",
"this",
"IOU",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L1094-L1105 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.relative_startup_config_file | def relative_startup_config_file(self):
"""
Returns the startup-config file relative to the project directory.
It's compatible with pre 1.3 projects.
:returns: path to startup-config file. None if the file doesn't exist
"""
path = os.path.join(self.working_dir, 'startup... | python | def relative_startup_config_file(self):
"""
Returns the startup-config file relative to the project directory.
It's compatible with pre 1.3 projects.
:returns: path to startup-config file. None if the file doesn't exist
"""
path = os.path.join(self.working_dir, 'startup... | [
"def",
"relative_startup_config_file",
"(",
"self",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"working_dir",
",",
"'startup-config.cfg'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"return",
"'start... | Returns the startup-config file relative to the project directory.
It's compatible with pre 1.3 projects.
:returns: path to startup-config file. None if the file doesn't exist | [
"Returns",
"the",
"startup",
"-",
"config",
"file",
"relative",
"to",
"the",
"project",
"directory",
".",
"It",
"s",
"compatible",
"with",
"pre",
"1",
".",
"3",
"projects",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L1108-L1120 | train |
GNS3/gns3-server | gns3server/compute/iou/iou_vm.py | IOUVM.relative_private_config_file | def relative_private_config_file(self):
"""
Returns the private-config file relative to the project directory.
:returns: path to private-config file. None if the file doesn't exist
"""
path = os.path.join(self.working_dir, 'private-config.cfg')
if os.path.exists(path):
... | python | def relative_private_config_file(self):
"""
Returns the private-config file relative to the project directory.
:returns: path to private-config file. None if the file doesn't exist
"""
path = os.path.join(self.working_dir, 'private-config.cfg')
if os.path.exists(path):
... | [
"def",
"relative_private_config_file",
"(",
"self",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"working_dir",
",",
"'private-config.cfg'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"return",
"'priva... | Returns the private-config file relative to the project directory.
:returns: path to private-config file. None if the file doesn't exist | [
"Returns",
"the",
"private",
"-",
"config",
"file",
"relative",
"to",
"the",
"project",
"directory",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/iou/iou_vm.py#L1123-L1134 | train |
GNS3/gns3-server | gns3server/controller/drawing.py | Drawing.svg | def svg(self, value):
"""
Set SVG field value.
If the svg has embed base64 element we will extract them
to disk in order to avoid duplication of content
"""
if len(value) < 500:
self._svg = value
return
try:
root = ET.fromstr... | python | def svg(self, value):
"""
Set SVG field value.
If the svg has embed base64 element we will extract them
to disk in order to avoid duplication of content
"""
if len(value) < 500:
self._svg = value
return
try:
root = ET.fromstr... | [
"def",
"svg",
"(",
"self",
",",
"value",
")",
":",
"if",
"len",
"(",
"value",
")",
"<",
"500",
":",
"self",
".",
"_svg",
"=",
"value",
"return",
"try",
":",
"root",
"=",
"ET",
".",
"fromstring",
"(",
"value",
")",
"except",
"ET",
".",
"ParseError... | Set SVG field value.
If the svg has embed base64 element we will extract them
to disk in order to avoid duplication of content | [
"Set",
"SVG",
"field",
"value",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/drawing.py#L84-L134 | train |
GNS3/gns3-server | gns3server/controller/drawing.py | Drawing.update | def update(self, **kwargs):
"""
Update the drawing
:param kwargs: Drawing properties
"""
# Update node properties with additional elements
svg_changed = False
for prop in kwargs:
if prop == "drawing_id":
pass # No good reason to chan... | python | def update(self, **kwargs):
"""
Update the drawing
:param kwargs: Drawing properties
"""
# Update node properties with additional elements
svg_changed = False
for prop in kwargs:
if prop == "drawing_id":
pass # No good reason to chan... | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Update node properties with additional elements",
"svg_changed",
"=",
"False",
"for",
"prop",
"in",
"kwargs",
":",
"if",
"prop",
"==",
"\"drawing_id\"",
":",
"pass",
"# No good reason to change a dr... | Update the drawing
:param kwargs: Drawing properties | [
"Update",
"the",
"drawing"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/drawing.py#L169-L190 | train |
GNS3/gns3-server | gns3server/compute/vpcs/__init__.py | VPCS.create_node | def create_node(self, *args, **kwargs):
"""
Creates a new VPCS VM.
:returns: VPCSVM instance
"""
node = yield from super().create_node(*args, **kwargs)
self._free_mac_ids.setdefault(node.project.id, list(range(0, 255)))
try:
self._used_mac_ids[node.i... | python | def create_node(self, *args, **kwargs):
"""
Creates a new VPCS VM.
:returns: VPCSVM instance
"""
node = yield from super().create_node(*args, **kwargs)
self._free_mac_ids.setdefault(node.project.id, list(range(0, 255)))
try:
self._used_mac_ids[node.i... | [
"def",
"create_node",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"node",
"=",
"yield",
"from",
"super",
"(",
")",
".",
"create_node",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"_free_mac_ids",
".",
"setdefa... | Creates a new VPCS VM.
:returns: VPCSVM instance | [
"Creates",
"a",
"new",
"VPCS",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vpcs/__init__.py#L41-L54 | train |
GNS3/gns3-server | gns3server/compute/vpcs/__init__.py | VPCS.close_node | def close_node(self, node_id, *args, **kwargs):
"""
Closes a VPCS VM.
:returns: VPCSVM instance
"""
node = self.get_node(node_id)
if node_id in self._used_mac_ids:
i = self._used_mac_ids[node_id]
self._free_mac_ids[node.project.id].insert(0, i)
... | python | def close_node(self, node_id, *args, **kwargs):
"""
Closes a VPCS VM.
:returns: VPCSVM instance
"""
node = self.get_node(node_id)
if node_id in self._used_mac_ids:
i = self._used_mac_ids[node_id]
self._free_mac_ids[node.project.id].insert(0, i)
... | [
"def",
"close_node",
"(",
"self",
",",
"node_id",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"node",
"=",
"self",
".",
"get_node",
"(",
"node_id",
")",
"if",
"node_id",
"in",
"self",
".",
"_used_mac_ids",
":",
"i",
"=",
"self",
".",
"_use... | Closes a VPCS VM.
:returns: VPCSVM instance | [
"Closes",
"a",
"VPCS",
"VM",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/vpcs/__init__.py#L57-L70 | train |
GNS3/gns3-server | gns3server/compute/dynamips/nios/nio.py | NIO.delete | def delete(self):
"""
Deletes this NIO.
"""
if self._input_filter or self._output_filter:
yield from self.unbind_filter("both")
yield from self._hypervisor.send("nio delete {}".format(self._name))
log.info("NIO {name} has been deleted".format(name=self._name)... | python | def delete(self):
"""
Deletes this NIO.
"""
if self._input_filter or self._output_filter:
yield from self.unbind_filter("both")
yield from self._hypervisor.send("nio delete {}".format(self._name))
log.info("NIO {name} has been deleted".format(name=self._name)... | [
"def",
"delete",
"(",
"self",
")",
":",
"if",
"self",
".",
"_input_filter",
"or",
"self",
".",
"_output_filter",
":",
"yield",
"from",
"self",
".",
"unbind_filter",
"(",
"\"both\"",
")",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"\"n... | Deletes this NIO. | [
"Deletes",
"this",
"NIO",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nios/nio.py#L61-L69 | train |
GNS3/gns3-server | gns3server/compute/dynamips/nios/nio.py | NIO.rename | def rename(self, new_name):
"""
Renames this NIO
:param new_name: new NIO name
"""
yield from self._hypervisor.send("nio rename {name} {new_name}".format(name=self._name, new_name=new_name))
log.info("NIO {name} renamed to {new_name}".format(name=self._name, new_name=n... | python | def rename(self, new_name):
"""
Renames this NIO
:param new_name: new NIO name
"""
yield from self._hypervisor.send("nio rename {name} {new_name}".format(name=self._name, new_name=new_name))
log.info("NIO {name} renamed to {new_name}".format(name=self._name, new_name=n... | [
"def",
"rename",
"(",
"self",
",",
"new_name",
")",
":",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"\"nio rename {name} {new_name}\"",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"new_name",
"=",
"new_name",
")",
")",
... | Renames this NIO
:param new_name: new NIO name | [
"Renames",
"this",
"NIO"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nios/nio.py#L72-L82 | train |
GNS3/gns3-server | gns3server/compute/dynamips/nios/nio.py | NIO.bind_filter | def bind_filter(self, direction, filter_name):
"""
Adds a packet filter to this NIO.
Filter "freq_drop" drops packets.
Filter "capture" captures packets.
:param direction: "in", "out" or "both"
:param filter_name: name of the filter to apply
"""
if direc... | python | def bind_filter(self, direction, filter_name):
"""
Adds a packet filter to this NIO.
Filter "freq_drop" drops packets.
Filter "capture" captures packets.
:param direction: "in", "out" or "both"
:param filter_name: name of the filter to apply
"""
if direc... | [
"def",
"bind_filter",
"(",
"self",
",",
"direction",
",",
"filter_name",
")",
":",
"if",
"direction",
"not",
"in",
"self",
".",
"_dynamips_direction",
":",
"raise",
"DynamipsError",
"(",
"\"Unknown direction {} to bind filter {}:\"",
".",
"format",
"(",
"direction",... | Adds a packet filter to this NIO.
Filter "freq_drop" drops packets.
Filter "capture" captures packets.
:param direction: "in", "out" or "both"
:param filter_name: name of the filter to apply | [
"Adds",
"a",
"packet",
"filter",
"to",
"this",
"NIO",
".",
"Filter",
"freq_drop",
"drops",
"packets",
".",
"Filter",
"capture",
"captures",
"packets",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nios/nio.py#L95-L119 | train |
GNS3/gns3-server | gns3server/compute/dynamips/nios/nio.py | NIO.unbind_filter | def unbind_filter(self, direction):
"""
Removes packet filter for this NIO.
:param direction: "in", "out" or "both"
"""
if direction not in self._dynamips_direction:
raise DynamipsError("Unknown direction {} to unbind filter:".format(direction))
dynamips_dir... | python | def unbind_filter(self, direction):
"""
Removes packet filter for this NIO.
:param direction: "in", "out" or "both"
"""
if direction not in self._dynamips_direction:
raise DynamipsError("Unknown direction {} to unbind filter:".format(direction))
dynamips_dir... | [
"def",
"unbind_filter",
"(",
"self",
",",
"direction",
")",
":",
"if",
"direction",
"not",
"in",
"self",
".",
"_dynamips_direction",
":",
"raise",
"DynamipsError",
"(",
"\"Unknown direction {} to unbind filter:\"",
".",
"format",
"(",
"direction",
")",
")",
"dynam... | Removes packet filter for this NIO.
:param direction: "in", "out" or "both" | [
"Removes",
"packet",
"filter",
"for",
"this",
"NIO",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nios/nio.py#L122-L142 | train |
GNS3/gns3-server | gns3server/compute/dynamips/nios/nio.py | NIO.setup_filter | def setup_filter(self, direction, options):
"""
Setups a packet filter bound with this NIO.
Filter "freq_drop" has 1 argument "<frequency>". It will drop
everything with a -1 frequency, drop every Nth packet with a
positive frequency, or drop nothing.
Filter "capture" h... | python | def setup_filter(self, direction, options):
"""
Setups a packet filter bound with this NIO.
Filter "freq_drop" has 1 argument "<frequency>". It will drop
everything with a -1 frequency, drop every Nth packet with a
positive frequency, or drop nothing.
Filter "capture" h... | [
"def",
"setup_filter",
"(",
"self",
",",
"direction",
",",
"options",
")",
":",
"if",
"direction",
"not",
"in",
"self",
".",
"_dynamips_direction",
":",
"raise",
"DynamipsError",
"(",
"\"Unknown direction {} to setup filter:\"",
".",
"format",
"(",
"direction",
")... | Setups a packet filter bound with this NIO.
Filter "freq_drop" has 1 argument "<frequency>". It will drop
everything with a -1 frequency, drop every Nth packet with a
positive frequency, or drop nothing.
Filter "capture" has 2 arguments "<link_type_name> <output_file>".
It will... | [
"Setups",
"a",
"packet",
"filter",
"bound",
"with",
"this",
"NIO",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nios/nio.py#L145-L177 | train |
GNS3/gns3-server | gns3server/compute/dynamips/nios/nio.py | NIO.get_stats | def get_stats(self):
"""
Gets statistics for this NIO.
:returns: NIO statistics (string with packets in, packets out, bytes in, bytes out)
"""
stats = yield from self._hypervisor.send("nio get_stats {}".format(self._name))
return stats[0] | python | def get_stats(self):
"""
Gets statistics for this NIO.
:returns: NIO statistics (string with packets in, packets out, bytes in, bytes out)
"""
stats = yield from self._hypervisor.send("nio get_stats {}".format(self._name))
return stats[0] | [
"def",
"get_stats",
"(",
"self",
")",
":",
"stats",
"=",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"\"nio get_stats {}\"",
".",
"format",
"(",
"self",
".",
"_name",
")",
")",
"return",
"stats",
"[",
"0",
"]"
] | Gets statistics for this NIO.
:returns: NIO statistics (string with packets in, packets out, bytes in, bytes out) | [
"Gets",
"statistics",
"for",
"this",
"NIO",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nios/nio.py#L200-L208 | train |
GNS3/gns3-server | gns3server/compute/dynamips/nios/nio.py | NIO.set_bandwidth | def set_bandwidth(self, bandwidth):
"""
Sets bandwidth constraint.
:param bandwidth: bandwidth integer value (in Kb/s)
"""
yield from self._hypervisor.send("nio set_bandwidth {name} {bandwidth}".format(name=self._name, bandwidth=bandwidth))
self._bandwidth = bandwidth | python | def set_bandwidth(self, bandwidth):
"""
Sets bandwidth constraint.
:param bandwidth: bandwidth integer value (in Kb/s)
"""
yield from self._hypervisor.send("nio set_bandwidth {name} {bandwidth}".format(name=self._name, bandwidth=bandwidth))
self._bandwidth = bandwidth | [
"def",
"set_bandwidth",
"(",
"self",
",",
"bandwidth",
")",
":",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"\"nio set_bandwidth {name} {bandwidth}\"",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"bandwidth",
"=",
"bandwidth... | Sets bandwidth constraint.
:param bandwidth: bandwidth integer value (in Kb/s) | [
"Sets",
"bandwidth",
"constraint",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nios/nio.py#L229-L237 | train |
GNS3/gns3-server | gns3server/controller/node.py | Node.create | def create(self):
"""
Create the node on the compute server
"""
data = self._node_data()
data["node_id"] = self._id
if self._node_type == "docker":
timeout = None
else:
timeout = 1200
trial = 0
while trial != 6:
... | python | def create(self):
"""
Create the node on the compute server
"""
data = self._node_data()
data["node_id"] = self._id
if self._node_type == "docker":
timeout = None
else:
timeout = 1200
trial = 0
while trial != 6:
... | [
"def",
"create",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"_node_data",
"(",
")",
"data",
"[",
"\"node_id\"",
"]",
"=",
"self",
".",
"_id",
"if",
"self",
".",
"_node_type",
"==",
"\"docker\"",
":",
"timeout",
"=",
"None",
"else",
":",
"timeou... | Create the node on the compute server | [
"Create",
"the",
"node",
"on",
"the",
"compute",
"server"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/node.py#L326-L350 | train |
GNS3/gns3-server | gns3server/controller/node.py | Node.update | def update(self, **kwargs):
"""
Update the node on the compute server
:param kwargs: Node properties
"""
# When updating properties used only on controller we don't need to call the compute
update_compute = False
old_json = self.__json__()
compute_prop... | python | def update(self, **kwargs):
"""
Update the node on the compute server
:param kwargs: Node properties
"""
# When updating properties used only on controller we don't need to call the compute
update_compute = False
old_json = self.__json__()
compute_prop... | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# When updating properties used only on controller we don't need to call the compute",
"update_compute",
"=",
"False",
"old_json",
"=",
"self",
".",
"__json__",
"(",
")",
"compute_properties",
"=",
"None"... | Update the node on the compute server
:param kwargs: Node properties | [
"Update",
"the",
"node",
"on",
"the",
"compute",
"server"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/node.py#L353-L386 | train |
GNS3/gns3-server | gns3server/controller/node.py | Node.parse_node_response | def parse_node_response(self, response):
"""
Update the object with the remote node object
"""
for key, value in response.items():
if key == "console":
self._console = value
elif key == "node_directory":
self._node_directory = value... | python | def parse_node_response(self, response):
"""
Update the object with the remote node object
"""
for key, value in response.items():
if key == "console":
self._console = value
elif key == "node_directory":
self._node_directory = value... | [
"def",
"parse_node_response",
"(",
"self",
",",
"response",
")",
":",
"for",
"key",
",",
"value",
"in",
"response",
".",
"items",
"(",
")",
":",
"if",
"key",
"==",
"\"console\"",
":",
"self",
".",
"_console",
"=",
"value",
"elif",
"key",
"==",
"\"node_... | Update the object with the remote node object | [
"Update",
"the",
"object",
"with",
"the",
"remote",
"node",
"object"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/node.py#L389-L416 | train |
GNS3/gns3-server | gns3server/controller/node.py | Node._node_data | def _node_data(self, properties=None):
"""
Prepare node data to send to the remote controller
:param properties: If properties is None use actual property otherwise use the parameter
"""
if properties:
data = copy.copy(properties)
else:
data = cop... | python | def _node_data(self, properties=None):
"""
Prepare node data to send to the remote controller
:param properties: If properties is None use actual property otherwise use the parameter
"""
if properties:
data = copy.copy(properties)
else:
data = cop... | [
"def",
"_node_data",
"(",
"self",
",",
"properties",
"=",
"None",
")",
":",
"if",
"properties",
":",
"data",
"=",
"copy",
".",
"copy",
"(",
"properties",
")",
"else",
":",
"data",
"=",
"copy",
".",
"copy",
"(",
"self",
".",
"_properties",
")",
"# We ... | Prepare node data to send to the remote controller
:param properties: If properties is None use actual property otherwise use the parameter | [
"Prepare",
"node",
"data",
"to",
"send",
"to",
"the",
"remote",
"controller"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/node.py#L418-L450 | train |
GNS3/gns3-server | gns3server/controller/node.py | Node.reload | def reload(self):
"""
Suspend a node
"""
try:
yield from self.post("/reload", timeout=240)
except asyncio.TimeoutError:
raise aiohttp.web.HTTPRequestTimeout(text="Timeout when reloading {}".format(self._name)) | python | def reload(self):
"""
Suspend a node
"""
try:
yield from self.post("/reload", timeout=240)
except asyncio.TimeoutError:
raise aiohttp.web.HTTPRequestTimeout(text="Timeout when reloading {}".format(self._name)) | [
"def",
"reload",
"(",
"self",
")",
":",
"try",
":",
"yield",
"from",
"self",
".",
"post",
"(",
"\"/reload\"",
",",
"timeout",
"=",
"240",
")",
"except",
"asyncio",
".",
"TimeoutError",
":",
"raise",
"aiohttp",
".",
"web",
".",
"HTTPRequestTimeout",
"(",
... | Suspend a node | [
"Suspend",
"a",
"node"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/node.py#L498-L505 | train |
GNS3/gns3-server | gns3server/controller/node.py | Node._upload_missing_image | def _upload_missing_image(self, type, img):
"""
Search an image on local computer and upload it to remote compute
if the image exists
"""
for directory in images_directories(type):
image = os.path.join(directory, img)
if os.path.exists(image):
... | python | def _upload_missing_image(self, type, img):
"""
Search an image on local computer and upload it to remote compute
if the image exists
"""
for directory in images_directories(type):
image = os.path.join(directory, img)
if os.path.exists(image):
... | [
"def",
"_upload_missing_image",
"(",
"self",
",",
"type",
",",
"img",
")",
":",
"for",
"directory",
"in",
"images_directories",
"(",
"type",
")",
":",
"image",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"img",
")",
"if",
"os",
".",
"... | Search an image on local computer and upload it to remote compute
if the image exists | [
"Search",
"an",
"image",
"on",
"local",
"computer",
"and",
"upload",
"it",
"to",
"remote",
"compute",
"if",
"the",
"image",
"exists"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/node.py#L542-L558 | train |
GNS3/gns3-server | gns3server/controller/node.py | Node.dynamips_auto_idlepc | def dynamips_auto_idlepc(self):
"""
Compute the idle PC for a dynamips node
"""
return (yield from self._compute.get("/projects/{}/{}/nodes/{}/auto_idlepc".format(self._project.id, self._node_type, self._id), timeout=240)).json | python | def dynamips_auto_idlepc(self):
"""
Compute the idle PC for a dynamips node
"""
return (yield from self._compute.get("/projects/{}/{}/nodes/{}/auto_idlepc".format(self._project.id, self._node_type, self._id), timeout=240)).json | [
"def",
"dynamips_auto_idlepc",
"(",
"self",
")",
":",
"return",
"(",
"yield",
"from",
"self",
".",
"_compute",
".",
"get",
"(",
"\"/projects/{}/{}/nodes/{}/auto_idlepc\"",
".",
"format",
"(",
"self",
".",
"_project",
".",
"id",
",",
"self",
".",
"_node_type",
... | Compute the idle PC for a dynamips node | [
"Compute",
"the",
"idle",
"PC",
"for",
"a",
"dynamips",
"node"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/node.py#L561-L565 | train |
GNS3/gns3-server | gns3server/controller/node.py | Node.get_port | def get_port(self, adapter_number, port_number):
"""
Return the port for this adapter_number and port_number
or returns None if the port is not found
"""
for port in self.ports:
if port.adapter_number == adapter_number and port.port_number == port_number:
... | python | def get_port(self, adapter_number, port_number):
"""
Return the port for this adapter_number and port_number
or returns None if the port is not found
"""
for port in self.ports:
if port.adapter_number == adapter_number and port.port_number == port_number:
... | [
"def",
"get_port",
"(",
"self",
",",
"adapter_number",
",",
"port_number",
")",
":",
"for",
"port",
"in",
"self",
".",
"ports",
":",
"if",
"port",
".",
"adapter_number",
"==",
"adapter_number",
"and",
"port",
".",
"port_number",
"==",
"port_number",
":",
"... | Return the port for this adapter_number and port_number
or returns None if the port is not found | [
"Return",
"the",
"port",
"for",
"this",
"adapter_number",
"and",
"port_number",
"or",
"returns",
"None",
"if",
"the",
"port",
"is",
"not",
"found"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/node.py#L574-L582 | train |
GNS3/gns3-server | gns3server/compute/dynamips/nodes/c1700.py | C1700.set_chassis | def set_chassis(self, chassis):
"""
Sets the chassis.
:param: chassis string:
1720, 1721, 1750, 1751 or 1760
"""
yield from self._hypervisor.send('c1700 set_chassis "{name}" {chassis}'.format(name=self._name, chassis=chassis))
log.info('Router "{name}" [{id}]: ... | python | def set_chassis(self, chassis):
"""
Sets the chassis.
:param: chassis string:
1720, 1721, 1750, 1751 or 1760
"""
yield from self._hypervisor.send('c1700 set_chassis "{name}" {chassis}'.format(name=self._name, chassis=chassis))
log.info('Router "{name}" [{id}]: ... | [
"def",
"set_chassis",
"(",
"self",
",",
"chassis",
")",
":",
"yield",
"from",
"self",
".",
"_hypervisor",
".",
"send",
"(",
"'c1700 set_chassis \"{name}\" {chassis}'",
".",
"format",
"(",
"name",
"=",
"self",
".",
"_name",
",",
"chassis",
"=",
"chassis",
")"... | Sets the chassis.
:param: chassis string:
1720, 1721, 1750, 1751 or 1760 | [
"Sets",
"the",
"chassis",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/c1700.py#L107-L122 | train |
GNS3/gns3-server | gns3server/controller/topology.py | load_topology | def load_topology(path):
"""
Open a topology file, patch it for last GNS3 release and return it
"""
log.debug("Read topology %s", path)
try:
with open(path, encoding="utf-8") as f:
topo = json.load(f)
except (OSError, UnicodeDecodeError, ValueError) as e:
raise aiohtt... | python | def load_topology(path):
"""
Open a topology file, patch it for last GNS3 release and return it
"""
log.debug("Read topology %s", path)
try:
with open(path, encoding="utf-8") as f:
topo = json.load(f)
except (OSError, UnicodeDecodeError, ValueError) as e:
raise aiohtt... | [
"def",
"load_topology",
"(",
"path",
")",
":",
"log",
".",
"debug",
"(",
"\"Read topology %s\"",
",",
"path",
")",
"try",
":",
"with",
"open",
"(",
"path",
",",
"encoding",
"=",
"\"utf-8\"",
")",
"as",
"f",
":",
"topo",
"=",
"json",
".",
"load",
"(",... | Open a topology file, patch it for last GNS3 release and return it | [
"Open",
"a",
"topology",
"file",
"patch",
"it",
"for",
"last",
"GNS3",
"release",
"and",
"return",
"it"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/topology.py#L115-L166 | train |
GNS3/gns3-server | gns3server/controller/topology.py | _convert_2_0_0 | def _convert_2_0_0(topo, topo_path):
"""
Convert topologies from GNS3 2.0.0 to 2.1
Changes:
* Remove startup_script_path from VPCS and base config file for IOU and Dynamips
"""
topo["revision"] = 8
for node in topo.get("topology", {}).get("nodes", []):
if "properties" in node:
... | python | def _convert_2_0_0(topo, topo_path):
"""
Convert topologies from GNS3 2.0.0 to 2.1
Changes:
* Remove startup_script_path from VPCS and base config file for IOU and Dynamips
"""
topo["revision"] = 8
for node in topo.get("topology", {}).get("nodes", []):
if "properties" in node:
... | [
"def",
"_convert_2_0_0",
"(",
"topo",
",",
"topo_path",
")",
":",
"topo",
"[",
"\"revision\"",
"]",
"=",
"8",
"for",
"node",
"in",
"topo",
".",
"get",
"(",
"\"topology\"",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"nodes\"",
",",
"[",
"]",
")",
":",
... | Convert topologies from GNS3 2.0.0 to 2.1
Changes:
* Remove startup_script_path from VPCS and base config file for IOU and Dynamips | [
"Convert",
"topologies",
"from",
"GNS3",
"2",
".",
"0",
".",
"0",
"to",
"2",
".",
"1"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/topology.py#L169-L194 | train |
GNS3/gns3-server | gns3server/controller/topology.py | _convert_2_0_0_beta_2 | def _convert_2_0_0_beta_2(topo, topo_path):
"""
Convert topologies from GNS3 2.0.0 beta 2 to beta 3.
Changes:
* Node id folders for dynamips
"""
topo_dir = os.path.dirname(topo_path)
topo["revision"] = 7
for node in topo.get("topology", {}).get("nodes", []):
if node["node_type... | python | def _convert_2_0_0_beta_2(topo, topo_path):
"""
Convert topologies from GNS3 2.0.0 beta 2 to beta 3.
Changes:
* Node id folders for dynamips
"""
topo_dir = os.path.dirname(topo_path)
topo["revision"] = 7
for node in topo.get("topology", {}).get("nodes", []):
if node["node_type... | [
"def",
"_convert_2_0_0_beta_2",
"(",
"topo",
",",
"topo_path",
")",
":",
"topo_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"topo_path",
")",
"topo",
"[",
"\"revision\"",
"]",
"=",
"7",
"for",
"node",
"in",
"topo",
".",
"get",
"(",
"\"topology\"",
... | Convert topologies from GNS3 2.0.0 beta 2 to beta 3.
Changes:
* Node id folders for dynamips | [
"Convert",
"topologies",
"from",
"GNS3",
"2",
".",
"0",
".",
"0",
"beta",
"2",
"to",
"beta",
"3",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/topology.py#L197-L222 | train |
GNS3/gns3-server | gns3server/controller/topology.py | _convert_2_0_0_alpha | def _convert_2_0_0_alpha(topo, topo_path):
"""
Convert topologies from GNS3 2.0.0 alpha to 2.0.0 final.
Changes:
* No more serial console
* No more option for VMware / VirtualBox remote console (always use telnet)
"""
topo["revision"] = 6
for node in topo.get("topology", {}).get("node... | python | def _convert_2_0_0_alpha(topo, topo_path):
"""
Convert topologies from GNS3 2.0.0 alpha to 2.0.0 final.
Changes:
* No more serial console
* No more option for VMware / VirtualBox remote console (always use telnet)
"""
topo["revision"] = 6
for node in topo.get("topology", {}).get("node... | [
"def",
"_convert_2_0_0_alpha",
"(",
"topo",
",",
"topo_path",
")",
":",
"topo",
"[",
"\"revision\"",
"]",
"=",
"6",
"for",
"node",
"in",
"topo",
".",
"get",
"(",
"\"topology\"",
",",
"{",
"}",
")",
".",
"get",
"(",
"\"nodes\"",
",",
"[",
"]",
")",
... | Convert topologies from GNS3 2.0.0 alpha to 2.0.0 final.
Changes:
* No more serial console
* No more option for VMware / VirtualBox remote console (always use telnet) | [
"Convert",
"topologies",
"from",
"GNS3",
"2",
".",
"0",
".",
"0",
"alpha",
"to",
"2",
".",
"0",
".",
"0",
"final",
"."
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/topology.py#L225-L241 | train |
GNS3/gns3-server | gns3server/controller/topology.py | _convert_label | def _convert_label(label):
"""
Convert a label from 1.X to the new format
"""
style = qt_font_to_style(label.get("font"), label.get("color"))
return {
"text": html.escape(label["text"]),
"rotation": 0,
"style": style,
"x": int(label["x"]),
"y": int(label["y"])... | python | def _convert_label(label):
"""
Convert a label from 1.X to the new format
"""
style = qt_font_to_style(label.get("font"), label.get("color"))
return {
"text": html.escape(label["text"]),
"rotation": 0,
"style": style,
"x": int(label["x"]),
"y": int(label["y"])... | [
"def",
"_convert_label",
"(",
"label",
")",
":",
"style",
"=",
"qt_font_to_style",
"(",
"label",
".",
"get",
"(",
"\"font\"",
")",
",",
"label",
".",
"get",
"(",
"\"color\"",
")",
")",
"return",
"{",
"\"text\"",
":",
"html",
".",
"escape",
"(",
"label"... | Convert a label from 1.X to the new format | [
"Convert",
"a",
"label",
"from",
"1",
".",
"X",
"to",
"the",
"new",
"format"
] | a221678448fb5d24e977ef562f81d56aacc89ab1 | https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/topology.py#L573-L584 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.