id
int32
0
252k
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
226,600
GNS3/gns3-server
gns3server/compute/project.py
Project.record_tcp_port
def record_tcp_port(self, port): """ Associate a reserved TCP port number with this project. :param port: TCP port number """ if port not in self._used_tcp_ports: self._used_tcp_ports.add(port)
python
def record_tcp_port(self, port): """ Associate a reserved TCP port number with this project. :param port: TCP port number """ if port not in self._used_tcp_ports: self._used_tcp_ports.add(port)
[ "def", "record_tcp_port", "(", "self", ",", "port", ")", ":", "if", "port", "not", "in", "self", ".", "_used_tcp_ports", ":", "self", ".", "_used_tcp_ports", ".", "add", "(", "port", ")" ]
Associate a reserved TCP port number with this project. :param port: TCP port number
[ "Associate", "a", "reserved", "TCP", "port", "number", "with", "this", "project", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project.py#L134-L142
226,601
GNS3/gns3-server
gns3server/compute/project.py
Project.record_udp_port
def record_udp_port(self, port): """ Associate a reserved UDP port number with this project. :param port: UDP port number """ if port not in self._used_udp_ports: self._used_udp_ports.add(port)
python
def record_udp_port(self, port): """ Associate a reserved UDP port number with this project. :param port: UDP port number """ if port not in self._used_udp_ports: self._used_udp_ports.add(port)
[ "def", "record_udp_port", "(", "self", ",", "port", ")", ":", "if", "port", "not", "in", "self", ".", "_used_udp_ports", ":", "self", ".", "_used_udp_ports", ".", "add", "(", "port", ")" ]
Associate a reserved UDP port number with this project. :param port: UDP port number
[ "Associate", "a", "reserved", "UDP", "port", "number", "with", "this", "project", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project.py#L144-L152
226,602
GNS3/gns3-server
gns3server/compute/project.py
Project.remove_tcp_port
def remove_tcp_port(self, port): """ Removes an associated TCP port number from this project. :param port: TCP port number """ if port in self._used_tcp_ports: self._used_tcp_ports.remove(port)
python
def remove_tcp_port(self, port): """ Removes an associated TCP port number from this project. :param port: TCP port number """ if port in self._used_tcp_ports: self._used_tcp_ports.remove(port)
[ "def", "remove_tcp_port", "(", "self", ",", "port", ")", ":", "if", "port", "in", "self", ".", "_used_tcp_ports", ":", "self", ".", "_used_tcp_ports", ".", "remove", "(", "port", ")" ]
Removes an associated TCP port number from this project. :param port: TCP port number
[ "Removes", "an", "associated", "TCP", "port", "number", "from", "this", "project", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project.py#L154-L162
226,603
GNS3/gns3-server
gns3server/compute/project.py
Project.remove_udp_port
def remove_udp_port(self, port): """ Removes an associated UDP port number from this project. :param port: UDP port number """ if port in self._used_udp_ports: self._used_udp_ports.remove(port)
python
def remove_udp_port(self, port): """ Removes an associated UDP port number from this project. :param port: UDP port number """ if port in self._used_udp_ports: self._used_udp_ports.remove(port)
[ "def", "remove_udp_port", "(", "self", ",", "port", ")", ":", "if", "port", "in", "self", ".", "_used_udp_ports", ":", "self", ".", "_used_udp_ports", ".", "remove", "(", "port", ")" ]
Removes an associated UDP port number from this project. :param port: UDP port number
[ "Removes", "an", "associated", "UDP", "port", "number", "from", "this", "project", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project.py#L164-L172
226,604
GNS3/gns3-server
gns3server/compute/project.py
Project.module_working_directory
def module_working_directory(self, module_name): """ Returns a working directory for the module The directory is created if the directory doesn't exist. :param module_name: name for the module :returns: working directory """ workdir = self.module_working_path(mo...
python
def module_working_directory(self, module_name): """ Returns a working directory for the module The directory is created if the directory doesn't exist. :param module_name: name for the module :returns: working directory """ workdir = self.module_working_path(mo...
[ "def", "module_working_directory", "(", "self", ",", "module_name", ")", ":", "workdir", "=", "self", ".", "module_working_path", "(", "module_name", ")", "if", "not", "self", ".", "_deleted", ":", "try", ":", "os", ".", "makedirs", "(", "workdir", ",", "e...
Returns a working directory for the module The directory is created if the directory doesn't exist. :param module_name: name for the module :returns: working directory
[ "Returns", "a", "working", "directory", "for", "the", "module", "The", "directory", "is", "created", "if", "the", "directory", "doesn", "t", "exist", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project.py#L174-L189
226,605
GNS3/gns3-server
gns3server/compute/project.py
Project.node_working_directory
def node_working_directory(self, node): """ Returns a working directory for a specific node. If the directory doesn't exist, the directory is created. :param node: Node instance :returns: Node working directory """ workdir = self.node_working_path(node) ...
python
def node_working_directory(self, node): """ Returns a working directory for a specific node. If the directory doesn't exist, the directory is created. :param node: Node instance :returns: Node working directory """ workdir = self.node_working_path(node) ...
[ "def", "node_working_directory", "(", "self", ",", "node", ")", ":", "workdir", "=", "self", ".", "node_working_path", "(", "node", ")", "if", "not", "self", ".", "_deleted", ":", "try", ":", "os", ".", "makedirs", "(", "workdir", ",", "exist_ok", "=", ...
Returns a working directory for a specific node. If the directory doesn't exist, the directory is created. :param node: Node instance :returns: Node working directory
[ "Returns", "a", "working", "directory", "for", "a", "specific", "node", ".", "If", "the", "directory", "doesn", "t", "exist", "the", "directory", "is", "created", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project.py#L200-L216
226,606
GNS3/gns3-server
gns3server/compute/project.py
Project.capture_working_directory
def capture_working_directory(self): """ Returns a working directory where to temporary store packet capture files. :returns: path to the directory """ workdir = os.path.join(self._path, "tmp", "captures") if not self._deleted: try: os.makedi...
python
def capture_working_directory(self): """ Returns a working directory where to temporary store packet capture files. :returns: path to the directory """ workdir = os.path.join(self._path, "tmp", "captures") if not self._deleted: try: os.makedi...
[ "def", "capture_working_directory", "(", "self", ")", ":", "workdir", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_path", ",", "\"tmp\"", ",", "\"captures\"", ")", "if", "not", "self", ".", "_deleted", ":", "try", ":", "os", ".", "makedirs"...
Returns a working directory where to temporary store packet capture files. :returns: path to the directory
[ "Returns", "a", "working", "directory", "where", "to", "temporary", "store", "packet", "capture", "files", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project.py#L233-L246
226,607
GNS3/gns3-server
gns3server/compute/project.py
Project.remove_node
def remove_node(self, node): """ Removes a node from the project. In theory this should be called by the node manager. :param node: Node instance """ if node in self._nodes: yield from node.delete() self._nodes.remove(node)
python
def remove_node(self, node): """ Removes a node from the project. In theory this should be called by the node manager. :param node: Node instance """ if node in self._nodes: yield from node.delete() self._nodes.remove(node)
[ "def", "remove_node", "(", "self", ",", "node", ")", ":", "if", "node", "in", "self", ".", "_nodes", ":", "yield", "from", "node", ".", "delete", "(", ")", "self", ".", "_nodes", ".", "remove", "(", "node", ")" ]
Removes a node from the project. In theory this should be called by the node manager. :param node: Node instance
[ "Removes", "a", "node", "from", "the", "project", ".", "In", "theory", "this", "should", "be", "called", "by", "the", "node", "manager", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project.py#L278-L288
226,608
GNS3/gns3-server
gns3server/compute/project.py
Project.close
def close(self): """ Closes the project, but keep information on disk """ project_nodes_id = set([n.id for n in self.nodes]) for module in self.compute(): module_nodes_id = set([n.id for n in module.instance().nodes]) # We close the project only for the ...
python
def close(self): """ Closes the project, but keep information on disk """ project_nodes_id = set([n.id for n in self.nodes]) for module in self.compute(): module_nodes_id = set([n.id for n in module.instance().nodes]) # We close the project only for the ...
[ "def", "close", "(", "self", ")", ":", "project_nodes_id", "=", "set", "(", "[", "n", ".", "id", "for", "n", "in", "self", ".", "nodes", "]", ")", "for", "module", "in", "self", ".", "compute", "(", ")", ":", "module_nodes_id", "=", "set", "(", "...
Closes the project, but keep information on disk
[ "Closes", "the", "project", "but", "keep", "information", "on", "disk" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project.py#L291-L316
226,609
GNS3/gns3-server
gns3server/compute/project.py
Project._close_and_clean
def _close_and_clean(self, cleanup): """ Closes the project, and cleanup the disk if cleanup is True :param cleanup: Whether to delete the project directory """ tasks = [] for node in self._nodes: tasks.append(asyncio.async(node.manager.close_node(node.id)))...
python
def _close_and_clean(self, cleanup): """ Closes the project, and cleanup the disk if cleanup is True :param cleanup: Whether to delete the project directory """ tasks = [] for node in self._nodes: tasks.append(asyncio.async(node.manager.close_node(node.id)))...
[ "def", "_close_and_clean", "(", "self", ",", "cleanup", ")", ":", "tasks", "=", "[", "]", "for", "node", "in", "self", ".", "_nodes", ":", "tasks", ".", "append", "(", "asyncio", ".", "async", "(", "node", ".", "manager", ".", "close_node", "(", "nod...
Closes the project, and cleanup the disk if cleanup is True :param cleanup: Whether to delete the project directory
[ "Closes", "the", "project", "and", "cleanup", "the", "disk", "if", "cleanup", "is", "True" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project.py#L319-L358
226,610
GNS3/gns3-server
gns3server/compute/project.py
Project.delete
def delete(self): """ Removes project from disk """ for module in self.compute(): yield from module.instance().project_closing(self) yield from self._close_and_clean(True) for module in self.compute(): yield from module.instance().project_closed(s...
python
def delete(self): """ Removes project from disk """ for module in self.compute(): yield from module.instance().project_closing(self) yield from self._close_and_clean(True) for module in self.compute(): yield from module.instance().project_closed(s...
[ "def", "delete", "(", "self", ")", ":", "for", "module", "in", "self", ".", "compute", "(", ")", ":", "yield", "from", "module", ".", "instance", "(", ")", ".", "project_closing", "(", "self", ")", "yield", "from", "self", ".", "_close_and_clean", "(",...
Removes project from disk
[ "Removes", "project", "from", "disk" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project.py#L361-L370
226,611
GNS3/gns3-server
gns3server/compute/project.py
Project._hash_file
def _hash_file(self, path): """ Compute and md5 hash for file :returns: hexadecimal md5 """ m = hashlib.md5() with open(path, "rb") as f: while True: buf = f.read(128) if not buf: break m.up...
python
def _hash_file(self, path): """ Compute and md5 hash for file :returns: hexadecimal md5 """ m = hashlib.md5() with open(path, "rb") as f: while True: buf = f.read(128) if not buf: break m.up...
[ "def", "_hash_file", "(", "self", ",", "path", ")", ":", "m", "=", "hashlib", ".", "md5", "(", ")", "with", "open", "(", "path", ",", "\"rb\"", ")", "as", "f", ":", "while", "True", ":", "buf", "=", "f", ".", "read", "(", "128", ")", "if", "n...
Compute and md5 hash for file :returns: hexadecimal md5
[ "Compute", "and", "md5", "hash", "for", "file" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/project.py#L413-L427
226,612
GNS3/gns3-server
gns3server/compute/dynamips/nodes/ethernet_switch.py
EthernetSwitchConsole.mac
def mac(self): """ Show MAC address table """ res = 'Port Mac VLAN\n' result = (yield from self._node._hypervisor.send('ethsw show_mac_addr_table {}'.format(self._node.name))) for line in result: mac, vlan, nio = line.replace(' ', ' ').sp...
python
def mac(self): """ Show MAC address table """ res = 'Port Mac VLAN\n' result = (yield from self._node._hypervisor.send('ethsw show_mac_addr_table {}'.format(self._node.name))) for line in result: mac, vlan, nio = line.replace(' ', ' ').sp...
[ "def", "mac", "(", "self", ")", ":", "res", "=", "'Port Mac VLAN\\n'", "result", "=", "(", "yield", "from", "self", ".", "_node", ".", "_hypervisor", ".", "send", "(", "'ethsw show_mac_addr_table {}'", ".", "format", "(", "self", ".", "_no...
Show MAC address table
[ "Show", "MAC", "address", "table" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/ethernet_switch.py#L47-L67
226,613
GNS3/gns3-server
gns3server/compute/dynamips/nodes/ethernet_switch.py
EthernetSwitch.set_name
def set_name(self, new_name): """ Renames this Ethernet switch. :param new_name: New name for this switch """ yield from self._hypervisor.send('ethsw rename "{name}" "{new_name}"'.format(name=self._name, new_name=new_name)) log.info('Ethernet switch "{name}" [{id}]: ren...
python
def set_name(self, new_name): """ Renames this Ethernet switch. :param new_name: New name for this switch """ yield from self._hypervisor.send('ethsw rename "{name}" "{new_name}"'.format(name=self._name, new_name=new_name)) log.info('Ethernet switch "{name}" [{id}]: ren...
[ "def", "set_name", "(", "self", ",", "new_name", ")", ":", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'ethsw rename \"{name}\" \"{new_name}\"'", ".", "format", "(", "name", "=", "self", ".", "_name", ",", "new_name", "=", "new_name", ")"...
Renames this Ethernet switch. :param new_name: New name for this switch
[ "Renames", "this", "Ethernet", "switch", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/ethernet_switch.py#L175-L186
226,614
GNS3/gns3-server
gns3server/compute/dynamips/nodes/ethernet_switch.py
EthernetSwitch.close
def close(self): """ Deletes this Ethernet switch. """ yield from self._telnet.close() self._telnet_server.close() for nio in self._nios.values(): if nio: yield from nio.close() self.manager.port_manager.release_tcp_port(self._...
python
def close(self): """ Deletes this Ethernet switch. """ yield from self._telnet.close() self._telnet_server.close() for nio in self._nios.values(): if nio: yield from nio.close() self.manager.port_manager.release_tcp_port(self._...
[ "def", "close", "(", "self", ")", ":", "yield", "from", "self", ".", "_telnet", ".", "close", "(", ")", "self", ".", "_telnet_server", ".", "close", "(", ")", "for", "nio", "in", "self", ".", "_nios", ".", "values", "(", ")", ":", "if", "nio", ":...
Deletes this Ethernet switch.
[ "Deletes", "this", "Ethernet", "switch", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/ethernet_switch.py#L213-L235
226,615
GNS3/gns3-server
gns3server/compute/dynamips/nodes/ethernet_switch.py
EthernetSwitch.add_nio
def add_nio(self, nio, port_number): """ Adds a NIO as new port on Ethernet switch. :param nio: NIO instance to add :param port_number: port to allocate for the NIO """ if port_number in self._nios: raise DynamipsError("Port {} isn't free".format(port_number...
python
def add_nio(self, nio, port_number): """ Adds a NIO as new port on Ethernet switch. :param nio: NIO instance to add :param port_number: port to allocate for the NIO """ if port_number in self._nios: raise DynamipsError("Port {} isn't free".format(port_number...
[ "def", "add_nio", "(", "self", ",", "nio", ",", "port_number", ")", ":", "if", "port_number", "in", "self", ".", "_nios", ":", "raise", "DynamipsError", "(", "\"Port {} isn't free\"", ".", "format", "(", "port_number", ")", ")", "yield", "from", "self", "....
Adds a NIO as new port on Ethernet switch. :param nio: NIO instance to add :param port_number: port to allocate for the NIO
[ "Adds", "a", "NIO", "as", "new", "port", "on", "Ethernet", "switch", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/ethernet_switch.py#L238-L259
226,616
GNS3/gns3-server
gns3server/compute/dynamips/nodes/ethernet_switch.py
EthernetSwitch.remove_nio
def remove_nio(self, port_number): """ Removes the specified NIO as member of this Ethernet switch. :param port_number: allocated port number :returns: the NIO that was bound to the port """ if port_number not in self._nios: raise DynamipsError("Port {} is ...
python
def remove_nio(self, port_number): """ Removes the specified NIO as member of this Ethernet switch. :param port_number: allocated port number :returns: the NIO that was bound to the port """ if port_number not in self._nios: raise DynamipsError("Port {} is ...
[ "def", "remove_nio", "(", "self", ",", "port_number", ")", ":", "if", "port_number", "not", "in", "self", ".", "_nios", ":", "raise", "DynamipsError", "(", "\"Port {} is not allocated\"", ".", "format", "(", "port_number", ")", ")", "nio", "=", "self", ".", ...
Removes the specified NIO as member of this Ethernet switch. :param port_number: allocated port number :returns: the NIO that was bound to the port
[ "Removes", "the", "specified", "NIO", "as", "member", "of", "this", "Ethernet", "switch", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/ethernet_switch.py#L262-L289
226,617
GNS3/gns3-server
gns3server/compute/dynamips/nodes/ethernet_switch.py
EthernetSwitch.set_port_settings
def set_port_settings(self, port_number, settings): """ Applies port settings to a specific port. :param port_number: port number to set the settings :param settings: port settings """ if settings["type"] == "access": yield from self.set_access_port(port_num...
python
def set_port_settings(self, port_number, settings): """ Applies port settings to a specific port. :param port_number: port number to set the settings :param settings: port settings """ if settings["type"] == "access": yield from self.set_access_port(port_num...
[ "def", "set_port_settings", "(", "self", ",", "port_number", ",", "settings", ")", ":", "if", "settings", "[", "\"type\"", "]", "==", "\"access\"", ":", "yield", "from", "self", ".", "set_access_port", "(", "port_number", ",", "settings", "[", "\"vlan\"", "]...
Applies port settings to a specific port. :param port_number: port number to set the settings :param settings: port settings
[ "Applies", "port", "settings", "to", "a", "specific", "port", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/ethernet_switch.py#L292-L305
226,618
GNS3/gns3-server
gns3server/compute/dynamips/nodes/ethernet_switch.py
EthernetSwitch.set_access_port
def set_access_port(self, port_number, vlan_id): """ Sets the specified port as an ACCESS port. :param port_number: allocated port number :param vlan_id: VLAN number membership """ if port_number not in self._nios: raise DynamipsError("Port {} is not allocat...
python
def set_access_port(self, port_number, vlan_id): """ Sets the specified port as an ACCESS port. :param port_number: allocated port number :param vlan_id: VLAN number membership """ if port_number not in self._nios: raise DynamipsError("Port {} is not allocat...
[ "def", "set_access_port", "(", "self", ",", "port_number", ",", "vlan_id", ")", ":", "if", "port_number", "not", "in", "self", ".", "_nios", ":", "raise", "DynamipsError", "(", "\"Port {} is not allocated\"", ".", "format", "(", "port_number", ")", ")", "nio",...
Sets the specified port as an ACCESS port. :param port_number: allocated port number :param vlan_id: VLAN number membership
[ "Sets", "the", "specified", "port", "as", "an", "ACCESS", "port", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/ethernet_switch.py#L308-L328
226,619
GNS3/gns3-server
gns3server/compute/dynamips/nodes/ethernet_switch.py
EthernetSwitch.get_mac_addr_table
def get_mac_addr_table(self): """ Returns the MAC address table for this Ethernet switch. :returns: list of entries (Ethernet address, VLAN, NIO) """ mac_addr_table = yield from self._hypervisor.send('ethsw show_mac_addr_table "{}"'.format(self._name)) return mac_addr_t...
python
def get_mac_addr_table(self): """ Returns the MAC address table for this Ethernet switch. :returns: list of entries (Ethernet address, VLAN, NIO) """ mac_addr_table = yield from self._hypervisor.send('ethsw show_mac_addr_table "{}"'.format(self._name)) return mac_addr_t...
[ "def", "get_mac_addr_table", "(", "self", ")", ":", "mac_addr_table", "=", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'ethsw show_mac_addr_table \"{}\"'", ".", "format", "(", "self", ".", "_name", ")", ")", "return", "mac_addr_table" ]
Returns the MAC address table for this Ethernet switch. :returns: list of entries (Ethernet address, VLAN, NIO)
[ "Returns", "the", "MAC", "address", "table", "for", "this", "Ethernet", "switch", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/ethernet_switch.py#L383-L391
226,620
GNS3/gns3-server
gns3server/web/web_server.py
WebServer.instance
def instance(host=None, port=None): """ Singleton to return only one instance of Server. :returns: instance of Server """ if not hasattr(WebServer, "_instance") or WebServer._instance is None: assert host is not None assert port is not None W...
python
def instance(host=None, port=None): """ Singleton to return only one instance of Server. :returns: instance of Server """ if not hasattr(WebServer, "_instance") or WebServer._instance is None: assert host is not None assert port is not None W...
[ "def", "instance", "(", "host", "=", "None", ",", "port", "=", "None", ")", ":", "if", "not", "hasattr", "(", "WebServer", ",", "\"_instance\"", ")", "or", "WebServer", ".", "_instance", "is", "None", ":", "assert", "host", "is", "not", "None", "assert...
Singleton to return only one instance of Server. :returns: instance of Server
[ "Singleton", "to", "return", "only", "one", "instance", "of", "Server", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/web/web_server.py#L64-L75
226,621
GNS3/gns3-server
gns3server/web/web_server.py
WebServer.shutdown_server
def shutdown_server(self): """ Cleanly shutdown the server. """ if not self._closing: self._closing = True else: log.warning("Close is already in progress") return if self._server: self._server.close() yield fr...
python
def shutdown_server(self): """ Cleanly shutdown the server. """ if not self._closing: self._closing = True else: log.warning("Close is already in progress") return if self._server: self._server.close() yield fr...
[ "def", "shutdown_server", "(", "self", ")", ":", "if", "not", "self", ".", "_closing", ":", "self", ".", "_closing", "=", "True", "else", ":", "log", ".", "warning", "(", "\"Close is already in progress\"", ")", "return", "if", "self", ".", "_server", ":",...
Cleanly shutdown the server.
[ "Cleanly", "shutdown", "the", "server", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/web/web_server.py#L87-L133
226,622
GNS3/gns3-server
gns3server/web/web_server.py
WebServer._exit_handling
def _exit_handling(self): """ Makes sure the asyncio loop is closed. """ def close_asyncio_loop(): loop = None try: loop = asyncio.get_event_loop() except AttributeError: pass if loop is not None: ...
python
def _exit_handling(self): """ Makes sure the asyncio loop is closed. """ def close_asyncio_loop(): loop = None try: loop = asyncio.get_event_loop() except AttributeError: pass if loop is not None: ...
[ "def", "_exit_handling", "(", "self", ")", ":", "def", "close_asyncio_loop", "(", ")", ":", "loop", "=", "None", "try", ":", "loop", "=", "asyncio", ".", "get_event_loop", "(", ")", "except", "AttributeError", ":", "pass", "if", "loop", "is", "not", "Non...
Makes sure the asyncio loop is closed.
[ "Makes", "sure", "the", "asyncio", "loop", "is", "closed", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/web/web_server.py#L181-L195
226,623
GNS3/gns3-server
gns3server/web/web_server.py
WebServer._on_startup
def _on_startup(self, *args): """ Called when the HTTP server start """ yield from Controller.instance().start() # Because with a large image collection # without md5sum already computed we start the # computing with server start asyncio.async(Qemu.instanc...
python
def _on_startup(self, *args): """ Called when the HTTP server start """ yield from Controller.instance().start() # Because with a large image collection # without md5sum already computed we start the # computing with server start asyncio.async(Qemu.instanc...
[ "def", "_on_startup", "(", "self", ",", "*", "args", ")", ":", "yield", "from", "Controller", ".", "instance", "(", ")", ".", "start", "(", ")", "# Because with a large image collection", "# without md5sum already computed we start the", "# computing with server start", ...
Called when the HTTP server start
[ "Called", "when", "the", "HTTP", "server", "start" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/web/web_server.py#L198-L206
226,624
GNS3/gns3-server
gns3server/compute/builtin/nodes/ethernet_hub.py
EthernetHub.create
def create(self): """ Creates this hub. """ super().create() log.info('Ethernet hub "{name}" [{id}] has been created'.format(name=self._name, id=self._id))
python
def create(self): """ Creates this hub. """ super().create() log.info('Ethernet hub "{name}" [{id}] has been created'.format(name=self._name, id=self._id))
[ "def", "create", "(", "self", ")", ":", "super", "(", ")", ".", "create", "(", ")", "log", ".", "info", "(", "'Ethernet hub \"{name}\" [{id}] has been created'", ".", "format", "(", "name", "=", "self", ".", "_name", ",", "id", "=", "self", ".", "_id", ...
Creates this hub.
[ "Creates", "this", "hub", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/builtin/nodes/ethernet_hub.py#L48-L54
226,625
GNS3/gns3-server
gns3server/compute/virtualbox/__init__.py
VirtualBox.list_vms
def list_vms(self, allow_clone=False): """ Gets VirtualBox VM list. """ vbox_vms = [] result = yield from self.execute("list", ["vms"]) for line in result: if len(line) == 0 or line[0] != '"' or line[-1:] != "}": continue # Broken output (per...
python
def list_vms(self, allow_clone=False): """ Gets VirtualBox VM list. """ vbox_vms = [] result = yield from self.execute("list", ["vms"]) for line in result: if len(line) == 0 or line[0] != '"' or line[-1:] != "}": continue # Broken output (per...
[ "def", "list_vms", "(", "self", ",", "allow_clone", "=", "False", ")", ":", "vbox_vms", "=", "[", "]", "result", "=", "yield", "from", "self", ".", "execute", "(", "\"list\"", ",", "[", "\"vms\"", "]", ")", "for", "line", "in", "result", ":", "if", ...
Gets VirtualBox VM list.
[ "Gets", "VirtualBox", "VM", "list", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/virtualbox/__init__.py#L174-L202
226,626
GNS3/gns3-server
gns3server/compute/dynamips/nodes/c7200.py
C7200.set_npe
def set_npe(self, npe): """ Sets the NPE model. :params npe: NPE model string (e.g. "npe-200") NPE models are npe-100, npe-150, npe-175, npe-200, npe-225, npe-300, npe-400 and npe-g2 (PowerPC c7200 only) """ if (yield from self.is_running()): raise D...
python
def set_npe(self, npe): """ Sets the NPE model. :params npe: NPE model string (e.g. "npe-200") NPE models are npe-100, npe-150, npe-175, npe-200, npe-225, npe-300, npe-400 and npe-g2 (PowerPC c7200 only) """ if (yield from self.is_running()): raise D...
[ "def", "set_npe", "(", "self", ",", "npe", ")", ":", "if", "(", "yield", "from", "self", ".", "is_running", "(", ")", ")", ":", "raise", "DynamipsError", "(", "\"Cannot change NPE on running router\"", ")", "yield", "from", "self", ".", "_hypervisor", ".", ...
Sets the NPE model. :params npe: NPE model string (e.g. "npe-200") NPE models are npe-100, npe-150, npe-175, npe-200, npe-225, npe-300, npe-400 and npe-g2 (PowerPC c7200 only)
[ "Sets", "the", "NPE", "model", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/c7200.py#L114-L132
226,627
GNS3/gns3-server
gns3server/compute/dynamips/nodes/c7200.py
C7200.set_midplane
def set_midplane(self, midplane): """ Sets the midplane model. :returns: midplane model string (e.g. "vxr" or "std") """ yield from self._hypervisor.send('c7200 set_midplane "{name}" {midplane}'.format(name=self._name, midplane=midplane)) log.info('Router "{name}" [{id...
python
def set_midplane(self, midplane): """ Sets the midplane model. :returns: midplane model string (e.g. "vxr" or "std") """ yield from self._hypervisor.send('c7200 set_midplane "{name}" {midplane}'.format(name=self._name, midplane=midplane)) log.info('Router "{name}" [{id...
[ "def", "set_midplane", "(", "self", ",", "midplane", ")", ":", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'c7200 set_midplane \"{name}\" {midplane}'", ".", "format", "(", "name", "=", "self", ".", "_name", ",", "midplane", "=", "midplane",...
Sets the midplane model. :returns: midplane model string (e.g. "vxr" or "std")
[ "Sets", "the", "midplane", "model", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/c7200.py#L145-L158
226,628
GNS3/gns3-server
gns3server/compute/dynamips/nodes/c7200.py
C7200.set_sensors
def set_sensors(self, sensors): """ Sets the 4 sensors with temperature in degree Celcius. :param sensors: list of 4 sensor temperatures corresponding to sensor 1 = I/0 controller inlet sensor 2 = I/0 controller outlet sensor 3 = NPE inlet sensor 4 = NPE outlet ...
python
def set_sensors(self, sensors): """ Sets the 4 sensors with temperature in degree Celcius. :param sensors: list of 4 sensor temperatures corresponding to sensor 1 = I/0 controller inlet sensor 2 = I/0 controller outlet sensor 3 = NPE inlet sensor 4 = NPE outlet ...
[ "def", "set_sensors", "(", "self", ",", "sensors", ")", ":", "sensor_id", "=", "0", "for", "sensor", "in", "sensors", ":", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'c7200 set_temp_sensor \"{name}\" {sensor_id} {temp}'", ".", "format", "(",...
Sets the 4 sensors with temperature in degree Celcius. :param sensors: list of 4 sensor temperatures corresponding to sensor 1 = I/0 controller inlet sensor 2 = I/0 controller outlet sensor 3 = NPE inlet sensor 4 = NPE outlet Example: [22, 22, 22, 22]
[ "Sets", "the", "4", "sensors", "with", "temperature", "in", "degree", "Celcius", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/c7200.py#L171-L196
226,629
GNS3/gns3-server
gns3server/compute/dynamips/nodes/c7200.py
C7200.set_power_supplies
def set_power_supplies(self, power_supplies): """ Sets the 2 power supplies with 0 = off, 1 = on. :param power_supplies: list of 2 power supplies. Example: [1, 0] = first power supply is on, second is off. """ power_supply_id = 0 for power_supply in power_suppli...
python
def set_power_supplies(self, power_supplies): """ Sets the 2 power supplies with 0 = off, 1 = on. :param power_supplies: list of 2 power supplies. Example: [1, 0] = first power supply is on, second is off. """ power_supply_id = 0 for power_supply in power_suppli...
[ "def", "set_power_supplies", "(", "self", ",", "power_supplies", ")", ":", "power_supply_id", "=", "0", "for", "power_supply", "in", "power_supplies", ":", "yield", "from", "self", ".", "_hypervisor", ".", "send", "(", "'c7200 set_power_supply \"{name}\" {power_supply...
Sets the 2 power supplies with 0 = off, 1 = on. :param power_supplies: list of 2 power supplies. Example: [1, 0] = first power supply is on, second is off.
[ "Sets", "the", "2", "power", "supplies", "with", "0", "=", "off", "1", "=", "on", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/c7200.py#L209-L229
226,630
GNS3/gns3-server
gns3server/compute/dynamips/nodes/c7200.py
C7200.start
def start(self): """ Starts this router. At least the IOS image must be set before starting it. """ # trick: we must send sensors and power supplies info after starting the router # otherwise they are not taken into account (Dynamips bug?) yield from Router.start...
python
def start(self): """ Starts this router. At least the IOS image must be set before starting it. """ # trick: we must send sensors and power supplies info after starting the router # otherwise they are not taken into account (Dynamips bug?) yield from Router.start...
[ "def", "start", "(", "self", ")", ":", "# trick: we must send sensors and power supplies info after starting the router", "# otherwise they are not taken into account (Dynamips bug?)", "yield", "from", "Router", ".", "start", "(", "self", ")", "if", "self", ".", "_sensors", "...
Starts this router. At least the IOS image must be set before starting it.
[ "Starts", "this", "router", ".", "At", "least", "the", "IOS", "image", "must", "be", "set", "before", "starting", "it", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/compute/dynamips/nodes/c7200.py#L232-L244
226,631
GNS3/gns3-server
gns3server/controller/export_project.py
export_project
def export_project(project, temporary_dir, include_images=False, keep_compute_id=False, allow_all_nodes=False, ignore_prefixes=None): """ Export the project as zip. It's a ZipStream object. The file will be read chunk by chunk when you iterate on the zip. It will ignore some file...
python
def export_project(project, temporary_dir, include_images=False, keep_compute_id=False, allow_all_nodes=False, ignore_prefixes=None): """ Export the project as zip. It's a ZipStream object. The file will be read chunk by chunk when you iterate on the zip. It will ignore some file...
[ "def", "export_project", "(", "project", ",", "temporary_dir", ",", "include_images", "=", "False", ",", "keep_compute_id", "=", "False", ",", "allow_all_nodes", "=", "False", ",", "ignore_prefixes", "=", "None", ")", ":", "# To avoid issue with data not saved we disa...
Export the project as zip. It's a ZipStream object. The file will be read chunk by chunk when you iterate on the zip. It will ignore some files like snapshots and :param temporary_dir: A temporary dir where to store intermediate data :param keep_compute_id: If false replace all compute id by local...
[ "Export", "the", "project", "as", "zip", ".", "It", "s", "a", "ZipStream", "object", ".", "The", "file", "will", "be", "read", "chunk", "by", "chunk", "when", "you", "iterate", "on", "the", "zip", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/export_project.py#L32-L102
226,632
GNS3/gns3-server
gns3server/controller/notification.py
Notification.dispatch
def dispatch(self, action, event, compute_id): """ Notification received from compute node. Send it directly to clients or process it :param action: Action name :param event: Event to send :param compute_id: Compute id of the sender """ if action == "node...
python
def dispatch(self, action, event, compute_id): """ Notification received from compute node. Send it directly to clients or process it :param action: Action name :param event: Event to send :param compute_id: Compute id of the sender """ if action == "node...
[ "def", "dispatch", "(", "self", ",", "action", ",", "event", ",", "compute_id", ")", ":", "if", "action", "==", "\"node.updated\"", ":", "try", ":", "# Update controller node data and send the event node.updated", "project", "=", "self", ".", "_controller", ".", "...
Notification received from compute node. Send it directly to clients or process it :param action: Action name :param event: Event to send :param compute_id: Compute id of the sender
[ "Notification", "received", "from", "compute", "node", ".", "Send", "it", "directly", "to", "clients", "or", "process", "it" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/notification.py#L56-L79
226,633
GNS3/gns3-server
gns3server/controller/notification.py
Notification.emit
def emit(self, action, event): """ Send a notification to clients scoped by projects :param action: Action name :param event: Event to send """ # If use in tests for documentation we save a sample if os.environ.get("PYTEST_BUILD_DOCUMENTATION") == "1": ...
python
def emit(self, action, event): """ Send a notification to clients scoped by projects :param action: Action name :param event: Event to send """ # If use in tests for documentation we save a sample if os.environ.get("PYTEST_BUILD_DOCUMENTATION") == "1": ...
[ "def", "emit", "(", "self", ",", "action", ",", "event", ")", ":", "# If use in tests for documentation we save a sample", "if", "os", ".", "environ", ".", "get", "(", "\"PYTEST_BUILD_DOCUMENTATION\"", ")", "==", "\"1\"", ":", "os", ".", "makedirs", "(", "\"docs...
Send a notification to clients scoped by projects :param action: Action name :param event: Event to send
[ "Send", "a", "notification", "to", "clients", "scoped", "by", "projects" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/notification.py#L81-L104
226,634
GNS3/gns3-server
gns3server/controller/notification.py
Notification._send_event_to_project
def _send_event_to_project(self, project_id, action, event): """ Send an event to all the client listening for notifications for this project :param project: Project where we need to send the event :param action: Action name :param event: Event to send """ ...
python
def _send_event_to_project(self, project_id, action, event): """ Send an event to all the client listening for notifications for this project :param project: Project where we need to send the event :param action: Action name :param event: Event to send """ ...
[ "def", "_send_event_to_project", "(", "self", ",", "project_id", ",", "action", ",", "event", ")", ":", "try", ":", "project_listeners", "=", "self", ".", "_listeners", "[", "project_id", "]", "except", "KeyError", ":", "return", "for", "listener", "in", "pr...
Send an event to all the client listening for notifications for this project :param project: Project where we need to send the event :param action: Action name :param event: Event to send
[ "Send", "an", "event", "to", "all", "the", "client", "listening", "for", "notifications", "for", "this", "project" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/notification.py#L106-L120
226,635
GNS3/gns3-server
gns3server/controller/notification.py
Notification._send_event_to_all
def _send_event_to_all(self, action, event): """ Send an event to all the client listening for notifications on all projects :param action: Action name :param event: Event to send """ for project_listeners in self._listeners.values(): for listener in ...
python
def _send_event_to_all(self, action, event): """ Send an event to all the client listening for notifications on all projects :param action: Action name :param event: Event to send """ for project_listeners in self._listeners.values(): for listener in ...
[ "def", "_send_event_to_all", "(", "self", ",", "action", ",", "event", ")", ":", "for", "project_listeners", "in", "self", ".", "_listeners", ".", "values", "(", ")", ":", "for", "listener", "in", "project_listeners", ":", "listener", ".", "put_nowait", "(",...
Send an event to all the client listening for notifications on all projects :param action: Action name :param event: Event to send
[ "Send", "an", "event", "to", "all", "the", "client", "listening", "for", "notifications", "on", "all", "projects" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/notification.py#L122-L132
226,636
GNS3/gns3-server
gns3server/controller/__init__.py
Controller._update_config
def _update_config(self): """ Call this when the server configuration file change """ if self._local_server: server_config = Config.instance().get_section_config("Server") self._local_server.user = server_config.get("user") self._local_server.p...
python
def _update_config(self): """ Call this when the server configuration file change """ if self._local_server: server_config = Config.instance().get_section_config("Server") self._local_server.user = server_config.get("user") self._local_server.p...
[ "def", "_update_config", "(", "self", ")", ":", "if", "self", ".", "_local_server", ":", "server_config", "=", "Config", ".", "instance", "(", ")", ".", "get_section_config", "(", "\"Server\"", ")", "self", ".", "_local_server", ".", "user", "=", "server_con...
Call this when the server configuration file change
[ "Call", "this", "when", "the", "server", "configuration", "file", "change" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L205-L213
226,637
GNS3/gns3-server
gns3server/controller/__init__.py
Controller.save
def save(self): """ Save the controller configuration on disk """ # We don't save during the loading otherwise we could lost stuff if self._settings is None: return data = { "computes": [], "settings": self._settings, "gns3v...
python
def save(self): """ Save the controller configuration on disk """ # We don't save during the loading otherwise we could lost stuff if self._settings is None: return data = { "computes": [], "settings": self._settings, "gns3v...
[ "def", "save", "(", "self", ")", ":", "# We don't save during the loading otherwise we could lost stuff", "if", "self", ".", "_settings", "is", "None", ":", "return", "data", "=", "{", "\"computes\"", ":", "[", "]", ",", "\"settings\"", ":", "self", ".", "_setti...
Save the controller configuration on disk
[ "Save", "the", "controller", "configuration", "on", "disk" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L230-L260
226,638
GNS3/gns3-server
gns3server/controller/__init__.py
Controller._load_controller_settings
def _load_controller_settings(self): """ Reload the controller configuration from disk """ try: if not os.path.exists(self._config_file): yield from self._import_gns3_gui_conf() self.save() with open(self._config_file) as f: ...
python
def _load_controller_settings(self): """ Reload the controller configuration from disk """ try: if not os.path.exists(self._config_file): yield from self._import_gns3_gui_conf() self.save() with open(self._config_file) as f: ...
[ "def", "_load_controller_settings", "(", "self", ")", ":", "try", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "_config_file", ")", ":", "yield", "from", "self", ".", "_import_gns3_gui_conf", "(", ")", "self", ".", "save", "(", ...
Reload the controller configuration from disk
[ "Reload", "the", "controller", "configuration", "from", "disk" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L263-L286
226,639
GNS3/gns3-server
gns3server/controller/__init__.py
Controller.load_projects
def load_projects(self): """ Preload the list of projects from disk """ server_config = Config.instance().get_section_config("Server") projects_path = os.path.expanduser(server_config.get("projects_path", "~/GNS3/projects")) os.makedirs(projects_path, exist_ok=True) ...
python
def load_projects(self): """ Preload the list of projects from disk """ server_config = Config.instance().get_section_config("Server") projects_path = os.path.expanduser(server_config.get("projects_path", "~/GNS3/projects")) os.makedirs(projects_path, exist_ok=True) ...
[ "def", "load_projects", "(", "self", ")", ":", "server_config", "=", "Config", ".", "instance", "(", ")", ".", "get_section_config", "(", "\"Server\"", ")", "projects_path", "=", "os", ".", "path", ".", "expanduser", "(", "server_config", ".", "get", "(", ...
Preload the list of projects from disk
[ "Preload", "the", "list", "of", "projects", "from", "disk" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L289-L307
226,640
GNS3/gns3-server
gns3server/controller/__init__.py
Controller.load_base_files
def load_base_files(self): """ At startup we copy base file to the user location to allow them to customize it """ dst_path = self.configs_path() src_path = get_resource('configs') try: for file in os.listdir(src_path): if not os.path.e...
python
def load_base_files(self): """ At startup we copy base file to the user location to allow them to customize it """ dst_path = self.configs_path() src_path = get_resource('configs') try: for file in os.listdir(src_path): if not os.path.e...
[ "def", "load_base_files", "(", "self", ")", ":", "dst_path", "=", "self", ".", "configs_path", "(", ")", "src_path", "=", "get_resource", "(", "'configs'", ")", "try", ":", "for", "file", "in", "os", ".", "listdir", "(", "src_path", ")", ":", "if", "no...
At startup we copy base file to the user location to allow them to customize it
[ "At", "startup", "we", "copy", "base", "file", "to", "the", "user", "location", "to", "allow", "them", "to", "customize", "it" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L309-L321
226,641
GNS3/gns3-server
gns3server/controller/__init__.py
Controller._import_gns3_gui_conf
def _import_gns3_gui_conf(self): """ Import old config from GNS3 GUI """ config_file = os.path.join(os.path.dirname(self._config_file), "gns3_gui.conf") if os.path.exists(config_file): with open(config_file) as f: data = json.load(f) se...
python
def _import_gns3_gui_conf(self): """ Import old config from GNS3 GUI """ config_file = os.path.join(os.path.dirname(self._config_file), "gns3_gui.conf") if os.path.exists(config_file): with open(config_file) as f: data = json.load(f) se...
[ "def", "_import_gns3_gui_conf", "(", "self", ")", ":", "config_file", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "self", ".", "_config_file", ")", ",", "\"gns3_gui.conf\"", ")", "if", "os", ".", "path", ".", "exis...
Import old config from GNS3 GUI
[ "Import", "old", "config", "from", "GNS3", "GUI" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L351-L400
226,642
GNS3/gns3-server
gns3server/controller/__init__.py
Controller.add_compute
def add_compute(self, compute_id=None, name=None, force=False, connect=True, **kwargs): """ Add a server to the dictionary of compute servers controlled by this controller :param compute_id: Compute server identifier :param name: Compute name :param force: True skip security che...
python
def add_compute(self, compute_id=None, name=None, force=False, connect=True, **kwargs): """ Add a server to the dictionary of compute servers controlled by this controller :param compute_id: Compute server identifier :param name: Compute name :param force: True skip security che...
[ "def", "add_compute", "(", "self", ",", "compute_id", "=", "None", ",", "name", "=", "None", ",", "force", "=", "False", ",", "connect", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "compute_id", "not", "in", "self", ".", "_computes", ":", ...
Add a server to the dictionary of compute servers controlled by this controller :param compute_id: Compute server identifier :param name: Compute name :param force: True skip security check :param connect: True connect to the compute immediately :param kwargs: See the documentat...
[ "Add", "a", "server", "to", "the", "dictionary", "of", "compute", "servers", "controlled", "by", "this", "controller" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L418-L455
226,643
GNS3/gns3-server
gns3server/controller/__init__.py
Controller.close_compute_projects
def close_compute_projects(self, compute): """ Close projects running on a compute """ for project in self._projects.values(): if compute in project.computes: yield from project.close()
python
def close_compute_projects(self, compute): """ Close projects running on a compute """ for project in self._projects.values(): if compute in project.computes: yield from project.close()
[ "def", "close_compute_projects", "(", "self", ",", "compute", ")", ":", "for", "project", "in", "self", ".", "_projects", ".", "values", "(", ")", ":", "if", "compute", "in", "project", ".", "computes", ":", "yield", "from", "project", ".", "close", "(",...
Close projects running on a compute
[ "Close", "projects", "running", "on", "a", "compute" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L458-L464
226,644
GNS3/gns3-server
gns3server/controller/__init__.py
Controller.delete_compute
def delete_compute(self, compute_id): """ Delete a compute node. Project using this compute will be close :param compute_id: Compute server identifier """ try: compute = self.get_compute(compute_id) except aiohttp.web.HTTPNotFound: return ...
python
def delete_compute(self, compute_id): """ Delete a compute node. Project using this compute will be close :param compute_id: Compute server identifier """ try: compute = self.get_compute(compute_id) except aiohttp.web.HTTPNotFound: return ...
[ "def", "delete_compute", "(", "self", ",", "compute_id", ")", ":", "try", ":", "compute", "=", "self", ".", "get_compute", "(", "compute_id", ")", "except", "aiohttp", ".", "web", ".", "HTTPNotFound", ":", "return", "yield", "from", "self", ".", "close_com...
Delete a compute node. Project using this compute will be close :param compute_id: Compute server identifier
[ "Delete", "a", "compute", "node", ".", "Project", "using", "this", "compute", "will", "be", "close" ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L467-L481
226,645
GNS3/gns3-server
gns3server/controller/__init__.py
Controller.get_compute
def get_compute(self, compute_id): """ Returns a compute server or raise a 404 error. """ try: return self._computes[compute_id] except KeyError: if compute_id == "vm": raise aiohttp.web.HTTPNotFound(text="You try to use a node on the GNS3 ...
python
def get_compute(self, compute_id): """ Returns a compute server or raise a 404 error. """ try: return self._computes[compute_id] except KeyError: if compute_id == "vm": raise aiohttp.web.HTTPNotFound(text="You try to use a node on the GNS3 ...
[ "def", "get_compute", "(", "self", ",", "compute_id", ")", ":", "try", ":", "return", "self", ".", "_computes", "[", "compute_id", "]", "except", "KeyError", ":", "if", "compute_id", "==", "\"vm\"", ":", "raise", "aiohttp", ".", "web", ".", "HTTPNotFound",...
Returns a compute server or raise a 404 error.
[ "Returns", "a", "compute", "server", "or", "raise", "a", "404", "error", "." ]
a221678448fb5d24e977ef562f81d56aacc89ab1
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/controller/__init__.py#L497-L506
226,646
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
226,647
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
226,648
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
226,649
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
226,650
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
226,651
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
226,652
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
226,653
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
226,654
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
226,655
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
226,656
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
226,657
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
226,658
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
226,659
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
226,660
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
226,661
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
226,662
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
226,663
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
226,664
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
226,665
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
226,666
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
226,667
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
226,668
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
226,669
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
226,670
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
226,671
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
226,672
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
226,673
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
226,674
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
226,675
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
226,676
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
226,677
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
226,678
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
226,679
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
226,680
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
226,681
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
226,682
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
226,683
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
226,684
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
226,685
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
226,686
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
226,687
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
226,688
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
226,689
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
226,690
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
226,691
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
226,692
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
226,693
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
226,694
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
226,695
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
226,696
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
226,697
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
226,698
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
226,699
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