Base GUI, client and Dynamips module implementations.

This commit is contained in:
grossmj
2014-01-31 16:22:31 -07:00
parent 740513821c
commit 0bb92cada5
99 changed files with 493723 additions and 10 deletions

524
gns3/graphics_view.py Normal file
View File

@@ -0,0 +1,524 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Graphical view on the scene where items are drawn.
"""
import pickle
from .qt import QtCore, QtGui
from .scene import Scene
from .items.node_item import NodeItem
from .node_configurator import NodeConfigurator
from .link import Link
from .modules.dynamips import Dynamips
# link items
from .items.ethernet_link_item import EthernetLinkItem
from .items.serial_link_item import SerialLinkItem
# ports
from .ports.ethernet_port import EthernetPort
from .ports.fastethernet_port import FastEthernetPort
from .ports.gigabitethernet_port import GigabitEthernetPort
class GraphicsView(QtGui.QGraphicsView):
"""
Graphics view that displays the scene.
:param parent: parent widget
"""
def __init__(self, parent):
QtGui.QGraphicsView.__init__(self, parent)
self._adding_link = False
self._newlink = None
self._dragging = False
self._last_mouse_position = None
#FIXME: temporary location to store links
self._links = {}
# restore settings
settings = QtCore.QSettings()
width = settings.value("GUI/scene_width", 2000)
height = settings.value("GUI/scene_height", 2000)
# set the scene
scene = Scene(parent=self)
scene.setSceneRect(-(width / 2), -(height / 2), width, height)
self.setScene(scene)
# set the custom flags for this view
self.setDragMode(QtGui.QGraphicsView.RubberBandDrag)
self.setCacheMode(QtGui.QGraphicsView.CacheBackground)
self.setRenderHint(QtGui.QPainter.Antialiasing)
self.setTransformationAnchor(QtGui.QGraphicsView.AnchorUnderMouse)
self.setResizeAnchor(QtGui.QGraphicsView.AnchorViewCenter)
def addingLinkSlot(self, enabled):
"""
Slot to receive events from MainWindow
when a user has clicked on "Add a link" button.
:param enable: either the user is adding a link or not (boolean)
"""
if enabled:
self.setCursor(QtCore.Qt.CrossCursor)
else:
if self._newlink:
self.scene().removeItem(self._newlink)
self._newlink = None
self.setCursor(QtCore.Qt.ArrowCursor)
self._adding_link = enabled
def addLink(self, source_node, source_port, destination_node, destination_port):
"""
Creates a Link object representing a connection between 2 devices.
:param source_node: source Node object
:param source_port: source Port object
:param destination_node: destination Node object
:param destination_port: destination Port object
"""
link = Link(source_node, source_port, destination_node, destination_port)
# connect the signals that let the graphics view knows about events such as
# a new link creation or deletion.
link.add_link_signal.connect(self.addLinkSlot)
link.delete_link_signal.connect(self.deleteLinkSlot)
self._links[link.id] = link
def addLinkSlot(self, link_id):
"""
Slot to receive events from Link instances
when a link has been created.
:param link_id: link identifier
"""
link = self._links[link_id]
source_item = None
destination_item = None
source_port = link._source_port
destination_port = link._destination_port
# find the correct source and destination node items
for item in self.scene().items():
if isinstance(item, NodeItem):
if item.node().id == link._source_node.id:
source_item = item
if item.node().id == link._destination_node.id:
destination_item = item
if source_item and destination_item:
break
if not source_item or not destination_item:
print("Could not find a source or destination item for the link!")
self.deleteLinkSlot(link_id)
return
# ugly multi-link management
# FIXME: taken from old GNS3 and has a bug!
multi = 0
d1 = 0
d2 = 1
link_items = source_item.links()
for link_item in link_items:
if link_item.destinationItem().node().id == destination_item.node().id:
d1 += 1
if link_item.sourceItem().node().id == destination_item.node().id:
d2 += 1
if len(link_items) > 0:
if d2 - d1 == 2:
source_port, destination_port = destination_port, source_port
source_item, destination_item = destination_item, source_item
multi = d1 + 1
elif d1 >= d2:
source_port, destination_port = destination_port, source_port
source_item, destination_item = destination_item, source_item
multi = d2
else:
multi = d1
# MAX 7 links on the scene between 2 nodes
if multi > 3:
multi = 0
if source_item == destination_item:
multi = 0
if link._source_port.linkType() == "Serial":
link_item = SerialLinkItem(source_item, source_port, destination_item, destination_port, link, multilink=multi)
else:
link_item = EthernetLinkItem(source_item, source_port, destination_item, destination_port, link, multilink=multi)
self.scene().addItem(link_item)
def deleteLinkSlot(self, link_id):
"""
Slot to receive events from Link instances
when a link has been deleted.
:param link_id: link identifier
"""
link = self._links[link_id]
# disconnect the signals just in case...
link.add_link_signal.disconnect()
link.delete_link_signal.disconnect()
del self._links[link_id]
def mousePressEvent(self, event):
"""
Handles all mouse press events.
:param: QMouseEvent object
"""
item = self.itemAt(event.pos())
# if item and isinstance(item, NodeItem):
# item.setSelected(True)
# This statement checks to see if either the middle mouse is pressed
# or a combination of the right and left mouse buttons is pressed to start dragging the view
if (event.buttons() == QtCore.Qt.LeftButton and event.modifiers() == QtCore.Qt.ControlModifier) or event.buttons() == QtCore.Qt.MidButton:
self._last_mouse_position = self.mapFromGlobal(event.globalPos())
self._dragging = True
self.setCursor(QtCore.Qt.ClosedHandCursor)
return
if event.modifiers() == QtCore.Qt.ShiftModifier and event.button() == QtCore.Qt.LeftButton and item and not self._adding_link:
if item.isSelected():
item.setSelected(False)
else:
item.setSelected(True)
elif item and isinstance(item, NodeItem):
item.setSelected(True)
if item and isinstance(item, NodeItem) and self._adding_link and event.button() == QtCore.Qt.LeftButton:
if not self._newlink:
source_item = item
source_port = source_item.connectToPort()
if not source_port:
return
if source_port.linkType() == "Serial":
self._newlink = SerialLinkItem(source_item, source_port, self.mapToScene(event.pos()), None, adding_flag=True)
else:
self._newlink = EthernetLinkItem(source_item, source_port, self.mapToScene(event.pos()), None, adding_flag=True)
self.scene().addItem(self._newlink)
else:
source_item = self._newlink.sourceItem()
source_port = self._newlink.sourcePort()
destination_item = item
if source_item == destination_item:
QtGui.QMessageBox.critical(self, "Connection", "Cannot connect to itself!")
return
destination_port = destination_item.connectToPort()
if not destination_port:
return
if source_port.isStub() or destination_port.isStub():
pass
#FIXME
elif type(source_port) in (EthernetPort, FastEthernetPort, GigabitEthernetPort) and \
not type(destination_port) in (EthernetPort, FastEthernetPort, GigabitEthernetPort):
QtGui.QMessageBox.critical(self, "Connection", "You must connect an Ethernet port to another Ethernet compatible port")
return
# elif type(source_port) != type(destination_port):
# QtGui.QMessageBox.critical(self, "Connection", "Cannot connect this port!")
# return
self.scene().removeItem(self._newlink)
self.addLink(source_item.node(), source_port, destination_item.node(), destination_port)
self._newlink = None
else:
QtGui.QGraphicsView.mousePressEvent(self, event)
def mouseReleaseEvent(self, event):
"""
Handles all mouse release events.
:param: QMouseEvent object
"""
item = self.itemAt(event.pos())
# If the left mouse button is not still pressed TOGETHER with the CTRL key and neither is the middle button
# this means the user is no longer trying to drag the view
if self._dragging and not (event.buttons() == QtCore.Qt.LeftButton and event.modifiers() == QtCore.Qt.ControlModifier) and not event.buttons() & QtCore.Qt.MidButton:
self._dragging = False
self.setCursor(QtCore.Qt.ArrowCursor)
else:
if item is not None and not event.modifiers() & QtCore.Qt.ShiftModifier:
item.setSelected(True)
#for other_item in self.__topology.selectedItems():
# other_item.setSelected(False)
QtGui.QGraphicsView.mouseReleaseEvent(self, event)
def scaleView(self, scale_factor):
"""
Scales the view (zoom in and out).
"""
factor = self.matrix().scale(scale_factor, scale_factor).mapRect(QtCore.QRectF(0, 0, 1, 1)).width()
if (factor < 0.10 or factor > 10):
return
self.scale(scale_factor, scale_factor)
def keyPressEvent(self, event):
"""
Handles all key press events for this view.
:param event: QKeyEvent
"""
if event.matches(QtGui.QKeySequence.ZoomIn):
# zoom in
factor_in = pow(2.0, 120 / 240.0)
self.scaleView(factor_in)
elif event.matches(QtGui.QKeySequence.ZoomOut):
# zoom out
factor_out = pow(2.0, -120 / 240.0)
self.scaleView(factor_out)
# elif event.key() == QtCore.Qt.Key_Delete:
# # check if we are editing an Annotation object, then send the Delete event to it
# for item in self.__topology.selectedItems():
# if isinstance(item, Annotation) and item.hasFocus():
# QtGui.QGraphicsView.keyPressEvent(self, event)
# return
# self.slotDeleteNode()
else:
QtGui.QGraphicsView.keyPressEvent(self, event)
def mouseMoveEvent(self, event):
"""
Handles all mouse move events (mouse tracking has been enabled).
:param: QMouseEvent object
"""
if self._dragging:
# This if statement event checks to see if the user is dragging the scene
# if so it sets the value of the scene scroll bars based on the change between
# the previous and current mouse position
mapped_global_pos = self.mapFromGlobal(event.globalPos())
hBar = self.horizontalScrollBar()
vBar = self.verticalScrollBar()
delta = mapped_global_pos - self._last_mouse_position
hBar.setValue(hBar.value() + (delta.x() if QtGui.QApplication.isRightToLeft() else -delta.x()))
vBar.setValue(vBar.value() - delta.y())
self._last_mouse_position = mapped_global_pos
if self._adding_link and self._newlink:
# update the mouse position when the user is adding a link.
self._newlink.setMousePoint(self.mapToScene(event.pos()))
event.ignore()
else:
QtGui.QGraphicsView.mouseMoveEvent(self, event)
def mouseDoubleClickEvent(self, event):
"""
Handles all mouse double click events.
:param: QMouseEvent object
"""
item = self.itemAt(event.pos())
if not self._adding_link and isinstance(item, NodeItem):
item.setSelected(True)
# if (isinstance(item, IOSRouter) or isinstance(item, AnyEmuDevice)) and item.isStarted():
# self.slotConsole()
# elif isinstance(item, AnyVBoxEmuDevice) and (item.isStarted() or item.isSuspended()) and not globals.addingLinkFlag:
# self.slotDisplayWindowFocus()
# else:
self.configureSlot()
else:
QtGui.QGraphicsView.mouseDoubleClickEvent(self, event)
def configureSlot(self, items=None):
"""
Opens the node configurator.
"""
from .main_window import MainWindow
if not items:
items = self.scene().selectedItems()
node_configurator = NodeConfigurator(items, MainWindow.instance())
node_configurator.setModal(True)
node_configurator.show()
node_configurator.exec_()
for item in items:
item.setSelected(False)
def dragMoveEvent(self, event):
"""
Handles all drag move events.
:param event: QDragMoveEvent object
"""
# check if what is dragged is handled by this view
if event.mimeData().hasFormat("application/x-gns3-node"):
event.acceptProposedAction()
event.accept()
else:
event.ignore()
def dropEvent(self, event):
"""
Handles all drop events.
:param event: QDropEvent object
"""
# check if what has been dropped is handled by this view
if event.mimeData().hasFormat("application/x-gns3-node"):
data = event.mimeData().data("application/x-gns3-node")
# load the pickled node class
node_class = pickle.loads(data)
event.setDropAction(QtCore.Qt.CopyAction)
event.accept()
self.createNode(node_class, event.pos())
else:
event.ignore()
def contextMenuEvent(self, event):
"""
Handles all context menu events.
:param event: QContextMenuEvent object
"""
menu = QtGui.QMenu()
self.populateContextMenu(menu)
menu.exec_(event.globalPos())
def populateContextMenu(self, menu):
"""
Adds actions to the contextual menu.
:param menu: QMenu object
"""
items = self.scene().selectedItems()
if not items:
return
start_action = QtGui.QAction("Start", menu)
start_action.setIcon(QtGui.QIcon(':/icons/play.svg'))
start_action.triggered.connect(self.startActionSlot)
menu.addAction(start_action)
stop_action = QtGui.QAction("Stop", menu)
stop_action.setIcon(QtGui.QIcon(':/icons/stop.svg'))
stop_action.triggered.connect(self.stopActionSlot)
menu.addAction(stop_action)
suspend_action = QtGui.QAction("Suspend", menu)
suspend_action.setIcon(QtGui.QIcon(':/icons/pause.svg'))
suspend_action.triggered.connect(self.suspendActionSlot)
menu.addAction(suspend_action)
configure_action = QtGui.QAction("Configure", menu)
configure_action.setIcon(QtGui.QIcon(':/icons/configuration.svg'))
configure_action.triggered.connect(self.configureActionSlot)
menu.addAction(configure_action)
delete_action = QtGui.QAction("Delete", menu)
delete_action.setIcon(QtGui.QIcon(':/icons/delete.svg'))
delete_action.triggered.connect(self.deleteActionSlot)
menu.addAction(delete_action)
def startActionSlot(self):
"""
Slot to receive events from the start action in the
contextual menu.
"""
for item in self.scene().selectedItems():
if hasattr(item.node(), "start"):
item.node().start()
def stopActionSlot(self):
"""
Slot to receive events from the stop action in the
contextual menu.
"""
for item in self.scene().selectedItems():
if hasattr(item.node(), "stop"):
item.node().stop()
def suspendActionSlot(self):
"""
Slot to receive events from the suspend action in the
contextual menu.
"""
for item in self.scene().selectedItems():
if hasattr(item.node(), "suspend"):
item.node().suspend()
def configureActionSlot(self):
"""
Slot to receive events from the configure action in the
contextual menu.
"""
items = []
for item in self.scene().selectedItems():
if isinstance(item, NodeItem):
items.append(item)
if items:
self.configureSlot(items)
def deleteActionSlot(self):
"""
Slot to receive events from the delete action in the
contextual menu.
"""
items = []
for item in self.scene().selectedItems():
if isinstance(item, NodeItem):
item.node().delete()
def createNode(self, node_class, pos):
"""
Creates a new node on the scene.
:param node_class: node class to be instanciated
:param pos: position of the drop event
"""
#TODO: node setup management with other modules
dynamips = Dynamips.instance()
node = dynamips.createNode(node_class)
node_item = NodeItem(node)
node_item.setPos(self.mapToScene(pos))
self.scene().addItem(node_item)
x = node_item.pos().x() - (node_item.boundingRect().width() / 2)
y = node_item.pos().y() - (node_item.boundingRect().height() / 2)
node_item.setPos(x, y)
dynamips.setupNode(node)

0
gns3/items/__init__.py Normal file
View File

View File

@@ -0,0 +1,216 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Graphical representation of an Ethernet link for QGraphicsScene.
"""
from ..qt import QtCore, QtGui
from .link_item import LinkItem
class EthernetLinkItem(LinkItem):
"""
Ethernet link for the scene.
:param source_item: source NodeItem object
:param source_port: source Port object
:param destination_item: destination NodeItem object
:param destination_port: destination Port object
:param link: Link object (contains back-end stuff for this link)
:param adding_flag: indicates if this link is being added (no destination yet)
:param multilink: used to draw multiple link between the same source and destination
"""
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False, multilink=0):
LinkItem.__init__(self, source_item, source_port, destination_item, destination_port, link, adding_flag, multilink)
self.setPen(QtGui.QPen(QtCore.Qt.black, self._pen_width, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
self._source_collision_offset = 0.0
self._destination_collision_offset = 0.0
def adjust(self):
"""
Draws a line and compute offsets for status points.
"""
LinkItem.adjust(self)
# draw a line between nodes
self.path = QtGui.QPainterPath(self.source)
self.path.lineTo(self.destination)
self.setPath(self.path)
# offset on the line for status points
if self.length == 0:
self.edge_offset = QtCore.QPointF(0, 0)
else:
self.edge_offset = QtCore.QPointF((self.dx * 40) / self.length, (self.dy * 40) / self.length)
def shape(self):
"""
Returns the shape of the item to the scene renderer.
:returns: QPainterPath instance
"""
path = QtGui.QGraphicsPathItem.shape(self)
offset = self._point_size / 2
if not self._adding_flag:
if self.length:
collision_offset = QtCore.QPointF((self.dx * self._source_collision_offset) / self.length, (self.dy * self._source_collision_offset) / self.length)
else:
collision_offset = QtCore.QPointF(0, 0)
point = self.source + (self.edge_offset + collision_offset)
else:
point = self.source
path.addEllipse(point.x() - offset, point.y() - offset, self._point_size, self._point_size)
if not self._adding_flag:
if self.length:
collision_offset = QtCore.QPointF((self.dx * self._destination_collision_offset) / self.length, (self.dy * self._destination_collision_offset) / self.length)
else:
collision_offset = QtCore.QPointF(0, 0)
point = self.destination - (self.edge_offset + collision_offset)
else:
point = self.destination
path.addEllipse(point.x() - offset, point.y() - offset, self._point_size, self._point_size)
return path
def paint(self, painter, option, widget):
"""
Draws the status points.
:param painter: QPainter object
:param option: QStyleOptionGraphicsItem object
:param widget: QWidget object.
"""
QtGui.QGraphicsPathItem.paint(self, painter, option, widget)
if not self._adding_flag and self._show_status_points:
# points disappears if nodes are too close to each others.
if self.length < 100:
return
if self._source_port_status == 'up':
color = QtCore.Qt.green
elif self._source_port_status == 'suspended':
color = QtCore.Qt.yellow
else:
color = QtCore.Qt.red
painter.setPen(QtGui.QPen(color, self._point_size, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.MiterJoin))
point1 = QtCore.QPointF(self.source + self.edge_offset) + QtCore.QPointF((self.dx * self._source_collision_offset) / self.length, (self.dy * self._source_collision_offset) / self.length)
# avoid any collision of the status point with the source node
while self._source_item.contains(self.mapFromScene(self.mapToItem(self._source_item, point1))):
self._source_collision_offset += 10
point1 = QtCore.QPointF(self.source + self.edge_offset) + QtCore.QPointF((self.dx * self._source_collision_offset) / self.length, (self.dy * self._source_collision_offset) / self.length)
# check with we can paint the status point more closely of the source node
if not self._source_item.contains(self.mapFromScene(self.mapToItem(self._source_item, point1))):
check_point = QtCore.QPointF(self.source + self.edge_offset) + QtCore.QPointF((self.dx * (self._source_collision_offset - 20)) / self.length, (self.dy * (self._source_collision_offset - 20)) / self.length)
if not self._source_item.contains(self.mapFromScene(self.mapToItem(self._source_item, check_point))) and self._source_collision_offset > 0:
self._source_collision_offset -= 10
#TODO: draw port labels
# if self._show_port_names:
# if self.labelSouceIf == None:
#
# if globals.interfaceLabels.has_key(self.source.hostname + ' ' + self.srcIf):
# self.labelSouceIf = Annotation(self.source)
# annotation = globals.interfaceLabels[self.source.hostname + ' ' + self.srcIf]
# self.labelSouceIf.setZValue(annotation.zValue())
# self.labelSouceIf.setDefaultTextColor(annotation.defaultTextColor())
# self.labelSouceIf.setFont(annotation.font())
# self.labelSouceIf.setPlainText(annotation.toPlainText())
# self.labelSouceIf.setPos(annotation.x(), annotation.y())
# self.labelSouceIf.rotation = annotation.rotation
# self.labelSouceIf.rotate(annotation.rotation)
# del globals.interfaceLabels[self.source.hostname + ' ' + self.srcIf]
# elif not globals.GApp.workspace.flg_showOnlySavedInterfaceNames:
# self.labelSouceIf = Annotation(self.source)
# self.labelSouceIf.setPlainText(self.srcIf)
# self.labelSouceIf.setPos(self.mapToItem(self.source, point1))
# #self.labelSouceIf.autoGenerated = True
#
# if self.labelSouceIf:
# self.labelSouceIf.deviceName = self.source.hostname
# self.labelSouceIf.deviceIf = self.srcIf
#
# if self.labelSouceIf and not self.labelSouceIf.isVisible():
# self.labelSouceIf.show()
#
# elif self.labelSouceIf and globals.GApp.workspace.flg_showInterfaceNames == False:
# self.labelSouceIf.hide()
painter.drawPoint(point1)
if self._destination_port_status == 'up':
color = QtCore.Qt.green
elif self._destination_port_status == 'suspended':
color = QtCore.Qt.yellow
else:
color = QtCore.Qt.red
painter.setPen(QtGui.QPen(color, self._point_size, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.MiterJoin))
point2 = QtCore.QPointF(self.destination - self.edge_offset) - QtCore.QPointF((self.dx * self._destination_collision_offset) / self.length, (self.dy * self._destination_collision_offset) / self.length)
# avoid any collision of the status point with the destination node
while self._destination_item.contains(self.mapFromScene(self.mapToItem(self._destination_item, point2))):
self._destination_collision_offset += 10
point2 = QtCore.QPointF(self.destination - self.edge_offset) - QtCore.QPointF((self.dx * self._destination_collision_offset) / self.length, (self.dy * self._destination_collision_offset) / self.length)
# check with we can paint the status point more closely of the destination node
if not self._destination_item.contains(self.mapFromScene(self.mapToItem(self._destination_item, point2))):
check_point = QtCore.QPointF(self.destination - self.edge_offset) - QtCore.QPointF((self.dx * (self._destination_collision_offset - 20)) / self.length, (self.dy * (self._destination_collision_offset - 20)) / self.length)
if not self._destination_item.contains(self.mapFromScene(self.mapToItem(self._destination_item, check_point))) and self._destination_collision_offset > 0:
self._destination_collision_offset -= 10
#TODO: draw port labels
# if globals.GApp.workspace.flg_showInterfaceNames:
# if self.labelDestIf == None:
#
# if globals.interfaceLabels.has_key(self.dest.hostname + ' ' + self.destIf):
# self.labelDestIf = Annotation(self.dest)
# annotation = globals.interfaceLabels[self.dest.hostname + ' ' + self.destIf]
# self.labelDestIf.setZValue(annotation.zValue())
# self.labelDestIf.setDefaultTextColor(annotation.defaultTextColor())
# self.labelDestIf.setFont(annotation.font())
# self.labelDestIf.setPlainText(annotation.toPlainText())
# self.labelDestIf.setPos(annotation.x(), annotation.y())
# self.labelDestIf.rotation = annotation.rotation
# self.labelDestIf.rotate(annotation.rotation)
# del globals.interfaceLabels[self.dest.hostname + ' ' + self.destIf]
# elif not globals.GApp.workspace.flg_showOnlySavedInterfaceNames:
# self.labelDestIf = Annotation(self.dest)
# self.labelDestIf.setPlainText(self.destIf)
# self.labelDestIf.setPos(self.mapToItem(self.dest, point2))
# #self.labelDestIf.autoGenerated = True
#
# if self.labelDestIf:
# self.labelDestIf.deviceName = self.dest.hostname
# self.labelDestIf.deviceIf = self.destIf
#
# if self.labelDestIf and not self.labelDestIf.isVisible():
# self.labelDestIf.show()
#
# elif self.labelDestIf and globals.GApp.workspace.flg_showInterfaceNames == False:
# self.labelDestIf.hide()
painter.drawPoint(point2)

224
gns3/items/link_item.py Normal file
View File

@@ -0,0 +1,224 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Base class for link items (Ethernet, serial etc.).
Link items are graphical representation of a link on the QGraphicsScene
"""
import math
from ..qt import QtCore, QtGui
class LinkItem(QtGui.QGraphicsPathItem):
"""
Base class for link items.
:param source_item: source NodeItem object
:param source_port: source Port object
:param destination_item: destination NodeItem object
:param destination_port: destination Port object
:param link: Link object (contains back-end stuff for this link)
:param adding_flag: indicates if this link is being added (no destination yet)
:param multilink: used to draw multiple link between the same source and destination
"""
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False, multilink=0):
QtGui.QGraphicsPathItem.__init__(self)
self.setZValue(-1)
# indicates link is being added:
# source has been chosen but not its destination yet
self._adding_flag = adding_flag
# status points size
self._point_size = 10
# default pen size
self._pen_width = 2.0
# indicates the link position when there are multiple links
# between the same source and destination
self._multilink = multilink
self._source_item = source_item
self._destination_item = destination_item
self._source_port = source_port
self._destination_port = destination_port
self._show_port_names = True
self._show_status_points = True
self._source_port_status = "down"
self._destination_port_status = "down"
if not self._adding_flag:
self._link = link
# links must always be below node items on the scene
min_zvalue = min([source_item.zValue(), destination_item.zValue()])
self.setZValue(min_zvalue - 1)
self.setFlag(self.ItemIsFocusable)
source_item.addLink(self)
destination_item.addLink(self)
#TODO: tooltip + capture support
# source_item.node.nio_signal.connect(self.newNIOSlot)
# destination_item.node.nio_signal.connect(self.newNIOSlot)
# self._source_item.setCustomToolTip()
# self._destination_item.setCustomToolTip()
# self.capturing = False
# self.capfile = None
# self.captureInfo = None
# self.tailProcess = None
# self.capturePipeThread = None
# # Set default tooltip
# self.setCustomToolTip()
# self.encapsulationTransform = { 'ETH': 'EN10MB',
# 'FR': 'FRELAY',
# 'HDLC': 'C_HDLC',
# 'PPP': 'PPP_SERIAL'}
else:
source_rect = self._source_item.boundingRect()
self.source = self.mapFromItem(self._source_item, source_rect.width() / 2.0, source_rect.height() / 2.0)
self.destination = self._destination_item
self.adjust()
def delete(self):
"""
Delete this link
"""
self._source_item.removeLink(self)
self._destination_item.removeLink(self)
self._link.deleteLink()
self.scene().removeItem(self)
def sourceItem(self):
"""
Returns the source item for this link.
:returns: NodeItem object
"""
return self._source_item
def destinationItem(self):
"""
Returns the destination item for this link.
:returns: NodeItem object
"""
return self._destination_item
def sourcePort(self):
"""
Returns the source port for this link.
:returns: Port object
"""
return self._source_port
def destinationPort(self):
"""
Returns the destination port for this link.
:returns: Port object
"""
return self._destination_port
def mousePressEvent(self, event):
"""
Called when the link is clicked and shows a contextual menu.
:param: QGraphicsSceneMouseEvent instance
"""
if (event.button() == QtCore.Qt.RightButton):
if self._adding_flag:
# send a escape key to the main window to cancel the link addition
from ..main_window import MainWindow
key = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, QtCore.Qt.Key_Escape, QtCore.Qt.NoModifier)
QtGui.QApplication.sendEvent(MainWindow.instance(), key)
return
# create the contextual menu
menu = QtGui.QMenu()
delete_action = QtGui.QAction("Delete", menu)
delete_action.setIcon(QtGui.QIcon(':/icons/delete.svg'))
delete_action.triggered.connect(self._deleteActionSlot)
menu.addAction(delete_action)
menu.exec_(QtGui.QCursor.pos())
def _deleteActionSlot(self):
"""
Slot to receive events from the delete action in the
contextual menu.
"""
self.delete()
def adjust(self):
"""
Computes the source point and destination point.
Must be overloaded.
"""
self.prepareGeometryChange()
source_rect = self._source_item.boundingRect()
self.source = self.mapFromItem(self._source_item, source_rect.width() / 2.0, source_rect.height() / 2.0)
# if source point is not a mouse point
if not self._adding_flag:
destination_rect = self._destination_item.boundingRect()
self.destination = self.mapFromItem(self._destination_item, destination_rect.width() / 2.0, destination_rect.height() / 2.0)
# compute vectors
self.dx = self.destination.x() - self.source.x()
self.dy = self.destination.y() - self.source.y()
# compute the length of the line
self.length = math.sqrt(self.dx * self.dx + self.dy * self.dy)
# multi-link management
if not self._adding_flag and self._multilink and self.length:
angle = math.radians(90)
self.dxrot = math.cos(angle) * self.dx - math.sin(angle) * self.dy
self.dyrot = math.sin(angle) * self.dx + math.cos(angle) * self.dy
offset = QtCore.QPointF((self.dxrot * (self._multilink * 5)) / self.length, (self.dyrot * (self._multilink * 5)) / self.length)
self.source = QtCore.QPointF(self.source + offset)
self.destination = QtCore.QPointF(self.destination + offset)
def setMousePoint(self, scene_point):
"""
Sets new mouse point coordinates.
Used when adding a link and the destination is not yet chosen.
:param scene_point: event position
"""
self.destination = scene_point
self.adjust()
self.update()

318
gns3/items/node_item.py Normal file
View File

@@ -0,0 +1,318 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Graphical representation of a node on the QGraphicsScene.
"""
from ..qt import QtGui, QtSvg
class NodeItem(QtSvg.QGraphicsSvgItem):
"""
Node for the scene.
:param node: Node instance.
"""
def __init__(self, node):
QtSvg.QGraphicsSvgItem.__init__(self)
self._node = node
self._name = "N/A"
# set graphical settings for this node
self.setFlag(QtSvg.QGraphicsSvgItem.ItemIsMovable)
self.setFlag(QtSvg.QGraphicsSvgItem.ItemIsSelectable)
self.setFlag(QtSvg.QGraphicsSvgItem.ItemIsFocusable)
self.setFlag(QtSvg.QGraphicsSvgItem.ItemSendsGeometryChanges)
self.setAcceptsHoverEvents(True)
self.setZValue(1)
# create renderers using symbols paths/resources
self._default_renderer = QtSvg.QSvgRenderer(node.defaultSymbol())
self._hover_renderer = QtSvg.QSvgRenderer(node.hoverSymbol())
self.setSharedRenderer(self._default_renderer)
# connect signals to know about some events
# e.g. when the node has been started, stopped or suspended etc.
node.newname_signal.connect(self.newNameSlot)
node.started_signal.connect(self.startedSlot)
node.stopped_signal.connect(self.stoppedSlot)
node.suspended_signal.connect(self.suspendedSlot)
node.delete_links_signal.connect(self.deleteLinksSlot)
node.delete_signal.connect(self.deleteSlot)
# link items connected to this node item.
self._links = []
# used when a port has been selected from the contextual menu
self._selected_port = None
def node(self):
"""
Returns the node attached to this node item.
:returns: Node instance
"""
return self._node
def addLink(self, link):
"""
Adds a link items to this node item.
:param link: LinkItem object
"""
self._links.append(link)
def removeLink(self, link):
"""
Removes a link items from this node item.
:param link: LinkItem object
"""
self._links.remove(link)
def links(self):
"""
Returns all the link items attached to this node item.
:returns: list of LinkItem objects
"""
return self._links
def newNameSlot(self, name):
"""
Slot to receive events from the attached Node instance
when a the node has a new name.
:param name: node new name
"""
#TODO: finish this
self._name = name
#self.showName()
def startedSlot(self):
"""
Slot to receive events from the attached Node instance
when a the node has started.
"""
#TODO: finish this
print("Node started!")
def stoppedSlot(self):
"""
Slot to receive events from the attached Node instance
when a the node has stopped.
"""
#TODO: finish this
print("Node stopped!")
def suspendedSlot(self):
"""
Slot to receive events from the attached Node instance
when a the node has suspended.
"""
#TODO: finish this
print("Node suspended")
def deleteLinksSlot(self):
"""
Slot to receive events from the attached Node instance
when a all the links must be deleted.
"""
for link in self._links.copy():
link.delete()
def deleteSlot(self):
"""
Slot to receive events from the attached Node instance
when the node has been deleted.
"""
self.scene().removeItem(self)
def setCustomToolTip(self):
"""
Sets a new ToolTip.
"""
self.setToolTip(self._name)
def showName(self):
"""
Shows the node name on the scene.
"""
#TODO: possibility to change the Font size etc.
self.textItem = QtGui.QGraphicsTextItem(self._name, self)
self.textItem.setFont(QtGui.QFont("TypeWriter", 10, QtGui.QFont.Bold))
self.textItem.setFlag(self.textItem.ItemIsMovable)
textrect = self.textItem.boundingRect()
textmiddle = textrect.topRight() / 2
noderect = self.boundingRect()
nodemiddle = noderect.topRight() / 2
self.default_name_xpos = nodemiddle.x() - textmiddle.x()
self.default_name_ypos = -25
self.textItem.setPos(self.default_name_xpos, self.default_name_ypos)
def connectToPort(self, unavailable_ports=[]):
"""
Shows a contextual menu for the user to choose port or auto-select one.
:param unavailable_ports: list of port names that the user cannot choose
:returns: Port object corresponding to the selected port
"""
self._selected_port = None
menu = QtGui.QMenu()
ports = self._node.ports()
if not ports:
QtGui.QMessageBox.critical(self.scene().parent(), "Link", "No port available, please configure this device")
return None
# sort by port name
port_names = {}
for port in ports:
port_names[port.name] = port
ports = sorted(port_names.keys())
# show a contextual menu for the user to choose a port
for port in ports:
port_object = port_names[port]
if port in unavailable_ports:
# this port cannot be chosen by the user (grayed out)
action = menu.addAction(QtGui.QIcon(':/icons/led_green.svg'), port)
action.setDisabled(True)
elif port_object.isFree():
menu.addAction(QtGui.QIcon(':/icons/led_red.svg'), port)
else:
menu.addAction(QtGui.QIcon(':/icons/led_green.svg'), port)
menu.triggered.connect(self.selectedPortSlot)
menu.exec_(QtGui.QCursor.pos())
return self._selected_port
def selectedPortSlot(self, action):
"""
Slot to receive events when a port has been selected in the
contextual menu.
:param action: QAction object
"""
ports = self._node.ports()
# get the Port object based on the selected port name.
for port in ports:
if port.name == str(action.text()):
self._selected_port = port
break
def itemChange(self, change, value):
"""
Notifies this node item that some part of the item's state changes.
:param change: GraphicsItemChange type
:param value: value of the change
"""
# dynamically change the renderer when this node item is selected/unselected.
if change == QtSvg.QGraphicsSvgItem.ItemSelectedChange:
if value:
self.setSharedRenderer(self._hover_renderer)
else:
self.setSharedRenderer(self._default_renderer)
# adjust link item positions when this node is moving or has changed.
if change == QtSvg.QGraphicsSvgItem.ItemPositionChange or change == QtSvg.QGraphicsSvgItem.ItemPositionHasChanged:
for link in self._links:
link.adjust()
return QtGui.QGraphicsItem.itemChange(self, change, value)
def paint(self, painter, option, widget=None):
"""
Paints the contents of an item in local coordinates.
:param painter: QPainter object.
:param option: QStyleOptionGraphicsItem object.
:param widget: QWidget object.
"""
# don't show the selection rectangle
option.state = QtGui.QStyle.State_None
return QtSvg.QGraphicsSvgItem.paint(self, painter, option, widget)
#TODO: show layer position on the node
# # Don't draw if not activated
# if globals.GApp.workspace.flg_showLayerPos == False:
# return
#
# # Show layer level of this node
# brect = self.boundingRect()
# center = self.mapFromItem(self, brect.width() / 2.0, brect.height() / 2.0)
#
# painter.setBrush(QtCore.Qt.red)
# painter.setPen(QtCore.Qt.red)
# painter.drawRect((brect.width() / 2.0) - 10, (brect.height() / 2.0) - 10, 20,20)
# painter.setPen(QtCore.Qt.black)
# painter.setFont(QtGui.QFont("TypeWriter", 14, QtGui.QFont.Bold))
# zval = str(int(self.zValue()))
# painter.drawText(QtCore.QPointF(center.x() - 4, center.y() + 4), zval)
def hoverEnterEvent(self, event):
"""
Handles all hover enter events for this item.
:param event: QGraphicsSceneHoverEvent object
"""
self.setCustomToolTip()
#TODO: finish tooptip support
# update tool tip
# try:
# self.setCustomToolTip()
# except:
# print translate("AbstractNode", "Cannot communicate with %s, the server running this node may have crashed!" % self.hostname)
# dynamically change the renderer when this node item is hovered.
if not self.isSelected():
self.setSharedRenderer(self._hover_renderer)
def hoverLeaveEvent(self, event):
"""
Handles all hover leave events for this item.
:param event: QGraphicsSceneHoverEvent object
"""
# dynamically change the renderer back to the default when this node item is not hovered anymore.
if not self.isSelected():
self.setSharedRenderer(self._default_renderer)

View File

@@ -0,0 +1,196 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Graphical representation of a Serial link on the QGraphicsScene.
"""
import math
from ..qt import QtCore, QtGui
from .link_item import LinkItem
class SerialLinkItem(LinkItem):
"""
Serial link for the scene.
:param source_item: source NodeItem object
:param source_port: source Port object
:param destination_item: destination NodeItem object
:param destination_port: destination Port object
:param link: Link object (contains back-end stuff for this link)
:param adding_flag: indicates if this link is being added (no destination yet)
:param multilink: used to draw multiple link between the same source and destination
"""
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False, multilink=0):
LinkItem.__init__(self, source_item, source_port, destination_item, destination_port, link, adding_flag, multilink)
self.setPen(QtGui.QPen(QtCore.Qt.red, self._pen_width, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
def adjust(self):
"""
Draws a line and computes offsets for status points.
"""
LinkItem.adjust(self)
# get source to destination angle
vector_angle = math.atan2(self.dy, self.dx)
# get minimum vector and its angle
rot_angle = - math.pi / 4.0
vectrot = QtCore.QPointF(math.cos(vector_angle + rot_angle), math.sin(vector_angle + rot_angle))
# get the rotated point positions
angle_source = QtCore.QPointF(self.source.x() + self.dx / 2.0 + 15 * vectrot.x(), self.source.y() + self.dy / 2.0 + 15 * vectrot.y())
angle_destination = QtCore.QPointF(self.destination.x() - self.dx / 2.0 - 15 * vectrot.x(), self.destination.y() - self.dy / 2.0 - 15 * vectrot.y())
# draw the path
self.path = QtGui.QPainterPath(self.source)
self.path.lineTo(angle_source)
self.path.lineTo(angle_destination)
self.path.lineTo(self.destination)
self.setPath(self.path)
# set the interface status points positions
scale_vect = QtCore.QPointF(angle_source.x() - self.source.x(), angle_source.y() - self.source.y())
scale_vect_diag = math.sqrt(scale_vect.x() ** 2 + scale_vect.y() ** 2)
scale_coef = scale_vect_diag / 40.0
self.source = QtCore.QPointF(self.source.x() + scale_vect.x() / scale_coef, self.source.y() + scale_vect.y() / scale_coef)
self.destination = QtCore.QPointF(self.destination.x() - scale_vect.x() / scale_coef, self.destination.y() - scale_vect.y() / scale_coef)
def shape(self):
"""
Returns the shape of the item to the scene renderer.
:returns: QPainterPath instance
"""
path = QtGui.QGraphicsPathItem.shape(self)
offset = self._point_size / 2
point = self.source
path.addEllipse(point.x() - offset, point.y() - offset, self._point_size, self._point_size)
point = self.destination
path.addEllipse(point.x() - offset, point.y() - offset, self._point_size, self._point_size)
return path
def paint(self, painter, option, widget):
"""
Draws the status points.
:param painter: QPainter object
:param option: QStyleOptionGraphicsItem object
:param widget: QWidget object.
"""
QtGui.QGraphicsPathItem.paint(self, painter, option, widget)
if not self._adding_flag and self._show_status_points:
# points disappears if nodes are too close to each others.
if self.length < 80:
return
# source point color
if self._source_port_status == 'up':
color = QtCore.Qt.green
elif self._source_port_status == 'suspended':
color = QtCore.Qt.yellow
else:
color = QtCore.Qt.red
painter.setPen(QtGui.QPen(color, self._point_size, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.MiterJoin))
#TODO: draw port labels
# if globals.GApp.workspace.flg_showInterfaceNames:
# if self.labelSouceIf == None:
#
# if globals.interfaceLabels.has_key(self.source.hostname + ' ' + self.srcIf):
# self.labelSouceIf = Annotation(self.source)
# annotation = globals.interfaceLabels[self.source.hostname + ' ' + self.srcIf]
# self.labelSouceIf.setZValue(annotation.zValue())
# self.labelSouceIf.setDefaultTextColor(annotation.defaultTextColor())
# self.labelSouceIf.setFont(annotation.font())
# self.labelSouceIf.setPlainText(annotation.toPlainText())
# self.labelSouceIf.setPos(annotation.x(), annotation.y())
# self.labelSouceIf.rotation = annotation.rotation
# self.labelSouceIf.rotate(annotation.rotation)
# del globals.interfaceLabels[self.source.hostname + ' ' + self.srcIf]
# elif not globals.GApp.workspace.flg_showOnlySavedInterfaceNames:
# self.labelSouceIf = Annotation(self.source)
# self.labelSouceIf.setPlainText(self.srcIf)
# self.labelSouceIf.setPos(self.mapToItem(self.source, self.src))
# #self.labelSouceIf.autoGenerated = True
#
# if self.labelSouceIf:
# self.labelSouceIf.deviceName = self.source.hostname
# self.labelSouceIf.deviceIf = self.srcIf
#
# if self.labelSouceIf and not self.labelSouceIf.isVisible():
# self.labelSouceIf.show()
#
# elif self.labelSouceIf and globals.GApp.workspace.flg_showInterfaceNames == False:
# self.labelSouceIf.hide()
painter.drawPoint(self.source)
#painter.drawPoint(self.source)
# destination point color
if self._destination_port_status == 'up':
color = QtCore.Qt.green
elif self._destination_port_status == 'suspended':
color = QtCore.Qt.yellow
else:
color = QtCore.Qt.red
painter.setPen(QtGui.QPen(color, self._point_size, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.MiterJoin))
#TODO: draw port labels
# if globals.GApp.workspace.flg_showInterfaceNames:
# if self.labelDestIf == None:
#
# if globals.interfaceLabels.has_key(self.dest.hostname + ' ' + self.destIf):
# self.labelDestIf = Annotation(self.dest)
# annotation = globals.interfaceLabels[self.dest.hostname + ' ' + self.destIf]
# self.labelDestIf.setZValue(annotation.zValue())
# self.labelDestIf.setDefaultTextColor(annotation.defaultTextColor())
# self.labelDestIf.setFont(annotation.font())
# self.labelDestIf.setPlainText(annotation.toPlainText())
# self.labelDestIf.setPos(annotation.x(), annotation.y())
# self.labelDestIf.rotation = annotation.rotation
# self.labelDestIf.rotate(annotation.rotation)
# del globals.interfaceLabels[self.dest.hostname + ' ' + self.destIf]
# elif not globals.GApp.workspace.flg_showOnlySavedInterfaceNames:
# self.labelDestIf = Annotation(self.dest)
# self.labelDestIf.setPlainText(self.destIf)
# self.labelDestIf.setPos(self.mapToItem(self.dest, self.dst))
# #self.labelDestIf.autoGenerated = True
#
# if self.labelDestIf:
# self.labelDestIf.deviceName = self.dest.hostname
# self.labelDestIf.deviceIf = self.destIf
#
# if self.labelDestIf and not self.labelDestIf.isVisible():
# self.labelDestIf.show()
#
#
# elif self.labelDestIf and globals.GApp.workspace.flg_showInterfaceNames == False:
# self.labelDestIf.hide()
painter.drawPoint(self.destination)

184
gns3/jsonrpc.py Normal file
View File

@@ -0,0 +1,184 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
JSON-RPC protocol implementation.
http://www.jsonrpc.org/specification
"""
import json
import uuid
class JSONRPCObject(object):
"""
Base object for JSON-RPC requests, responses,
notifications and errors.
"""
def __init__(self):
return JSONRPCEncoder().default(self)
def __str__(self, *args, **kwargs):
return json.dumps(self, cls=JSONRPCEncoder)
def __call__(self):
return JSONRPCEncoder().default(self)
class JSONRPCEncoder(json.JSONEncoder):
"""
Creates the JSON-RPC message.
"""
def default(self, obj):
"""
Returns a Python dictionary corresponding to a JSON-RPC message.
"""
if isinstance(obj, JSONRPCObject):
message = {"jsonrpc": 2.0}
for field in dir(obj):
if not field.startswith('_'):
value = getattr(obj, field)
message[field] = value
return message
return json.JSONEncoder.default(self, obj)
class JSONRPCInvalidRequest(JSONRPCObject):
"""
Error response for an invalid request.
"""
def __init__(self):
JSONRPCObject.__init__(self)
self.id = None
self.error = {"code": -32600, "message": "Invalid Request"}
class JSONRPCMethodNotFound(JSONRPCObject):
"""
Error response for an method not found.
:param request_id: JSON-RPC identifier
"""
def __init__(self, request_id):
JSONRPCObject.__init__(self)
self.id = request_id
self.error = {"code": -32601, "message": "Method not found"}
class JSONRPCInvalidParams(JSONRPCObject):
"""
Error response for invalid parameters.
:param request_id: JSON-RPC identifier
"""
def __init__(self, request_id):
JSONRPCObject.__init__(self)
self.id = request_id
self.error = {"code": -32602, "message": "Invalid params"}
class JSONRPCInternalError(JSONRPCObject):
"""
Error response for an internal error.
:param request_id: JSON-RPC identifier (optional)
"""
def __init__(self, request_id=None):
JSONRPCObject.__init__(self)
self.id = request_id
self.error = {"code": -32603, "message": "Internal error"}
class JSONRPCParseError(JSONRPCObject):
"""
Error response for parsing error.
"""
def __init__(self):
JSONRPCObject.__init__(self)
self.id = None
self.error = {"code": -32700, "message": "Parse error"}
class JSONRPCCustomError(JSONRPCObject):
"""
Error response for an custom error.
:param code: JSON-RPC error code
:param message: JSON-RPC error message
:param request_id: JSON-RPC identifier (optional)
"""
def __init__(self, code, message, request_id=None):
JSONRPCObject.__init__(self)
self.id = request_id
self.error = {"code": code, "message": message}
class JSONRPCResponse(JSONRPCObject):
"""
JSON-RPC successful response.
:param result: JSON-RPC result
:param request_id: JSON-RPC identifier
"""
def __init__(self, result, request_id):
JSONRPCObject.__init__(self)
self.id = request_id
self.result = result
class JSONRPCRequest(JSONRPCObject):
"""
JSON-RPC request.
:param method: JSON-RPC destination method
:param params: JSON-RPC params for the corresponding method (optional)
:param request_id: JSON-RPC identifier (generated by default)
"""
def __init__(self, method, params=None, request_id=None):
JSONRPCObject.__init__(self)
if request_id == None:
request_id = str(uuid.uuid4())
self.id = request_id
self.method = method
if params:
self.params = params
class JSONRPCNotification(JSONRPCObject):
"""
JSON-RPC notification.
:param method: JSON-RPC destination method
:param params: JSON-RPC params for the corresponding method (optional)
"""
def __init__(self, method, params=None):
JSONRPCObject.__init__(self)
self.method = method
if params:
self.params = params

203
gns3/link.py Normal file
View File

@@ -0,0 +1,203 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Manages and stores everything needed for a connection between 2 devices.
"""
from .qt import QtCore
from .nios.nio_udp import NIO_UDP
import logging
log = logging.getLogger(__name__)
class Link(QtCore.QObject):
"""
Link implementation.
:param source_node: source Node object
:param source_port: source Port object
:param destination_node: destination Node object
:param destination_port: destination Port object
:param stub: indicates if the link is connected to
a stub device like a Cloud
"""
# signals used to let the GUI view know about link
# additions and deletions.
add_link_signal = QtCore.Signal(int)
delete_link_signal = QtCore.Signal(int)
_instance_count = 1
def __init__(self, source_node, source_port, destination_node, destination_port):
super(Link, self).__init__()
# create an unique ID
self._id = Link._instance_count
Link._instance_count += 1
self._source_node = source_node
self._source_port = source_port
self._destination_node = destination_node
self._destination_port = destination_port
self._source_nio = None
self._destination_nio = None
self._source_nio_active = False
self._destination_nio_active = False
if source_port.isStub() or destination_port.isStub():
self._stub = True
else:
self._stub = False
#FIXME: polish this
# we must request UDP information if the NIO is a NIO UDP and before
# it can be created.
if not self._stub:
# connect signals used when a NIO has been created by a node
# and this NIO need to be attached to a port connected to this link
source_node.nio_signal.connect(self.newNIOSlot)
destination_node.nio_signal.connect(self.newNIOSlot)
# currently, we support only NIO_UDP for normal connections (non-stub).
if not source_port.default_nio == NIO_UDP:
raise NotImplementedError()
self._source_udp = None
self._destination_udp = None
# connect signals used to receive a UDP port and host allocated by a node
source_node.allocate_udp_nio_signal.connect(self.UDPPortAllocatedSlot)
destination_node.allocate_udp_nio_signal.connect(self.UDPPortAllocatedSlot)
# request the UDP info for each node
source_node.allocateUDPPort()
destination_node.allocateUDPPort()
else:
# handle stub connections (to a cloud for instance).
if not source_port.isStub() and destination_port.isStub():
source_node.nio_signal.connect(self.newNIOSlot)
self._source_nio = self._destination_port.default_nio
self._source_node.addNIO(self._source_port, self._source_nio)
elif not destination_port.isStub() and source_port.isStub():
destination_node.nio_signal.connect(self.newNIOSlot)
self._destination_nio = self._source_port.default_nio
self._destination_node.addNIO(self._destination_port, self._destination_nio)
else:
log.error("both ports are stub!")
def deleteLink(self):
"""
Deletes this link.
"""
# delete the NIOs on both source and destination nodes
self._source_node.deleteNIO(self._source_port)
self._destination_node.deleteNIO(self._destination_port)
# let the GUI know about this link has been deleted
self.delete_link_signal.emit(self._id)
@property
def id(self):
"""
Returns this link identifier.
:returns: link identifier (integer)
"""
return self._id
def UDPPortAllocatedSlot(self, node_id, lport, laddr):
"""
Slot to receive events from Node instances
when a UDP port has been allocated in order to create a NIO UDP.
:param node_id: node identifier
:param lport: local UDP port
:param laddr: local host/address
"""
# check that the node is connected to this link as a source
if node_id == self._source_node.id:
self._source_udp = (lport, laddr)
# disconnect the signal has we don't expect new source UDP info for this link.
self._source_node.allocate_udp_nio_signal.disconnect()
# check that the node is connected to this link as a destination
elif node_id == self._destination_node.id:
self._destination_udp = (lport, laddr)
# disconnect the signal has we don't expect new source UDP info for this link.
self._destination_node.allocate_udp_nio_signal.disconnect()
if self._source_udp and self._destination_udp:
# we got UDP info from both source and destination nodes
# meaning we can proceed with the creation of UDP NIOs
lport, laddr = self._source_udp
rport, raddr = self._destination_udp
#TODO: check address compatibility? for instance 127.0.0.1 <-> 83.15.12.2 isn't likely gonna work.
self._source_nio = NIO_UDP(lport, raddr, rport)
self._destination_nio = NIO_UDP(rport, laddr, lport)
# add the UDP NIOs to the nodes
self._source_node.addNIO(self._source_port, self._source_nio)
self._destination_node.addNIO(self._destination_port, self._destination_nio)
def newNIOSlot(self, node_id):
"""
Slot to receive events from Node instances
when a NIO has been created on the server
and are active.
:param node_id: node identifier
"""
# check that the node is connected to this link as a source
if node_id == self._source_node.id:
self._source_nio_active = True
# disconnect the signal has we don't expect new source NIO for this link.
self._source_node.nio_signal.disconnect()
# check that the node is connected to this link as a destination
elif node_id == self._destination_node.id:
self._destination_nio_active = True
# disconnect the signal has we don't expect new destination NIO for this link.
self._destination_node.nio_signal.disconnect()
if not self._stub and self._source_nio_active and self._destination_nio_active:
# both NIOs are active now.
self._source_port.nio = self._source_nio
self._destination_port.nio = self._destination_nio
# let the GUI know about this link has been created
self.add_link_signal.emit(self._id)
elif self._stub and self._source_nio_active:
self._source_port.nio = self._source_nio
# add the NIO to destination to show the port is not free.
self._destination_port.nio = self._source_nio
self.add_link_signal.emit(self._id)
elif self._stub and self._destination_nio_active:
# add the NIO to source to show the port is not free.
self._source_port.nio = self._destination_nio
self._destination_port.nio = self._destination_nio
self.add_link_signal.emit(self._id)

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,15 +19,18 @@
import datetime
import sys
import logging
from gns3.version import __version__
from gns3.main_window import MainWindow
from gns3.qt import QtGui
def main():
"""
Entry point for GNS3 server
Entry point for GNS3 GUI.
"""
current_year = datetime.date.today().year
#print("GNS3 server version {}".format(gns3server.__version__))
print("GNS3 GUI version {}".format(__version__))
print("Copyright (c) 2007-{} GNS3 Technologies Inc.".format(current_year))
# we only support Python 2 version >= 2.7 and Python 3 version >= 3.3
@@ -36,5 +39,40 @@ def main():
elif sys.version_info[0] == 3 and sys.version_info < (3, 3):
raise RuntimeError("Python 3.3 or higher is required")
try:
from gns3.qt import QtCore, DEFAULT_BINDING
except ImportError:
raise RuntimeError("Can't import Qt modules, Python binding is probably not installed...")
version = lambda version_string: [int(i) for i in version_string.split('.')]
if version(QtCore.QT_VERSION_STR) < version("4.6"):
raise RuntimeError("Requirement is Qt version 4.6 or higher, got version {}".format(QtCore.QT_VERSION_STR))
# 4.8.3 because of QSettings (http://pyqt.sourceforge.net/Docs/PyQt4/pyqt_qsettings.html)
if DEFAULT_BINDING == "PyQt" and version(QtCore.BINDING_VERSION_STR) < version("4.8.3"):
raise RuntimeError("Requirement is PyQt version 4.8.3 or higher, got version {}".format(QtCore.BINDING_VERSION_STR))
if DEFAULT_BINDING == "PySide" and version(QtCore.BINDING_VERSION_STR) < version("1.0"):
raise RuntimeError("Requirement is PySide version 1.0 or higher, got version {}".format(QtCore.BINDING_VERSION_STR))
# default logging level
logging.basicConfig(level=logging.INFO)
app = QtGui.QApplication(sys.argv)
# this info is necessary for QSettings
app.setOrganizationName("GNS3")
app.setOrganizationDomain("gns3.net")
app.setApplicationName("GNS3")
# don't use the registry to store settings on Windows
# because we don't like it!
if sys.platform.startswith('win'):
QtCore.QSettings.setDefaultFormat(QtCore.QSettings.IniFormat)
mainwindow = MainWindow.instance()
mainwindow.show()
app.exec_()
if __name__ == '__main__':
main()

167
gns3/main_window.py Normal file
View File

@@ -0,0 +1,167 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Main window for the GUI.
"""
import socket
from .servers import Servers
from .qt import QtGui, QtCore
from .ui.main_window_ui import Ui_MainWindow
from .preferences_dialog import PreferencesDialog
class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
Main window implementation.
:param parent: parent widget
"""
# signal to tell the view if the user is adding a link or not
adding_link_signal = QtCore.Signal(bool)
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.setupUi(self)
# restore the geometry and state of the main window.
settings = QtCore.QSettings()
self.restoreGeometry(settings.value("GUI/geometry", QtCore.QByteArray()))
self.restoreState(settings.value("GUI/state", QtCore.QByteArray()))
# flag to know if there are any unsaved changes
self.unsaved_changes = False
# load initial stuff once the event loop isn't busy
QtCore.QTimer.singleShot(0, self.startupLoading)
# connect the signal to the view
self.adding_link_signal.connect(self.uiGraphicsView.addingLinkSlot)
# connect actions
self.uiAddLinkAction.triggered.connect(self._addLinkActionSlot)
self.uiPreferencesAction.triggered.connect(self._preferencesActionSlot)
def _addLinkActionSlot(self):
"""
Slot to receive events from the add a link action.
"""
if not self.uiAddLinkAction.isChecked():
self.uiAddLinkAction.setText("Add a link")
link_icon = QtGui.QIcon()
link_icon.addPixmap(QtGui.QPixmap(":/icons/connection-new.svg"), QtGui.QIcon.Normal, QtGui.QIcon.On)
link_icon.addPixmap(QtGui.QPixmap(":/icons/connection-new-hover.svg"), QtGui.QIcon.Active, QtGui.QIcon.On)
self.uiAddLinkAction.setIcon(link_icon)
self.adding_link_signal.emit(False)
else:
#TODO: handle automatic linking based on the link type
# modifiers = QtGui.QApplication.keyboardModifiers()
# if not globals.GApp.systconf['general'].manual_connection or modifiers == QtCore.Qt.ShiftModifier:
# menu = QtGui.QMenu()
# for linktype in globals.linkTypes.keys():
# menu.addAction(linktype)
# menu.connect(menu, QtCore.SIGNAL("triggered(QAction *)"), self.__setLinkType)
# menu.exec_(QtGui.QCursor.pos())
# else:
# globals.currentLinkType = globals.Enum.LinkType.Manual
self.uiAddLinkAction.setText("Cancel")
self.uiAddLinkAction.setIcon(QtGui.QIcon(':/icons/cancel-connection.svg'))
self.adding_link_signal.emit(True)
def _preferencesActionSlot(self):
"""
Slot to show the preferences dialog.
"""
dialog = PreferencesDialog(self)
dialog.show()
dialog.exec_()
def keyPressEvent(self, event):
"""
Handles all key press events for the main window.
:param event: QKeyEvent
"""
key = event.key()
# if the user is adding a link and press Escape, then cancel the link addition.
if self.uiAddLinkAction.isChecked() and key == QtCore.Qt.Key_Escape:
self.uiAddLinkAction.setChecked(False)
self._addLinkActionSlot()
else:
QtGui.QMainWindow.keyPressEvent(self, event)
def closeEvent(self, event):
"""
Handles the event when the main window is closed.
:param event: QCloseEvent
"""
if self.checkForUnsavedChanges():
# save the geometry and state of the main window.
settings = QtCore.QSettings()
settings.setValue("GUI/geometry", self.saveGeometry())
settings.setValue("GUI/state", self.saveState())
else:
event.ignore()
def checkForUnsavedChanges(self):
"""
Checks if there are any unsaved changes.
:returns: boolean
"""
if self.unsaved_changes:
return True
return True
def startupLoading(self):
"""
Called by QTimer.singleShot to load everything needed at startup.
"""
# connect to the local server
servers = Servers.instance()
server = servers.localServer()
if not server.connected:
try:
server.connect()
except socket.error as e:
QtGui.QMessageBox.critical(self, "Local server", "Could not connect to the local server {host} on port {port}: {error}".format(host=server.host,
port=server.port,
error=e))
return
@staticmethod
def instance():
"""
Singleton to return only on instance of MainWindow.
:returns: instance of MainWindow
"""
if not hasattr(MainWindow, "_instance"):
MainWindow._instance = MainWindow()
return MainWindow._instance

0
gns3/modules/__init__.py Normal file
View File

View File

@@ -0,0 +1,225 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips module implementation.
"""
import socket
from gns3.qt import QtCore
from gns3.servers import Servers
from ..module import Module
from .nodes.router import Router
from .nodes.c1700 import C1700
from .nodes.c2600 import C2600
from .nodes.c2691 import C2691
from .nodes.c3600 import C3600
from .nodes.c3725 import C3725
from .nodes.c3745 import C3745
from .nodes.c7200 import C7200
from .nodes.cloud import Cloud
from .nodes.ethernet_switch import EthernetSwitch
from .nodes.ethernet_hub import EthernetHub
from .nodes.frame_relay_switch import FrameRelaySwitch
from .nodes.atm_switch import ATMSwitch
from .settings import DYNAMIPS_SETTINGS, DYNAMIPS_SETTING_TYPES
class Dynamips(Module):
def __init__(self):
Module.__init__(self)
self._settings = {}
self._ios_images = {}
self._servers = []
# load the settings and IOS images.
self._loadSettings()
self._loadIOSImages()
def _loadSettings(self):
# load the settings
settings = QtCore.QSettings()
settings.beginGroup(self.__class__.__name__)
for name, value in DYNAMIPS_SETTINGS.items():
self._settings[name] = settings.value(name, value, type=DYNAMIPS_SETTING_TYPES[name])
settings.endGroup()
def _saveSettings(self):
# save the settings
settings = QtCore.QSettings()
settings.beginGroup(self.__class__.__name__)
for name, value in self._settings.items():
settings.setValue(name, value)
settings.endGroup()
def _loadIOSImages(self):
# load the settings
settings = QtCore.QSettings()
settings.beginGroup("IOS_images")
# load the IOS images
size = settings.beginReadArray("ios_image")
for index in range(0, size):
settings.setArrayIndex(index)
path = settings.value("path", "")
image = settings.value("image", "")
startup_config = settings.value("image", "")
platform = settings.value("platform", "")
chassis = settings.value("chassis", "")
idlepc = settings.value("idlepc", "")
ram = settings.value("ram", 128, type=int)
server = settings.value("server", "local")
key = "{server}:{image}".format(server=server, image=image)
self._ios_images[key] = {"path": path,
"image": image,
"startup-config": startup_config,
"platform": platform,
"chassis": chassis,
"idlepc": idlepc,
"ram": ram,
"server": server}
settings.endArray()
settings.endGroup()
def _saveIOSImages(self):
# save the settings
settings = QtCore.QSettings()
settings.beginGroup("IOS_images")
settings.remove("")
# save the IOS images
settings.beginWriteArray("ios_image", len(self._ios_images))
index = 0
for ios_image in self._ios_images.values():
settings.setArrayIndex(index)
for name, value in ios_image.items():
settings.setValue(name, value)
index += 1
settings.endArray()
settings.endGroup()
def addServer(self, server):
self._servers.append(server)
server.send_notification("dynamips.settings", self._settings)
def removeServer(self, server):
self._servers.remove(server)
def servers(self):
return self._servers
def iosImages(self):
return self._ios_images
def setIOSImages(self, new_ios_images):
self._ios_images = new_ios_images.copy()
self._saveIOSImages()
def settings(self):
return self._settings
def setSettings(self, settings):
params = {}
for name, value in settings.items():
if self._settings[name] != value:
params[name] = value
if params:
for server in self._servers:
server.send_notification("dynamips.settings", params)
self._settings.update(settings)
self._saveSettings()
def createNode(self, node_class):
servers = Servers.instance()
server = servers.localServer()
if not server.connected:
try:
server.connect()
except socket.error as e:
print("COULD NOT CONNECT TO SERVER!!")
print(e)
return
self.addServer(server)
return node_class(server)
def _allocateIOSImage(self, node):
platform = node.settings()["platform"]
for ios_image in self._ios_images.values():
if ios_image["platform"] == platform:
return ios_image
def setupNode(self, node):
if isinstance(node, Router):
ios_image = self._allocateIOSImage(node)
#node.setup(ios_image)
node.setup("/home/grossmj/Documents/IOS images/c3725-adventerprisek9-mz.124-15.T14.image", 128)
else:
node.setup()
@staticmethod
def nodes():
"""
Returns all the node classes supported by this module.
:returns: list of classes
"""
return [C1700, C2600, C2691, C3600, C3725, C3745, C7200, Cloud, EthernetSwitch, EthernetHub, FrameRelaySwitch, ATMSwitch]
@staticmethod
def preferencePages():
"""
:returns: QWidget object list
"""
from .pages.dynamips_preferences_page import DynamipsPreferencesPage
from .pages.ios_router_preferences_page import IOSRouterPreferencesPage
return [DynamipsPreferencesPage, IOSRouterPreferencesPage]
@staticmethod
def instance():
"""
Singleton to return only on instance of Dynamips.
:returns: instance of Dynamips
"""
if not hasattr(Dynamips, "_instance"):
Dynamips._instance = Dynamips()
return Dynamips._instance

View File

@@ -0,0 +1,128 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Adapter matrix to create Port objects with the correct parameters.
"""
from gns3.ports.atm_port import ATMPort
from gns3.ports.ethernet_port import EthernetPort
from gns3.ports.fastethernet_port import FastEthernetPort
from gns3.ports.gigabitethernet_port import GigabitEthernetPort
from gns3.ports.pos_port import POSPort
from gns3.ports.serial_port import SerialPort
ADAPTER_MATRIX = {"C1700-MB-1FE": {"nb_ports": 1,
"wics": 2,
"port": FastEthernetPort},
"C1700-MB-WIC1": {"nb_ports": 0,
"wics": 2},
"C2600-MB-1E": {"nb_ports": 1,
"wics": 3,
"port": EthernetPort},
"C2600-MB-1FE": {"nb_ports": 1,
"wics": 3,
"port": FastEthernetPort},
"C2600-MB-2E": {"nb_ports": 2,
"wics": 3,
"port": EthernetPort},
"C2600-MB-2FE": {"nb_ports": 2,
"wics": 3,
"port": FastEthernetPort},
"C7200-IO-2FE": {"nb_ports": 2,
"wics": 0,
"port": FastEthernetPort},
"C7200-IO-FE": {"nb_ports": 1,
"wics": 0,
"port": FastEthernetPort},
"C7200-IO-GE-E": {"nb_ports": 1,
"wics": 0,
"port": GigabitEthernetPort},
"GT96100-FE": {"nb_ports": 2,
"wics": 3,
"port": FastEthernetPort},
"Leopard-2FE": {"nb_ports": 2,
"wics": 0,
"port": FastEthernetPort},
"NM-16ESW": {"nb_ports": 16,
"wics": 0,
"port": FastEthernetPort},
"NM-1E": {"nb_ports": 1,
"wics": 0,
"port": EthernetPort},
"NM-1FE-TX": {"nb_ports": 1,
"wics": 0,
"port": FastEthernetPort},
"NM-4E": {"nb_ports": 4,
"wics": 0,
"port": EthernetPort},
"NM-4T": {"nb_ports": 4,
"wics": 0,
"port": SerialPort},
"PA-2FE-TX": {"nb_ports": 2,
"wics": 0,
"port": FastEthernetPort},
"PA-4E": {"nb_ports": 4,
"wics": 0,
"port": EthernetPort},
"PA-4T+": {"nb_ports": 4,
"wics": 0,
"port": SerialPort},
"PA-8E": {"nb_ports": 8,
"wics": 0,
"port": EthernetPort},
"PA-8T": {"nb_ports": 8,
"wics": 0,
"port": SerialPort},
"PA-A1": {"nb_ports": 1,
"wics": 0,
"port": ATMPort},
"PA-FE-TX": {"nb_ports": 1,
"wics": 0,
"port": FastEthernetPort},
"PA-GE": {"nb_ports": 1,
"wics": 0,
"port": GigabitEthernetPort},
"PA-POS-OC3": {"nb_ports": 1,
"wics": 0,
"port": POSPort},
}

View File

View File

@@ -0,0 +1,278 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips ATMSW implementation on the client side.
Asynchronously sends JSON messages to the GNS3 server and receives responses with callbacks.
"""
from gns3.node import Node
from gns3.ports.serial_port import SerialPort
from gns3.nios.nio_udp import NIO_UDP
import logging
log = logging.getLogger(__name__)
class ATMSwitch(Node):
"""
Dynamips ATM switch.
:param server: GNS3 server instance
"""
def __init__(self, server):
Node.__init__(self)
self._server = server
self._atmsw_id = None
self._ports = []
self._settings = {"name": "",
"mapping": {}}
def setup(self, name=None):
"""
Setups this switch.
:param image: IOS image path
:param ram: amount of RAM
:param name: optional name for this router
"""
self._server.send_message("dynamips.atmsw.create", None, self.setupCallback)
def setupCallback(self, response, error=False):
"""
Callback for the setup.
:param result: server response
:param error: ..
"""
self._atmsw_id = response["id"]
self._settings["name"] = response["name"]
# let the GUI knows about this router name
self.newname_signal.emit(self._settings["name"])
def delete(self):
"""
Deletes this ATM switch.
"""
# first delete all the links attached to this node
self.delete_links_signal.emit()
self._server.send_message("dynamips.atmsw.delete", {"id": self._atmsw_id}, self._deleteCallback)
def _deleteCallback(self, result, error=False):
"""
Callback for the delete method.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while deleting {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
log.info("{} has been deleted".format(self.name()))
self.delete_signal.emit()
def update(self, new_settings):
"""
Updates the settings for this ATM switch.
:param new_settings: settings dictionary
"""
ports_to_create = []
mapping = new_settings["mapping"]
print(mapping)
for source, destination in mapping.items():
source_port = source.split(":")[0]
destination_port = destination.split(":")[0]
if source_port not in ports_to_create:
ports_to_create.append(source_port)
if destination_port not in ports_to_create:
ports_to_create.append(destination_port)
for port in self._ports.copy():
if port.isFree():
self._ports.remove(port)
else:
ports_to_create.remove(port.name)
for port_name in ports_to_create:
port = SerialPort(port_name)
port.port = int(port_name)
self._ports.append(port)
self._settings["mapping"] = new_settings["mapping"].copy()
#self._server.send_message("dynamips.ethsw.update", params, self.updateCallback)
def updateCallback(self, response, error=False):
print(response)
def allocateUDPPort(self):
"""
Requests an UDP port allocation.
"""
log.debug("{} is requesting an UDP port allocation".format(self.name()))
self._server.send_message("dynamips.atmsw.allocate_udp_port", {"id": self._atmsw_id}, self._allocateUDPPortCallback)
def _allocateUDPPortCallback(self, result, error=False):
"""
Callback for allocateUDPPort.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while allocating an UDP port for {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
lhost = result["lhost"]
lport = result["lport"]
log.info("{} has allocated UDP port {} for host {}".format(self.name(), lport, lhost))
self.allocate_udp_nio_signal.emit(self.id, lport, lhost)
def addNIO(self, port, nio):
"""
Adds a new NIO on the specified port for this ATM switch.
:param port: Port object.
:param nio: NIO object.
"""
if isinstance(nio, NIO_UDP):
params = {"id": self._atmsw_id,
"nio": "NIO_UDP",
"port": port.port,
"lport": nio.lport,
"rhost": nio.rhost,
"rport": nio.rport}
params["mapping"] = {}
for source, destination in self._settings["mapping"].items():
source_port = source.split(":")[0]
destination_port = destination.split(":")[0]
if port.name == source_port:
params["mapping"][source] = destination
if port.name == destination_port:
params["mapping"][destination] = source
log.debug("{} is adding an UDP NIO: {}".format(self.name(), params))
self._server.send_message("dynamips.atmsw.add_nio", params, self._addNIOCallback)
def _addNIOCallback(self, result, error=False):
"""
Callback for addNIO.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while adding an UDP NIO for {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
self.nio_signal.emit(self.id)
def deleteNIO(self, port):
params = {"id": self._atmsw_id,
"port": port.port}
port.nio = None
self._server.send_message("dynamips.atmsw.delete_nio", params, self.deleteNIOCallback)
def deleteNIOCallback(self, result, error=False):
print("NIO deleted!")
print(result)
def name(self):
"""
Returns the name of this router.
:returns: name (string)
"""
return self._settings["name"]
def settings(self):
"""
Returns all this router settings.
:returns: settings dictionary
"""
return self._settings
def ports(self):
"""
Returns all the ports for this router.
:returns: list of Port objects
"""
return self._ports
def configPage(self):
"""
Returns the configuration page widget to be used by the node configurator.
:returns: QWidget object.
"""
from ..pages.atm_switch_configuration_page import ATMSwitchConfigurationPage
return ATMSwitchConfigurationPage
@staticmethod
def defaultSymbol():
"""
Returns the default symbol path for this node.
:returns: symbol path (or resource).
"""
return ":/symbols/atm_switch.normal.svg"
@staticmethod
def hoverSymbol():
"""
Returns the symbol to use when this node is hovered.
:returns: symbol path (or resource).
"""
return ":/symbols/atm_switch.selected.svg"
@staticmethod
def symbolName():
return "ATM switch"
def __str__(self):
return "ATM switch"

View File

@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips c1700 router implementation.
"""
from .router import Router
class C1700(Router):
"""
Dynamips c1700 router.
:param server: GNS3 server instance
"""
def __init__(self, server):
Router.__init__(self, server, platform="c1700")
self._platform_settings = {"ram": 64,
"nvram": 32,
"disk0": 0,
"disk1": 0,
"chassis": "1720",
"iomem": 15,
"clock_divisor": 8}
# merge platform settings with the generic ones
self._settings.update(self._platform_settings)
def __str__(self):
return "Router c1700"
@staticmethod
def symbolName():
return "Router c1700"

View File

@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips c2600 router implementation.
"""
from .router import Router
class C2600(Router):
"""
Dynamips c2600 router.
:param server: GNS3 server instance
"""
def __init__(self, server):
Router.__init__(self, server, platform="c2600")
self._platform_settings = {"ram": 64,
"nvram": 128,
"disk0": 0,
"disk1": 0,
"chassis": "2610",
"iomem": 15,
"clock_divisor": 8}
# merge platform settings with the generic ones
self._settings.update(self._platform_settings)
def __str__(self):
return "Router c2600"
@staticmethod
def symbolName():
return "Router c2600"

View File

@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips c2691 router implementation.
"""
from .router import Router
class C2691(Router):
"""
Dynamips c2691 router.
:param server: GNS3 server instance
"""
def __init__(self, server):
Router.__init__(self, server, platform="c2691")
self._platform_settings = {"ram": 128,
"nvram": 112,
"disk0": 16,
"disk1": 0,
"iomem": 5,
"clock_divisor": 8}
# merge platform settings with the generic ones
self._settings.update(self._platform_settings)
def __str__(self):
return "Router c2691"
@staticmethod
def symbolName():
return "Router c2691"

View File

@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips c3600 router implementation.
"""
from .router import Router
class C3600(Router):
"""
Dynamips c3600 router.
:param server: GNS3 server instance
"""
def __init__(self, server):
Router.__init__(self, server, platform="c3600")
self._platform_settings = {"ram": 128,
"nvram": 128,
"disk0": 0,
"disk1": 0,
"chassis": "3640",
"iomem": 5,
"clock_divisor": 4}
# merge platform settings with the generic ones
self._settings.update(self._platform_settings)
def __str__(self):
return "Router c3600"
@staticmethod
def symbolName():
return "Router c3600"

View File

@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips c3725 router implementation.
"""
from .router import Router
class C3725(Router):
"""
Dynamips c3725 router.
:param server: GNS3 server instance
"""
def __init__(self, server):
Router.__init__(self, server, platform="c3725")
self._platform_settings = {"ram": 128,
"nvram": 112,
"disk0": 16,
"disk1": 0,
"iomem": 5,
"clock_divisor": 8}
# merge platform settings with the generic ones
self._settings.update(self._platform_settings)
def __str__(self):
return "Router c3725"
@staticmethod
def symbolName():
return "Router c3725"

View File

@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips c3745 router implementation.
"""
from .router import Router
class C3745(Router):
"""
Dynamips c3745 router.
:param server: GNS3 server instance
"""
def __init__(self, server):
Router.__init__(self, server, platform="c3745")
self._platform_settings = {"ram": 128,
"nvram": 304,
"disk0": 16,
"disk1": 0,
"iomem": 5,
"clock_divisor": 8}
# merge platform settings with the generic ones
self._settings.update(self._platform_settings)
def __str__(self):
return "Router c3745"
@staticmethod
def symbolName():
return "Router c3745"

View File

@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips c7200 router implementation.
"""
from .router import Router
class C7200(Router):
"""
Dynamips c7200 router.
:param server: GNS3 server instance
"""
def __init__(self, server):
Router.__init__(self, server, platform="c7200")
self._platform_settings = {"ram": 256,
"nvram": 128,
"disk0": 64,
"disk1": 0,
"npe": "npe-400",
"midplane": "vxr",
"clock_divisor": 4}
# merge platform settings with the generic ones
self._settings.update(self._platform_settings)
def __str__(self):
return "Router c7200"
@staticmethod
def symbolName():
return "Router c7200"

View File

@@ -0,0 +1,302 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips NIO implementation on the client side (in the form of a pseudo node represented as a cloud).
Asynchronously sends JSON messages to the GNS3 server and receives responses with callbacks.
"""
import re
from gns3.node import Node
from gns3.ports.port import Port
from gns3.nios.nio_generic_ethernet import NIO_GenericEthernet
from gns3.nios.nio_linux_ethernet import NIO_LinuxEthernet
from gns3.nios.nio_udp import NIO_UDP
from gns3.nios.nio_tap import NIO_TAP
from gns3.nios.nio_unix import NIO_UNIX
from gns3.nios.nio_vde import NIO_VDE
from gns3.nios.nio_null import NIO_Null
import logging
log = logging.getLogger(__name__)
class Cloud(Node):
"""
Dynamips cloud.
:param server: GNS3 server instance
"""
_name_instance_count = 1
def __init__(self, server, platform="c7200"):
Node.__init__(self)
self._server = server
# create an unique id and name
self._name_id = Cloud._name_instance_count
Cloud._name_instance_count += 1
self._name = "Cloud {}".format(self._name_id)
self._defaults = {}
self._ports = []
self._settings = {"nios": [],
"interfaces": []}
def setup(self, name=None):
"""
Setups this cloud.
:param image: IOS image path
:param ram: amount of RAM
:param name: optional name for this router
"""
self._server.send_message("dynamips.nio.get_interfaces", None, self.setupCallback)
def delete(self):
"""
Deletes this cloud.
"""
# first delete all the links attached to this node
self.delete_links_signal.emit()
self.delete_signal.emit()
def setupCallback(self, response, error=False):
"""
Callback for the setup.
:param result: server response
:param error: ..
"""
for interface in response:
self._settings["interfaces"].append(interface)
def _createNIOUDP(self, nio):
match = re.search(r"""^nio_udp:(\d+):(.+):(\d+)$""", nio)
if match:
lport = int(match.group(1))
rhost = match.group(2)
rport = int(match.group(3))
return NIO_UDP(lport, rhost, rport)
return None
def _createNIOGenericEthernet(self, nio):
match = re.search(r"""^nio_gen_eth:(.+)$""", nio)
if match:
ethernet_device = match.group(1)
return NIO_GenericEthernet(ethernet_device)
return None
def _createNIOLinuxEthernet(self, nio):
match = re.search(r"""^nio_gen_linux:(.+)$""", nio)
if match:
linux_device = match.group(1)
return NIO_LinuxEthernet(linux_device)
return None
def _createNIOTAP(self, nio):
match = re.search(r"""^nio_tap:(.+)$""", nio)
if match:
tap_device = match.group(1)
return NIO_TAP(tap_device)
return None
def _createNIOUNIX(self, nio):
match = re.search(r"""^nio_unix:(.+):(.+)$""", nio)
if match:
local_file = match.group(1)
remote_file = match.group(2)
return NIO_UNIX(local_file, remote_file)
return None
def _createNIOVDE(self, nio):
match = re.search(r"""^nio_vde:(.+):(.+)$""", nio)
if match:
control_file = match.group(1)
local_file = match.group(2)
return NIO_VDE(control_file, local_file)
return None
def _createNIONull(self, nio):
match = re.search(r"""^nio_null:(.+)$""", nio)
if match:
identifier = match.group(1)
return NIO_Null(identifier)
return None
def update(self, new_settings):
"""
Updates the settings for this cloud.
:param new_settings: settings dictionary
"""
nios = new_settings["nios"]
# add ports
for nio in nios:
if nio in self._settings["nios"]:
# port already created for this NIO
continue
nio_object = None
if nio.lower().startswith("nio_udp"):
nio_object = self._createNIOUDP(nio)
if nio.lower().startswith("nio_gen_eth"):
nio_object = self._createNIOGenericEthernet(nio)
if nio.lower().startswith("nio_gen_linux"):
nio_object = self._createNIOLinuxEthernet(nio)
if nio.lower().startswith("nio_tap"):
nio_object = self._createNIOTAP(nio)
if nio.lower().startswith("nio_unix"):
nio_object = self._createNIOUNIX(nio)
if nio.lower().startswith("nio_vde"):
nio_object = self._createNIOVDE(nio)
if nio.lower().startswith("nio_null"):
nio_object = self._createNIONull(nio)
if nio_object == None:
log.error("Could not create NIO object from {}".format(nio))
continue
print("Create port for {}".format(nio))
port = Port(nio, nio_object, stub=True)
self._ports.append(port)
# delete ports
for nio in self._settings["nios"]:
if nio not in nios:
for port in self._ports.copy():
if port.name == nio:
print("Delete port {}".format(nio))
self._ports.remove(port)
break
self._settings = new_settings.copy()
# def addNIO(self, port, nio):
# """
# Adds a new NIO on the specified port for this router.
#
# :param port: Port object.
# :param nio: NIO object.
# """
#
# if isinstance(nio, NIO_UDP):
# params = {"id": self._router_id,
# "nio": "NIO_UDP",
# "slot": port.slot,
# "port": port.port,
# "lport": nio.lport,
# "rhost": nio.rhost,
# "rport": nio.rport}
# log.debug("{} is adding an UDP NIO: {}".format(self.name(), params))
#
# self._server.send_message("dynamips.vm.add_nio", params, self._addNIOCallback)
#
# def _addNIOCallback(self, result, error=False):
# """
# Callback for addNIO.
#
# :param result: server response
# :param error: indicates an error (boolean)
# """
#
# if error:
# log.error("error while adding an UDP NIO for {}: {}".format(self.name(), result["message"]))
# self.error_signal.emit(self.name(), result["code"], result["message"])
# else:
# self.nio_signal.emit(self.id)
def deleteNIO(self, port):
port.nio = None
def name(self):
"""
Returns the name of this router.
:returns: name (string)
"""
return self._name
def settings(self):
"""
Returns all this router settings.
:returns: settings dictionary
"""
return self._settings
def ports(self):
"""
Returns all the ports for this router.
:returns: list of Port objects
"""
return self._ports
def configPage(self):
"""
Returns the configuration page widget to be used by the node configurator.
:returns: QWidget object.
"""
from ..pages.cloud_configuration_page import CloudConfigurationPage
return CloudConfigurationPage
@staticmethod
def defaultSymbol():
"""
Returns the default symbol path for this cloud.
:returns: symbol path (or resource).
"""
return ":/symbols/cloud.normal.svg"
@staticmethod
def hoverSymbol():
"""
Returns the symbol to use when the cloud is hovered.
:returns: symbol path (or resource).
"""
return ":/symbols/cloud.selected.svg"
@staticmethod
def symbolName():
return "Cloud"
def __str__(self):
return "Cloud"

View File

@@ -0,0 +1,262 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips bridge implementation on the client side (in the form of a hub).
Asynchronously sends JSON messages to the GNS3 server and receives responses with callbacks.
"""
from gns3.node import Node
from gns3.ports.ethernet_port import EthernetPort
from gns3.nios.nio_udp import NIO_UDP
import logging
log = logging.getLogger(__name__)
class EthernetHub(Node):
"""
Dynamips Ethernet hub.
:param server: GNS3 server instance
"""
def __init__(self, server):
Node.__init__(self)
self._server = server
self._ethhub_id = None
self._ports = []
self._settings = {"name": "",
"ports": []}
def setup(self, name=None):
"""
Setups this hub.
:param image: IOS image path
:param ram: amount of RAM
:param name: optional name for this router
"""
self._server.send_message("dynamips.ethhub.create", None, self.setupCallback)
def setupCallback(self, response, error=False):
"""
Callback for the setup.
:param result: server response
:param error: ..
"""
self._ethhub_id = response["id"]
self._settings["name"] = response["name"]
# let the GUI knows about this router name
self.newname_signal.emit(self._settings["name"])
def delete(self):
"""
Deletes this Ethernet hub.
"""
# first delete all the links attached to this node
self.delete_links_signal.emit()
self._server.send_message("dynamips.ethhub.delete", {"id": self._ethhub_id}, self._deleteCallback)
def _deleteCallback(self, result, error=False):
"""
Callback for the delete method.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while deleting {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
log.info("{} has been deleted".format(self.name()))
self.delete_signal.emit()
def update(self, new_settings):
"""
Updates the settings for this cloud.
:param new_settings: settings dictionary
"""
ports_to_create = []
ports = new_settings["ports"]
for port_id in ports:
if port_id not in ports_to_create:
ports_to_create.append(port_id)
for port in self._ports.copy():
if port.isFree():
self._ports.remove(port)
else:
ports_to_create.remove(port.name)
for port_name in ports_to_create:
port = EthernetPort(port_name)
port.port = int(port_name)
self._ports.append(port)
self._settings["ports"] = new_settings["ports"].copy()
def updateCallback(self, response, error=False):
print(response)
def allocateUDPPort(self):
"""
Requests an UDP port allocation.
"""
log.debug("{} is requesting an UDP port allocation".format(self.name()))
self._server.send_message("dynamips.ethhub.allocate_udp_port", {"id": self._ethhub_id}, self._allocateUDPPortCallback)
def _allocateUDPPortCallback(self, result, error=False):
"""
Callback for allocateUDPPort.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while allocating an UDP port for {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
lhost = result["lhost"]
lport = result["lport"]
log.info("{} has allocated UDP port {} for host {}".format(self.name(), lport, lhost))
self.allocate_udp_nio_signal.emit(self.id, lport, lhost)
def addNIO(self, port, nio):
"""
Adds a new NIO on the specified port for this router.
:param port: Port object.
:param nio: NIO object.
"""
if isinstance(nio, NIO_UDP):
params = {"id": self._ethhub_id,
"nio": "NIO_UDP",
"port": port.port,
"lport": nio.lport,
"rhost": nio.rhost,
"rport": nio.rport}
log.debug("{} is adding an UDP NIO: {}".format(self.name(), params))
self._server.send_message("dynamips.ethhub.add_nio", params, self._addNIOCallback)
def _addNIOCallback(self, result, error=False):
"""
Callback for addNIO.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while adding an UDP NIO for {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
self.nio_signal.emit(self.id)
def deleteNIO(self, port):
params = {"id": self._ethhub_id,
"port": port.port}
port.nio = None
self._server.send_message("dynamips.ethhub.delete_nio", params, self.deleteNIOCallback)
def deleteNIOCallback(self, result, error=False):
print("NIO deleted!")
print(result)
def name(self):
"""
Returns the name of this router.
:returns: name (string)
"""
return self._settings["name"]
def settings(self):
"""
Returns all this router settings.
:returns: settings dictionary
"""
return self._settings
def ports(self):
"""
Returns all the ports for this router.
:returns: list of Port objects
"""
return self._ports
def configPage(self):
"""
Returns the configuration page widget to be used by the node configurator.
:returns: QWidget object.
"""
from ..pages.ethernet_hub_configuration_page import EthernetHubConfigurationPage
return EthernetHubConfigurationPage
@staticmethod
def defaultSymbol():
"""
Returns the default symbol path for this node.
:returns: symbol path (or resource).
"""
return ":/symbols/hub.normal.svg"
@staticmethod
def hoverSymbol():
"""
Returns the symbol to use when this node is hovered.
:returns: symbol path (or resource).
"""
return ":/symbols/hub.selected.svg"
@staticmethod
def symbolName():
return "Ethernet hub"
def __str__(self):
return "Ethernet hub"

View File

@@ -0,0 +1,276 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips ETHSW implementation on the client side.
Asynchronously sends JSON messages to the GNS3 server and receives responses with callbacks.
"""
from gns3.node import Node
from gns3.ports.ethernet_port import EthernetPort
from gns3.nios.nio_udp import NIO_UDP
import logging
log = logging.getLogger(__name__)
class EthernetSwitch(Node):
"""
Dynamips Ethernet switch.
:param server: GNS3 server instance
"""
#_name_instance_count = 1
def __init__(self, server):
Node.__init__(self)
self._server = server
self._ethsw_id = None
self._ports = []
self._settings = {"name": "",
"ports": {}}
# create an unique id and name
# self._name_id = EthernetSwitch._name_instance_count
# EthernetSwitch._name_instance_count += 1
# self._name = "SW{}".format(self._name_id)
def setup(self, name=None):
"""
Setups this switch.
:param image: IOS image path
:param ram: amount of RAM
:param name: optional name for this router
"""
self._server.send_message("dynamips.ethsw.create", None, self.setupCallback)
def setupCallback(self, response, error=False):
"""
Callback for the setup.
:param result: server response
:param error: ..
"""
self._ethsw_id = response["id"]
self._settings["name"] = response["name"]
# let the GUI knows about this router name
self.newname_signal.emit(self._settings["name"])
def delete(self):
"""
Deletes this Ethernet switch.
"""
# first delete all the links attached to this node
self.delete_links_signal.emit()
self._server.send_message("dynamips.ethsw.delete", {"id": self._ethsw_id}, self._deleteCallback)
def _deleteCallback(self, result, error=False):
"""
Callback for the delete method.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while deleting {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
log.info("{} has been deleted".format(self.name()))
self.delete_signal.emit()
def update(self, new_settings):
"""
Updates the settings for this Ethernet switch.
:param new_settings: settings dictionary
"""
ports_to_update = {}
ports = new_settings["ports"]
for port_id in ports.keys():
if port_id in self._settings["ports"]:
if self._settings["ports"][port_id] != ports[port_id]:
print("Port {} has been updated".format(port_id))
for port in self._ports:
if port.port == port_id and not port.isFree():
ports_to_update[port_id] = ports[port_id]
break
continue
port = EthernetPort(str(port_id))
port.port = port_id
self._ports.append(port)
if ports_to_update:
params = {"id": self._ethsw_id,
"ports": {}}
for port_id, info in ports_to_update.items():
params["ports"][port_id] = info
self._server.send_message("dynamips.ethsw.update", params, self.updateCallback)
self._settings["ports"] = new_settings["ports"].copy()
def updateCallback(self, response, error=False):
print(response)
def allocateUDPPort(self):
"""
Requests an UDP port allocation.
"""
log.debug("{} is requesting an UDP port allocation".format(self.name()))
self._server.send_message("dynamips.ethsw.allocate_udp_port", {"id": self._ethsw_id}, self._allocateUDPPortCallback)
def _allocateUDPPortCallback(self, result, error=False):
"""
Callback for allocateUDPPort.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while allocating an UDP port for {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
lhost = result["lhost"]
lport = result["lport"]
log.info("{} has allocated UDP port {} for host {}".format(self.name(), lport, lhost))
self.allocate_udp_nio_signal.emit(self.id, lport, lhost)
def addNIO(self, port, nio):
"""
Adds a new NIO on the specified port for this router.
:param port: Port object.
:param nio: NIO object.
"""
port_info = self._settings["ports"][port.port]
if isinstance(nio, NIO_UDP):
params = {"id": self._ethsw_id,
"nio": "NIO_UDP",
"port": port.port,
"vlan": port_info["vlan"],
"port_type": port_info["type"],
"lport": nio.lport,
"rhost": nio.rhost,
"rport": nio.rport}
log.debug("{} is adding an UDP NIO: {}".format(self.name(), params))
self._server.send_message("dynamips.ethsw.add_nio", params, self._addNIOCallback)
def _addNIOCallback(self, result, error=False):
"""
Callback for addNIO.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while adding an UDP NIO for {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
self.nio_signal.emit(self.id)
def deleteNIO(self, port):
params = {"id": self._ethsw_id,
"port": port.port}
port.nio = None
self._server.send_message("dynamips.ethsw.delete_nio", params, self.deleteNIOCallback)
def deleteNIOCallback(self, result, error=False):
print("NIO deleted!")
print(result)
def name(self):
"""
Returns the name of this router.
:returns: name (string)
"""
return self._settings["name"]
def settings(self):
"""
Returns all this router settings.
:returns: settings dictionary
"""
return self._settings
def ports(self):
"""
Returns all the ports for this router.
:returns: list of Port objects
"""
return self._ports
def configPage(self):
"""
Returns the configuration page widget to be used by the node configurator.
:returns: QWidget object.
"""
from ..pages.ethernet_switch_configuration_page import EthernetSwitchConfigurationPage
return EthernetSwitchConfigurationPage
@staticmethod
def defaultSymbol():
"""
Returns the default symbol path for this node.
:returns: symbol path (or resource).
"""
return ":/symbols/ethernet_switch.normal.svg"
@staticmethod
def hoverSymbol():
"""
Returns the symbol to use when this node is hovered.
:returns: symbol path (or resource).
"""
return ":/symbols/ethernet_switch.selected.svg"
@staticmethod
def symbolName():
return "Ethernet switch"
def __str__(self):
return "Ethernet switch"

View File

@@ -0,0 +1,277 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dynamips FRSW implementation on the client side.
Asynchronously sends JSON messages to the GNS3 server and receives responses with callbacks.
"""
from gns3.node import Node
from gns3.ports.serial_port import SerialPort
from gns3.nios.nio_udp import NIO_UDP
import logging
log = logging.getLogger(__name__)
class FrameRelaySwitch(Node):
"""
Dynamips Frame-Relay switch.
:param server: GNS3 server instance
"""
def __init__(self, server):
Node.__init__(self)
self._server = server
self._frsw_id = None
self._ports = []
self._settings = {"name": "",
"mapping": {}}
def setup(self, name=None):
"""
Setups this switch.
:param image: IOS image path
:param ram: amount of RAM
:param name: optional name for this router
"""
self._server.send_message("dynamips.frsw.create", None, self.setupCallback)
def setupCallback(self, response, error=False):
"""
Callback for the setup.
:param result: server response
:param error: ..
"""
self._frsw_id = response["id"]
self._settings["name"] = response["name"]
# let the GUI knows about this router name
self.newname_signal.emit(self._settings["name"])
def delete(self):
"""
Deletes this Frame Relay switch.
"""
# first delete all the links attached to this node
self.delete_links_signal.emit()
self._server.send_message("dynamips.frsw.delete", {"id": self._frsw_id}, self._deleteCallback)
def _deleteCallback(self, result, error=False):
"""
Callback for the delete method.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while deleting {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
log.info("{} has been deleted".format(self.name()))
self.delete_signal.emit()
def update(self, new_settings):
"""
Updates the settings for this Frame Relay switch.
:param new_settings: settings dictionary
"""
ports_to_create = []
mapping = new_settings["mapping"]
for source, destination in mapping.items():
source_port = source.split(":")[0]
destination_port = destination.split(":")[0]
if source_port not in ports_to_create:
ports_to_create.append(source_port)
if destination_port not in ports_to_create:
ports_to_create.append(destination_port)
for port in self._ports.copy():
if port.isFree():
self._ports.remove(port)
else:
ports_to_create.remove(port.name)
for port_name in ports_to_create:
port = SerialPort(port_name)
port.port = int(port_name)
self._ports.append(port)
self._settings["mapping"] = new_settings["mapping"].copy()
# self._server.send_message("dynamips.ethsw.update", params, self.updateCallback)
def updateCallback(self, response, error=False):
print(response)
def allocateUDPPort(self):
"""
Requests an UDP port allocation.
"""
log.debug("{} is requesting an UDP port allocation".format(self.name()))
self._server.send_message("dynamips.frsw.allocate_udp_port", {"id": self._frsw_id}, self._allocateUDPPortCallback)
def _allocateUDPPortCallback(self, result, error=False):
"""
Callback for allocateUDPPort.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while allocating an UDP port for {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
lhost = result["lhost"]
lport = result["lport"]
log.info("{} has allocated UDP port {} for host {}".format(self.name(), lport, lhost))
self.allocate_udp_nio_signal.emit(self.id, lport, lhost)
def addNIO(self, port, nio):
"""
Adds a new NIO on the specified port for this Frame Relay switch.
:param port: Port object.
:param nio: NIO object.
"""
if isinstance(nio, NIO_UDP):
params = {"id": self._frsw_id,
"nio": "NIO_UDP",
"port": port.port,
"lport": nio.lport,
"rhost": nio.rhost,
"rport": nio.rport}
params["mapping"] = {}
for source, destination in self._settings["mapping"].items():
source_port = source.split(":")[0]
destination_port = destination.split(":")[0]
if port.name == source_port:
params["mapping"][source] = destination
if port.name == destination_port:
params["mapping"][destination] = source
log.debug("{} is adding an UDP NIO: {}".format(self.name(), params))
self._server.send_message("dynamips.frsw.add_nio", params, self._addNIOCallback)
def _addNIOCallback(self, result, error=False):
"""
Callback for addNIO.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while adding an UDP NIO for {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
self.nio_signal.emit(self.id)
def deleteNIO(self, port):
params = {"id": self._frsw_id,
"port": port.port}
port.nio = None
self._server.send_message("dynamips.frsw.delete_nio", params, self.deleteNIOCallback)
def deleteNIOCallback(self, result, error=False):
print("NIO deleted!")
print(result)
def name(self):
"""
Returns the name of this router.
:returns: name (string)
"""
return self._settings["name"]
def settings(self):
"""
Returns all this router settings.
:returns: settings dictionary
"""
return self._settings
def ports(self):
"""
Returns all the ports for this router.
:returns: list of Port objects
"""
return self._ports
def configPage(self):
"""
Returns the configuration page widget to be used by the node configurator.
:returns: QWidget object.
"""
from ..pages.frame_relay_switch_configuration_page import FrameRelaySwitchConfigurationPage
return FrameRelaySwitchConfigurationPage
@staticmethod
def defaultSymbol():
"""
Returns the default symbol path for this node.
:returns: symbol path (or resource).
"""
return ":/symbols/frame_relay_switch.normal.svg"
@staticmethod
def hoverSymbol():
"""
Returns the symbol to use when this node is hovered.
:returns: symbol path (or resource).
"""
return ":/symbols/frame_relay_switch.selected.svg"
@staticmethod
def symbolName():
return "Frame Relay switch"
def __str__(self):
return "Frame Relay switch"

View File

@@ -0,0 +1,517 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Base class for Dynamips router implementations on the client side.
Asynchronously sends JSON messages to the GNS3 server and receives responses with callbacks.
"""
from gns3.node import Node
from ..adapters import ADAPTER_MATRIX
from ..wics import WIC_MATRIX
import logging
log = logging.getLogger(__name__)
class Router(Node):
"""
Dynamips router (client implementation).
:param server: GNS3 server instance
:param platform: c7200, c3745, c3725, c3600, c2691, c2600 or c1700
"""
def __init__(self, server, platform="c7200"):
Node.__init__(self)
self._server = server
self._defaults = {}
self._ports = []
self._router_id = None
self._settings = {"name": "",
"platform": platform,
"image": "",
"ram": 128,
"nvram": 128,
"mmap": True,
"sparsemem": True,
"clock_divisor": 8,
"idlepc": "",
"idlemax": 1500,
"idlesleep": 30,
"exec_area": None,
"jit_sharing_group": None,
"disk0": 0,
"disk1": 0,
"confreg": '0x2102',
"console": None,
"aux": None,
"mac_addr": None,
"system_id": None,
"slot0": None,
"slot1": None,
"slot2": None,
"slot3": None,
"slot4": None,
"slot5": None,
"slot6": None,
"wic0": None,
"wic1": None,
"wic2": None}
#self._ethernet_wic_port_id = 0
#self._serial_wic_port_id = 0
def _addAdapterPorts(self, adapter, slot_id):
"""
:param adapter: adapter name
:param slot_id: slot identifier (integer)
"""
nb_ports = ADAPTER_MATRIX[adapter]["nb_ports"]
for port_id in range(0, nb_ports):
port = ADAPTER_MATRIX[adapter]["port"]
if "chassis" in self._settings and self._settings["chassis"] in ("1720", "1721", "1750"):
# these chassis show their interface without a slot number
port_name = port.longNameType() + str(port_id)
else:
port_name = port.longNameType() + str(slot_id) + "/" + str(port_id)
new_port = port(port_name)
new_port.slot = slot_id
new_port.port = port_id
self._ports.append(new_port)
def _removeAdapterPorts(self, slot_id):
for port in self._ports.copy():
if port.slot == slot_id:
self._ports.remove(port)
def _addWICPorts(self, wic, wic_slot_id):
"""
:param wic: WIC name
:param wic_slot_id: WIC slot identifier (integer)
"""
nb_ports = WIC_MATRIX[wic]["nb_ports"]
base = 16 * (wic_slot_id + 1)
for port_id in range(0, nb_ports):
port = WIC_MATRIX[wic]["port"]
port_name = port.longNameType() + str(base + port_id)
new_port = port(port_name)
# WICs are always in adapter slot 0.
new_port.slot = 0
# Dynamips WICs slot IDs start on a multiple of 16.
new_port.port = base + port_id
self._ports.append(new_port)
def _removeWICPorts(self, wic, wic_slot_id):
wic_ports_to_delete = []
nb_ports = WIC_MATRIX[wic]["nb_ports"]
base = 16 * (wic_slot_id + 1)
for port_id in range(0, nb_ports):
wic_ports_to_delete.append(base + port_id)
for port in self._ports.copy():
if port.slot == 0 and port.port in wic_ports_to_delete:
self._ports.remove(port)
def delete(self):
"""
Deletes this router.
"""
# first delete all the links attached to this node
self.delete_links_signal.emit()
self._server.send_message("dynamips.vm.delete", {"id": self._router_id}, self._deleteCallback)
def _deleteCallback(self, result, error=False):
"""
Callback for the delete method.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while deleting {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
log.info("{} has been deleted".format(self.name()))
self.delete_signal.emit()
def setup(self, image, ram, name=None):
"""
Setups this router.
:param image: IOS image path
:param ram: amount of RAM
:param name: optional name for this router
"""
#self._settings["image"] = ios_image["path"]
#self._settings["ram"] = ios_image["ram"]
#self._settings["idlepc"] = ios_image["idlepc"]
#TODO: handle startup-config
#if "chassis" in self._settings:
# self._settings["chassis"] = ios_image["chassis"]
platform = self._settings["platform"]
#image = self._settings["image"]
#ram = self._settings["ram"]
# Minimum settings to send to the server in order
# to create a new router
params = {"platform": platform,
"ram": ram,
"image": image}
# A name for this router is optional, the server
# will create one if there is no name set.
if name:
self._settings["name"] = name
params["name"] = name
self._server.send_message("dynamips.vm.create", params, self.setupCallback)
def setupCallback(self, response, error=False):
"""
Callback for the setup.
:param result: server response
:param error: ..
"""
if error:
#TODO: send errors to the GUI using a signal.
print(response)
return
self._router_id = response["id"]
# update the settings using the defaults sent by the server
self._defaults = response.copy()
for name, value in response.items():
if name in self._settings and self._settings[name] != value:
log.info("router setting up and updating {} from {} to {}".format(name, self._settings[name], value))
self._settings[name] = value
# insert default adapters
for name, value in self._settings.items():
if name.startswith("slot") and value:
slot_id = int(name[-1])
adapter = value
self._addAdapterPorts(adapter, slot_id)
# let the GUI knows about this router name
self.newname_signal.emit(self._settings["name"])
def update(self, new_settings):
"""
Updates the settings for this router.
:param new_settings: settings dictionary
"""
params = {"id": self._router_id}
for name, value in new_settings.items():
if name in self._settings and self._settings[name] != value:
params[name] = value
self._server.send_message("dynamips.vm.update", params, self.updateCallback)
def _updateWICNumbering(self):
wic_ethernet_port_count = 0
wic_serial_port_count = 0
for wic_slot_id in range(0, 3):
base = 16 * (wic_slot_id + 1)
wic_slot = "wic" + str(wic_slot_id)
if self._settings[wic_slot]:
wic = self._settings[wic_slot]
nb_ports = WIC_MATRIX[wic]["nb_ports"]
for port_id in range(0, nb_ports):
for port in self._ports:
if port.slot == 0 and port.port == base + port_id:
if port.linkType() == "Serial":
wic_port_id = wic_serial_port_count
wic_serial_port_count += 1
else:
wic_port_id = wic_ethernet_port_count
wic_ethernet_port_count += 1
if "chassis" in self._settings and self._settings["chassis"] in ("1720", "1721", "1750"):
# these chassis show their interface without a slot number
port.name = port.longNameType() + str(wic_port_id)
else:
port.name = port.longNameType() + "0/" + str(wic_port_id)
def updateCallback(self, response, error=False):
for name, value in response.items():
if name in self._settings and self._settings[name] != value:
log.info("{}: updating {} from {} to {}".format(self.name(), name, self._settings[name], value))
if name.startswith("slot"):
# add or remove adapters ports
slot_id = int(name[-1])
if value:
adapter = value
if adapter != self._settings[name]:
self._removeAdapterPorts(slot_id)
self._addAdapterPorts(adapter, slot_id)
elif self._settings[name]:
self._removeAdapterPorts(slot_id)
if name.startswith("wic"):
# create or remove WIC ports
wic_slot_id = int(name[-1])
if value:
wic = value
if self._settings[name] and wic != self._settings[name]:
self._removeWICPorts(self._settings[name], wic_slot_id)
self._addWICPorts(wic, wic_slot_id)
elif self._settings[name]:
self._removeWICPorts(self._settings[name], wic_slot_id)
self._settings[name] = value
self._updateWICNumbering()
def start(self):
"""
Starts this router.
"""
log.debug("{} is starting".format(self.name()))
self._server.send_message("dynamips.vm.start", {"id": self._router_id}, self._startCallback)
def _startCallback(self, result, error=False):
"""
Callback for start.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while starting {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
log.info("{} has started".format(self.name()))
self.started_signal.emit()
def stop(self):
"""
Stops this router.
"""
log.debug("{} is stopping".format(self.name()))
self._server.send_message("dynamips.vm.stop", {"id": self._router_id}, self._stopCallback)
def _stopCallback(self, result, error=False):
"""
Callback for stop.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while stopping {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
log.info("{} has stopped".format(self.name()))
self.stopped_signal.emit()
def suspend(self):
"""
Suspends this router.
"""
log.debug("{} is being suspended".format(self.name()))
self._server.send_message("dynamips.vm.suspend", {"id": self._router_id}, self._suspendCallback)
def _suspendCallback(self, result, error=False):
"""
Callback for suspend.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while suspending {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
log.info("{} has suspended".format(self.name()))
self.suspended_signal.emit()
def allocateUDPPort(self):
"""
Requests an UDP port allocation.
"""
log.debug("{} is requesting an UDP port allocation".format(self.name()))
self._server.send_message("dynamips.vm.allocate_udp_port", {"id": self._router_id}, self._allocateUDPPortCallback)
def _allocateUDPPortCallback(self, result, error=False):
"""
Callback for allocateUDPPort.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while allocating an UDP port for {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
lhost = result["lhost"]
lport = result["lport"]
log.info("{} has allocated UDP port {} for host {}".format(self.name(), lport, lhost))
self.allocate_udp_nio_signal.emit(self.id, lport, lhost)
def addNIO(self, port, nio):
"""
Adds a new NIO on the specified port for this router.
:param port: Port object.
:param nio: NIO object.
"""
nio_type = str(nio)
params = {"id": self._router_id,
"nio": nio_type,
"slot": port.slot,
"port": port.port}
if nio_type == "NIO_UDP":
# add NIO UDP params
params["lport"] = nio.lport
params["rhost"] = nio.rhost
params["rport"] = nio.rport
elif nio_type == "NIO_GenericEthernet":
# add NIO generic Ethernet param
params["ethernet_device"] = nio.ethernet_device
elif nio_type == "NIO_LinuxEthernet":
# add NIO Linux Ethernet param
params["ethernet_device"] = nio.ethernet_device
elif nio_type == "NIO_TAP":
# add NIO TAP param
params["tap_device"] = nio.tap_device
elif nio_type == "NIO_UNIX":
# add NIO UNIX params
params["local_file"] = nio.local_file
params["remote_file"] = nio.remote_file
elif nio_type == "NIO_VDE":
# add NIO VDE params
params["control_file"] = nio.control_file
params["local_file"] = nio.local_file
log.debug("{} is adding an {}: {}".format(self.name(), nio_type, params))
self._server.send_message("dynamips.vm.add_nio", params, self._addNIOCallback)
def _addNIOCallback(self, result, error=False):
"""
Callback for addNIO.
:param result: server response
:param error: indicates an error (boolean)
"""
if error:
log.error("error while adding an UDP NIO for {}: {}".format(self.name(), result["message"]))
self.error_signal.emit(self.name(), result["code"], result["message"])
else:
self.nio_signal.emit(self.id)
def deleteNIO(self, port):
params = {"id": self._router_id,
"nio": "NIO_UDP",
"slot": port.slot,
"port": port.port}
port.nio = None
self._server.send_message("dynamips.vm.delete_nio", params, self.deleteNIOCallback)
def deleteNIOCallback(self, result, error=False):
print("NIO deleted!")
print(result)
def name(self):
"""
Returns the name of this router.
:returns: name (string)
"""
return self._settings["name"]
def settings(self):
"""
Returns all this router settings.
:returns: settings dictionary
"""
return self._settings
def ports(self):
"""
Returns all the ports for this router.
:returns: list of Port objects
"""
return self._ports
def configPage(self):
"""
Returns the configuration page widget to be used by the node configurator.
:returns: QWidget object.
"""
from ..pages.router_configuration_page import RouterConfigurationPage
return RouterConfigurationPage
@staticmethod
def defaultSymbol():
"""
Returns the default symbol path for this router.
:returns: symbol path (or resource).
"""
return ":/symbols/router.normal.svg"
@staticmethod
def hoverSymbol():
"""
Returns the symbol to use when the router is hovered.
:returns: symbol path (or resource).
"""
return ":/symbols/router.selected.svg"

View File

View File

@@ -0,0 +1,168 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Configuration page for Dynamips ATM bridges.
"""
import re
from gns3.qt import QtCore, QtGui
from ..ui.atm_bridge_configuration_page_ui import Ui_atmBridgeConfigPageWidget
class ATMBridgeConfigurationPage(QtGui.QWidget, Ui_atmBridgeConfigPageWidget):
"""
QWidget configuration page for ATM bridges.
"""
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
self._mapping = {}
# connect slots
self.uiAddPushButton.clicked.connect(self._addMappingSlot)
self.uiDeletePushButton.clicked.connect(self._deleteMappingSlot)
self.uiMappingTreeWidget.itemActivated.connect(self._mappingSelectedSlot)
self.uiMappingTreeWidget.itemSelectionChanged.connect(self._mappingSelectionChangedSlot)
# enable sorting
self.uiMappingTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
self.uiMappingTreeWidget.setSortingEnabled(True)
def _mappingSelectedSlot(self, item, column):
"""
Loads a selected mapping from the tree widget.
:param item: selected QTreeWidgetItem object
:param column: ignored
"""
ethernet_port = item.text(0)
destination = item.text(1)
mapping = re.compile(r"""^([0-9]*):([0-9]*):([0-9]*)$""")
match_atm_mapping = mapping.search(destination)
(atm_port, atm_vpi, atm_vci) = match_atm_mapping.group(1, 2, 3)
# source
self.uiEthernetPortSpinBox.setValue(int(ethernet_port))
# destination
self.uiATMPortSpinBox.setValue(int(atm_port))
self.uiATMVPISpinBox.setValue(int(atm_vpi))
self.uiATMVCISpinBox.setValue(int(atm_vci))
def _mappingSelectionChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiMappingTreeWidget.currentItem()
if item != None:
self.uiDeletePushButton.setEnabled(True)
else:
self.uiDeletePushButton.setEnabled(False)
def _addMappingSlot(self):
"""
Adds a new mapping.
"""
ethernet_port = self.uiEthernetPortSpinBox.value()
atm_port = self.uiATMPortSpinBox.value()
atm_vpi = self.uiATMVPISpinBox.value()
atm_vci = self.uiATMVCISpinBox.value()
if ethernet_port == atm_port:
QtGui.QMessageBox.critical(self, self._node.name(), "Same source and destination ports")
return
destination = "{port}:{vpi}:{vci}".format(port=atm_port,
vpi=atm_vpi,
vci=atm_vci)
if destination in self._mapping:
QtGui.QMessageBox.critical(self, self._node.name(), "Mapping already defined")
return
item = QtGui.QTreeWidgetItem(self.uiMappingTreeWidget)
item.setText(0, str(ethernet_port))
item.setText(1, destination)
self.uiMappingTreeWidget.addTopLevelItem(item)
self.uiEthernetPortSpinBox.setValue(ethernet_port + 1)
self.uiATMPortSpinBox.setValue(atm_port + 1)
self._mapping[ethernet_port] = destination
def _deleteMappingSlot(self):
"""
Deletes a mapping.
"""
item = self.uiMappingTreeWidget.currentItem()
if item:
ethernet_port = int(item.text(0))
atm_port = int(item.text(1).split(":")[0])
# check that a link isn't connected to these ports
# before we delete that mapping.
node_ports = self._node.ports()
for node_port in node_ports:
if (node_port.port == ethernet_port or node_port.port == atm_port) and not node_port.isFree():
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to port {}, please remove it first".format(node_port.port))
return
del self.mapping[ethernet_port]
self.uiMappingTreeWidget.takeTopLevelItem(self.uiMappingTreeWidget.indexOfTopLevelItem(item))
def loadSettings(self, settings, node):
"""
Loads the ATM bridge settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
self.uiMappingTreeWidget.clear()
self._mapping = {}
self._node = node
for ethernet_port, destination in settings["mapping"].items():
item = QtGui.QTreeWidgetItem(self.uiMappingTreeWidget)
item.setText(0, ethernet_port)
item.setText(1, destination)
self.uiMappingTreeWidget.addTopLevelItem(item)
self._mapping[ethernet_port] = destination
self.uiMappingTreeWidget.resizeColumnToContents(0)
self.uiMappingTreeWidget.resizeColumnToContents(1)
def saveSettings(self, settings, node):
"""
Saves the ATM bridge settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
# these setting cannot be shared by nodes and updated
# in the node configurator.
if "name" in settings:
del settings["name"]
settings["mapping"] = self._mapping.copy()

View File

@@ -0,0 +1,188 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Configuration page for Dynamips ATM switches.
"""
import re
from gns3.qt import QtCore, QtGui
from ..ui.atm_switch_configuration_page_ui import Ui_atmSwitchConfigPageWidget
class ATMSwitchConfigurationPage(QtGui.QWidget, Ui_atmSwitchConfigPageWidget):
"""
QWidget configuration page for ATM switches.
"""
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
self._mapping = {}
# connect slots
self.uiAddPushButton.clicked.connect(self._addMappingSlot)
self.uiDeletePushButton.clicked.connect(self._deleteMappingSlot)
self.uiMappingTreeWidget.itemActivated.connect(self._mappingSelectedSlot)
self.uiMappingTreeWidget.itemSelectionChanged.connect(self._mappingSelectionChangedSlot)
# enable sorting
self.uiMappingTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
self.uiMappingTreeWidget.setSortingEnabled(True)
def _mappingSelectedSlot(self, item, column):
"""
Loads a selected mapping from the tree widget.
:param item: selected QTreeWidgetItem object
:param column: ignored
"""
source = item.text(0)
destination = item.text(1)
mapping = re.compile(r"""^([0-9]*):([0-9]*):([0-9]*)$""")
match_source_mapping = mapping.search(source)
match_destination_mapping = mapping.search(destination)
if match_source_mapping and match_destination_mapping:
self.uiVPICheckBox.setCheckState(QtCore.Qt.Unchecked)
(source_port, source_vpi, source_vci) = match_source_mapping.group(1, 2, 3)
(destination_port, destination_vpi, destination_vci) = match_destination_mapping.group(1, 2, 3)
else:
self.uiVPICheckBox.setCheckState(QtCore.Qt.Checked)
(source_port, source_vpi) = source.split(':')
(destination_port, destination_vpi) = destination.split(':')
source_vci = destination_vci = 0
# source
self.uiSourcePortSpinBox.setValue(int(source_port))
self.uiSourceVPISpinBox.setValue(int(source_vpi))
self.uiSourceVCISpinBox.setValue(int(source_vci))
# destination
self.uiDestinationPortSpinBox.setValue(int(destination_port))
self.uiDestinationVPISpinBox.setValue(int(destination_vpi))
self.uiDestinationVCISpinBox.setValue(int(destination_vci))
def _mappingSelectionChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiMappingTreeWidget.currentItem()
if item != None:
self.uiDeletePushButton.setEnabled(True)
else:
self.uiDeletePushButton.setEnabled(False)
def _addMappingSlot(self):
"""
Adds a new mapping.
"""
source_port = self.uiSourcePortSpinBox.value()
source_vpi = self.uiSourceVPISpinBox.value()
source_vci = self.uiSourceVCISpinBox.value()
destination_port = self.uiDestinationPortSpinBox.value()
destination_vpi = self.uiDestinationVPISpinBox.value()
destination_vci = self.uiDestinationVCISpinBox.value()
if self.uiVPICheckBox.checkState() == QtCore.Qt.Unchecked:
source = "{port}:{vpi}:{vci}".format(port=source_port,
vpi=source_vpi,
vci=source_vci)
destination = "{port}:{vpi}:{vci}".format(port=destination_port,
vpi=destination_vpi,
vci=destination_vci)
else:
source = "{port}:{vpi}".format(port=source_port, vpi=source_vpi)
destination = "{port}:{vpi}".format(port=destination_port, vpi=destination_vpi)
if source in self._mapping or destination in self._mapping:
QtGui.QMessageBox.critical(self, self._node.name(), "Mapping already defined")
return
item = QtGui.QTreeWidgetItem(self.uiMappingTreeWidget)
item.setText(0, source)
item.setText(1, destination)
self.uiMappingTreeWidget.addTopLevelItem(item)
self.uiSourcePortSpinBox.setValue(source_port + 1)
self.uiDestinationPortSpinBox.setValue(destination_port + 1)
self._mapping[source] = destination
def _deleteMappingSlot(self):
"""
Deletes a mapping.
"""
item = self.uiMappingTreeWidget.currentItem()
if item:
source = item.text(0)
source_port = int(source.split(':')[0])
destination = item.text(1)
destination_port = int(destination.split(':')[0])
# check that a link isn't connected to these ports
# before we delete that mapping
node_ports = self._node.ports()
for node_port in node_ports:
if (node_port.port == source_port or node_port.port == destination_port) and not node_port.isFree():
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to port {}, please remove it first".format(node_port.port))
return
del self._mapping[source]
self.uiMappingTreeWidget.takeTopLevelItem(self.uiMappingTreeWidget.indexOfTopLevelItem(item))
def loadSettings(self, settings, node):
"""
Loads the ATM switch settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
self.uiMappingTreeWidget.clear()
self._mapping = {}
self._node = node
for source, destination in settings["mapping"].items():
item = QtGui.QTreeWidgetItem(self.uiMappingTreeWidget)
item.setText(0, source)
item.setText(1, destination)
self.uiMappingTreeWidget.addTopLevelItem(item)
self._mapping[source] = destination
self.uiMappingTreeWidget.resizeColumnToContents(0)
self.uiMappingTreeWidget.resizeColumnToContents(1)
def saveSettings(self, settings, node):
"""
Saves the ATM switch settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
# these setting cannot be shared by nodes and updated
# in the node configurator.
if "name" in settings:
del settings["name"]
settings["mapping"] = self._mapping.copy()

View File

@@ -0,0 +1,512 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Configuration page for clouds.
"""
import re
from gns3.qt import QtGui
from ..ui.cloud_configuration_page_ui import Ui_cloudConfigPageWidget
class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
"""
QWidget configuration page for clouds.
"""
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
self._nios = []
# connect NIO generic Ethernet slots
self.uiGenericEthernetComboBox.currentIndexChanged.connect(self._genericEthernetSelectedSlot)
self.uiGenericEthernetListWidget.itemSelectionChanged.connect(self._genericEthernetChangedSlot)
self.uiAddGenericEthernetPushButton.clicked.connect(self._genericEthernetAddSlot)
self.uiDeleteGenericEthernetPushButton.clicked.connect(self._genericEthernetDeleteSlot)
# connect NIO Linux Ethernet slots
self.uiLinuxEthernetComboBox.currentIndexChanged.connect(self._linuxEthernetSelectedSlot)
self.uiLinuxEthernetListWidget.itemSelectionChanged.connect(self._linuxEthernetChangedSlot)
self.uiAddLinuxEthernetPushButton.clicked.connect(self._linuxEthernetAddSlot)
self.uiDeleteLinuxEthernetPushButton.clicked.connect(self._linuxEthernetDeleteSlot)
# connect NIO UDP slots
self.uiNIOUDPListWidget.currentRowChanged.connect(self._NIOUDPSelectedSlot)
self.uiNIOUDPListWidget.itemSelectionChanged.connect(self._NIOUDPChangedSlot)
self.uiAddNIOUDPPushButton.clicked.connect(self._NIOUDPAddSlot)
self.uiDeleteNIOUDPPushButton.clicked.connect(self._NIOUDPDeleteSlot)
# connect NIO TAP slots
self.uiNIOTAPListWidget.currentRowChanged.connect(self._NIOTAPSelectedSlot)
self.uiNIOTAPListWidget.itemSelectionChanged.connect(self._NIOTAPChangedSlot)
self.uiAddNIOTAPPushButton.clicked.connect(self._NIOTAPAddSlot)
self.uiDeleteNIOTAPPushButton.clicked.connect(self._NIOTAPDeleteSlot)
# connect NIO UNIX slots
self.uiNIOUNIXListWidget.currentRowChanged.connect(self._NIOUNIXSelectedSlot)
self.uiNIOUNIXListWidget.itemSelectionChanged.connect(self._NIOUNIXChangedSlot)
self.uiAddNIOUNIXPushButton.clicked.connect(self._NIOUNIXAddSlot)
self.uiDeleteNIOUNIXPushButton.clicked.connect(self._NIOUNIXDeleteSlot)
# connect NIO VDE slots
self.uiNIOVDEListWidget.currentRowChanged.connect(self._NIOVDESelectedSlot)
self.uiNIOVDEListWidget.itemSelectionChanged.connect(self._NIOVDEChangedSlot)
self.uiAddNIOVDEPushButton.clicked.connect(self._NIOVDEAddSlot)
self.uiDeleteNIOVDEPushButton.clicked.connect(self._NIOVDEDeleteSlot)
# connect NIO NULL slots
self.uiNIONullListWidget.currentRowChanged.connect(self._NIONullSelectedSlot)
self.uiNIONullListWidget.itemSelectionChanged.connect(self._NIONullChangedSlot)
self.uiAddNIONullPushButton.clicked.connect(self._NIONullAddSlot)
self.uiDeleteNIONullPushButton.clicked.connect(self._NIONullDeleteSlot)
def _genericEthernetSelectedSlot(self, index):
"""
Loads the selected generic Ethernet interface in lineEdit.
:param index: ignored
"""
self.uiGenericEthernetLineEdit.setText(self.uiGenericEthernetComboBox.currentText())
def _genericEthernetChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiGenericEthernetListWidget.currentItem()
if item:
self.uiDeleteGenericEthernetPushButton.setEnabled(True)
else:
self.uiDeleteGenericEthernetPushButton.setEnabled(False)
def _genericEthernetAddSlot(self):
"""
Adds a new generic Ethernet NIO.
"""
interface = self.uiGenericEthernetLineEdit.text()
if interface:
nio = "nio_gen_eth:{interface}".format(interface=interface.lower())
if not nio in self._nios:
self.uiGenericEthernetListWidget.addItem(nio)
self._nios.append(nio)
def _genericEthernetDeleteSlot(self):
"""
Deletes the selected generic Ethernet NIO.
"""
item = self.uiGenericEthernetListWidget.currentItem()
if item:
nio = item.text()
# check we can delete that NIO
node_ports = self._node.ports()
for node_port in node_ports:
if node_port.name == nio and not node_port.isFree():
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
return
self._nios.remove(nio)
self.uiGenericEthernetListWidget.takeItem(self.uiGenericEthernetListWidget.currentRow())
def _linuxEthernetSelectedSlot(self, index):
"""
Loads the selected Linux interface in lineEdit.
:param index: ignored
"""
self.uiLinuxEthernetLineEdit.setText(self.uiLinuxEthernetComboBox.currentText())
def _linuxEthernetChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiLinuxEthernetListWidget.currentItem()
if item:
self.uiDeleteLinuxEthernetPushButton.setEnabled(True)
else:
self.uiDeleteLinuxEthernetPushButton.setEnabled(False)
def _linuxEthernetAddSlot(self):
"""
Adds a new Linux Ethernet NIO.
"""
interface = self.uiLinuxEthernetLineEdit.text()
if interface:
nio = "nio_gen_linux:{interface}".format(interface=interface.lower())
if not nio in self._nios:
self.uiLinuxEthernetListWidget.addItem(nio)
self._nios.append(nio)
def _linuxEthernetDeleteSlot(self):
"""
Deletes the selected Linux Ethernet NIO.
"""
item = self.uiLinuxEthernetListWidget.currentItem()
if item:
nio = item.text()
# check we can delete that NIO
node_ports = self._node.ports()
for node_port in node_ports:
if node_port.name == nio and not node_port.isFree():
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
return
self._nios.remove(nio)
self.uiLinuxEthernetListWidget.takeItem(self.uiLinuxEthernetListWidget.currentRow())
def _NIOUDPSelectedSlot(self, index):
"""
Loads a selected UDP.
"""
item = self.uiNIOUDPListWidget.currentItem()
if item:
nio = item.text()
match = re.search(r"""^nio_udp:(\d+):(.+):(\d+)$""", nio)
if match:
self.uiLocalPortSpinBox.setValue(int(match.group(1)))
self.uiRemoteHostLineEdit.setText(match.group(2))
self.uiRemotePortSpinBox.setValue(int(match.group(3)))
def _NIOUDPChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiNIOUDPListWidget.currentItem()
if item:
self.uiDeleteNIOUDPPushButton.setEnabled(True)
else:
self.uiDeleteNIOUDPPushButton.setEnabled(False)
def _NIOUDPAddSlot(self):
"""
Adds a new UDP NIO.
"""
local_port = self.uiLocalPortSpinBox.value()
remote_host = self.uiRemoteHostLineEdit.text()
remote_port = self.uiRemotePortSpinBox.value()
if remote_host:
nio = "nio_udp:{lport}:{rhost}:{rport}".format(lport=local_port,
rhost=remote_host,
rport=remote_port)
if not nio in self._nios:
self.uiNIOUDPListWidget.addItem(nio)
self._nios.append(nio)
self.uiLocalPortSpinBox.setValue(local_port + 1)
self.uiRemotePortSpinBox.setValue(remote_port + 1)
def _NIOUDPDeleteSlot(self):
"""
Deletes an UDP NIO.
"""
item = self.uiNIOUDPListWidget.currentItem()
if item:
nio = item.text()
# check we can delete that NIO
node_ports = self._node.ports()
for node_port in node_ports:
if node_port.name == nio and not node_port.isFree():
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
return
self._nios.remove(nio)
self.uiNIOUDPListWidget.takeItem(self.uiNIOUDPListWidget.currentRow())
def _NIOTAPSelectedSlot(self, index):
"""
Loads the selected NIO TAP in lineEdit.
:param index: ignored
"""
item = self.uiNIOTAPListWidget.currentItem()
if item:
nio = item.text()
match = re.search(r"""^nio_tap:(.+)$""", nio)
if match:
self.uiNIOTAPLineEdit.setText(match.group(1))
def _NIOTAPChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiNIOTAPListWidget.currentItem()
if item:
self.uiDeleteNIOTAPPushButton.setEnabled(True)
else:
self.uiDeleteNIOTAPPushButton.setEnabled(False)
def _NIOTAPAddSlot(self):
"""
Adds a new UDP NIO.
"""
tap_interface = self.uiNIOTAPLineEdit.text()
if tap_interface:
nio = "nio_tap:{}".format(tap_interface.lower())
if not nio in self._nios:
self.uiNIOTAPListWidget.addItem(nio)
self._nios.append(nio)
def _NIOTAPDeleteSlot(self):
"""
Deletes a TAP NIO.
"""
item = self.uiNIOTAPListWidget.currentItem()
if item:
nio = item.text()
# check we can delete that NIO
node_ports = self._node.ports()
for node_port in node_ports:
if node_port.name == nio and not node_port.isFree():
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
return
self._nios.remove(nio)
self.uiNIOTAPListWidget.takeItem(self.uiNIOTAPListWidget.currentRow())
def _NIOUNIXSelectedSlot(self, index):
"""
Loads a selected UNIX NIO.
:param index: ignored
"""
item = self.uiNIOUNIXListWidget.currentItem()
if item:
nio = item.text()
match = re.search(r"""^nio_unix:(.+):(.+)$""", nio)
if match:
self.uiLocalFileLineEdit.setText(match.group(1))
self.uiRemoteFileLineEdit.setText(match.group(2))
def _NIOUNIXChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiNIOUNIXListWidget.currentItem()
if item:
self.uiDeleteNIOUNIXPushButton.setEnabled(True)
else:
self.uiDeleteNIOUNIXPushButton.setEnabled(False)
def _NIOUNIXAddSlot(self):
"""
Adds a new UNIX NIO.
"""
local_file = self.uiLocalFileLineEdit.text()
remote_file = self.uiRemoteFileLineEdit.text()
if local_file and remote_file:
nio = "nio_unix:{local}:{remote}".format(local=local_file,
remote=remote_file)
if not nio in self._nios:
self.uiNIOUNIXListWidget.addItem(nio)
self._nios.append(nio)
def _NIOUNIXDeleteSlot(self):
"""
Deletes an UNIX NIO.
"""
item = self.uiNIOUNIXListWidget.currentItem()
if item:
nio = item.text()
# check we can delete that NIO
node_ports = self._node.ports()
for node_port in node_ports:
if node_port.name == nio and not node_port.isFree():
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
return
self._nios.remove(nio)
self.uiNIOUNIXListWidget.takeItem(self.uiNIOUNIXListWidget.currentRow())
def _NIOVDESelectedSlot(self, index):
"""
Loads a selected VDE NIO.
:param index: ignored
"""
item = self.uiNIOVDEListWidget.currentItem()
if item:
nio = item.text()
match = re.search(r"""^nio_vde:(.+):(.+)$""", nio)
if match:
self.uiVDEControlFileLineEdit.setText(match.group(1))
self.uiVDELocalFileLineEdit.setText(match.group(2))
def _NIOVDEChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiNIOVDEListWidget.currentItem()
if item:
self.uiDeleteNIOVDEPushButton.setEnabled(True)
else:
self.uiDeleteNIOVDEPushButton.setEnabled(False)
def _NIOVDEAddSlot(self):
"""
Adds a new VDE NIO.
"""
control_file = self.uiVDEControlFileLineEdit.text()
local_file = self.uiVDELocalFileLineEdit.text()
if local_file and control_file:
nio = "nio_vde:{control}:{local}".format(control=control_file, local=local_file)
if not nio in self._nios:
self.uiNIOVDEListWidget.addItem(nio)
self._nios.append(nio)
def _NIOVDEDeleteSlot(self):
"""
Deletes a VDE NIO.
"""
item = self.uiNIOVDEListWidget.currentItem()
if item:
nio = item.text()
# check we can delete that NIO
node_ports = self._node.ports()
for node_port in node_ports:
if node_port.name == nio and not node_port.isFree():
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
return
self._nios.remove(nio)
self.uiNIOVDEListWidget.takeItem(self.uiNIOVDEListWidget.currentRow())
def _NIONullSelectedSlot(self, index):
"""
Loads a selected NULL NIO.
"""
item = self.uiNIONullListWidget.currentItem()
if item:
nio = item.text()
match = re.search(r"""^nio_null:(.+)$""", nio)
if match:
self.uiNIONullIdentiferLineEdit.setText(match.group(1))
def _NIONullChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiNIONullListWidget.currentItem()
if item:
self.uiDeleteNIONullPushButton.setEnabled(True)
else:
self.uiDeleteNIONullPushButton.setEnabled(False)
def _NIONullAddSlot(self):
"""
Adds a new NULL NIO.
"""
identifier = self.uiNIONullIdentiferLineEdit.text()
if identifier:
nio = "nio_null:{}".format(identifier)
if not nio in self._nios:
self.uiNIONullListWidget.addItem(nio)
self._nios.append(nio)
def _NIONullDeleteSlot(self):
"""
Deletes a NULL NIO.
"""
item = self.uiNIONullListWidget.currentItem()
if item:
nio = item.text()
# check we can delete that NIO
node_ports = self._node.ports()
for node_port in node_ports:
if node_port.name == nio and not node_port.isFree():
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to NIO {}, please remove it first".format(nio))
return
self._nios.remove(nio)
self.uiNIONullListWidget.takeItem(self.uiNIONullListWidget.currentRow())
def loadSettings(self, settings, node, parent):
"""
Loads the cloud settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
self._node = node
# load all network interfaces
self.uiGenericEthernetComboBox.clear()
self.uiGenericEthernetComboBox.addItems(settings["interfaces"])
self.uiGenericEthernetComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
# load all network interfaces
self.uiLinuxEthernetComboBox.clear()
self.uiLinuxEthernetComboBox.addItems(settings["interfaces"])
self.uiLinuxEthernetComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
# populate the NIO lists
self.nios = []
self.uiGenericEthernetListWidget.clear()
self.uiLinuxEthernetListWidget.clear()
self.uiNIOUDPListWidget.clear()
self.uiNIOTAPListWidget.clear()
self.uiNIOUNIXListWidget.clear()
self.uiNIOVDEListWidget.clear()
self.uiNIONullListWidget.clear()
for nio in settings["nios"]:
self._nios.append(nio)
if nio.lower().startswith("nio_gen_eth"):
self.uiGenericEthernetListWidget.addItem(nio)
elif nio.lower().startswith("nio_gen_linux"):
self.uiLinuxEthernetListWidget.addItem(nio)
elif nio.lower().startswith("nio_udp"):
self.uiNIOUDPListWidget.addItem(nio)
elif nio.lower().startswith("nio_tap"):
self.uiNIOTAPListWidget.addItem(nio)
elif nio.lower().startswith("nio_unix"):
self.uiNIOUNIXListWidget.addItem(nio)
elif nio.lower().startswith("nio_vde"):
self.uiNIOVDEListWidget.addItem(nio)
elif nio.lower().startswith("nio_null"):
self.uiNIONullListWidget.addItem(nio)
def saveSettings(self, settings, node):
"""
Saves the cloud settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
settings["nios"] = list(self._nios)

View File

@@ -0,0 +1,145 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Configuration page for Dynamips preferences.
"""
from gns3.qt import QtGui
from gns3.servers import Servers
from .. import Dynamips
from ..ui.dynamips_preferences_page_ui import Ui_DynamipsPreferencesPageWidget
from ..settings import DYNAMIPS_SETTINGS
class DynamipsPreferencesPage(QtGui.QWidget, Ui_DynamipsPreferencesPageWidget):
"""
QWidget preference page for Dynamips.
"""
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
# connect signals
self.uiAllocateHypervisorPerDeviceCheckBox.stateChanged.connect(self._allocateHypervisorPerDeviceSlot)
self.uiGhostIOSSupportCheckBox.stateChanged.connect(self._ghostIOSSupportSlot)
self.uiRestoreDefaultsPushButton.clicked.connect(self._restoreDefaultsSlot)
self.uiUseLocalServercheckBox.stateChanged.connect(self._useLocalServerSlot)
def _allocateHypervisorPerDeviceSlot(self, state):
"""
Slot to enable or not the memory usage limit per hypervisor and
the per IOS allocation, based if the user want one hypervisor per IOS router.
:param state: state of the allocate hypervisor per device checkBox
"""
if state:
self.uiMemoryUsageLimitPerHypervisorSpinBox.setEnabled(False)
self.uiAllocateHypervisorPerIOSCheckBox.setEnabled(False)
else:
self.uiMemoryUsageLimitPerHypervisorSpinBox.setEnabled(True)
self.uiAllocateHypervisorPerIOSCheckBox.setEnabled(True)
def _ghostIOSSupportSlot(self, state):
"""
Slot to have the mmap checkBox checked if ghost IOS is checked.
Ghost IOS is dependent on the mmap feature.
:param state: state of the ghost IOS checkBox
"""
if state:
self.uiMmapSupportCheckBox.setChecked(True)
def _restoreDefaultsSlot(self):
"""
Slot to populate the page widgets with the default settings.
"""
self._populateWidgets(DYNAMIPS_SETTINGS)
def _useLocalServerSlot(self, state):
"""
Slot to enable or not the QTreeWidget for remote servers.
"""
if state:
self.uiRemoteServersTreeWidget.setEnabled(False)
else:
self.uiRemoteServersTreeWidget.setEnabled(True)
def _populateWidgets(self, settings):
"""
Populates the widgets with the settings.
:param settings: Dynamips settings
"""
self.uiDynamipsPathLineEdit.setText(settings["path"])
self.uiBaseHypervisorPortSpinBox.setValue(settings["base_hypervisor_port"])
self.uiBaseConsolePortSpinBox.setValue(settings["base_console_port"])
self.uiBaseAuxPortSpinBox.setValue(settings["base_aux_port"])
self.uiAllocateHypervisorPerDeviceCheckBox.setChecked(settings["allocate_hypervisor_per_device"])
self.uiMemoryUsageLimitPerHypervisorSpinBox.setValue(settings["memory_usage_limit_per_hypervisor"])
self.uiAllocateHypervisorPerIOSCheckBox.setChecked(settings["allocate_hypervisor_per_ios_image"])
self.uiBaseUDPPortSpinBox.setValue(settings["base_udp_port"])
self.uiBaseUDPPortIncrementationSpinBox.setValue(settings["udp_incrementation_per_hypervisor"])
self.uiGhostIOSSupportCheckBox.setChecked(settings["ghost_ios_support"])
self.uiMmapSupportCheckBox.setChecked(settings["mmap_support"])
self.uiJITSharingSupportCheckBox.setChecked(settings["jit_sharing_support"])
self.uiSparseMemorySupportCheckBox.setChecked(settings["sparse_memory_support"])
def loadPreferences(self):
"""
Loads the Dynamips preferences.
"""
dynamips_settings = Dynamips.instance().settings()
self._populateWidgets(dynamips_settings)
servers = Servers.instance()
self.uiRemoteServersTreeWidget.clear()
for server in servers.remoteServers().values():
host = server.host
port = server.port
item = QtGui.QTreeWidgetItem(self.uiRemoteServersTreeWidget)
item.setText(0, host)
item.setText(1, str(port))
def savePreferences(self):
"""
Saves the Dynamips preferences.
"""
new_settings = {}
new_settings["path"] = self.uiDynamipsPathLineEdit.text()
new_settings["base_hypervisor_port"] = self.uiBaseHypervisorPortSpinBox.value()
new_settings["base_console_port"] = self.uiBaseConsolePortSpinBox.value()
new_settings["base_aux_port"] = self.uiBaseAuxPortSpinBox.value()
new_settings["allocate_hypervisor_per_device"] = self.uiAllocateHypervisorPerDeviceCheckBox.isChecked()
new_settings["memory_usage_limit_per_hypervisor"] = self.uiMemoryUsageLimitPerHypervisorSpinBox.value()
new_settings["allocate_hypervisor_per_ios_image"] = self.uiAllocateHypervisorPerIOSCheckBox.isChecked()
new_settings["base_udp_port"] = self.uiBaseUDPPortSpinBox.value()
new_settings["udp_incrementation_per_hypervisor"] = self.uiBaseUDPPortIncrementationSpinBox.value()
new_settings["ghost_ios_support"] = self.uiGhostIOSSupportCheckBox.isChecked()
new_settings["mmap_support"] = self.uiMmapSupportCheckBox.isChecked()
new_settings["jit_sharing_support"] = self.uiJITSharingSupportCheckBox.isChecked()
new_settings["sparse_memory_support"] = self.uiSparseMemorySupportCheckBox.isChecked()
Dynamips.instance().setSettings(new_settings)

View File

@@ -0,0 +1,74 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Configuration page for Dynamips Ethernet hubs.
"""
from gns3.qt import QtGui
from gns3.node_configurator import ConfigurationError
from ..ui.ethernet_hub_configuration_page_ui import Ui_ethernetHubConfigPageWidget
class EthernetHubConfigurationPage(QtGui.QWidget, Ui_ethernetHubConfigPageWidget):
"""
QWidget configuration page for Ethernet hubs.
"""
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
def loadSettings(self, settings, node):
"""
Loads the Ethernet hub settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
nbports = len(settings["ports"])
self.uiPortsSpinBox.setValue(nbports)
def saveSettings(self, settings, node):
"""
Saves the Ethernet hub settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
# these setting cannot be shared by nodes and updated
# in the node configurator.
if "name" in settings:
del settings["name"]
nbports = self.uiPortsSpinBox.value()
# check that a link isn't connected to a port
# before we delete it
ports = node.ports()
for port in ports:
if not port.isFree() and port.port > nbports:
self.loadSettings(settings, node)
QtGui.QMessageBox.critical(self, node.name(), "A link is connected to port {}, please remove it first".format(port))
raise ConfigurationError()
settings["ports"] = []
for port in range(1, nbports + 1):
settings["ports"].append(str(port))

View File

@@ -0,0 +1,163 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Configuration page for Dynamips Ethernet switches.
"""
from gns3.qt import QtCore, QtGui
from ..ui.ethernet_switch_configuration_page_ui import Ui_ethernetSwitchConfigPageWidget
class EthernetSwitchConfigurationPage(QtGui.QWidget, Ui_ethernetSwitchConfigPageWidget):
"""
QWidget configuration page for Ethernet switches.
"""
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
self._ports = {}
# connect slots
self.uiAddPushButton.clicked.connect(self._addPortSlot)
self.uiDeletePushButton.clicked.connect(self._deletePortSlot)
self.uiPortsTreeWidget.itemActivated.connect(self._portSelectedSlot)
self.uiPortsTreeWidget.itemSelectionChanged.connect(self._portSelectionChangedSlot)
# enable sorting
self.uiPortsTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
self.uiPortsTreeWidget.setSortingEnabled(True)
def _portSelectedSlot(self, item, column):
"""
Loads a selected port from the tree widget.
:param item: selected QTreeWidgetItem object
:param column: ignored
"""
port = int(item.text(0))
vlan = int(item.text(1))
port_type = item.text(2)
self.uiPortSpinBox.setValue(port)
self.uiVlanSpinBox.setValue(vlan)
index = self.uiPortTypeComboBox.findText(port_type)
if index != -1:
self.uiPortTypeComboBox.setCurrentIndex(index)
def _portSelectionChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiPortsTreeWidget.currentItem()
if item:
self.uiDeletePushButton.setEnabled(True)
else:
self.uiDeletePushButton.setEnabled(False)
def _addPortSlot(self):
"""
Adds a new port.
"""
port = self.uiPortSpinBox.value()
vlan = self.uiVlanSpinBox.value()
port_type = self.uiPortTypeComboBox.currentText()
if port in self._ports:
# update a given entry in the tree widget
item = self.uiPortsTreeWidget.findItems(str(port), QtCore.Qt.MatchFixedString)[0]
item.setText(1, str(vlan))
item.setText(2, port_type)
else:
# add a new entry in the tree widget
item = QtGui.QTreeWidgetItem(self.uiPortsTreeWidget)
item.setText(0, str(port))
item.setText(1, str(vlan))
item.setText(2, port_type)
self.uiPortsTreeWidget.addTopLevelItem(item)
self._ports[port] = {"type": port_type,
"vlan": vlan}
self.uiPortSpinBox.setValue(max(self._ports) + 1)
self.uiPortsTreeWidget.resizeColumnToContents(0)
def _deletePortSlot(self):
"""
Deletes a port.
"""
item = self.uiPortsTreeWidget.currentItem()
if item:
port = int(item.text(0))
node_ports = self._node.ports()
for node_port in node_ports:
if node_port.port == port and not node_port.isFree():
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to port {}, please remove it first".format(port))
return
del self._ports[port]
self.uiPortsTreeWidget.takeTopLevelItem(self.uiPortsTreeWidget.indexOfTopLevelItem(item))
if len(self._ports):
self.uiPortSpinBox.setValue(max(self._ports) + 1)
else:
self.uiPortSpinBox.setValue(1)
def loadSettings(self, settings, node):
"""
Loads the Ethernet switch settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
self.uiPortsTreeWidget.clear()
self._ports = {}
self._node = node
for port, info in settings["ports"].items():
item = QtGui.QTreeWidgetItem(self.uiPortsTreeWidget)
item.setText(0, str(port))
item.setText(1, str(info["vlan"]))
item.setText(2, info["type"])
self.uiPortsTreeWidget.addTopLevelItem(item)
self._ports[port] = info
self.uiPortsTreeWidget.resizeColumnToContents(0)
self.uiPortsTreeWidget.resizeColumnToContents(1)
if len(self._ports) > 0:
self.uiPortSpinBox.setValue(max(self._ports) + 1)
def saveSettings(self, settings, node):
"""
Saves the Ethernet switch settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
# these setting cannot be shared by nodes and updated
# in the node configurator.
if "name" in settings:
del settings["name"]
settings["ports"] = self._ports.copy()

View File

@@ -0,0 +1,163 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Configuration page for Dynamips Frame Relay switches.
"""
from gns3.qt import QtCore, QtGui
from ..ui.frame_relay_switch_configuration_page_ui import Ui_frameRelaySwitchConfigPageWidget
class FrameRelaySwitchConfigurationPage(QtGui.QWidget, Ui_frameRelaySwitchConfigPageWidget):
"""
QWidget configuration page for Frame Relay switches.
"""
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
self._mapping = {}
# connect slots
self.uiAddPushButton.clicked.connect(self._addMappingSlot)
self.uiDeletePushButton.clicked.connect(self._deleteMappingSlot)
self.uiMappingTreeWidget.itemActivated.connect(self._mappingSelectedSlot)
self.uiMappingTreeWidget.itemSelectionChanged.connect(self._mappingSelectionChangedSlot)
# enable sorting
self.uiMappingTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
self.uiMappingTreeWidget.setSortingEnabled(True)
def _mappingSelectedSlot(self, item, column):
"""
Loads a selected mapping from the tree widget.
:param item: selected QTreeWidgetItem object
:param column: ignored
"""
(source_port, source_dlci) = item.text(0).split(':')
(destination_port, destination_dlci) = item.text(1).split(':')
self.uiSourcePortSpinBox.setValue(int(source_port))
self.uiSourceDLCISpinBox.setValue(int(source_dlci))
self.uiDestinationPortSpinBox.setValue(int(destination_port))
self.uiDestinationDLCISpinBox.setValue(int(destination_dlci))
def _mappingSelectionChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiMappingTreeWidget.currentItem()
if item != None:
self.uiDeletePushButton.setEnabled(True)
else:
self.uiDeletePushButton.setEnabled(False)
def _addMappingSlot(self):
"""
Adds a new mapping.
"""
source_port = self.uiSourcePortSpinBox.value()
source_dlci = self.uiSourceDLCISpinBox.value()
destination_port = self.uiDestinationPortSpinBox.value()
destination_dlci = self.uiDestinationDLCISpinBox.value()
if source_port == destination_port:
QtGui.QMessageBox.critical(self, self._node.name(), "Same source and destination ports")
return
source = "{port}:{dlci}".format(port=source_port, dlci=source_dlci)
destination = "{port}:{dlci}".format(port=destination_port, dlci=destination_dlci)
if source in self._mapping or destination in self._mapping:
QtGui.QMessageBox.critical(self, self._node.name(), "Mapping already defined")
return
item = QtGui.QTreeWidgetItem(self.uiMappingTreeWidget)
item.setText(0, source)
item.setText(1, destination)
self.uiMappingTreeWidget.addTopLevelItem(item)
self.uiSourcePortSpinBox.setValue(source_port + 1)
self.uiSourceDLCISpinBox.setValue(source_dlci + 1)
self.uiDestinationPortSpinBox.setValue(destination_port + 1)
self.uiDestinationDLCISpinBox.setValue(destination_dlci + 1)
self._mapping[source] = destination
def _deleteMappingSlot(self):
"""
Deletes a mapping.
"""
item = self.uiMappingTreeWidget.currentItem()
if item:
#connected_ports = self.node.getConnectedInterfaceList()
source = item.text(0)
source_port = int(source.split(':')[0])
destination = item.text(1)
destination_port = int(destination.split(':')[0])
# check that a link isn't connected to these ports
# before we delete that mapping
node_ports = self._node.ports()
for node_port in node_ports:
if (node_port.port == source_port or node_port.port == destination_port) and not node_port.isFree():
QtGui.QMessageBox.critical(self, self._node.name(), "A link is connected to port {}, please remove it first".format(node_port.port))
return
del self._mapping[source]
self.uiMappingTreeWidget.takeTopLevelItem(self.uiMappingTreeWidget.indexOfTopLevelItem(item))
def loadSettings(self, settings, node):
"""
Loads the Frame-Relay switch settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
self.uiMappingTreeWidget.clear()
self._mapping = {}
self._node = node
for source, destination in settings["mapping"].items():
item = QtGui.QTreeWidgetItem(self.uiMappingTreeWidget)
item.setText(0, source)
item.setText(1, destination)
self.uiMappingTreeWidget.addTopLevelItem(item)
self._mapping[source] = destination
self.uiMappingTreeWidget.resizeColumnToContents(0)
self.uiMappingTreeWidget.resizeColumnToContents(1)
def saveSettings(self, settings, node):
"""
Saves the Frame-Relay switch settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
# these setting cannot be shared by nodes and updated
# in the node configurator.
if "name" in settings:
del settings["name"]
settings["mapping"] = self._mapping.copy()

View File

@@ -0,0 +1,272 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Configuration page for IOS image & router preferences.
"""
import os
import sys
import re
from gns3.qt import QtGui
from .. import Dynamips
from ..ui.ios_router_preferences_page_ui import Ui_IOSRouterPreferencesPageWidget
# supported platforms with the default RAM value
PLATFORMS = {"c1700": 64,
"c2600": 64,
"c2691": 128,
"c3600": 128,
"c3725": 128,
"c3745": 128,
"c7200": 256}
# platforms with supported chassis
CHASSIS = {"c1700": ("1720", "1721", "1750", "1751", "1760"),
"c2600": ("2610", "2611", "2620", "2621", "2610XM", "2611XM", "2620XM", "2621XM", "2650XM", "2651XM"),
"c3600": ("3620", "3640", "3660")}
class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget):
"""
QWidget preference page for IOS images and routers.
"""
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
self._ios_images = {}
self.uiPlatformComboBox.currentIndexChanged[str].connect(self._platformChangedSlot)
self.uiPlatformComboBox.addItems(list(PLATFORMS.keys()))
self.uiSaveIOSImagePushButton.clicked.connect(self._iosImageSaveSlot)
self.uiDeleteIOSImagePushButton.clicked.connect(self._iosImageDeleteSlot)
self.uiIOSImagesTreeWidget.itemClicked.connect(self._iosImageClickedSlot)
self.uiIOSImagesTreeWidget.itemSelectionChanged.connect(self._iosImageChangedSlot)
self.uiIOSPathToolButton.clicked.connect(self._iosImageBrowserSlot)
self.uiStartupConfigToolButton.clicked.connect(self._startupConfigBrowserSlot)
self.uiIdlePCFinderPushButton.clicked.connect(self._idlePCFinderSlot)
self.uiIOSImageTestSettingsPushButton.clicked.connect(self._testSettingsSlot)
def _platformChangedSlot(self, platform):
"""
Updates the chassis comboBox based on the selected platform.
:param platform: selected router platform
"""
self.uiChassisComboBox.clear()
if platform in CHASSIS:
self.uiChassisComboBox.addItems(CHASSIS[platform])
def _iosImageClickedSlot(self, item, column):
"""
Loads a selected IOS image from the tree widget.
:param item: selected QTreeWidgetItem object
:param column: ignored
"""
image = item.text(0)
key = "{server}:{image}".format(server="local", image=image)
ios_image = self._ios_images[key]
self.uiIOSPathLineEdit.setText(ios_image["path"])
self.uiStartupConfigLineEdit.setText(ios_image["startup-config"])
index = self.uiPlatformComboBox.findText(ios_image["platform"])
if index != -1:
self.uiPlatformComboBox.setCurrentIndex(index)
index = self.uiChassisComboBox.findText(ios_image["chassis"])
if index != -1:
self.uiChassisComboBox.setCurrentIndex(index)
self.uiIdlePCLineEdit.setText(ios_image["idlepc"])
self.uiRAMSpinBox.setValue(ios_image["ram"])
def _iosImageChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiIOSImagesTreeWidget.currentItem()
if item:
self.uiDeleteIOSImagePushButton.setEnabled(True)
else:
self.uiDeleteIOSImagePushButton.setEnabled(False)
def _iosImageSaveSlot(self):
"""
Adds/Saves an IOS image.
"""
path = self.uiIOSPathLineEdit.text()
startup_config = self.uiStartupConfigLineEdit.text()
platform = self.uiPlatformComboBox.currentText()
chassis = self.uiChassisComboBox.currentText()
idlepc = self.uiIdlePCLineEdit.text()
ram = self.uiRAMSpinBox.value()
# basename doesn't work on Unix with Windows paths
if not sys.platform.startswith('win') and len(path) > 2 and path[1] == ":":
import ntpath
image = ntpath.basename(path)
else:
image = os.path.basename(path)
if image.startswith("c7200p"):
QtGui.QMessageBox.warning(self, "IOS Image", "This IOS image is for the c7200 platform with NPE-G2 and using it is not recommended.\nPlease use an IOS image that do not start with c7200p.")
#ios_images = Dynamips.instance().iosImages()
key = "{server}:{image}".format(server="local", image=image)
item = self.uiIOSImagesTreeWidget.currentItem()
if key in self._ios_images and item and item.text(0) == image:
item.setText(0, image)
item.setText(1, platform)
item.setText(2, "local")
elif key in self._ios_images:
print("Image already added")
return
else:
# add a new entry in the tree widget
item = QtGui.QTreeWidgetItem(self.uiIOSImagesTreeWidget)
item.setText(0, image)
item.setText(1, platform)
item.setText(2, "local")
self.uiIOSImagesTreeWidget.setCurrentItem(item)
self._ios_images[key] = {"path": path,
"image": image,
"startup-config": startup_config,
"platform": platform,
"chassis": chassis,
"idlepc": idlepc,
"ram": ram,
"server": "local"}
self.uiIOSImagesTreeWidget.resizeColumnToContents(0)
self.uiIOSImagesTreeWidget.resizeColumnToContents(1)
def _iosImageDeleteSlot(self):
"""
Deletes an IOS image.
"""
item = self.uiIOSImagesTreeWidget.currentItem()
if item:
image = item.text(0)
key = "{server}:{image}".format(server="local", image=image)
del self._ios_images[key]
self.uiIOSImagesTreeWidget.takeTopLevelItem(self.uiIOSImagesTreeWidget.indexOfTopLevelItem(item))
def _iosImageBrowserSlot(self):
"""
Slot to open a file browser and select an IOS image.
"""
#TODO: current directory for IOS image + filter?
path = QtGui.QFileDialog.getOpenFileName(self, "Select an IOS image", ".", "IOS image (*.bin *.image)")
if not path:
return
if not os.access(path, os.R_OK):
QtGui.QMessageBox.critical(self, "IOS image", "Cannot read {}".format(path))
return
if sys.platform.startswith('win'):
# Dynamips (Cygwin acutally) doesn't like non ascii paths on Windows
try:
path.encode('ascii')
except UnicodeEncodeError:
QtGui.QMessageBox.warning(self, "IOS image", "The IOS image filename should contains only ascii (English) characters.")
self.uiIOSPathLineEdit.clear()
self.uiIOSPathLineEdit.setText(path)
# try to guess the platform
image = os.path.basename(path)
match = re.match("^(c[0-9]+)\\-\w+", image)
if not match:
QtGui.QMessageBox.warning(self, "IOS image", "Could not detect the platform, make sure this is a valid IOS image!")
return
detected_platform = match.group(1)
if detected_platform not in PLATFORMS:
QtGui.QMessageBox.warning(self, "IOS image", "This IOS image is for the {} platform and is not supported by this application!".format(detected_platform))
return
index = self.uiPlatformComboBox.findText(detected_platform)
if index != -1:
self.uiPlatformComboBox.setCurrentIndex(index)
self.uiRAMSpinBox.setValue(PLATFORMS[detected_platform])
def _startupConfigBrowserSlot(self):
"""
Slot to open a file browser and select a startup-config file.
"""
#TODO: current directory for startup-config + filter?
path = QtGui.QFileDialog.getOpenFileName(self, "Select a startup configuration", ".")
if not path:
return
if not os.access(path, os.R_OK):
QtGui.QMessageBox.critical(self, "Startup configuration", "Cannot read {}".format(path))
return
if sys.platform.startswith('win'):
# Dynamips (Cygwin acutally) doesn't like non ascii paths on Windows
try:
path.encode('ascii')
except UnicodeEncodeError:
QtGui.QMessageBox.warning(self, "Startup configuration", "The startup configuration filename should contains only ascii (English) characters.")
self.uiStartupConfigLineEdit.clear()
self.uiStartupConfigLineEdit.setText(path)
def _idlePCFinderSlot(self):
QtGui.QMessageBox.critical(self, "Idle-PC finder", "Sorry, not yet implemented!")
def _testSettingsSlot(self):
QtGui.QMessageBox.critical(self, "Test settings", "Sorry, not yet implemented!")
def loadPreferences(self):
"""
Loads the IOS image & router preferences.
"""
self._ios_images.clear()
self.uiIOSImagesTreeWidget.clear()
ios_images = Dynamips.instance().iosImages()
for ios_image in ios_images.values():
item = QtGui.QTreeWidgetItem(self.uiIOSImagesTreeWidget)
item.setText(0, ios_image["image"])
item.setText(1, ios_image["platform"])
item.setText(2, "local")
self.uiIOSImagesTreeWidget.resizeColumnToContents(0)
self.uiIOSImagesTreeWidget.resizeColumnToContents(1)
self._ios_images.update(ios_images)
def savePreferences(self):
"""
Saves the IOS image & router preferences.
"""
Dynamips.instance().setIOSImages(self._ios_images)

View File

@@ -0,0 +1,423 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Configuration page for Dynamips IOS routers.
"""
import os
import re
from gns3.qt import QtGui
from gns3.node_configurator import ConfigurationError
from ..ui.router_configuration_page_ui import Ui_routerConfigPageWidget
# Network modules for the c2600 platform
C2600_NMS = (
"NM-1FE-TX",
"NM-1E",
"NM-4E",
"NM-16ESW"
)
# Network modules for the c3600 platform
C3600_NMS = (
"NM-1FE-TX",
"NM-1E",
"NM-4E",
"NM-16ESW",
"NM-4T"
)
# Network modules for the c3700 platform
C3700_NMS = (
"NM-1FE-TX",
"NM-4T",
"NM-16ESW",
)
# Port adapters for the c7200 platform
C7200_PAS = (
"PA-A1",
"PA-FE-TX",
"PA-2FE-TX",
"PA-GE",
"PA-4T+",
"PA-8T",
"PA-4E",
"PA-8E",
"PA-POS-OC3",
)
# I/O controller for the c7200 platform
IO_C7200 = ("C7200-IO-FE",
"C7200-IO-2FE",
"C7200-IO-GE-E"
)
"""
Build the adapter compatibility matrix:
ADAPTER_MATRIX = {
"c3600" : { # Router model
"3620" : { # Router chassis (if applicable)
{ 0 : ("NM-1FE-TX", "NM_1E", ...)
}
}
}
"""
ADAPTER_MATRIX = {}
for platform in ("c1700", "c2600", "c2691", "c3725", "c3745", "c3600", "c7200"):
ADAPTER_MATRIX[platform] = {}
# 1700s have one interface on the MB, 2 sub-slots for WICs, an no NM slots
for chassis in ("1720", "1721", "1750", "1751", "1760"):
ADAPTER_MATRIX["c1700"][chassis] = {0: "C1700-MB-1FE"}
# Add a fake NM in slot 1 on 1751s and 1760s to provide two WIC slots
for chassis in ("1751", "1760"):
ADAPTER_MATRIX["c1700"][chassis][1] = "C1700_MB_WIC1"
# 2600s have one or more interfaces on the MB , 2 subslots for WICs, and an available NM slot 1
for chassis in ("2620", "2610XM", "2620XM", "2650XM"):
ADAPTER_MATRIX["c2600"][chassis] = {0: "C2600-MB-1FE", 1: C2600_NMS}
for chassis in ("2620", "2610XM", "2620XM", "2650XM"):
ADAPTER_MATRIX["c2600"][chassis] = {0: "C2600-MB-2FE", 1: C2600_NMS}
ADAPTER_MATRIX["c1700"]["2610"] = {0: "C2600-MB-1E", 1: C2600_NMS}
ADAPTER_MATRIX["c1700"]["2611"] = {0: "C2600-MB-2E", 1: C2600_NMS}
# 2691s have two FEs on the motherboard and one NM slot
ADAPTER_MATRIX["c2691"][""] = {0: "GT96100-FE", 1: C3700_NMS}
# 3620s have two generic NM slots
ADAPTER_MATRIX["c3600"]["3620"] = {}
for slot in range(2):
ADAPTER_MATRIX["c3600"]["3620"][slot] = C3600_NMS
# 3640s have four generic NM slots
ADAPTER_MATRIX["c3600"]["3640"] = {}
for slot in range(4):
ADAPTER_MATRIX["c3600"]["3640"][slot] = C3600_NMS
# 3660s have 2 FEs on the motherboard and 6 generic NM slots
ADAPTER_MATRIX["c3600"]["3660"] = {0: "Leopard-2FE"}
for slot in range(1, 7):
ADAPTER_MATRIX["c3600"]["3660"][slot] = C3600_NMS
# 3725s have 2 FEs on the motherboard and 2 generic NM slots
ADAPTER_MATRIX["c3725"][""] = {0: "GT96100-FE"}
for slot in range(1, 3):
ADAPTER_MATRIX["c3725"][""][slot] = C3700_NMS
# 3745s have 2 FEs on the motherboard and 4 generic NM slots
ADAPTER_MATRIX["c3745"][""] = {0: "GT96100-FE"}
for slot in range(1, 5):
ADAPTER_MATRIX["c3745"][""][slot] = C3700_NMS
# 7206s allow an IO controller in slot 0, and a generic PA in slots 1-6
ADAPTER_MATRIX["c7200"][""] = {0: IO_C7200}
for slot in range(1, 7):
ADAPTER_MATRIX["c7200"][""][slot] = C7200_PAS
C1700_WICS = ("WIC-1T", "WIC-2T", "WIC-1ENET")
C2600_WICS = ("WIC-1T", "WIC-2T")
C3700_WICS = ("WIC-1T", "WIC-2T")
WIC_MATRIX = {}
WIC_MATRIX["c1700"] = {0: C1700_WICS, 1: C1700_WICS}
WIC_MATRIX["c2600"] = {0: C2600_WICS, 1: C2600_WICS, 2: C2600_WICS}
WIC_MATRIX["c2691"] = {0: C3700_WICS, 1: C3700_WICS, 2: C3700_WICS}
WIC_MATRIX["c3725"] = {0: C3700_WICS, 1: C3700_WICS, 2: C3700_WICS}
WIC_MATRIX["c3745"] = {0: C3700_WICS, 1: C3700_WICS, 2: C3700_WICS}
class RouterConfigurationPage(QtGui.QWidget, Ui_routerConfigPageWidget):
"""
QWidget configuration page for IOS routers.
"""
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
self._widget_slots = {0: self.uiSlot0comboBox,
1: self.uiSlot1comboBox,
2: self.uiSlot2comboBox,
3: self.uiSlot3comboBox,
4: self.uiSlot4comboBox,
5: self.uiSlot5comboBox,
6: self.uiSlot6comboBox}
self._widget_wics = {0: self.uiWic0comboBox,
1: self.uiWic1comboBox,
2: self.uiWic2comboBox}
def _loadAdapterConfig(self, platform, chassis, settings):
"""
Loads the adapter and WIC configuration.
:param platform: the router platform (string)
:param chassis: the router chassis (string)
:param settings: the router settings (dictionary)
"""
# clear all the slot combo boxes.
for widget in self._widget_slots.values():
widget.clear()
widget.setEnabled(False)
# load the available adapters to the correct slot for the corresponding platform and chassis
for slot_number, slot_adapters in ADAPTER_MATRIX[platform][chassis].items():
self._widget_slots[slot_number].setEnabled(True)
if type(slot_adapters) == str:
# only one default adapter for this slot.
self._widget_slots[slot_number].addItem(slot_adapters)
# elif platform == "c7200" and slot_number == 0 and settings["slot0"] != None:
# # special case
# self._widget_slots[slot_number].addItem(settings["slot0"])
else:
# list of adapters
module_list = list(slot_adapters)
self._widget_slots[slot_number].addItems([""] + module_list)
# set the combox box to the correct slot adapter if configured.
if settings["slot" + str(slot_number)]:
index = self._widget_slots[slot_number].findText(settings["slot" + str(slot_number)])
if (index != -1):
self._widget_slots[slot_number].setCurrentIndex(index)
# clear all the WIC combo boxes.
for widget in self._widget_wics.values():
widget.setEnabled(False)
widget.clear()
# load the available WICs to the correct slot for the corresponding platform
if platform in WIC_MATRIX:
for wic_number, wics in WIC_MATRIX[platform].items():
self._widget_wics[wic_number].setEnabled(True)
wic_list = list(wics)
self._widget_wics[wic_number].addItems([""] + wic_list)
# set the combox box to the correct WIC if configured.
if settings["wic" + str(wic_number)]:
index = self._widget_wics[wic_number].findText(settings["wic" + str(wic_number)])
if (index != -1):
self._widget_wics[wic_number].setCurrentIndex(index)
def loadSettings(self, settings, node):
"""
Loads the router settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
# show the platform and chassis if applicable
platform = settings["platform"]
chassis = ""
if "chassis" in settings:
chassis = settings["chassis"]
self.uiPlatformTextLabel.setText("{} (chassis: {})".format(platform, chassis))
else:
self.uiPlatformTextLabel.setText(platform)
# load the IOS image name without the full path
self.uiIOSImageTextLabel.setText(os.path.basename(settings["image"]))
#TODO: startup-config setting
self.uiStartupConfigTextLabel.setText("None")
if platform == "c7200":
# load the midplane and NPE settings
self.uiMidplaneComboBox.clear()
self.uiMidplaneComboBox.addItems(["std", "vxr"])
self.uiNPEComboBox.clear()
self.uiNPEComboBox.addItems(["npe-100", "npe-150", "npe-175", "npe-200", "npe-225", "npe-300", "npe-400", "npe-g2"])
if settings["midplane"]:
index = self.uiMidplaneComboBox.findText(settings["midplane"])
if index != -1:
self.uiMidplaneComboBox.setCurrentIndex(index)
if settings["npe"]:
index = self.uiNPEComboBox.findText(settings["npe"])
if index != -1:
self.uiNPEComboBox.setCurrentIndex(index)
# all platforms but c7200 have the iomem feature
# let"s hide these widgets.
self.uiIomemLabel.hide()
self.uiIomemSpinBox.hide()
else:
# hide the specific c7200 widgets.
self.uiMidplaneLabel.hide()
self.uiMidplaneComboBox.hide()
self.uiNPELabel.hide()
self.uiNPEComboBox.hide()
# load the I/O memory setting
self.uiIomemSpinBox.setValue(settings["iomem"])
# load the memories and disks settings
self.uiRamSpinBox.setValue(settings["ram"])
self.uiNvramSpinBox.setValue(settings["nvram"])
self.uiDisk0SpinBox.setValue(settings["disk0"])
self.uiDisk1SpinBox.setValue(settings["disk1"])
# load all the slots with configured adapters
self._loadAdapterConfig(platform, chassis, settings)
# load the configuration register setting
self.uiConfregLineEdit.setText(settings["confreg"])
# load the MAC address setting
if settings["mac_addr"]:
self.uiBaseMACLineEdit.setText(settings["mac_addr"])
else:
self.uiBaseMACLineEdit.clear()
# load the Exec Area setting
if settings["exec_area"]:
self.uiExecAreaSpinBox.setValue(settings["exec_area"])
#self.uiTabWidget.removeTab(0)
def _checkForLinkConnectedToAdapter(self, slot_number, settings, node):
"""
Checks if links are connected to an adapter.
:param slot_number: adapter slot number
:param settings: IOS router settings
:param node: Node object
"""
node_ports = node.ports()
for node_port in node_ports:
# ports > 15 are WICs ones.
if node_port.slot == slot_number and node_port.port <= 15 and not node_port.isFree():
adapter = settings["slot" + str(slot_number)]
index = self._widget_slots[slot_number].findText(adapter)
if (index != -1):
self._widget_slots[slot_number].setCurrentIndex(index)
QtGui.QMessageBox.critical(self, node.name(), "A link is connected to port {} on adapter {}, please remove it first".format(node_port.name,
adapter))
raise ConfigurationError()
def _checkForLinkConnectedToWIC(self, wic_number, settings, node):
"""
Checks if links are connected to a WIC.
:param wic_number: WIC slot number
:param settings: IOS router settings
:param node: Node object
"""
node_ports = node.ports()
for node_port in node_ports:
# ports > 15 are WICs ones.
if node_port.slot == wic_number and node_port.port > 15 and not node_port.isFree():
wic = settings["wic" + str(wic_number)]
index = self._widget_wics[wic_number].findText(wic)
if (index != -1):
self._widget_wics[wic_number].setCurrentIndex(index)
QtGui.QMessageBox.critical(self, node.name(), "A link is connected to port {} on {}, please remove it first".format(node_port.name,
wic))
raise ConfigurationError()
def saveSettings(self, settings, node):
"""
Saves the router settings.
:param settings: the settings (dictionary)
:param node: Node object
"""
# these settings cannot be shared by nodes and updated
# in the node configurator.
if "name" in settings:
del settings["name"]
if "console" in settings:
del settings["console"]
if "aux" in settings:
del settings["aux"]
#del self._settings["image"]
# get the platform and chassis if applicable
platform = settings["platform"]
chassis = ""
if "chassis" in settings:
chassis = settings["chassis"]
# check and save the base MAC address
mac = self.uiBaseMACLineEdit.text()
if mac and not re.search(r"""^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}$""", mac):
QtGui.QMessageBox.critical(self, "MAC address", "Invalid MAC address (format required: hh:hh:hh:hh:hh:hh)")
elif mac != "":
settings["mac_addr"] = mac
if platform == "c7200":
# save the midplane and NPE settings
settings["midplane"] = self.uiMidplaneComboBox.currentText()
settings["npe"] = self.uiNPEComboBox.currentText()
else:
# save the I/O memory setting
settings["iomem"] = self.uiIomemSpinBox.value()
# save the memories and disks settings
settings["ram"] = self.uiRamSpinBox.value()
settings["nvram"] = self.uiNvramSpinBox.value()
settings["disk0"] = self.uiDisk0SpinBox.value()
settings["disk1"] = self.uiDisk1SpinBox.value()
# save the configuration register setting
# TODO: check the format? 0xnnnn
settings["confreg"] = self.uiConfregLineEdit.text()
# save the Exec Area setting
exec_area = self.uiExecAreaSpinBox.value()
if exec_area and exec_area != 64:
settings["exec_area"] = exec_area
else:
settings["exec_area"] = None
# save the adapters and WICs configuration and
# check if a module port is connected before removing or replacing.
for slot_number, widget in self._widget_slots.items():
module = widget.currentText()
if module:
if settings["slot" + str(slot_number)] and settings["slot" + str(slot_number)] != module:
self._checkForLinkConnectedToAdapter(slot_number, settings, node)
settings["slot" + str(slot_number)] = module
elif settings["slot" + str(slot_number)]:
self._checkForLinkConnectedToAdapter(slot_number, settings, node)
settings["slot" + str(slot_number)] = None
for wic_number, widget in self._widget_wics.items():
wic_name = str(widget.currentText())
if wic_name:
if settings["wic" + str(wic_number)] and settings["wic" + str(wic_number)] != wic_name:
self._checkForLinkConnectedToWIC(wic_number, settings, node)
settings["wic" + str(wic_number)] = wic_name
elif settings["wic" + str(wic_number)]:
self._checkForLinkConnectedToWIC(wic_number, settings, node)
settings["wic" + str(wic_number)] = None

View File

@@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Default Dynamips settings.
"""
import sys
import os
# default path to Dynamips executable
if sys.platform.startswith("win"):
DEFAULT_DYNAMIPS_PATH = "dynamips.exe"
elif sys.platform.startswith('darwin'):
if hasattr(sys, "frozen"):
DEFAULT_DYNAMIPS_PATH = os.path.join(os.getcwdu(), "../Resources/dynamips-0.2.10-OSX.intel64.bin")
else:
DEFAULT_DYNAMIPS_PATH = os.path.join(os.getcwdu(), "dynamips-0.2.10-OSX.intel64.bin")
else:
DEFAULT_DYNAMIPS_PATH = "dynamips"
DYNAMIPS_SETTINGS = {
"path": DEFAULT_DYNAMIPS_PATH,
"base_hypervisor_port": 7200,
"base_console_port": 2101,
"base_aux_port": 2501,
"allocate_hypervisor_per_device": True,
"memory_usage_limit_per_hypervisor": 1024,
"allocate_hypervisor_per_ios_image": True,
"base_udp_port": 10001,
"udp_incrementation_per_hypervisor": 100,
"ghost_ios_support": True,
"jit_sharing_support": False,
"sparse_memory_support": True,
"mmap_support": True,
}
DYNAMIPS_SETTING_TYPES = {
"path": str,
"base_hypervisor_port": int,
"base_console_port": int,
"base_aux_port": int,
"allocate_hypervisor_per_device": bool,
"memory_usage_limit_per_hypervisor": int,
"allocate_hypervisor_per_ios_image": bool,
"base_udp_port": int,
"udp_incrementation_per_hypervisor": int,
"ghost_ios_support": bool,
"jit_sharing_support": bool,
"sparse_memory_support": bool,
"mmap_support": bool,
}

View File

View File

@@ -0,0 +1,229 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>atmBridgeConfigPageWidget</class>
<widget class="QWidget" name="atmBridgeConfigPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>403</width>
<height>383</height>
</rect>
</property>
<property name="windowTitle">
<string>ATM Bridge</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="uiEthernetGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Ethernet side</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiEthernetPortLabel">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="uiEthernetPortSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2" rowspan="3">
<widget class="QGroupBox" name="uiMappingGroupBox">
<property name="title">
<string>Mapping</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QTreeWidget" name="uiMappingTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<column>
<property name="text">
<string>Ethernet Port</string>
</property>
</column>
<column>
<property name="text">
<string>Port:VPI:VCI</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="uiATMGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>ATM side</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiATMPortLabel">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="uiATMPortSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiATMVPILabel">
<property name="text">
<string>VPI:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="uiATMVPISpinBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="uiATMVCILabel">
<property name="text">
<string>VCI:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="uiATMVCISpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="uiAddPushButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="uiDeletePushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>371</width>
<height>121</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>
<tabstop>uiEthernetPortSpinBox</tabstop>
<tabstop>uiATMPortSpinBox</tabstop>
<tabstop>uiATMVPISpinBox</tabstop>
<tabstop>uiATMVCISpinBox</tabstop>
<tabstop>uiAddPushButton</tabstop>
<tabstop>uiDeletePushButton</tabstop>
<tabstop>uiMappingTreeWidget</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,155 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/atm_bridge_configuration_page.ui'
#
# Created: Tue Jan 21 20:55:02 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_atmBridgeConfigPageWidget(object):
def setupUi(self, atmBridgeConfigPageWidget):
atmBridgeConfigPageWidget.setObjectName(_fromUtf8("atmBridgeConfigPageWidget"))
atmBridgeConfigPageWidget.resize(403, 383)
self.gridlayout = QtGui.QGridLayout(atmBridgeConfigPageWidget)
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
self.uiEthernetGroupBox = QtGui.QGroupBox(atmBridgeConfigPageWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiEthernetGroupBox.sizePolicy().hasHeightForWidth())
self.uiEthernetGroupBox.setSizePolicy(sizePolicy)
self.uiEthernetGroupBox.setObjectName(_fromUtf8("uiEthernetGroupBox"))
self.gridlayout1 = QtGui.QGridLayout(self.uiEthernetGroupBox)
self.gridlayout1.setObjectName(_fromUtf8("gridlayout1"))
self.uiEthernetPortLabel = QtGui.QLabel(self.uiEthernetGroupBox)
self.uiEthernetPortLabel.setObjectName(_fromUtf8("uiEthernetPortLabel"))
self.gridlayout1.addWidget(self.uiEthernetPortLabel, 0, 0, 1, 1)
self.uiEthernetPortSpinBox = QtGui.QSpinBox(self.uiEthernetGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiEthernetPortSpinBox.sizePolicy().hasHeightForWidth())
self.uiEthernetPortSpinBox.setSizePolicy(sizePolicy)
self.uiEthernetPortSpinBox.setMinimum(0)
self.uiEthernetPortSpinBox.setMaximum(65535)
self.uiEthernetPortSpinBox.setProperty("value", 1)
self.uiEthernetPortSpinBox.setObjectName(_fromUtf8("uiEthernetPortSpinBox"))
self.gridlayout1.addWidget(self.uiEthernetPortSpinBox, 0, 1, 1, 1)
self.gridlayout.addWidget(self.uiEthernetGroupBox, 0, 0, 1, 2)
self.uiMappingGroupBox = QtGui.QGroupBox(atmBridgeConfigPageWidget)
self.uiMappingGroupBox.setObjectName(_fromUtf8("uiMappingGroupBox"))
self.vboxlayout = QtGui.QVBoxLayout(self.uiMappingGroupBox)
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
self.uiMappingTreeWidget = QtGui.QTreeWidget(self.uiMappingGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiMappingTreeWidget.sizePolicy().hasHeightForWidth())
self.uiMappingTreeWidget.setSizePolicy(sizePolicy)
self.uiMappingTreeWidget.setRootIsDecorated(False)
self.uiMappingTreeWidget.setObjectName(_fromUtf8("uiMappingTreeWidget"))
self.vboxlayout.addWidget(self.uiMappingTreeWidget)
self.gridlayout.addWidget(self.uiMappingGroupBox, 0, 2, 3, 1)
self.uiATMGroupBox = QtGui.QGroupBox(atmBridgeConfigPageWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiATMGroupBox.sizePolicy().hasHeightForWidth())
self.uiATMGroupBox.setSizePolicy(sizePolicy)
self.uiATMGroupBox.setObjectName(_fromUtf8("uiATMGroupBox"))
self.gridlayout2 = QtGui.QGridLayout(self.uiATMGroupBox)
self.gridlayout2.setObjectName(_fromUtf8("gridlayout2"))
self.uiATMPortLabel = QtGui.QLabel(self.uiATMGroupBox)
self.uiATMPortLabel.setObjectName(_fromUtf8("uiATMPortLabel"))
self.gridlayout2.addWidget(self.uiATMPortLabel, 0, 0, 1, 1)
self.uiATMPortSpinBox = QtGui.QSpinBox(self.uiATMGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiATMPortSpinBox.sizePolicy().hasHeightForWidth())
self.uiATMPortSpinBox.setSizePolicy(sizePolicy)
self.uiATMPortSpinBox.setMinimum(0)
self.uiATMPortSpinBox.setMaximum(65535)
self.uiATMPortSpinBox.setProperty("value", 10)
self.uiATMPortSpinBox.setObjectName(_fromUtf8("uiATMPortSpinBox"))
self.gridlayout2.addWidget(self.uiATMPortSpinBox, 0, 1, 1, 1)
self.uiATMVPILabel = QtGui.QLabel(self.uiATMGroupBox)
self.uiATMVPILabel.setObjectName(_fromUtf8("uiATMVPILabel"))
self.gridlayout2.addWidget(self.uiATMVPILabel, 1, 0, 1, 1)
self.uiATMVPISpinBox = QtGui.QSpinBox(self.uiATMGroupBox)
self.uiATMVPISpinBox.setEnabled(True)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiATMVPISpinBox.sizePolicy().hasHeightForWidth())
self.uiATMVPISpinBox.setSizePolicy(sizePolicy)
self.uiATMVPISpinBox.setMinimum(0)
self.uiATMVPISpinBox.setMaximum(65535)
self.uiATMVPISpinBox.setSingleStep(1)
self.uiATMVPISpinBox.setProperty("value", 0)
self.uiATMVPISpinBox.setObjectName(_fromUtf8("uiATMVPISpinBox"))
self.gridlayout2.addWidget(self.uiATMVPISpinBox, 1, 1, 1, 1)
self.uiATMVCILabel = QtGui.QLabel(self.uiATMGroupBox)
self.uiATMVCILabel.setObjectName(_fromUtf8("uiATMVCILabel"))
self.gridlayout2.addWidget(self.uiATMVCILabel, 2, 0, 1, 1)
self.uiATMVCISpinBox = QtGui.QSpinBox(self.uiATMGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiATMVCISpinBox.sizePolicy().hasHeightForWidth())
self.uiATMVCISpinBox.setSizePolicy(sizePolicy)
self.uiATMVCISpinBox.setMaximum(65535)
self.uiATMVCISpinBox.setProperty("value", 100)
self.uiATMVCISpinBox.setObjectName(_fromUtf8("uiATMVCISpinBox"))
self.gridlayout2.addWidget(self.uiATMVCISpinBox, 2, 1, 1, 1)
self.gridlayout.addWidget(self.uiATMGroupBox, 1, 0, 1, 2)
self.uiAddPushButton = QtGui.QPushButton(atmBridgeConfigPageWidget)
self.uiAddPushButton.setObjectName(_fromUtf8("uiAddPushButton"))
self.gridlayout.addWidget(self.uiAddPushButton, 2, 0, 1, 1)
self.uiDeletePushButton = QtGui.QPushButton(atmBridgeConfigPageWidget)
self.uiDeletePushButton.setEnabled(False)
self.uiDeletePushButton.setObjectName(_fromUtf8("uiDeletePushButton"))
self.gridlayout.addWidget(self.uiDeletePushButton, 2, 1, 1, 1)
spacerItem = QtGui.QSpacerItem(371, 121, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout.addItem(spacerItem, 3, 0, 1, 3)
self.retranslateUi(atmBridgeConfigPageWidget)
QtCore.QMetaObject.connectSlotsByName(atmBridgeConfigPageWidget)
atmBridgeConfigPageWidget.setTabOrder(self.uiEthernetPortSpinBox, self.uiATMPortSpinBox)
atmBridgeConfigPageWidget.setTabOrder(self.uiATMPortSpinBox, self.uiATMVPISpinBox)
atmBridgeConfigPageWidget.setTabOrder(self.uiATMVPISpinBox, self.uiATMVCISpinBox)
atmBridgeConfigPageWidget.setTabOrder(self.uiATMVCISpinBox, self.uiAddPushButton)
atmBridgeConfigPageWidget.setTabOrder(self.uiAddPushButton, self.uiDeletePushButton)
atmBridgeConfigPageWidget.setTabOrder(self.uiDeletePushButton, self.uiMappingTreeWidget)
def retranslateUi(self, atmBridgeConfigPageWidget):
atmBridgeConfigPageWidget.setWindowTitle(_translate("atmBridgeConfigPageWidget", "ATM Bridge", None))
self.uiEthernetGroupBox.setTitle(_translate("atmBridgeConfigPageWidget", "Ethernet side", None))
self.uiEthernetPortLabel.setText(_translate("atmBridgeConfigPageWidget", "Port:", None))
self.uiMappingGroupBox.setTitle(_translate("atmBridgeConfigPageWidget", "Mapping", None))
self.uiMappingTreeWidget.headerItem().setText(0, _translate("atmBridgeConfigPageWidget", "Ethernet Port", None))
self.uiMappingTreeWidget.headerItem().setText(1, _translate("atmBridgeConfigPageWidget", "Port:VPI:VCI", None))
self.uiATMGroupBox.setTitle(_translate("atmBridgeConfigPageWidget", "ATM side", None))
self.uiATMPortLabel.setText(_translate("atmBridgeConfigPageWidget", "Port:", None))
self.uiATMVPILabel.setText(_translate("atmBridgeConfigPageWidget", "VPI:", None))
self.uiATMVCILabel.setText(_translate("atmBridgeConfigPageWidget", "VCI:", None))
self.uiAddPushButton.setText(_translate("atmBridgeConfigPageWidget", "&Add", None))
self.uiDeletePushButton.setText(_translate("atmBridgeConfigPageWidget", "&Delete", None))

View File

@@ -0,0 +1,282 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>atmSwitchConfigPageWidget</class>
<widget class="QWidget" name="atmSwitchConfigPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>482</width>
<height>376</height>
</rect>
</property>
<property name="windowTitle">
<string>ATM Switch</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="uiVPICheckBox">
<property name="text">
<string>Use VPI only (VP tunnel)</string>
</property>
</widget>
</item>
<item row="0" column="2" rowspan="4">
<widget class="QGroupBox" name="uiMappingGroupBox">
<property name="title">
<string>Mapping</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QTreeWidget" name="uiMappingTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<column>
<property name="text">
<string>Port:VPI:VCI</string>
</property>
</column>
<column>
<property name="text">
<string>Port:VPI:VCI</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="uiSourceGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Source</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiSourcePortLabel">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="uiSourcePortSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiSourceVPILabel">
<property name="text">
<string>VPI:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="uiSourceVPISpinBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="uiSourceVCILabel">
<property name="text">
<string>VCI:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="uiSourceVCISpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="uiDestinationGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Destination</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiDestinationPortLabel">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="uiDestinationPortSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiDestinationVPILabel">
<property name="text">
<string>VPI:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="uiDestinationVPISpinBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="uiDestinationVCILabel">
<property name="text">
<string>VCI:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="uiDestinationVCISpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>200</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="uiAddPushButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="uiDeletePushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</widget>
</item>
<item row="4" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>213</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>
<tabstop>uiVPICheckBox</tabstop>
<tabstop>uiSourcePortSpinBox</tabstop>
<tabstop>uiSourceVPISpinBox</tabstop>
<tabstop>uiSourceVCISpinBox</tabstop>
<tabstop>uiDestinationPortSpinBox</tabstop>
<tabstop>uiDestinationVPISpinBox</tabstop>
<tabstop>uiDestinationVCISpinBox</tabstop>
<tabstop>uiAddPushButton</tabstop>
<tabstop>uiDeletePushButton</tabstop>
<tabstop>uiMappingTreeWidget</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,189 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/atm_switch_configuration_page.ui'
#
# Created: Tue Jan 21 20:55:02 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_atmSwitchConfigPageWidget(object):
def setupUi(self, atmSwitchConfigPageWidget):
atmSwitchConfigPageWidget.setObjectName(_fromUtf8("atmSwitchConfigPageWidget"))
atmSwitchConfigPageWidget.resize(482, 376)
self.gridlayout = QtGui.QGridLayout(atmSwitchConfigPageWidget)
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
self.uiVPICheckBox = QtGui.QCheckBox(atmSwitchConfigPageWidget)
self.uiVPICheckBox.setObjectName(_fromUtf8("uiVPICheckBox"))
self.gridlayout.addWidget(self.uiVPICheckBox, 0, 0, 1, 2)
self.uiMappingGroupBox = QtGui.QGroupBox(atmSwitchConfigPageWidget)
self.uiMappingGroupBox.setObjectName(_fromUtf8("uiMappingGroupBox"))
self.vboxlayout = QtGui.QVBoxLayout(self.uiMappingGroupBox)
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
self.uiMappingTreeWidget = QtGui.QTreeWidget(self.uiMappingGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiMappingTreeWidget.sizePolicy().hasHeightForWidth())
self.uiMappingTreeWidget.setSizePolicy(sizePolicy)
self.uiMappingTreeWidget.setRootIsDecorated(False)
self.uiMappingTreeWidget.setObjectName(_fromUtf8("uiMappingTreeWidget"))
self.vboxlayout.addWidget(self.uiMappingTreeWidget)
self.gridlayout.addWidget(self.uiMappingGroupBox, 0, 2, 4, 1)
self.uiSourceGroupBox = QtGui.QGroupBox(atmSwitchConfigPageWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSourceGroupBox.sizePolicy().hasHeightForWidth())
self.uiSourceGroupBox.setSizePolicy(sizePolicy)
self.uiSourceGroupBox.setObjectName(_fromUtf8("uiSourceGroupBox"))
self.gridlayout1 = QtGui.QGridLayout(self.uiSourceGroupBox)
self.gridlayout1.setObjectName(_fromUtf8("gridlayout1"))
self.uiSourcePortLabel = QtGui.QLabel(self.uiSourceGroupBox)
self.uiSourcePortLabel.setObjectName(_fromUtf8("uiSourcePortLabel"))
self.gridlayout1.addWidget(self.uiSourcePortLabel, 0, 0, 1, 1)
self.uiSourcePortSpinBox = QtGui.QSpinBox(self.uiSourceGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSourcePortSpinBox.sizePolicy().hasHeightForWidth())
self.uiSourcePortSpinBox.setSizePolicy(sizePolicy)
self.uiSourcePortSpinBox.setMinimum(0)
self.uiSourcePortSpinBox.setMaximum(65535)
self.uiSourcePortSpinBox.setProperty("value", 1)
self.uiSourcePortSpinBox.setObjectName(_fromUtf8("uiSourcePortSpinBox"))
self.gridlayout1.addWidget(self.uiSourcePortSpinBox, 0, 1, 1, 1)
self.uiSourceVPILabel = QtGui.QLabel(self.uiSourceGroupBox)
self.uiSourceVPILabel.setObjectName(_fromUtf8("uiSourceVPILabel"))
self.gridlayout1.addWidget(self.uiSourceVPILabel, 1, 0, 1, 1)
self.uiSourceVPISpinBox = QtGui.QSpinBox(self.uiSourceGroupBox)
self.uiSourceVPISpinBox.setEnabled(True)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSourceVPISpinBox.sizePolicy().hasHeightForWidth())
self.uiSourceVPISpinBox.setSizePolicy(sizePolicy)
self.uiSourceVPISpinBox.setMaximum(65535)
self.uiSourceVPISpinBox.setProperty("value", 0)
self.uiSourceVPISpinBox.setObjectName(_fromUtf8("uiSourceVPISpinBox"))
self.gridlayout1.addWidget(self.uiSourceVPISpinBox, 1, 1, 1, 1)
self.uiSourceVCILabel = QtGui.QLabel(self.uiSourceGroupBox)
self.uiSourceVCILabel.setObjectName(_fromUtf8("uiSourceVCILabel"))
self.gridlayout1.addWidget(self.uiSourceVCILabel, 2, 0, 1, 1)
self.uiSourceVCISpinBox = QtGui.QSpinBox(self.uiSourceGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSourceVCISpinBox.sizePolicy().hasHeightForWidth())
self.uiSourceVCISpinBox.setSizePolicy(sizePolicy)
self.uiSourceVCISpinBox.setMaximum(65535)
self.uiSourceVCISpinBox.setProperty("value", 100)
self.uiSourceVCISpinBox.setObjectName(_fromUtf8("uiSourceVCISpinBox"))
self.gridlayout1.addWidget(self.uiSourceVCISpinBox, 2, 1, 1, 1)
self.gridlayout.addWidget(self.uiSourceGroupBox, 1, 0, 1, 2)
self.uiDestinationGroupBox = QtGui.QGroupBox(atmSwitchConfigPageWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiDestinationGroupBox.sizePolicy().hasHeightForWidth())
self.uiDestinationGroupBox.setSizePolicy(sizePolicy)
self.uiDestinationGroupBox.setObjectName(_fromUtf8("uiDestinationGroupBox"))
self.gridlayout2 = QtGui.QGridLayout(self.uiDestinationGroupBox)
self.gridlayout2.setObjectName(_fromUtf8("gridlayout2"))
self.uiDestinationPortLabel = QtGui.QLabel(self.uiDestinationGroupBox)
self.uiDestinationPortLabel.setObjectName(_fromUtf8("uiDestinationPortLabel"))
self.gridlayout2.addWidget(self.uiDestinationPortLabel, 0, 0, 1, 1)
self.uiDestinationPortSpinBox = QtGui.QSpinBox(self.uiDestinationGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiDestinationPortSpinBox.sizePolicy().hasHeightForWidth())
self.uiDestinationPortSpinBox.setSizePolicy(sizePolicy)
self.uiDestinationPortSpinBox.setMinimum(0)
self.uiDestinationPortSpinBox.setMaximum(65535)
self.uiDestinationPortSpinBox.setProperty("value", 10)
self.uiDestinationPortSpinBox.setObjectName(_fromUtf8("uiDestinationPortSpinBox"))
self.gridlayout2.addWidget(self.uiDestinationPortSpinBox, 0, 1, 1, 1)
self.uiDestinationVPILabel = QtGui.QLabel(self.uiDestinationGroupBox)
self.uiDestinationVPILabel.setObjectName(_fromUtf8("uiDestinationVPILabel"))
self.gridlayout2.addWidget(self.uiDestinationVPILabel, 1, 0, 1, 1)
self.uiDestinationVPISpinBox = QtGui.QSpinBox(self.uiDestinationGroupBox)
self.uiDestinationVPISpinBox.setEnabled(True)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiDestinationVPISpinBox.sizePolicy().hasHeightForWidth())
self.uiDestinationVPISpinBox.setSizePolicy(sizePolicy)
self.uiDestinationVPISpinBox.setMaximum(65535)
self.uiDestinationVPISpinBox.setProperty("value", 0)
self.uiDestinationVPISpinBox.setObjectName(_fromUtf8("uiDestinationVPISpinBox"))
self.gridlayout2.addWidget(self.uiDestinationVPISpinBox, 1, 1, 1, 1)
self.uiDestinationVCILabel = QtGui.QLabel(self.uiDestinationGroupBox)
self.uiDestinationVCILabel.setObjectName(_fromUtf8("uiDestinationVCILabel"))
self.gridlayout2.addWidget(self.uiDestinationVCILabel, 2, 0, 1, 1)
self.uiDestinationVCISpinBox = QtGui.QSpinBox(self.uiDestinationGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiDestinationVCISpinBox.sizePolicy().hasHeightForWidth())
self.uiDestinationVCISpinBox.setSizePolicy(sizePolicy)
self.uiDestinationVCISpinBox.setMaximum(65535)
self.uiDestinationVCISpinBox.setProperty("value", 200)
self.uiDestinationVCISpinBox.setObjectName(_fromUtf8("uiDestinationVCISpinBox"))
self.gridlayout2.addWidget(self.uiDestinationVCISpinBox, 2, 1, 1, 1)
self.gridlayout.addWidget(self.uiDestinationGroupBox, 2, 0, 1, 2)
self.uiAddPushButton = QtGui.QPushButton(atmSwitchConfigPageWidget)
self.uiAddPushButton.setObjectName(_fromUtf8("uiAddPushButton"))
self.gridlayout.addWidget(self.uiAddPushButton, 3, 0, 1, 1)
self.uiDeletePushButton = QtGui.QPushButton(atmSwitchConfigPageWidget)
self.uiDeletePushButton.setEnabled(False)
self.uiDeletePushButton.setObjectName(_fromUtf8("uiDeletePushButton"))
self.gridlayout.addWidget(self.uiDeletePushButton, 3, 1, 1, 1)
spacerItem = QtGui.QSpacerItem(213, 31, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout.addItem(spacerItem, 4, 2, 1, 1)
self.retranslateUi(atmSwitchConfigPageWidget)
QtCore.QMetaObject.connectSlotsByName(atmSwitchConfigPageWidget)
atmSwitchConfigPageWidget.setTabOrder(self.uiVPICheckBox, self.uiSourcePortSpinBox)
atmSwitchConfigPageWidget.setTabOrder(self.uiSourcePortSpinBox, self.uiSourceVPISpinBox)
atmSwitchConfigPageWidget.setTabOrder(self.uiSourceVPISpinBox, self.uiSourceVCISpinBox)
atmSwitchConfigPageWidget.setTabOrder(self.uiSourceVCISpinBox, self.uiDestinationPortSpinBox)
atmSwitchConfigPageWidget.setTabOrder(self.uiDestinationPortSpinBox, self.uiDestinationVPISpinBox)
atmSwitchConfigPageWidget.setTabOrder(self.uiDestinationVPISpinBox, self.uiDestinationVCISpinBox)
atmSwitchConfigPageWidget.setTabOrder(self.uiDestinationVCISpinBox, self.uiAddPushButton)
atmSwitchConfigPageWidget.setTabOrder(self.uiAddPushButton, self.uiDeletePushButton)
atmSwitchConfigPageWidget.setTabOrder(self.uiDeletePushButton, self.uiMappingTreeWidget)
def retranslateUi(self, atmSwitchConfigPageWidget):
atmSwitchConfigPageWidget.setWindowTitle(_translate("atmSwitchConfigPageWidget", "ATM Switch", None))
self.uiVPICheckBox.setText(_translate("atmSwitchConfigPageWidget", "Use VPI only (VP tunnel)", None))
self.uiMappingGroupBox.setTitle(_translate("atmSwitchConfigPageWidget", "Mapping", None))
self.uiMappingTreeWidget.headerItem().setText(0, _translate("atmSwitchConfigPageWidget", "Port:VPI:VCI", None))
self.uiMappingTreeWidget.headerItem().setText(1, _translate("atmSwitchConfigPageWidget", "Port:VPI:VCI", None))
self.uiSourceGroupBox.setTitle(_translate("atmSwitchConfigPageWidget", "Source", None))
self.uiSourcePortLabel.setText(_translate("atmSwitchConfigPageWidget", "Port:", None))
self.uiSourceVPILabel.setText(_translate("atmSwitchConfigPageWidget", "VPI:", None))
self.uiSourceVCILabel.setText(_translate("atmSwitchConfigPageWidget", "VCI:", None))
self.uiDestinationGroupBox.setTitle(_translate("atmSwitchConfigPageWidget", "Destination", None))
self.uiDestinationPortLabel.setText(_translate("atmSwitchConfigPageWidget", "Port:", None))
self.uiDestinationVPILabel.setText(_translate("atmSwitchConfigPageWidget", "VPI:", None))
self.uiDestinationVCILabel.setText(_translate("atmSwitchConfigPageWidget", "VCI:", None))
self.uiAddPushButton.setText(_translate("atmSwitchConfigPageWidget", "&Add", None))
self.uiDeletePushButton.setText(_translate("atmSwitchConfigPageWidget", "&Delete", None))

View File

@@ -0,0 +1,667 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cloudConfigPageWidget</class>
<widget class="QWidget" name="cloudConfigPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>542</width>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
<string>Cloud configuration</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>NIO Ethernet</string>
</attribute>
<layout class="QVBoxLayout">
<item>
<widget class="QGroupBox" name="uiGenericEthernetGroupBox">
<property name="title">
<string>Generic Ethernet NIO (Administrator or root access required)</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0" colspan="3">
<widget class="QComboBox" name="uiGenericEthernetComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="uiGenericEthernetLineEdit"/>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="uiAddGenericEthernetPushButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="uiDeleteGenericEthernetPushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QListWidget" name="uiGenericEthernetListWidget"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="uiLinuxEthernetGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Linux Ethernet NIO (Linux only, root access required)</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0" colspan="3">
<widget class="QComboBox" name="uiLinuxEthernetComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="uiLinuxEthernetLineEdit"/>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="uiAddLinuxEthernetPushButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="uiDeleteLinuxEthernetPushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QListWidget" name="uiLinuxEthernetListWidget"/>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>21</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>NIO UDP</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="uiNIOUDPSettingsGroupBox">
<property name="title">
<string>Settings</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiLocalPortLabel">
<property name="text">
<string>Local port:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="uiLocalPortSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>30000</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiRemoteHostLabel">
<property name="text">
<string>Remote host:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="uiRemoteHostLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>127.0.0.1</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="uiRemotePortLabel">
<property name="text">
<string>Remote port:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="uiRemotePortSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>20000</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2" rowspan="2">
<widget class="QGroupBox" name="uiNIOUDPListGroupBox">
<property name="title">
<string>NIOs</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QListWidget" name="uiNIOUDPListWidget"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="uiAddNIOUDPPushButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="uiDeleteNIOUDPPushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>211</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>NIO TAP</string>
</attribute>
<layout class="QVBoxLayout">
<item>
<widget class="QGroupBox" name="uiNIOTAPGroupBox">
<property name="title">
<string>TAP interface (require root access)</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLineEdit" name="uiNIOTAPLineEdit"/>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="uiAddNIOTAPPushButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="uiDeleteNIOTAPPushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QListWidget" name="uiNIOTAPListWidget"/>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>191</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>NIO UNIX</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="uiNIOUNIXSettingsGroupBox">
<property name="title">
<string>Settings</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiLocalFileLabel">
<property name="text">
<string>Local file:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="uiLocalFileLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiRemoteFileLabel">
<property name="text">
<string>Remote file:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="uiRemoteFileLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="2" rowspan="3">
<widget class="QGroupBox" name="uiNIOUNIXListGroupBox">
<property name="title">
<string>NIOs</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QListWidget" name="uiNIOUNIXListWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="uiAddNIOUNIXPushButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="uiDeleteNIOUNIXPushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</widget>
</item>
<item row="2" column="0" rowspan="2" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>160</width>
<height>190</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>196</width>
<height>132</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>NIO VDE</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="uiNIOVDESettingsGroupBox">
<property name="title">
<string>Settings</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiVDEControlFileLabel">
<property name="text">
<string>Control file:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="uiVDEControlFileLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiVDELocalFileLabel">
<property name="text">
<string>Local file:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="uiVDELocalFileLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="2" rowspan="3">
<widget class="QGroupBox" name="uiNIOVDEListGroupBox">
<property name="title">
<string>NIOs</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QListWidget" name="uiNIOVDEListWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="uiAddNIOVDEPushButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="uiDeleteNIOVDEPushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</widget>
</item>
<item row="2" column="0" rowspan="2" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>161</width>
<height>201</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>196</width>
<height>132</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_6">
<attribute name="title">
<string>NIO NULL</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="uiNIONullSettingsGroupBox">
<property name="title">
<string>Settings</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Identifier:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="uiNIONullIdentiferLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2" rowspan="3">
<widget class="QGroupBox" name="uiNIONullListGroupBox">
<property name="title">
<string>NIOs</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QListWidget" name="uiNIONullListWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="uiAddNIONullPushButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="uiDeleteNIONullPushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</widget>
</item>
<item row="2" column="0" rowspan="2" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>261</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>181</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,406 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/cloud_configuration_page.ui'
#
# Created: Tue Jan 21 14:35:27 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_cloudConfigPageWidget(object):
def setupUi(self, cloudConfigPageWidget):
cloudConfigPageWidget.setObjectName(_fromUtf8("cloudConfigPageWidget"))
cloudConfigPageWidget.resize(542, 500)
self.vboxlayout = QtGui.QVBoxLayout(cloudConfigPageWidget)
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
self.tabWidget = QtGui.QTabWidget(cloudConfigPageWidget)
self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
self.tab = QtGui.QWidget()
self.tab.setObjectName(_fromUtf8("tab"))
self.vboxlayout1 = QtGui.QVBoxLayout(self.tab)
self.vboxlayout1.setObjectName(_fromUtf8("vboxlayout1"))
self.uiGenericEthernetGroupBox = QtGui.QGroupBox(self.tab)
self.uiGenericEthernetGroupBox.setObjectName(_fromUtf8("uiGenericEthernetGroupBox"))
self.gridlayout = QtGui.QGridLayout(self.uiGenericEthernetGroupBox)
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
self.uiGenericEthernetComboBox = QtGui.QComboBox(self.uiGenericEthernetGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiGenericEthernetComboBox.sizePolicy().hasHeightForWidth())
self.uiGenericEthernetComboBox.setSizePolicy(sizePolicy)
self.uiGenericEthernetComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.uiGenericEthernetComboBox.setObjectName(_fromUtf8("uiGenericEthernetComboBox"))
self.gridlayout.addWidget(self.uiGenericEthernetComboBox, 0, 0, 1, 3)
self.uiGenericEthernetLineEdit = QtGui.QLineEdit(self.uiGenericEthernetGroupBox)
self.uiGenericEthernetLineEdit.setObjectName(_fromUtf8("uiGenericEthernetLineEdit"))
self.gridlayout.addWidget(self.uiGenericEthernetLineEdit, 1, 0, 1, 1)
self.uiAddGenericEthernetPushButton = QtGui.QPushButton(self.uiGenericEthernetGroupBox)
self.uiAddGenericEthernetPushButton.setObjectName(_fromUtf8("uiAddGenericEthernetPushButton"))
self.gridlayout.addWidget(self.uiAddGenericEthernetPushButton, 1, 1, 1, 1)
self.uiDeleteGenericEthernetPushButton = QtGui.QPushButton(self.uiGenericEthernetGroupBox)
self.uiDeleteGenericEthernetPushButton.setEnabled(False)
self.uiDeleteGenericEthernetPushButton.setObjectName(_fromUtf8("uiDeleteGenericEthernetPushButton"))
self.gridlayout.addWidget(self.uiDeleteGenericEthernetPushButton, 1, 2, 1, 1)
self.uiGenericEthernetListWidget = QtGui.QListWidget(self.uiGenericEthernetGroupBox)
self.uiGenericEthernetListWidget.setObjectName(_fromUtf8("uiGenericEthernetListWidget"))
self.gridlayout.addWidget(self.uiGenericEthernetListWidget, 2, 0, 1, 3)
self.vboxlayout1.addWidget(self.uiGenericEthernetGroupBox)
self.uiLinuxEthernetGroupBox = QtGui.QGroupBox(self.tab)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiLinuxEthernetGroupBox.sizePolicy().hasHeightForWidth())
self.uiLinuxEthernetGroupBox.setSizePolicy(sizePolicy)
self.uiLinuxEthernetGroupBox.setObjectName(_fromUtf8("uiLinuxEthernetGroupBox"))
self.gridlayout1 = QtGui.QGridLayout(self.uiLinuxEthernetGroupBox)
self.gridlayout1.setObjectName(_fromUtf8("gridlayout1"))
self.uiLinuxEthernetComboBox = QtGui.QComboBox(self.uiLinuxEthernetGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiLinuxEthernetComboBox.sizePolicy().hasHeightForWidth())
self.uiLinuxEthernetComboBox.setSizePolicy(sizePolicy)
self.uiLinuxEthernetComboBox.setObjectName(_fromUtf8("uiLinuxEthernetComboBox"))
self.gridlayout1.addWidget(self.uiLinuxEthernetComboBox, 0, 0, 1, 3)
self.uiLinuxEthernetLineEdit = QtGui.QLineEdit(self.uiLinuxEthernetGroupBox)
self.uiLinuxEthernetLineEdit.setObjectName(_fromUtf8("uiLinuxEthernetLineEdit"))
self.gridlayout1.addWidget(self.uiLinuxEthernetLineEdit, 1, 0, 1, 1)
self.uiAddLinuxEthernetPushButton = QtGui.QPushButton(self.uiLinuxEthernetGroupBox)
self.uiAddLinuxEthernetPushButton.setObjectName(_fromUtf8("uiAddLinuxEthernetPushButton"))
self.gridlayout1.addWidget(self.uiAddLinuxEthernetPushButton, 1, 1, 1, 1)
self.uiDeleteLinuxEthernetPushButton = QtGui.QPushButton(self.uiLinuxEthernetGroupBox)
self.uiDeleteLinuxEthernetPushButton.setEnabled(False)
self.uiDeleteLinuxEthernetPushButton.setObjectName(_fromUtf8("uiDeleteLinuxEthernetPushButton"))
self.gridlayout1.addWidget(self.uiDeleteLinuxEthernetPushButton, 1, 2, 1, 1)
self.uiLinuxEthernetListWidget = QtGui.QListWidget(self.uiLinuxEthernetGroupBox)
self.uiLinuxEthernetListWidget.setObjectName(_fromUtf8("uiLinuxEthernetListWidget"))
self.gridlayout1.addWidget(self.uiLinuxEthernetListWidget, 2, 0, 1, 3)
self.vboxlayout1.addWidget(self.uiLinuxEthernetGroupBox)
spacerItem = QtGui.QSpacerItem(21, 16, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
self.vboxlayout1.addItem(spacerItem)
self.tabWidget.addTab(self.tab, _fromUtf8(""))
self.tab_2 = QtGui.QWidget()
self.tab_2.setObjectName(_fromUtf8("tab_2"))
self.gridlayout2 = QtGui.QGridLayout(self.tab_2)
self.gridlayout2.setObjectName(_fromUtf8("gridlayout2"))
self.uiNIOUDPSettingsGroupBox = QtGui.QGroupBox(self.tab_2)
self.uiNIOUDPSettingsGroupBox.setObjectName(_fromUtf8("uiNIOUDPSettingsGroupBox"))
self.gridlayout3 = QtGui.QGridLayout(self.uiNIOUDPSettingsGroupBox)
self.gridlayout3.setObjectName(_fromUtf8("gridlayout3"))
self.uiLocalPortLabel = QtGui.QLabel(self.uiNIOUDPSettingsGroupBox)
self.uiLocalPortLabel.setObjectName(_fromUtf8("uiLocalPortLabel"))
self.gridlayout3.addWidget(self.uiLocalPortLabel, 0, 0, 1, 1)
self.uiLocalPortSpinBox = QtGui.QSpinBox(self.uiNIOUDPSettingsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiLocalPortSpinBox.sizePolicy().hasHeightForWidth())
self.uiLocalPortSpinBox.setSizePolicy(sizePolicy)
self.uiLocalPortSpinBox.setMaximum(65535)
self.uiLocalPortSpinBox.setProperty("value", 30000)
self.uiLocalPortSpinBox.setObjectName(_fromUtf8("uiLocalPortSpinBox"))
self.gridlayout3.addWidget(self.uiLocalPortSpinBox, 0, 1, 1, 1)
self.uiRemoteHostLabel = QtGui.QLabel(self.uiNIOUDPSettingsGroupBox)
self.uiRemoteHostLabel.setObjectName(_fromUtf8("uiRemoteHostLabel"))
self.gridlayout3.addWidget(self.uiRemoteHostLabel, 1, 0, 1, 1)
self.uiRemoteHostLineEdit = QtGui.QLineEdit(self.uiNIOUDPSettingsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiRemoteHostLineEdit.sizePolicy().hasHeightForWidth())
self.uiRemoteHostLineEdit.setSizePolicy(sizePolicy)
self.uiRemoteHostLineEdit.setMinimumSize(QtCore.QSize(80, 0))
self.uiRemoteHostLineEdit.setObjectName(_fromUtf8("uiRemoteHostLineEdit"))
self.gridlayout3.addWidget(self.uiRemoteHostLineEdit, 1, 1, 1, 1)
self.uiRemotePortLabel = QtGui.QLabel(self.uiNIOUDPSettingsGroupBox)
self.uiRemotePortLabel.setObjectName(_fromUtf8("uiRemotePortLabel"))
self.gridlayout3.addWidget(self.uiRemotePortLabel, 2, 0, 1, 1)
self.uiRemotePortSpinBox = QtGui.QSpinBox(self.uiNIOUDPSettingsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiRemotePortSpinBox.sizePolicy().hasHeightForWidth())
self.uiRemotePortSpinBox.setSizePolicy(sizePolicy)
self.uiRemotePortSpinBox.setMaximum(65535)
self.uiRemotePortSpinBox.setProperty("value", 20000)
self.uiRemotePortSpinBox.setObjectName(_fromUtf8("uiRemotePortSpinBox"))
self.gridlayout3.addWidget(self.uiRemotePortSpinBox, 2, 1, 1, 1)
self.gridlayout2.addWidget(self.uiNIOUDPSettingsGroupBox, 0, 0, 1, 2)
self.uiNIOUDPListGroupBox = QtGui.QGroupBox(self.tab_2)
self.uiNIOUDPListGroupBox.setObjectName(_fromUtf8("uiNIOUDPListGroupBox"))
self.vboxlayout2 = QtGui.QVBoxLayout(self.uiNIOUDPListGroupBox)
self.vboxlayout2.setObjectName(_fromUtf8("vboxlayout2"))
self.uiNIOUDPListWidget = QtGui.QListWidget(self.uiNIOUDPListGroupBox)
self.uiNIOUDPListWidget.setObjectName(_fromUtf8("uiNIOUDPListWidget"))
self.vboxlayout2.addWidget(self.uiNIOUDPListWidget)
self.gridlayout2.addWidget(self.uiNIOUDPListGroupBox, 0, 2, 2, 1)
self.uiAddNIOUDPPushButton = QtGui.QPushButton(self.tab_2)
self.uiAddNIOUDPPushButton.setObjectName(_fromUtf8("uiAddNIOUDPPushButton"))
self.gridlayout2.addWidget(self.uiAddNIOUDPPushButton, 1, 0, 1, 1)
self.uiDeleteNIOUDPPushButton = QtGui.QPushButton(self.tab_2)
self.uiDeleteNIOUDPPushButton.setEnabled(False)
self.uiDeleteNIOUDPPushButton.setObjectName(_fromUtf8("uiDeleteNIOUDPPushButton"))
self.gridlayout2.addWidget(self.uiDeleteNIOUDPPushButton, 1, 1, 1, 1)
spacerItem1 = QtGui.QSpacerItem(20, 211, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout2.addItem(spacerItem1, 2, 1, 1, 1)
self.tabWidget.addTab(self.tab_2, _fromUtf8(""))
self.tab_3 = QtGui.QWidget()
self.tab_3.setObjectName(_fromUtf8("tab_3"))
self.vboxlayout3 = QtGui.QVBoxLayout(self.tab_3)
self.vboxlayout3.setObjectName(_fromUtf8("vboxlayout3"))
self.uiNIOTAPGroupBox = QtGui.QGroupBox(self.tab_3)
self.uiNIOTAPGroupBox.setObjectName(_fromUtf8("uiNIOTAPGroupBox"))
self.gridlayout4 = QtGui.QGridLayout(self.uiNIOTAPGroupBox)
self.gridlayout4.setObjectName(_fromUtf8("gridlayout4"))
self.uiNIOTAPLineEdit = QtGui.QLineEdit(self.uiNIOTAPGroupBox)
self.uiNIOTAPLineEdit.setObjectName(_fromUtf8("uiNIOTAPLineEdit"))
self.gridlayout4.addWidget(self.uiNIOTAPLineEdit, 0, 0, 1, 1)
self.uiAddNIOTAPPushButton = QtGui.QPushButton(self.uiNIOTAPGroupBox)
self.uiAddNIOTAPPushButton.setObjectName(_fromUtf8("uiAddNIOTAPPushButton"))
self.gridlayout4.addWidget(self.uiAddNIOTAPPushButton, 0, 1, 1, 1)
self.uiDeleteNIOTAPPushButton = QtGui.QPushButton(self.uiNIOTAPGroupBox)
self.uiDeleteNIOTAPPushButton.setEnabled(False)
self.uiDeleteNIOTAPPushButton.setObjectName(_fromUtf8("uiDeleteNIOTAPPushButton"))
self.gridlayout4.addWidget(self.uiDeleteNIOTAPPushButton, 0, 2, 1, 1)
self.uiNIOTAPListWidget = QtGui.QListWidget(self.uiNIOTAPGroupBox)
self.uiNIOTAPListWidget.setObjectName(_fromUtf8("uiNIOTAPListWidget"))
self.gridlayout4.addWidget(self.uiNIOTAPListWidget, 1, 0, 1, 3)
self.vboxlayout3.addWidget(self.uiNIOTAPGroupBox)
spacerItem2 = QtGui.QSpacerItem(20, 191, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.vboxlayout3.addItem(spacerItem2)
self.tabWidget.addTab(self.tab_3, _fromUtf8(""))
self.tab_4 = QtGui.QWidget()
self.tab_4.setObjectName(_fromUtf8("tab_4"))
self.gridlayout5 = QtGui.QGridLayout(self.tab_4)
self.gridlayout5.setObjectName(_fromUtf8("gridlayout5"))
self.uiNIOUNIXSettingsGroupBox = QtGui.QGroupBox(self.tab_4)
self.uiNIOUNIXSettingsGroupBox.setObjectName(_fromUtf8("uiNIOUNIXSettingsGroupBox"))
self.gridlayout6 = QtGui.QGridLayout(self.uiNIOUNIXSettingsGroupBox)
self.gridlayout6.setObjectName(_fromUtf8("gridlayout6"))
self.gridlayout7 = QtGui.QGridLayout()
self.gridlayout7.setObjectName(_fromUtf8("gridlayout7"))
self.uiLocalFileLabel = QtGui.QLabel(self.uiNIOUNIXSettingsGroupBox)
self.uiLocalFileLabel.setObjectName(_fromUtf8("uiLocalFileLabel"))
self.gridlayout7.addWidget(self.uiLocalFileLabel, 0, 0, 1, 1)
self.uiLocalFileLineEdit = QtGui.QLineEdit(self.uiNIOUNIXSettingsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiLocalFileLineEdit.sizePolicy().hasHeightForWidth())
self.uiLocalFileLineEdit.setSizePolicy(sizePolicy)
self.uiLocalFileLineEdit.setObjectName(_fromUtf8("uiLocalFileLineEdit"))
self.gridlayout7.addWidget(self.uiLocalFileLineEdit, 1, 0, 1, 1)
self.gridlayout6.addLayout(self.gridlayout7, 0, 0, 1, 1)
self.gridlayout8 = QtGui.QGridLayout()
self.gridlayout8.setObjectName(_fromUtf8("gridlayout8"))
self.uiRemoteFileLabel = QtGui.QLabel(self.uiNIOUNIXSettingsGroupBox)
self.uiRemoteFileLabel.setObjectName(_fromUtf8("uiRemoteFileLabel"))
self.gridlayout8.addWidget(self.uiRemoteFileLabel, 0, 0, 1, 1)
self.uiRemoteFileLineEdit = QtGui.QLineEdit(self.uiNIOUNIXSettingsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiRemoteFileLineEdit.sizePolicy().hasHeightForWidth())
self.uiRemoteFileLineEdit.setSizePolicy(sizePolicy)
self.uiRemoteFileLineEdit.setObjectName(_fromUtf8("uiRemoteFileLineEdit"))
self.gridlayout8.addWidget(self.uiRemoteFileLineEdit, 1, 0, 1, 1)
self.gridlayout6.addLayout(self.gridlayout8, 1, 0, 1, 1)
self.gridlayout5.addWidget(self.uiNIOUNIXSettingsGroupBox, 0, 0, 1, 2)
self.uiNIOUNIXListGroupBox = QtGui.QGroupBox(self.tab_4)
self.uiNIOUNIXListGroupBox.setObjectName(_fromUtf8("uiNIOUNIXListGroupBox"))
self.vboxlayout4 = QtGui.QVBoxLayout(self.uiNIOUNIXListGroupBox)
self.vboxlayout4.setObjectName(_fromUtf8("vboxlayout4"))
self.uiNIOUNIXListWidget = QtGui.QListWidget(self.uiNIOUNIXListGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiNIOUNIXListWidget.sizePolicy().hasHeightForWidth())
self.uiNIOUNIXListWidget.setSizePolicy(sizePolicy)
self.uiNIOUNIXListWidget.setObjectName(_fromUtf8("uiNIOUNIXListWidget"))
self.vboxlayout4.addWidget(self.uiNIOUNIXListWidget)
self.gridlayout5.addWidget(self.uiNIOUNIXListGroupBox, 0, 2, 3, 1)
self.uiAddNIOUNIXPushButton = QtGui.QPushButton(self.tab_4)
self.uiAddNIOUNIXPushButton.setObjectName(_fromUtf8("uiAddNIOUNIXPushButton"))
self.gridlayout5.addWidget(self.uiAddNIOUNIXPushButton, 1, 0, 1, 1)
self.uiDeleteNIOUNIXPushButton = QtGui.QPushButton(self.tab_4)
self.uiDeleteNIOUNIXPushButton.setEnabled(False)
self.uiDeleteNIOUNIXPushButton.setObjectName(_fromUtf8("uiDeleteNIOUNIXPushButton"))
self.gridlayout5.addWidget(self.uiDeleteNIOUNIXPushButton, 1, 1, 1, 1)
spacerItem3 = QtGui.QSpacerItem(160, 190, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
self.gridlayout5.addItem(spacerItem3, 2, 0, 2, 2)
spacerItem4 = QtGui.QSpacerItem(196, 132, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout5.addItem(spacerItem4, 3, 2, 1, 1)
self.tabWidget.addTab(self.tab_4, _fromUtf8(""))
self.tab_5 = QtGui.QWidget()
self.tab_5.setObjectName(_fromUtf8("tab_5"))
self.gridlayout9 = QtGui.QGridLayout(self.tab_5)
self.gridlayout9.setObjectName(_fromUtf8("gridlayout9"))
self.uiNIOVDESettingsGroupBox = QtGui.QGroupBox(self.tab_5)
self.uiNIOVDESettingsGroupBox.setObjectName(_fromUtf8("uiNIOVDESettingsGroupBox"))
self.gridlayout10 = QtGui.QGridLayout(self.uiNIOVDESettingsGroupBox)
self.gridlayout10.setObjectName(_fromUtf8("gridlayout10"))
self.gridlayout11 = QtGui.QGridLayout()
self.gridlayout11.setObjectName(_fromUtf8("gridlayout11"))
self.uiVDEControlFileLabel = QtGui.QLabel(self.uiNIOVDESettingsGroupBox)
self.uiVDEControlFileLabel.setObjectName(_fromUtf8("uiVDEControlFileLabel"))
self.gridlayout11.addWidget(self.uiVDEControlFileLabel, 0, 0, 1, 1)
self.uiVDEControlFileLineEdit = QtGui.QLineEdit(self.uiNIOVDESettingsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiVDEControlFileLineEdit.sizePolicy().hasHeightForWidth())
self.uiVDEControlFileLineEdit.setSizePolicy(sizePolicy)
self.uiVDEControlFileLineEdit.setObjectName(_fromUtf8("uiVDEControlFileLineEdit"))
self.gridlayout11.addWidget(self.uiVDEControlFileLineEdit, 1, 0, 1, 1)
self.gridlayout10.addLayout(self.gridlayout11, 0, 0, 1, 1)
self.gridlayout12 = QtGui.QGridLayout()
self.gridlayout12.setObjectName(_fromUtf8("gridlayout12"))
self.uiVDELocalFileLabel = QtGui.QLabel(self.uiNIOVDESettingsGroupBox)
self.uiVDELocalFileLabel.setObjectName(_fromUtf8("uiVDELocalFileLabel"))
self.gridlayout12.addWidget(self.uiVDELocalFileLabel, 0, 0, 1, 1)
self.uiVDELocalFileLineEdit = QtGui.QLineEdit(self.uiNIOVDESettingsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiVDELocalFileLineEdit.sizePolicy().hasHeightForWidth())
self.uiVDELocalFileLineEdit.setSizePolicy(sizePolicy)
self.uiVDELocalFileLineEdit.setObjectName(_fromUtf8("uiVDELocalFileLineEdit"))
self.gridlayout12.addWidget(self.uiVDELocalFileLineEdit, 1, 0, 1, 1)
self.gridlayout10.addLayout(self.gridlayout12, 1, 0, 1, 1)
self.gridlayout9.addWidget(self.uiNIOVDESettingsGroupBox, 0, 0, 1, 2)
self.uiNIOVDEListGroupBox = QtGui.QGroupBox(self.tab_5)
self.uiNIOVDEListGroupBox.setObjectName(_fromUtf8("uiNIOVDEListGroupBox"))
self.vboxlayout5 = QtGui.QVBoxLayout(self.uiNIOVDEListGroupBox)
self.vboxlayout5.setObjectName(_fromUtf8("vboxlayout5"))
self.uiNIOVDEListWidget = QtGui.QListWidget(self.uiNIOVDEListGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiNIOVDEListWidget.sizePolicy().hasHeightForWidth())
self.uiNIOVDEListWidget.setSizePolicy(sizePolicy)
self.uiNIOVDEListWidget.setObjectName(_fromUtf8("uiNIOVDEListWidget"))
self.vboxlayout5.addWidget(self.uiNIOVDEListWidget)
self.gridlayout9.addWidget(self.uiNIOVDEListGroupBox, 0, 2, 3, 1)
self.uiAddNIOVDEPushButton = QtGui.QPushButton(self.tab_5)
self.uiAddNIOVDEPushButton.setObjectName(_fromUtf8("uiAddNIOVDEPushButton"))
self.gridlayout9.addWidget(self.uiAddNIOVDEPushButton, 1, 0, 1, 1)
self.uiDeleteNIOVDEPushButton = QtGui.QPushButton(self.tab_5)
self.uiDeleteNIOVDEPushButton.setEnabled(False)
self.uiDeleteNIOVDEPushButton.setObjectName(_fromUtf8("uiDeleteNIOVDEPushButton"))
self.gridlayout9.addWidget(self.uiDeleteNIOVDEPushButton, 1, 1, 1, 1)
spacerItem5 = QtGui.QSpacerItem(161, 201, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
self.gridlayout9.addItem(spacerItem5, 2, 0, 2, 2)
spacerItem6 = QtGui.QSpacerItem(196, 132, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout9.addItem(spacerItem6, 3, 2, 1, 1)
self.tabWidget.addTab(self.tab_5, _fromUtf8(""))
self.tab_6 = QtGui.QWidget()
self.tab_6.setObjectName(_fromUtf8("tab_6"))
self.gridlayout13 = QtGui.QGridLayout(self.tab_6)
self.gridlayout13.setObjectName(_fromUtf8("gridlayout13"))
self.uiNIONullSettingsGroupBox = QtGui.QGroupBox(self.tab_6)
self.uiNIONullSettingsGroupBox.setObjectName(_fromUtf8("uiNIONullSettingsGroupBox"))
self.gridlayout14 = QtGui.QGridLayout(self.uiNIONullSettingsGroupBox)
self.gridlayout14.setObjectName(_fromUtf8("gridlayout14"))
self.label_9 = QtGui.QLabel(self.uiNIONullSettingsGroupBox)
self.label_9.setObjectName(_fromUtf8("label_9"))
self.gridlayout14.addWidget(self.label_9, 0, 0, 1, 1)
self.uiNIONullIdentiferLineEdit = QtGui.QLineEdit(self.uiNIONullSettingsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiNIONullIdentiferLineEdit.sizePolicy().hasHeightForWidth())
self.uiNIONullIdentiferLineEdit.setSizePolicy(sizePolicy)
self.uiNIONullIdentiferLineEdit.setObjectName(_fromUtf8("uiNIONullIdentiferLineEdit"))
self.gridlayout14.addWidget(self.uiNIONullIdentiferLineEdit, 1, 0, 1, 1)
self.gridlayout13.addWidget(self.uiNIONullSettingsGroupBox, 0, 0, 1, 2)
self.uiNIONullListGroupBox = QtGui.QGroupBox(self.tab_6)
self.uiNIONullListGroupBox.setObjectName(_fromUtf8("uiNIONullListGroupBox"))
self.vboxlayout6 = QtGui.QVBoxLayout(self.uiNIONullListGroupBox)
self.vboxlayout6.setObjectName(_fromUtf8("vboxlayout6"))
self.uiNIONullListWidget = QtGui.QListWidget(self.uiNIONullListGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiNIONullListWidget.sizePolicy().hasHeightForWidth())
self.uiNIONullListWidget.setSizePolicy(sizePolicy)
self.uiNIONullListWidget.setObjectName(_fromUtf8("uiNIONullListWidget"))
self.vboxlayout6.addWidget(self.uiNIONullListWidget)
self.gridlayout13.addWidget(self.uiNIONullListGroupBox, 0, 2, 3, 1)
self.uiAddNIONullPushButton = QtGui.QPushButton(self.tab_6)
self.uiAddNIONullPushButton.setObjectName(_fromUtf8("uiAddNIONullPushButton"))
self.gridlayout13.addWidget(self.uiAddNIONullPushButton, 1, 0, 1, 1)
self.uiDeleteNIONullPushButton = QtGui.QPushButton(self.tab_6)
self.uiDeleteNIONullPushButton.setEnabled(False)
self.uiDeleteNIONullPushButton.setObjectName(_fromUtf8("uiDeleteNIONullPushButton"))
self.gridlayout13.addWidget(self.uiDeleteNIONullPushButton, 1, 1, 1, 1)
spacerItem7 = QtGui.QSpacerItem(20, 261, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout13.addItem(spacerItem7, 2, 0, 2, 2)
spacerItem8 = QtGui.QSpacerItem(20, 181, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout13.addItem(spacerItem8, 3, 2, 1, 1)
self.tabWidget.addTab(self.tab_6, _fromUtf8(""))
self.vboxlayout.addWidget(self.tabWidget)
self.retranslateUi(cloudConfigPageWidget)
self.tabWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(cloudConfigPageWidget)
def retranslateUi(self, cloudConfigPageWidget):
cloudConfigPageWidget.setWindowTitle(_translate("cloudConfigPageWidget", "Cloud configuration", None))
self.uiGenericEthernetGroupBox.setTitle(_translate("cloudConfigPageWidget", "Generic Ethernet NIO (Administrator or root access required)", None))
self.uiAddGenericEthernetPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
self.uiDeleteGenericEthernetPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
self.uiLinuxEthernetGroupBox.setTitle(_translate("cloudConfigPageWidget", "Linux Ethernet NIO (Linux only, root access required)", None))
self.uiAddLinuxEthernetPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
self.uiDeleteLinuxEthernetPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("cloudConfigPageWidget", "NIO Ethernet", None))
self.uiNIOUDPSettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings", None))
self.uiLocalPortLabel.setText(_translate("cloudConfigPageWidget", "Local port:", None))
self.uiRemoteHostLabel.setText(_translate("cloudConfigPageWidget", "Remote host:", None))
self.uiRemoteHostLineEdit.setText(_translate("cloudConfigPageWidget", "127.0.0.1", None))
self.uiRemotePortLabel.setText(_translate("cloudConfigPageWidget", "Remote port:", None))
self.uiNIOUDPListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs", None))
self.uiAddNIOUDPPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
self.uiDeleteNIOUDPPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("cloudConfigPageWidget", "NIO UDP", None))
self.uiNIOTAPGroupBox.setTitle(_translate("cloudConfigPageWidget", "TAP interface (require root access)", None))
self.uiAddNIOTAPPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
self.uiDeleteNIOTAPPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("cloudConfigPageWidget", "NIO TAP", None))
self.uiNIOUNIXSettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings", None))
self.uiLocalFileLabel.setText(_translate("cloudConfigPageWidget", "Local file:", None))
self.uiRemoteFileLabel.setText(_translate("cloudConfigPageWidget", "Remote file:", None))
self.uiNIOUNIXListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs", None))
self.uiAddNIOUNIXPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
self.uiDeleteNIOUNIXPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), _translate("cloudConfigPageWidget", "NIO UNIX", None))
self.uiNIOVDESettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings", None))
self.uiVDEControlFileLabel.setText(_translate("cloudConfigPageWidget", "Control file:", None))
self.uiVDELocalFileLabel.setText(_translate("cloudConfigPageWidget", "Local file:", None))
self.uiNIOVDEListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs", None))
self.uiAddNIOVDEPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
self.uiDeleteNIOVDEPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), _translate("cloudConfigPageWidget", "NIO VDE", None))
self.uiNIONullSettingsGroupBox.setTitle(_translate("cloudConfigPageWidget", "Settings", None))
self.label_9.setText(_translate("cloudConfigPageWidget", "Identifier:", None))
self.uiNIONullListGroupBox.setTitle(_translate("cloudConfigPageWidget", "NIOs", None))
self.uiAddNIONullPushButton.setText(_translate("cloudConfigPageWidget", "&Add", None))
self.uiDeleteNIONullPushButton.setText(_translate("cloudConfigPageWidget", "&Delete", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_6), _translate("cloudConfigPageWidget", "NIO NULL", None))

View File

@@ -0,0 +1,423 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DynamipsPreferencesPageWidget</class>
<widget class="QWidget" name="DynamipsPreferencesPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>508</height>
</rect>
</property>
<property name="windowTitle">
<string>Dynamips</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QTabWidget" name="uiTabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="uiGeneralSettingsTabWidget">
<attribute name="title">
<string>General settings</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiDynamipsPathLabel">
<property name="text">
<string>Path to Dynamips:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="uiBaseHypervisorPortLabel">
<property name="text">
<string>Base port for hypervisors:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="uiBaseConsolePortLabel">
<property name="text">
<string>Base console port for routers:</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="uiBaseAuxPortLabel">
<property name="text">
<string>Base auxiliary console port for routers:</string>
</property>
</widget>
</item>
<item row="8" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="uiTestSettingsPushButton">
<property name="text">
<string>Test settings</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="uiRestoreDefaultsPushButton">
<property name="text">
<string>Restore defaults</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>164</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="0" colspan="2">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>390</width>
<height>193</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="0" colspan="2">
<widget class="QSpinBox" name="uiBaseAuxPortSpinBox">
<property name="suffix">
<string notr="true"> TCP</string>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>2501</number>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QSpinBox" name="uiBaseConsolePortSpinBox">
<property name="suffix">
<string notr="true"> TCP</string>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>2001</number>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QSpinBox" name="uiBaseHypervisorPortSpinBox">
<property name="suffix">
<string notr="true"> TCP</string>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>7200</number>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="uiDynamipsPathLineEdit"/>
</item>
<item>
<widget class="QToolButton" name="uiDynamipsPathToolButton">
<property name="text">
<string>...</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="uiServerSettingsTabWidget">
<attribute name="title">
<string>Server settings</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="uiUseLocalServercheckBox">
<property name="text">
<string>Use the local server</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="uiRemoteServersGroupBox">
<property name="title">
<string>Remote servers</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QTreeWidget" name="uiRemoteServersTreeWidget">
<property name="enabled">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<column>
<property name="text">
<string>Host</string>
</property>
</column>
<column>
<property name="text">
<string>Port</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="uiAdvancedSettingsTabWidget">
<attribute name="title">
<string>Advanced settings</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QGroupBox" name="uiHypervisorAllocationGroupBox">
<property name="title">
<string>Hypervisor allocation</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="uiAllocateHypervisorPerDeviceCheckBox">
<property name="text">
<string>Allocate a new hypervisor for each device</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="uiMemoryUsageLimitPerHypervisorLabel">
<property name="text">
<string>Memory usage limit per hypervisor:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="uiMemoryUsageLimitPerHypervisorSpinBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> MiB</string>
</property>
<property name="maximum">
<number>1000000</number>
</property>
<property name="singleStep">
<number>128</number>
</property>
<property name="value">
<number>512</number>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="uiAllocateHypervisorPerIOSCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Allocate a new hypervisor per IOS image</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="uiUDPTunnelingGroupBox">
<property name="title">
<string>UDP tunneling</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="uiBaseUDPPortLabel">
<property name="text">
<string> Base UDP port:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="uiBaseUDPPortSpinBox">
<property name="suffix">
<string notr="true"> UDP</string>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>10001</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="uiBaseUDPPortIncrementationLabel">
<property name="text">
<string>UDP incrementation per hypervisor:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="uiBaseUDPPortIncrementationSpinBox">
<property name="maximum">
<number>100000</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="uiMemoryUsageOptimisationGroupBox">
<property name="title">
<string>Memory usage optimisation</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="uiGhostIOSSupportCheckBox">
<property name="text">
<string>Enable ghost IOS support</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="uiMmapSupportCheckBox">
<property name="text">
<string>Enable mmap support</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="uiJITSharingSupportCheckBox">
<property name="text">
<string>Enable JIT sharing support</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="uiSparseMemorySupportCheckBox">
<property name="text">
<string>Enable sparse memory support</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>390</width>
<height>12</height>
</size>
</property>
</spacer>
</item>
</layout>
<zorder>spacer_2</zorder>
<zorder>uiUDPTunnelingGroupBox</zorder>
<zorder>uiMemoryUsageOptimisationGroupBox</zorder>
<zorder>uiHypervisorAllocationGroupBox</zorder>
</widget>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>uiTabWidget</tabstop>
<tabstop>uiDynamipsPathLineEdit</tabstop>
<tabstop>uiDynamipsPathToolButton</tabstop>
<tabstop>uiBaseHypervisorPortSpinBox</tabstop>
<tabstop>uiBaseConsolePortSpinBox</tabstop>
<tabstop>uiBaseAuxPortSpinBox</tabstop>
<tabstop>uiAllocateHypervisorPerDeviceCheckBox</tabstop>
<tabstop>uiMemoryUsageLimitPerHypervisorSpinBox</tabstop>
<tabstop>uiAllocateHypervisorPerIOSCheckBox</tabstop>
<tabstop>uiBaseUDPPortSpinBox</tabstop>
<tabstop>uiBaseUDPPortIncrementationSpinBox</tabstop>
<tabstop>uiGhostIOSSupportCheckBox</tabstop>
<tabstop>uiMmapSupportCheckBox</tabstop>
<tabstop>uiJITSharingSupportCheckBox</tabstop>
<tabstop>uiSparseMemorySupportCheckBox</tabstop>
</tabstops>
<resources/>
<connections/>
<designerdata>
<property name="gridDeltaX">
<number>10</number>
</property>
<property name="gridDeltaY">
<number>10</number>
</property>
<property name="gridSnapX">
<bool>true</bool>
</property>
<property name="gridSnapY">
<bool>true</bool>
</property>
<property name="gridVisible">
<bool>true</bool>
</property>
</designerdata>
</ui>

View File

@@ -0,0 +1,235 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/dynamips_preferences_page.ui'
#
# Created: Thu Jan 30 21:18:31 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_DynamipsPreferencesPageWidget(object):
def setupUi(self, DynamipsPreferencesPageWidget):
DynamipsPreferencesPageWidget.setObjectName(_fromUtf8("DynamipsPreferencesPageWidget"))
DynamipsPreferencesPageWidget.resize(432, 508)
self.vboxlayout = QtGui.QVBoxLayout(DynamipsPreferencesPageWidget)
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
self.uiTabWidget = QtGui.QTabWidget(DynamipsPreferencesPageWidget)
self.uiTabWidget.setObjectName(_fromUtf8("uiTabWidget"))
self.uiGeneralSettingsTabWidget = QtGui.QWidget()
self.uiGeneralSettingsTabWidget.setObjectName(_fromUtf8("uiGeneralSettingsTabWidget"))
self.gridLayout = QtGui.QGridLayout(self.uiGeneralSettingsTabWidget)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.uiDynamipsPathLabel = QtGui.QLabel(self.uiGeneralSettingsTabWidget)
self.uiDynamipsPathLabel.setObjectName(_fromUtf8("uiDynamipsPathLabel"))
self.gridLayout.addWidget(self.uiDynamipsPathLabel, 0, 0, 1, 1)
self.uiBaseHypervisorPortLabel = QtGui.QLabel(self.uiGeneralSettingsTabWidget)
self.uiBaseHypervisorPortLabel.setObjectName(_fromUtf8("uiBaseHypervisorPortLabel"))
self.gridLayout.addWidget(self.uiBaseHypervisorPortLabel, 2, 0, 1, 1)
self.uiBaseConsolePortLabel = QtGui.QLabel(self.uiGeneralSettingsTabWidget)
self.uiBaseConsolePortLabel.setObjectName(_fromUtf8("uiBaseConsolePortLabel"))
self.gridLayout.addWidget(self.uiBaseConsolePortLabel, 4, 0, 1, 1)
self.uiBaseAuxPortLabel = QtGui.QLabel(self.uiGeneralSettingsTabWidget)
self.uiBaseAuxPortLabel.setObjectName(_fromUtf8("uiBaseAuxPortLabel"))
self.gridLayout.addWidget(self.uiBaseAuxPortLabel, 6, 0, 1, 2)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.uiTestSettingsPushButton = QtGui.QPushButton(self.uiGeneralSettingsTabWidget)
self.uiTestSettingsPushButton.setObjectName(_fromUtf8("uiTestSettingsPushButton"))
self.horizontalLayout_2.addWidget(self.uiTestSettingsPushButton)
self.uiRestoreDefaultsPushButton = QtGui.QPushButton(self.uiGeneralSettingsTabWidget)
self.uiRestoreDefaultsPushButton.setObjectName(_fromUtf8("uiRestoreDefaultsPushButton"))
self.horizontalLayout_2.addWidget(self.uiRestoreDefaultsPushButton)
self.gridLayout.addLayout(self.horizontalLayout_2, 8, 0, 1, 1)
spacerItem = QtGui.QSpacerItem(164, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem, 8, 1, 1, 1)
spacerItem1 = QtGui.QSpacerItem(390, 193, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem1, 9, 0, 1, 2)
self.uiBaseAuxPortSpinBox = QtGui.QSpinBox(self.uiGeneralSettingsTabWidget)
self.uiBaseAuxPortSpinBox.setSuffix(_fromUtf8(" TCP"))
self.uiBaseAuxPortSpinBox.setMaximum(65535)
self.uiBaseAuxPortSpinBox.setProperty("value", 2501)
self.uiBaseAuxPortSpinBox.setObjectName(_fromUtf8("uiBaseAuxPortSpinBox"))
self.gridLayout.addWidget(self.uiBaseAuxPortSpinBox, 7, 0, 1, 2)
self.uiBaseConsolePortSpinBox = QtGui.QSpinBox(self.uiGeneralSettingsTabWidget)
self.uiBaseConsolePortSpinBox.setSuffix(_fromUtf8(" TCP"))
self.uiBaseConsolePortSpinBox.setMaximum(65535)
self.uiBaseConsolePortSpinBox.setProperty("value", 2001)
self.uiBaseConsolePortSpinBox.setObjectName(_fromUtf8("uiBaseConsolePortSpinBox"))
self.gridLayout.addWidget(self.uiBaseConsolePortSpinBox, 5, 0, 1, 2)
self.uiBaseHypervisorPortSpinBox = QtGui.QSpinBox(self.uiGeneralSettingsTabWidget)
self.uiBaseHypervisorPortSpinBox.setSuffix(_fromUtf8(" TCP"))
self.uiBaseHypervisorPortSpinBox.setMaximum(65535)
self.uiBaseHypervisorPortSpinBox.setProperty("value", 7200)
self.uiBaseHypervisorPortSpinBox.setObjectName(_fromUtf8("uiBaseHypervisorPortSpinBox"))
self.gridLayout.addWidget(self.uiBaseHypervisorPortSpinBox, 3, 0, 1, 2)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.uiDynamipsPathLineEdit = QtGui.QLineEdit(self.uiGeneralSettingsTabWidget)
self.uiDynamipsPathLineEdit.setObjectName(_fromUtf8("uiDynamipsPathLineEdit"))
self.horizontalLayout.addWidget(self.uiDynamipsPathLineEdit)
self.uiDynamipsPathToolButton = QtGui.QToolButton(self.uiGeneralSettingsTabWidget)
self.uiDynamipsPathToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
self.uiDynamipsPathToolButton.setObjectName(_fromUtf8("uiDynamipsPathToolButton"))
self.horizontalLayout.addWidget(self.uiDynamipsPathToolButton)
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 2)
self.uiTabWidget.addTab(self.uiGeneralSettingsTabWidget, _fromUtf8(""))
self.uiServerSettingsTabWidget = QtGui.QWidget()
self.uiServerSettingsTabWidget.setObjectName(_fromUtf8("uiServerSettingsTabWidget"))
self.gridLayout_2 = QtGui.QGridLayout(self.uiServerSettingsTabWidget)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.uiUseLocalServercheckBox = QtGui.QCheckBox(self.uiServerSettingsTabWidget)
self.uiUseLocalServercheckBox.setChecked(True)
self.uiUseLocalServercheckBox.setObjectName(_fromUtf8("uiUseLocalServercheckBox"))
self.gridLayout_2.addWidget(self.uiUseLocalServercheckBox, 0, 0, 1, 1)
self.uiRemoteServersGroupBox = QtGui.QGroupBox(self.uiServerSettingsTabWidget)
self.uiRemoteServersGroupBox.setObjectName(_fromUtf8("uiRemoteServersGroupBox"))
self.horizontalLayout_3 = QtGui.QHBoxLayout(self.uiRemoteServersGroupBox)
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
self.uiRemoteServersTreeWidget = QtGui.QTreeWidget(self.uiRemoteServersGroupBox)
self.uiRemoteServersTreeWidget.setEnabled(False)
self.uiRemoteServersTreeWidget.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.uiRemoteServersTreeWidget.setObjectName(_fromUtf8("uiRemoteServersTreeWidget"))
self.horizontalLayout_3.addWidget(self.uiRemoteServersTreeWidget)
self.gridLayout_2.addWidget(self.uiRemoteServersGroupBox, 1, 0, 1, 1)
self.uiTabWidget.addTab(self.uiServerSettingsTabWidget, _fromUtf8(""))
self.uiAdvancedSettingsTabWidget = QtGui.QWidget()
self.uiAdvancedSettingsTabWidget.setObjectName(_fromUtf8("uiAdvancedSettingsTabWidget"))
self.verticalLayout_4 = QtGui.QVBoxLayout(self.uiAdvancedSettingsTabWidget)
self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
self.uiHypervisorAllocationGroupBox = QtGui.QGroupBox(self.uiAdvancedSettingsTabWidget)
self.uiHypervisorAllocationGroupBox.setObjectName(_fromUtf8("uiHypervisorAllocationGroupBox"))
self.verticalLayout_2 = QtGui.QVBoxLayout(self.uiHypervisorAllocationGroupBox)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.uiAllocateHypervisorPerDeviceCheckBox = QtGui.QCheckBox(self.uiHypervisorAllocationGroupBox)
self.uiAllocateHypervisorPerDeviceCheckBox.setChecked(True)
self.uiAllocateHypervisorPerDeviceCheckBox.setObjectName(_fromUtf8("uiAllocateHypervisorPerDeviceCheckBox"))
self.verticalLayout_2.addWidget(self.uiAllocateHypervisorPerDeviceCheckBox)
self.uiMemoryUsageLimitPerHypervisorLabel = QtGui.QLabel(self.uiHypervisorAllocationGroupBox)
self.uiMemoryUsageLimitPerHypervisorLabel.setObjectName(_fromUtf8("uiMemoryUsageLimitPerHypervisorLabel"))
self.verticalLayout_2.addWidget(self.uiMemoryUsageLimitPerHypervisorLabel)
self.uiMemoryUsageLimitPerHypervisorSpinBox = QtGui.QSpinBox(self.uiHypervisorAllocationGroupBox)
self.uiMemoryUsageLimitPerHypervisorSpinBox.setEnabled(False)
self.uiMemoryUsageLimitPerHypervisorSpinBox.setMaximum(1000000)
self.uiMemoryUsageLimitPerHypervisorSpinBox.setSingleStep(128)
self.uiMemoryUsageLimitPerHypervisorSpinBox.setProperty("value", 512)
self.uiMemoryUsageLimitPerHypervisorSpinBox.setObjectName(_fromUtf8("uiMemoryUsageLimitPerHypervisorSpinBox"))
self.verticalLayout_2.addWidget(self.uiMemoryUsageLimitPerHypervisorSpinBox)
self.uiAllocateHypervisorPerIOSCheckBox = QtGui.QCheckBox(self.uiHypervisorAllocationGroupBox)
self.uiAllocateHypervisorPerIOSCheckBox.setEnabled(False)
self.uiAllocateHypervisorPerIOSCheckBox.setChecked(True)
self.uiAllocateHypervisorPerIOSCheckBox.setObjectName(_fromUtf8("uiAllocateHypervisorPerIOSCheckBox"))
self.verticalLayout_2.addWidget(self.uiAllocateHypervisorPerIOSCheckBox)
self.verticalLayout_4.addWidget(self.uiHypervisorAllocationGroupBox)
self.uiUDPTunnelingGroupBox = QtGui.QGroupBox(self.uiAdvancedSettingsTabWidget)
self.uiUDPTunnelingGroupBox.setObjectName(_fromUtf8("uiUDPTunnelingGroupBox"))
self.verticalLayout_3 = QtGui.QVBoxLayout(self.uiUDPTunnelingGroupBox)
self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
self.uiBaseUDPPortLabel = QtGui.QLabel(self.uiUDPTunnelingGroupBox)
self.uiBaseUDPPortLabel.setObjectName(_fromUtf8("uiBaseUDPPortLabel"))
self.verticalLayout_3.addWidget(self.uiBaseUDPPortLabel)
self.uiBaseUDPPortSpinBox = QtGui.QSpinBox(self.uiUDPTunnelingGroupBox)
self.uiBaseUDPPortSpinBox.setSuffix(_fromUtf8(" UDP"))
self.uiBaseUDPPortSpinBox.setMaximum(65535)
self.uiBaseUDPPortSpinBox.setProperty("value", 10001)
self.uiBaseUDPPortSpinBox.setObjectName(_fromUtf8("uiBaseUDPPortSpinBox"))
self.verticalLayout_3.addWidget(self.uiBaseUDPPortSpinBox)
self.uiBaseUDPPortIncrementationLabel = QtGui.QLabel(self.uiUDPTunnelingGroupBox)
self.uiBaseUDPPortIncrementationLabel.setObjectName(_fromUtf8("uiBaseUDPPortIncrementationLabel"))
self.verticalLayout_3.addWidget(self.uiBaseUDPPortIncrementationLabel)
self.uiBaseUDPPortIncrementationSpinBox = QtGui.QSpinBox(self.uiUDPTunnelingGroupBox)
self.uiBaseUDPPortIncrementationSpinBox.setMaximum(100000)
self.uiBaseUDPPortIncrementationSpinBox.setSingleStep(10)
self.uiBaseUDPPortIncrementationSpinBox.setProperty("value", 100)
self.uiBaseUDPPortIncrementationSpinBox.setObjectName(_fromUtf8("uiBaseUDPPortIncrementationSpinBox"))
self.verticalLayout_3.addWidget(self.uiBaseUDPPortIncrementationSpinBox)
self.verticalLayout_4.addWidget(self.uiUDPTunnelingGroupBox)
self.uiMemoryUsageOptimisationGroupBox = QtGui.QGroupBox(self.uiAdvancedSettingsTabWidget)
self.uiMemoryUsageOptimisationGroupBox.setObjectName(_fromUtf8("uiMemoryUsageOptimisationGroupBox"))
self.verticalLayout = QtGui.QVBoxLayout(self.uiMemoryUsageOptimisationGroupBox)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.uiGhostIOSSupportCheckBox = QtGui.QCheckBox(self.uiMemoryUsageOptimisationGroupBox)
self.uiGhostIOSSupportCheckBox.setChecked(True)
self.uiGhostIOSSupportCheckBox.setObjectName(_fromUtf8("uiGhostIOSSupportCheckBox"))
self.verticalLayout.addWidget(self.uiGhostIOSSupportCheckBox)
self.uiMmapSupportCheckBox = QtGui.QCheckBox(self.uiMemoryUsageOptimisationGroupBox)
self.uiMmapSupportCheckBox.setChecked(True)
self.uiMmapSupportCheckBox.setObjectName(_fromUtf8("uiMmapSupportCheckBox"))
self.verticalLayout.addWidget(self.uiMmapSupportCheckBox)
self.uiJITSharingSupportCheckBox = QtGui.QCheckBox(self.uiMemoryUsageOptimisationGroupBox)
self.uiJITSharingSupportCheckBox.setChecked(True)
self.uiJITSharingSupportCheckBox.setObjectName(_fromUtf8("uiJITSharingSupportCheckBox"))
self.verticalLayout.addWidget(self.uiJITSharingSupportCheckBox)
self.uiSparseMemorySupportCheckBox = QtGui.QCheckBox(self.uiMemoryUsageOptimisationGroupBox)
self.uiSparseMemorySupportCheckBox.setChecked(False)
self.uiSparseMemorySupportCheckBox.setObjectName(_fromUtf8("uiSparseMemorySupportCheckBox"))
self.verticalLayout.addWidget(self.uiSparseMemorySupportCheckBox)
self.verticalLayout_4.addWidget(self.uiMemoryUsageOptimisationGroupBox)
spacerItem2 = QtGui.QSpacerItem(390, 12, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout_4.addItem(spacerItem2)
self.uiTabWidget.addTab(self.uiAdvancedSettingsTabWidget, _fromUtf8(""))
self.vboxlayout.addWidget(self.uiTabWidget)
self.retranslateUi(DynamipsPreferencesPageWidget)
self.uiTabWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(DynamipsPreferencesPageWidget)
DynamipsPreferencesPageWidget.setTabOrder(self.uiTabWidget, self.uiDynamipsPathLineEdit)
DynamipsPreferencesPageWidget.setTabOrder(self.uiDynamipsPathLineEdit, self.uiDynamipsPathToolButton)
DynamipsPreferencesPageWidget.setTabOrder(self.uiDynamipsPathToolButton, self.uiBaseHypervisorPortSpinBox)
DynamipsPreferencesPageWidget.setTabOrder(self.uiBaseHypervisorPortSpinBox, self.uiBaseConsolePortSpinBox)
DynamipsPreferencesPageWidget.setTabOrder(self.uiBaseConsolePortSpinBox, self.uiBaseAuxPortSpinBox)
DynamipsPreferencesPageWidget.setTabOrder(self.uiBaseAuxPortSpinBox, self.uiAllocateHypervisorPerDeviceCheckBox)
DynamipsPreferencesPageWidget.setTabOrder(self.uiAllocateHypervisorPerDeviceCheckBox, self.uiMemoryUsageLimitPerHypervisorSpinBox)
DynamipsPreferencesPageWidget.setTabOrder(self.uiMemoryUsageLimitPerHypervisorSpinBox, self.uiAllocateHypervisorPerIOSCheckBox)
DynamipsPreferencesPageWidget.setTabOrder(self.uiAllocateHypervisorPerIOSCheckBox, self.uiBaseUDPPortSpinBox)
DynamipsPreferencesPageWidget.setTabOrder(self.uiBaseUDPPortSpinBox, self.uiBaseUDPPortIncrementationSpinBox)
DynamipsPreferencesPageWidget.setTabOrder(self.uiBaseUDPPortIncrementationSpinBox, self.uiGhostIOSSupportCheckBox)
DynamipsPreferencesPageWidget.setTabOrder(self.uiGhostIOSSupportCheckBox, self.uiMmapSupportCheckBox)
DynamipsPreferencesPageWidget.setTabOrder(self.uiMmapSupportCheckBox, self.uiJITSharingSupportCheckBox)
DynamipsPreferencesPageWidget.setTabOrder(self.uiJITSharingSupportCheckBox, self.uiSparseMemorySupportCheckBox)
def retranslateUi(self, DynamipsPreferencesPageWidget):
DynamipsPreferencesPageWidget.setWindowTitle(_translate("DynamipsPreferencesPageWidget", "Dynamips", None))
self.uiDynamipsPathLabel.setText(_translate("DynamipsPreferencesPageWidget", "Path to Dynamips:", None))
self.uiBaseHypervisorPortLabel.setText(_translate("DynamipsPreferencesPageWidget", "Base port for hypervisors:", None))
self.uiBaseConsolePortLabel.setText(_translate("DynamipsPreferencesPageWidget", "Base console port for routers:", None))
self.uiBaseAuxPortLabel.setText(_translate("DynamipsPreferencesPageWidget", "Base auxiliary console port for routers:", None))
self.uiTestSettingsPushButton.setText(_translate("DynamipsPreferencesPageWidget", "Test settings", None))
self.uiRestoreDefaultsPushButton.setText(_translate("DynamipsPreferencesPageWidget", "Restore defaults", None))
self.uiDynamipsPathToolButton.setText(_translate("DynamipsPreferencesPageWidget", "...", None))
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiGeneralSettingsTabWidget), _translate("DynamipsPreferencesPageWidget", "General settings", None))
self.uiUseLocalServercheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Use the local server", None))
self.uiRemoteServersGroupBox.setTitle(_translate("DynamipsPreferencesPageWidget", "Remote servers", None))
self.uiRemoteServersTreeWidget.headerItem().setText(0, _translate("DynamipsPreferencesPageWidget", "Host", None))
self.uiRemoteServersTreeWidget.headerItem().setText(1, _translate("DynamipsPreferencesPageWidget", "Port", None))
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiServerSettingsTabWidget), _translate("DynamipsPreferencesPageWidget", "Server settings", None))
self.uiHypervisorAllocationGroupBox.setTitle(_translate("DynamipsPreferencesPageWidget", "Hypervisor allocation", None))
self.uiAllocateHypervisorPerDeviceCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Allocate a new hypervisor for each device", None))
self.uiMemoryUsageLimitPerHypervisorLabel.setText(_translate("DynamipsPreferencesPageWidget", "Memory usage limit per hypervisor:", None))
self.uiMemoryUsageLimitPerHypervisorSpinBox.setSuffix(_translate("DynamipsPreferencesPageWidget", " MiB", None))
self.uiAllocateHypervisorPerIOSCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Allocate a new hypervisor per IOS image", None))
self.uiUDPTunnelingGroupBox.setTitle(_translate("DynamipsPreferencesPageWidget", "UDP tunneling", None))
self.uiBaseUDPPortLabel.setText(_translate("DynamipsPreferencesPageWidget", " Base UDP port:", None))
self.uiBaseUDPPortIncrementationLabel.setText(_translate("DynamipsPreferencesPageWidget", "UDP incrementation per hypervisor:", None))
self.uiMemoryUsageOptimisationGroupBox.setTitle(_translate("DynamipsPreferencesPageWidget", "Memory usage optimisation", None))
self.uiGhostIOSSupportCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Enable ghost IOS support", None))
self.uiMmapSupportCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Enable mmap support", None))
self.uiJITSharingSupportCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Enable JIT sharing support", None))
self.uiSparseMemorySupportCheckBox.setText(_translate("DynamipsPreferencesPageWidget", "Enable sparse memory support", None))
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiAdvancedSettingsTabWidget), _translate("DynamipsPreferencesPageWidget", "Advanced settings", None))

View File

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ethernetHubConfigPageWidget</class>
<widget class="QWidget" name="ethernetHubConfigPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>381</width>
<height>270</height>
</rect>
</property>
<property name="windowTitle">
<string>Ethernet hub</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="uiSettingsGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Settings</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiPortsLabel">
<property name="text">
<string>Number of ports:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="uiPortsSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>71</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>uiPortsSpinBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/ethernet_hub_configuration_page.ui'
#
# Created: Tue Jan 21 20:55:02 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_ethernetHubConfigPageWidget(object):
def setupUi(self, ethernetHubConfigPageWidget):
ethernetHubConfigPageWidget.setObjectName(_fromUtf8("ethernetHubConfigPageWidget"))
ethernetHubConfigPageWidget.resize(381, 270)
self.gridlayout = QtGui.QGridLayout(ethernetHubConfigPageWidget)
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
self.uiSettingsGroupBox = QtGui.QGroupBox(ethernetHubConfigPageWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSettingsGroupBox.sizePolicy().hasHeightForWidth())
self.uiSettingsGroupBox.setSizePolicy(sizePolicy)
self.uiSettingsGroupBox.setObjectName(_fromUtf8("uiSettingsGroupBox"))
self.gridlayout1 = QtGui.QGridLayout(self.uiSettingsGroupBox)
self.gridlayout1.setObjectName(_fromUtf8("gridlayout1"))
self.uiPortsLabel = QtGui.QLabel(self.uiSettingsGroupBox)
self.uiPortsLabel.setObjectName(_fromUtf8("uiPortsLabel"))
self.gridlayout1.addWidget(self.uiPortsLabel, 0, 0, 1, 1)
self.uiPortsSpinBox = QtGui.QSpinBox(self.uiSettingsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiPortsSpinBox.sizePolicy().hasHeightForWidth())
self.uiPortsSpinBox.setSizePolicy(sizePolicy)
self.uiPortsSpinBox.setMinimum(0)
self.uiPortsSpinBox.setMaximum(65535)
self.uiPortsSpinBox.setProperty("value", 1)
self.uiPortsSpinBox.setObjectName(_fromUtf8("uiPortsSpinBox"))
self.gridlayout1.addWidget(self.uiPortsSpinBox, 0, 1, 1, 1)
spacerItem = QtGui.QSpacerItem(20, 71, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout1.addItem(spacerItem, 1, 1, 1, 1)
self.gridlayout.addWidget(self.uiSettingsGroupBox, 0, 0, 1, 2)
self.retranslateUi(ethernetHubConfigPageWidget)
QtCore.QMetaObject.connectSlotsByName(ethernetHubConfigPageWidget)
def retranslateUi(self, ethernetHubConfigPageWidget):
ethernetHubConfigPageWidget.setWindowTitle(_translate("ethernetHubConfigPageWidget", "Ethernet hub", None))
self.uiSettingsGroupBox.setTitle(_translate("ethernetHubConfigPageWidget", "Settings", None))
self.uiPortsLabel.setText(_translate("ethernetHubConfigPageWidget", "Number of ports:", None))

View File

@@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ethernetSwitchConfigPageWidget</class>
<widget class="QWidget" name="ethernetSwitchConfigPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>397</width>
<height>315</height>
</rect>
</property>
<property name="windowTitle">
<string>Ethernet switch configuration</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="uiEthernetSwitchSettingsGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Settings</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="uiPortSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>VLAN:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="uiVlanSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="uiPortTypeComboBox">
<item>
<property name="text">
<string>access</string>
</property>
</item>
<item>
<property name="text">
<string>dot1q</string>
</property>
</item>
<item>
<property name="text">
<string>qinq</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2" rowspan="3">
<widget class="QGroupBox" name="uiEthernetSwitchPortsGroupBox">
<property name="title">
<string>Ports</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QTreeWidget" name="uiPortsTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<column>
<property name="text">
<string>Port</string>
</property>
</column>
<column>
<property name="text">
<string>VLAN</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="uiAddPushButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="uiDeletePushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>71</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>
<tabstop>uiPortSpinBox</tabstop>
<tabstop>uiVlanSpinBox</tabstop>
<tabstop>uiPortTypeComboBox</tabstop>
<tabstop>uiAddPushButton</tabstop>
<tabstop>uiDeletePushButton</tabstop>
<tabstop>uiPortsTreeWidget</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,128 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/ethernet_switch_configuration_page.ui'
#
# Created: Tue Jan 21 20:35:18 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_ethernetSwitchConfigPageWidget(object):
def setupUi(self, ethernetSwitchConfigPageWidget):
ethernetSwitchConfigPageWidget.setObjectName(_fromUtf8("ethernetSwitchConfigPageWidget"))
ethernetSwitchConfigPageWidget.resize(397, 315)
self.gridlayout = QtGui.QGridLayout(ethernetSwitchConfigPageWidget)
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
self.uiEthernetSwitchSettingsGroupBox = QtGui.QGroupBox(ethernetSwitchConfigPageWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiEthernetSwitchSettingsGroupBox.sizePolicy().hasHeightForWidth())
self.uiEthernetSwitchSettingsGroupBox.setSizePolicy(sizePolicy)
self.uiEthernetSwitchSettingsGroupBox.setObjectName(_fromUtf8("uiEthernetSwitchSettingsGroupBox"))
self.gridlayout1 = QtGui.QGridLayout(self.uiEthernetSwitchSettingsGroupBox)
self.gridlayout1.setObjectName(_fromUtf8("gridlayout1"))
self.label = QtGui.QLabel(self.uiEthernetSwitchSettingsGroupBox)
self.label.setObjectName(_fromUtf8("label"))
self.gridlayout1.addWidget(self.label, 0, 0, 1, 1)
self.uiPortSpinBox = QtGui.QSpinBox(self.uiEthernetSwitchSettingsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiPortSpinBox.sizePolicy().hasHeightForWidth())
self.uiPortSpinBox.setSizePolicy(sizePolicy)
self.uiPortSpinBox.setMinimum(0)
self.uiPortSpinBox.setMaximum(65535)
self.uiPortSpinBox.setProperty("value", 1)
self.uiPortSpinBox.setObjectName(_fromUtf8("uiPortSpinBox"))
self.gridlayout1.addWidget(self.uiPortSpinBox, 0, 1, 1, 1)
self.label_3 = QtGui.QLabel(self.uiEthernetSwitchSettingsGroupBox)
self.label_3.setObjectName(_fromUtf8("label_3"))
self.gridlayout1.addWidget(self.label_3, 1, 0, 1, 1)
self.uiVlanSpinBox = QtGui.QSpinBox(self.uiEthernetSwitchSettingsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiVlanSpinBox.sizePolicy().hasHeightForWidth())
self.uiVlanSpinBox.setSizePolicy(sizePolicy)
self.uiVlanSpinBox.setMinimum(0)
self.uiVlanSpinBox.setMaximum(65535)
self.uiVlanSpinBox.setProperty("value", 1)
self.uiVlanSpinBox.setObjectName(_fromUtf8("uiVlanSpinBox"))
self.gridlayout1.addWidget(self.uiVlanSpinBox, 1, 1, 1, 1)
self.label_2 = QtGui.QLabel(self.uiEthernetSwitchSettingsGroupBox)
self.label_2.setObjectName(_fromUtf8("label_2"))
self.gridlayout1.addWidget(self.label_2, 2, 0, 1, 1)
self.uiPortTypeComboBox = QtGui.QComboBox(self.uiEthernetSwitchSettingsGroupBox)
self.uiPortTypeComboBox.setObjectName(_fromUtf8("uiPortTypeComboBox"))
self.uiPortTypeComboBox.addItem(_fromUtf8(""))
self.uiPortTypeComboBox.addItem(_fromUtf8(""))
self.uiPortTypeComboBox.addItem(_fromUtf8(""))
self.gridlayout1.addWidget(self.uiPortTypeComboBox, 2, 1, 1, 1)
self.gridlayout.addWidget(self.uiEthernetSwitchSettingsGroupBox, 0, 0, 1, 2)
self.uiEthernetSwitchPortsGroupBox = QtGui.QGroupBox(ethernetSwitchConfigPageWidget)
self.uiEthernetSwitchPortsGroupBox.setObjectName(_fromUtf8("uiEthernetSwitchPortsGroupBox"))
self.vboxlayout = QtGui.QVBoxLayout(self.uiEthernetSwitchPortsGroupBox)
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
self.uiPortsTreeWidget = QtGui.QTreeWidget(self.uiEthernetSwitchPortsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiPortsTreeWidget.sizePolicy().hasHeightForWidth())
self.uiPortsTreeWidget.setSizePolicy(sizePolicy)
self.uiPortsTreeWidget.setRootIsDecorated(False)
self.uiPortsTreeWidget.setObjectName(_fromUtf8("uiPortsTreeWidget"))
self.vboxlayout.addWidget(self.uiPortsTreeWidget)
self.gridlayout.addWidget(self.uiEthernetSwitchPortsGroupBox, 0, 2, 3, 1)
self.uiAddPushButton = QtGui.QPushButton(ethernetSwitchConfigPageWidget)
self.uiAddPushButton.setObjectName(_fromUtf8("uiAddPushButton"))
self.gridlayout.addWidget(self.uiAddPushButton, 1, 0, 1, 1)
self.uiDeletePushButton = QtGui.QPushButton(ethernetSwitchConfigPageWidget)
self.uiDeletePushButton.setEnabled(False)
self.uiDeletePushButton.setObjectName(_fromUtf8("uiDeletePushButton"))
self.gridlayout.addWidget(self.uiDeletePushButton, 1, 1, 1, 1)
spacerItem = QtGui.QSpacerItem(20, 71, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout.addItem(spacerItem, 2, 1, 1, 1)
spacerItem1 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout.addItem(spacerItem1, 3, 2, 1, 1)
self.retranslateUi(ethernetSwitchConfigPageWidget)
QtCore.QMetaObject.connectSlotsByName(ethernetSwitchConfigPageWidget)
ethernetSwitchConfigPageWidget.setTabOrder(self.uiPortSpinBox, self.uiVlanSpinBox)
ethernetSwitchConfigPageWidget.setTabOrder(self.uiVlanSpinBox, self.uiPortTypeComboBox)
ethernetSwitchConfigPageWidget.setTabOrder(self.uiPortTypeComboBox, self.uiAddPushButton)
ethernetSwitchConfigPageWidget.setTabOrder(self.uiAddPushButton, self.uiDeletePushButton)
ethernetSwitchConfigPageWidget.setTabOrder(self.uiDeletePushButton, self.uiPortsTreeWidget)
def retranslateUi(self, ethernetSwitchConfigPageWidget):
ethernetSwitchConfigPageWidget.setWindowTitle(_translate("ethernetSwitchConfigPageWidget", "Ethernet switch configuration", None))
self.uiEthernetSwitchSettingsGroupBox.setTitle(_translate("ethernetSwitchConfigPageWidget", "Settings", None))
self.label.setText(_translate("ethernetSwitchConfigPageWidget", "Port:", None))
self.label_3.setText(_translate("ethernetSwitchConfigPageWidget", "VLAN:", None))
self.label_2.setText(_translate("ethernetSwitchConfigPageWidget", "Type:", None))
self.uiPortTypeComboBox.setItemText(0, _translate("ethernetSwitchConfigPageWidget", "access", None))
self.uiPortTypeComboBox.setItemText(1, _translate("ethernetSwitchConfigPageWidget", "dot1q", None))
self.uiPortTypeComboBox.setItemText(2, _translate("ethernetSwitchConfigPageWidget", "qinq", None))
self.uiEthernetSwitchPortsGroupBox.setTitle(_translate("ethernetSwitchConfigPageWidget", "Ports", None))
self.uiPortsTreeWidget.headerItem().setText(0, _translate("ethernetSwitchConfigPageWidget", "Port", None))
self.uiPortsTreeWidget.headerItem().setText(1, _translate("ethernetSwitchConfigPageWidget", "VLAN", None))
self.uiPortsTreeWidget.headerItem().setText(2, _translate("ethernetSwitchConfigPageWidget", "Type", None))
self.uiAddPushButton.setText(_translate("ethernetSwitchConfigPageWidget", "&Add", None))
self.uiDeletePushButton.setText(_translate("ethernetSwitchConfigPageWidget", "&Delete", None))

View File

@@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>frameRelaySwitchConfigPageWidget</class>
<widget class="QWidget" name="frameRelaySwitchConfigPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>397</width>
<height>314</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame Relay Switch</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="uiFrameRelaySourceGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Source</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiSourcePortLabel">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="uiSourcePortSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiSourceDLCILabel">
<property name="text">
<string>DLCI:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="uiSourceDLCISpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>101</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2" rowspan="3">
<widget class="QGroupBox" name="uiFrameRelayMappingGroupBox">
<property name="title">
<string>Mapping</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QTreeWidget" name="uiMappingTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<column>
<property name="text">
<string>Port:DLCI</string>
</property>
</column>
<column>
<property name="text">
<string>Port:DLCI</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="uiFrameRelayDestinationGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Destination</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiDestinationPortLabel">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="uiDestinationPortSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiDestinationDLCILabel">
<property name="text">
<string>DLCI:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="uiDestinationDLCISpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>202</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="uiAddPushButton">
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="uiDeletePushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Delete</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>
<tabstop>uiSourcePortSpinBox</tabstop>
<tabstop>uiSourceDLCISpinBox</tabstop>
<tabstop>uiDestinationPortSpinBox</tabstop>
<tabstop>uiDestinationDLCISpinBox</tabstop>
<tabstop>uiAddPushButton</tabstop>
<tabstop>uiDeletePushButton</tabstop>
<tabstop>uiMappingTreeWidget</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,152 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/frame_relay_switch_configuration_page.ui'
#
# Created: Tue Jan 21 21:27:47 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_frameRelaySwitchConfigPageWidget(object):
def setupUi(self, frameRelaySwitchConfigPageWidget):
frameRelaySwitchConfigPageWidget.setObjectName(_fromUtf8("frameRelaySwitchConfigPageWidget"))
frameRelaySwitchConfigPageWidget.resize(397, 314)
self.gridlayout = QtGui.QGridLayout(frameRelaySwitchConfigPageWidget)
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
self.uiFrameRelaySourceGroupBox = QtGui.QGroupBox(frameRelaySwitchConfigPageWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiFrameRelaySourceGroupBox.sizePolicy().hasHeightForWidth())
self.uiFrameRelaySourceGroupBox.setSizePolicy(sizePolicy)
self.uiFrameRelaySourceGroupBox.setObjectName(_fromUtf8("uiFrameRelaySourceGroupBox"))
self.gridlayout1 = QtGui.QGridLayout(self.uiFrameRelaySourceGroupBox)
self.gridlayout1.setObjectName(_fromUtf8("gridlayout1"))
self.uiSourcePortLabel = QtGui.QLabel(self.uiFrameRelaySourceGroupBox)
self.uiSourcePortLabel.setObjectName(_fromUtf8("uiSourcePortLabel"))
self.gridlayout1.addWidget(self.uiSourcePortLabel, 0, 0, 1, 1)
self.uiSourcePortSpinBox = QtGui.QSpinBox(self.uiFrameRelaySourceGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSourcePortSpinBox.sizePolicy().hasHeightForWidth())
self.uiSourcePortSpinBox.setSizePolicy(sizePolicy)
self.uiSourcePortSpinBox.setMinimum(0)
self.uiSourcePortSpinBox.setMaximum(65535)
self.uiSourcePortSpinBox.setProperty("value", 1)
self.uiSourcePortSpinBox.setObjectName(_fromUtf8("uiSourcePortSpinBox"))
self.gridlayout1.addWidget(self.uiSourcePortSpinBox, 0, 1, 1, 1)
self.uiSourceDLCILabel = QtGui.QLabel(self.uiFrameRelaySourceGroupBox)
self.uiSourceDLCILabel.setObjectName(_fromUtf8("uiSourceDLCILabel"))
self.gridlayout1.addWidget(self.uiSourceDLCILabel, 1, 0, 1, 1)
self.uiSourceDLCISpinBox = QtGui.QSpinBox(self.uiFrameRelaySourceGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSourceDLCISpinBox.sizePolicy().hasHeightForWidth())
self.uiSourceDLCISpinBox.setSizePolicy(sizePolicy)
self.uiSourceDLCISpinBox.setMaximum(65535)
self.uiSourceDLCISpinBox.setProperty("value", 101)
self.uiSourceDLCISpinBox.setObjectName(_fromUtf8("uiSourceDLCISpinBox"))
self.gridlayout1.addWidget(self.uiSourceDLCISpinBox, 1, 1, 1, 1)
self.gridlayout.addWidget(self.uiFrameRelaySourceGroupBox, 0, 0, 1, 2)
self.uiFrameRelayMappingGroupBox = QtGui.QGroupBox(frameRelaySwitchConfigPageWidget)
self.uiFrameRelayMappingGroupBox.setObjectName(_fromUtf8("uiFrameRelayMappingGroupBox"))
self.vboxlayout = QtGui.QVBoxLayout(self.uiFrameRelayMappingGroupBox)
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
self.uiMappingTreeWidget = QtGui.QTreeWidget(self.uiFrameRelayMappingGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiMappingTreeWidget.sizePolicy().hasHeightForWidth())
self.uiMappingTreeWidget.setSizePolicy(sizePolicy)
self.uiMappingTreeWidget.setRootIsDecorated(False)
self.uiMappingTreeWidget.setObjectName(_fromUtf8("uiMappingTreeWidget"))
self.vboxlayout.addWidget(self.uiMappingTreeWidget)
self.gridlayout.addWidget(self.uiFrameRelayMappingGroupBox, 0, 2, 3, 1)
self.uiFrameRelayDestinationGroupBox = QtGui.QGroupBox(frameRelaySwitchConfigPageWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiFrameRelayDestinationGroupBox.sizePolicy().hasHeightForWidth())
self.uiFrameRelayDestinationGroupBox.setSizePolicy(sizePolicy)
self.uiFrameRelayDestinationGroupBox.setObjectName(_fromUtf8("uiFrameRelayDestinationGroupBox"))
self.gridlayout2 = QtGui.QGridLayout(self.uiFrameRelayDestinationGroupBox)
self.gridlayout2.setObjectName(_fromUtf8("gridlayout2"))
self.uiDestinationPortLabel = QtGui.QLabel(self.uiFrameRelayDestinationGroupBox)
self.uiDestinationPortLabel.setObjectName(_fromUtf8("uiDestinationPortLabel"))
self.gridlayout2.addWidget(self.uiDestinationPortLabel, 0, 0, 1, 1)
self.uiDestinationPortSpinBox = QtGui.QSpinBox(self.uiFrameRelayDestinationGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiDestinationPortSpinBox.sizePolicy().hasHeightForWidth())
self.uiDestinationPortSpinBox.setSizePolicy(sizePolicy)
self.uiDestinationPortSpinBox.setMinimum(0)
self.uiDestinationPortSpinBox.setMaximum(65535)
self.uiDestinationPortSpinBox.setProperty("value", 10)
self.uiDestinationPortSpinBox.setObjectName(_fromUtf8("uiDestinationPortSpinBox"))
self.gridlayout2.addWidget(self.uiDestinationPortSpinBox, 0, 1, 1, 1)
self.uiDestinationDLCILabel = QtGui.QLabel(self.uiFrameRelayDestinationGroupBox)
self.uiDestinationDLCILabel.setObjectName(_fromUtf8("uiDestinationDLCILabel"))
self.gridlayout2.addWidget(self.uiDestinationDLCILabel, 1, 0, 1, 1)
self.uiDestinationDLCISpinBox = QtGui.QSpinBox(self.uiFrameRelayDestinationGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiDestinationDLCISpinBox.sizePolicy().hasHeightForWidth())
self.uiDestinationDLCISpinBox.setSizePolicy(sizePolicy)
self.uiDestinationDLCISpinBox.setMaximum(65535)
self.uiDestinationDLCISpinBox.setProperty("value", 202)
self.uiDestinationDLCISpinBox.setObjectName(_fromUtf8("uiDestinationDLCISpinBox"))
self.gridlayout2.addWidget(self.uiDestinationDLCISpinBox, 1, 1, 1, 1)
self.gridlayout.addWidget(self.uiFrameRelayDestinationGroupBox, 1, 0, 1, 2)
self.uiAddPushButton = QtGui.QPushButton(frameRelaySwitchConfigPageWidget)
self.uiAddPushButton.setObjectName(_fromUtf8("uiAddPushButton"))
self.gridlayout.addWidget(self.uiAddPushButton, 2, 0, 1, 1)
self.uiDeletePushButton = QtGui.QPushButton(frameRelaySwitchConfigPageWidget)
self.uiDeletePushButton.setEnabled(False)
self.uiDeletePushButton.setObjectName(_fromUtf8("uiDeletePushButton"))
self.gridlayout.addWidget(self.uiDeletePushButton, 2, 1, 1, 1)
spacerItem = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout.addItem(spacerItem, 3, 1, 1, 2)
self.retranslateUi(frameRelaySwitchConfigPageWidget)
QtCore.QMetaObject.connectSlotsByName(frameRelaySwitchConfigPageWidget)
frameRelaySwitchConfigPageWidget.setTabOrder(self.uiSourcePortSpinBox, self.uiSourceDLCISpinBox)
frameRelaySwitchConfigPageWidget.setTabOrder(self.uiSourceDLCISpinBox, self.uiDestinationPortSpinBox)
frameRelaySwitchConfigPageWidget.setTabOrder(self.uiDestinationPortSpinBox, self.uiDestinationDLCISpinBox)
frameRelaySwitchConfigPageWidget.setTabOrder(self.uiDestinationDLCISpinBox, self.uiAddPushButton)
frameRelaySwitchConfigPageWidget.setTabOrder(self.uiAddPushButton, self.uiDeletePushButton)
frameRelaySwitchConfigPageWidget.setTabOrder(self.uiDeletePushButton, self.uiMappingTreeWidget)
def retranslateUi(self, frameRelaySwitchConfigPageWidget):
frameRelaySwitchConfigPageWidget.setWindowTitle(_translate("frameRelaySwitchConfigPageWidget", "Frame Relay Switch", None))
self.uiFrameRelaySourceGroupBox.setTitle(_translate("frameRelaySwitchConfigPageWidget", "Source", None))
self.uiSourcePortLabel.setText(_translate("frameRelaySwitchConfigPageWidget", "Port:", None))
self.uiSourceDLCILabel.setText(_translate("frameRelaySwitchConfigPageWidget", "DLCI:", None))
self.uiFrameRelayMappingGroupBox.setTitle(_translate("frameRelaySwitchConfigPageWidget", "Mapping", None))
self.uiMappingTreeWidget.headerItem().setText(0, _translate("frameRelaySwitchConfigPageWidget", "Port:DLCI", None))
self.uiMappingTreeWidget.headerItem().setText(1, _translate("frameRelaySwitchConfigPageWidget", "Port:DLCI", None))
self.uiFrameRelayDestinationGroupBox.setTitle(_translate("frameRelaySwitchConfigPageWidget", "Destination", None))
self.uiDestinationPortLabel.setText(_translate("frameRelaySwitchConfigPageWidget", "Port:", None))
self.uiDestinationDLCILabel.setText(_translate("frameRelaySwitchConfigPageWidget", "DLCI:", None))
self.uiAddPushButton.setText(_translate("frameRelaySwitchConfigPageWidget", "&Add", None))
self.uiDeletePushButton.setText(_translate("frameRelaySwitchConfigPageWidget", "&Delete", None))

View File

@@ -0,0 +1,275 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>IOSRouterPreferencesPageWidget</class>
<widget class="QWidget" name="IOSRouterPreferencesPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>430</width>
<height>525</height>
</rect>
</property>
<property name="windowTitle">
<string>IOS routers</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QTabWidget" name="uiTabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="uiIOSImagesTabWidget">
<attribute name="title">
<string>IOS images</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2">
<widget class="QTreeWidget" name="uiIOSImagesTreeWidget">
<column>
<property name="text">
<string>File</string>
</property>
</column>
<column>
<property name="text">
<string>Platform</string>
</property>
</column>
<column>
<property name="text">
<string>Server</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="uiIOSPathLabel">
<property name="text">
<string>IOS path:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="uiIOSPathLineEdit"/>
</item>
<item>
<widget class="QToolButton" name="uiIOSPathToolButton">
<property name="text">
<string>...</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiStartupConfigLabel">
<property name="text">
<string>Startup-config:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLineEdit" name="uiStartupConfigLineEdit"/>
</item>
<item>
<widget class="QToolButton" name="uiStartupConfigToolButton">
<property name="text">
<string>...</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="uiPlatformLabel">
<property name="text">
<string>Platform:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QComboBox" name="uiPlatformComboBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="uiChassisLabel">
<property name="text">
<string>Chassis:</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QComboBox" name="uiChassisComboBox"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="uiIdlePCLabel">
<property name="text">
<string>Idle-PC:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="uiIdlePCLineEdit"/>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="uiIdlePCFinderPushButton">
<property name="text">
<string>Idle-PC finder</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="uiRAMLabel">
<property name="text">
<string>RAM:</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QSpinBox" name="uiRAMSpinBox">
<property name="suffix">
<string> MB</string>
</property>
<property name="minimum">
<number>16</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>128</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="uiIOSImageTestSettingsPushButton">
<property name="text">
<string>Test settings</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="uiSaveIOSImagePushButton">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="uiDeleteIOSImagePushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="uiIOSRoutersTabWidget">
<attribute name="title">
<string>IOS routers</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2">
<widget class="QTreeWidget" name="treeWidget_2">
<column>
<property name="text">
<string>IOS routers</string>
</property>
</column>
<column>
<property name="text">
<string>IOS file</string>
</property>
</column>
</widget>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>New</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_5">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>354</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
<designerdata>
<property name="gridDeltaX">
<number>10</number>
</property>
<property name="gridDeltaY">
<number>10</number>
</property>
<property name="gridSnapX">
<bool>true</bool>
</property>
<property name="gridSnapY">
<bool>true</bool>
</property>
<property name="gridVisible">
<bool>true</bool>
</property>
</designerdata>
</ui>

View File

@@ -0,0 +1,170 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/ios_router_preferences_page.ui'
#
# Created: Thu Jan 30 21:12:48 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_IOSRouterPreferencesPageWidget(object):
def setupUi(self, IOSRouterPreferencesPageWidget):
IOSRouterPreferencesPageWidget.setObjectName(_fromUtf8("IOSRouterPreferencesPageWidget"))
IOSRouterPreferencesPageWidget.resize(430, 525)
self.vboxlayout = QtGui.QVBoxLayout(IOSRouterPreferencesPageWidget)
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
self.uiTabWidget = QtGui.QTabWidget(IOSRouterPreferencesPageWidget)
self.uiTabWidget.setObjectName(_fromUtf8("uiTabWidget"))
self.uiIOSImagesTabWidget = QtGui.QWidget()
self.uiIOSImagesTabWidget.setObjectName(_fromUtf8("uiIOSImagesTabWidget"))
self.gridLayout_3 = QtGui.QGridLayout(self.uiIOSImagesTabWidget)
self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
self.uiIOSImagesTreeWidget = QtGui.QTreeWidget(self.uiIOSImagesTabWidget)
self.uiIOSImagesTreeWidget.setObjectName(_fromUtf8("uiIOSImagesTreeWidget"))
self.gridLayout_3.addWidget(self.uiIOSImagesTreeWidget, 0, 0, 1, 2)
self.groupBox = QtGui.QGroupBox(self.uiIOSImagesTabWidget)
self.groupBox.setObjectName(_fromUtf8("groupBox"))
self.gridLayout_2 = QtGui.QGridLayout(self.groupBox)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.uiIOSPathLabel = QtGui.QLabel(self.groupBox)
self.uiIOSPathLabel.setObjectName(_fromUtf8("uiIOSPathLabel"))
self.gridLayout_2.addWidget(self.uiIOSPathLabel, 0, 0, 1, 1)
self.horizontalLayout_3 = QtGui.QHBoxLayout()
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
self.uiIOSPathLineEdit = QtGui.QLineEdit(self.groupBox)
self.uiIOSPathLineEdit.setObjectName(_fromUtf8("uiIOSPathLineEdit"))
self.horizontalLayout_3.addWidget(self.uiIOSPathLineEdit)
self.uiIOSPathToolButton = QtGui.QToolButton(self.groupBox)
self.uiIOSPathToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
self.uiIOSPathToolButton.setObjectName(_fromUtf8("uiIOSPathToolButton"))
self.horizontalLayout_3.addWidget(self.uiIOSPathToolButton)
self.gridLayout_2.addLayout(self.horizontalLayout_3, 0, 1, 1, 2)
self.uiStartupConfigLabel = QtGui.QLabel(self.groupBox)
self.uiStartupConfigLabel.setObjectName(_fromUtf8("uiStartupConfigLabel"))
self.gridLayout_2.addWidget(self.uiStartupConfigLabel, 1, 0, 1, 1)
self.horizontalLayout_4 = QtGui.QHBoxLayout()
self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
self.uiStartupConfigLineEdit = QtGui.QLineEdit(self.groupBox)
self.uiStartupConfigLineEdit.setObjectName(_fromUtf8("uiStartupConfigLineEdit"))
self.horizontalLayout_4.addWidget(self.uiStartupConfigLineEdit)
self.uiStartupConfigToolButton = QtGui.QToolButton(self.groupBox)
self.uiStartupConfigToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
self.uiStartupConfigToolButton.setObjectName(_fromUtf8("uiStartupConfigToolButton"))
self.horizontalLayout_4.addWidget(self.uiStartupConfigToolButton)
self.gridLayout_2.addLayout(self.horizontalLayout_4, 1, 1, 1, 2)
self.uiPlatformLabel = QtGui.QLabel(self.groupBox)
self.uiPlatformLabel.setObjectName(_fromUtf8("uiPlatformLabel"))
self.gridLayout_2.addWidget(self.uiPlatformLabel, 2, 0, 1, 1)
self.uiPlatformComboBox = QtGui.QComboBox(self.groupBox)
self.uiPlatformComboBox.setObjectName(_fromUtf8("uiPlatformComboBox"))
self.gridLayout_2.addWidget(self.uiPlatformComboBox, 2, 1, 1, 2)
self.uiChassisLabel = QtGui.QLabel(self.groupBox)
self.uiChassisLabel.setObjectName(_fromUtf8("uiChassisLabel"))
self.gridLayout_2.addWidget(self.uiChassisLabel, 3, 0, 1, 1)
self.uiChassisComboBox = QtGui.QComboBox(self.groupBox)
self.uiChassisComboBox.setObjectName(_fromUtf8("uiChassisComboBox"))
self.gridLayout_2.addWidget(self.uiChassisComboBox, 3, 1, 1, 2)
self.uiIdlePCLabel = QtGui.QLabel(self.groupBox)
self.uiIdlePCLabel.setObjectName(_fromUtf8("uiIdlePCLabel"))
self.gridLayout_2.addWidget(self.uiIdlePCLabel, 4, 0, 1, 1)
self.uiIdlePCLineEdit = QtGui.QLineEdit(self.groupBox)
self.uiIdlePCLineEdit.setObjectName(_fromUtf8("uiIdlePCLineEdit"))
self.gridLayout_2.addWidget(self.uiIdlePCLineEdit, 4, 1, 1, 1)
self.uiIdlePCFinderPushButton = QtGui.QPushButton(self.groupBox)
self.uiIdlePCFinderPushButton.setObjectName(_fromUtf8("uiIdlePCFinderPushButton"))
self.gridLayout_2.addWidget(self.uiIdlePCFinderPushButton, 4, 2, 1, 1)
self.uiRAMLabel = QtGui.QLabel(self.groupBox)
self.uiRAMLabel.setObjectName(_fromUtf8("uiRAMLabel"))
self.gridLayout_2.addWidget(self.uiRAMLabel, 5, 0, 1, 1)
self.uiRAMSpinBox = QtGui.QSpinBox(self.groupBox)
self.uiRAMSpinBox.setMinimum(16)
self.uiRAMSpinBox.setMaximum(65535)
self.uiRAMSpinBox.setProperty("value", 128)
self.uiRAMSpinBox.setObjectName(_fromUtf8("uiRAMSpinBox"))
self.gridLayout_2.addWidget(self.uiRAMSpinBox, 5, 1, 1, 2)
self.gridLayout_3.addWidget(self.groupBox, 1, 0, 1, 2)
self.horizontalLayout_5 = QtGui.QHBoxLayout()
self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
self.uiIOSImageTestSettingsPushButton = QtGui.QPushButton(self.uiIOSImagesTabWidget)
self.uiIOSImageTestSettingsPushButton.setObjectName(_fromUtf8("uiIOSImageTestSettingsPushButton"))
self.horizontalLayout_5.addWidget(self.uiIOSImageTestSettingsPushButton)
self.uiSaveIOSImagePushButton = QtGui.QPushButton(self.uiIOSImagesTabWidget)
self.uiSaveIOSImagePushButton.setObjectName(_fromUtf8("uiSaveIOSImagePushButton"))
self.horizontalLayout_5.addWidget(self.uiSaveIOSImagePushButton)
self.uiDeleteIOSImagePushButton = QtGui.QPushButton(self.uiIOSImagesTabWidget)
self.uiDeleteIOSImagePushButton.setEnabled(False)
self.uiDeleteIOSImagePushButton.setObjectName(_fromUtf8("uiDeleteIOSImagePushButton"))
self.horizontalLayout_5.addWidget(self.uiDeleteIOSImagePushButton)
self.gridLayout_3.addLayout(self.horizontalLayout_5, 2, 0, 1, 1)
self.uiTabWidget.addTab(self.uiIOSImagesTabWidget, _fromUtf8(""))
self.uiIOSRoutersTabWidget = QtGui.QWidget()
self.uiIOSRoutersTabWidget.setObjectName(_fromUtf8("uiIOSRoutersTabWidget"))
self.gridLayout = QtGui.QGridLayout(self.uiIOSRoutersTabWidget)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.treeWidget_2 = QtGui.QTreeWidget(self.uiIOSRoutersTabWidget)
self.treeWidget_2.setObjectName(_fromUtf8("treeWidget_2"))
self.gridLayout.addWidget(self.treeWidget_2, 0, 0, 2, 1)
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.pushButton_3 = QtGui.QPushButton(self.uiIOSRoutersTabWidget)
self.pushButton_3.setObjectName(_fromUtf8("pushButton_3"))
self.verticalLayout.addWidget(self.pushButton_3)
self.pushButton_4 = QtGui.QPushButton(self.uiIOSRoutersTabWidget)
self.pushButton_4.setObjectName(_fromUtf8("pushButton_4"))
self.verticalLayout.addWidget(self.pushButton_4)
self.pushButton_5 = QtGui.QPushButton(self.uiIOSRoutersTabWidget)
self.pushButton_5.setObjectName(_fromUtf8("pushButton_5"))
self.verticalLayout.addWidget(self.pushButton_5)
self.gridLayout.addLayout(self.verticalLayout, 0, 1, 1, 1)
spacerItem = QtGui.QSpacerItem(20, 354, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem, 1, 1, 1, 1)
self.uiTabWidget.addTab(self.uiIOSRoutersTabWidget, _fromUtf8(""))
self.vboxlayout.addWidget(self.uiTabWidget)
self.retranslateUi(IOSRouterPreferencesPageWidget)
self.uiTabWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(IOSRouterPreferencesPageWidget)
def retranslateUi(self, IOSRouterPreferencesPageWidget):
IOSRouterPreferencesPageWidget.setWindowTitle(_translate("IOSRouterPreferencesPageWidget", "IOS routers", None))
self.uiIOSImagesTreeWidget.headerItem().setText(0, _translate("IOSRouterPreferencesPageWidget", "File", None))
self.uiIOSImagesTreeWidget.headerItem().setText(1, _translate("IOSRouterPreferencesPageWidget", "Platform", None))
self.uiIOSImagesTreeWidget.headerItem().setText(2, _translate("IOSRouterPreferencesPageWidget", "Server", None))
self.groupBox.setTitle(_translate("IOSRouterPreferencesPageWidget", "Settings", None))
self.uiIOSPathLabel.setText(_translate("IOSRouterPreferencesPageWidget", "IOS path:", None))
self.uiIOSPathToolButton.setText(_translate("IOSRouterPreferencesPageWidget", "...", None))
self.uiStartupConfigLabel.setText(_translate("IOSRouterPreferencesPageWidget", "Startup-config:", None))
self.uiStartupConfigToolButton.setText(_translate("IOSRouterPreferencesPageWidget", "...", None))
self.uiPlatformLabel.setText(_translate("IOSRouterPreferencesPageWidget", "Platform:", None))
self.uiChassisLabel.setText(_translate("IOSRouterPreferencesPageWidget", "Chassis:", None))
self.uiIdlePCLabel.setText(_translate("IOSRouterPreferencesPageWidget", "Idle-PC:", None))
self.uiIdlePCFinderPushButton.setText(_translate("IOSRouterPreferencesPageWidget", "Idle-PC finder", None))
self.uiRAMLabel.setText(_translate("IOSRouterPreferencesPageWidget", "RAM:", None))
self.uiRAMSpinBox.setSuffix(_translate("IOSRouterPreferencesPageWidget", " MB", None))
self.uiIOSImageTestSettingsPushButton.setText(_translate("IOSRouterPreferencesPageWidget", "Test settings", None))
self.uiSaveIOSImagePushButton.setText(_translate("IOSRouterPreferencesPageWidget", "Save", None))
self.uiDeleteIOSImagePushButton.setText(_translate("IOSRouterPreferencesPageWidget", "Delete", None))
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiIOSImagesTabWidget), _translate("IOSRouterPreferencesPageWidget", "IOS images", None))
self.treeWidget_2.headerItem().setText(0, _translate("IOSRouterPreferencesPageWidget", "IOS routers", None))
self.treeWidget_2.headerItem().setText(1, _translate("IOSRouterPreferencesPageWidget", "IOS file", None))
self.pushButton_3.setText(_translate("IOSRouterPreferencesPageWidget", "New", None))
self.pushButton_4.setText(_translate("IOSRouterPreferencesPageWidget", "Edit", None))
self.pushButton_5.setText(_translate("IOSRouterPreferencesPageWidget", "Delete", None))
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiIOSRoutersTabWidget), _translate("IOSRouterPreferencesPageWidget", "IOS routers", None))

View File

@@ -0,0 +1,620 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>routerConfigPageWidget</class>
<widget class="QWidget" name="routerConfigPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>439</width>
<height>488</height>
</rect>
</property>
<property name="windowTitle">
<string>Dynamips IOS Router configuration</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QTabWidget" name="uiTabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="uiGeneralTabWidget">
<attribute name="title">
<string>General</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiPlatformLabel">
<property name="text">
<string>Platform:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="uiPlatformTextLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiIOSImageLabel">
<property name="text">
<string>IOS image:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="uiIOSImageTextLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="uiStartupConfigLabel">
<property name="text">
<string>Startup-config:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="uiStartupConfigTextLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="uiMidplaneLabel">
<property name="text">
<string>Midplane:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="uiMidplaneComboBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="uiNPELabel">
<property name="text">
<string>NPE:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="uiNPEComboBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>263</width>
<height>151</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="uiMemoriesTabWidget">
<attribute name="title">
<string>Memories and disks</string>
</attribute>
<layout class="QVBoxLayout">
<item>
<widget class="QGroupBox" name="uiMemoriesGroupBox">
<property name="title">
<string>Memories</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiRamLabel">
<property name="text">
<string>RAM size:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="uiRamSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> MiB</string>
</property>
<property name="maximum">
<number>4096</number>
</property>
<property name="singleStep">
<number>4</number>
</property>
<property name="value">
<number>128</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiNvramLabel">
<property name="text">
<string>NVRAM size:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="uiNvramSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> KiB</string>
</property>
<property name="maximum">
<number>4096</number>
</property>
<property name="singleStep">
<number>4</number>
</property>
<property name="value">
<number>128</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="uiDisksGroupBox">
<property name="title">
<string>Disks</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiDisk0Label">
<property name="text">
<string>PCMCIA disk0 size:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="uiDisk0SpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> MiB</string>
</property>
<property name="maximum">
<number>99999</number>
</property>
<property name="singleStep">
<number>4</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiDisk1Label">
<property name="text">
<string>PCMCIA disk1 size:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="uiDisk1SpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> MiB</string>
</property>
<property name="maximum">
<number>99999</number>
</property>
<property name="singleStep">
<number>4</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="uiSlotsTabWidget">
<attribute name="title">
<string>Slots</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="uiAdaptersGroupBox">
<property name="title">
<string>Adapters</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QComboBox" name="uiSlot1comboBox"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="uiSlot0Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>slot 0:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="uiSlot0comboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiSlot1Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>slot 1:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="uiSlot2Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>slot 2:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="uiSlot2comboBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="uiSlot3Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>slot 3:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="uiSlot3comboBox"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="uiSlot4Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>slot 4:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="uiSlot4comboBox"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="uiSlot5Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>slot 5:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="uiSlot5comboBox"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="uiSlot6Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>slot 6:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="uiSlot6comboBox"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="uiWicsGroupBox">
<property name="title">
<string>WICs</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiWic0Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>wic 0:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="uiWic0comboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiWic1Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>wic 1:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="uiWic1comboBox"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="uiWic2Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>wic 2:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="uiWic2comboBox"/>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>325</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="uiAdvancedTabWidget">
<attribute name="title">
<string>Advanced</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiConfregLabel">
<property name="text">
<string>Confreg:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="uiConfregLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>0x2102</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiBaseMacLabel">
<property name="text">
<string>Base MAC:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="uiBaseMACLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="uiExecAreaLabel">
<property name="text">
<string>Exec area:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="uiExecAreaSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> MiB</string>
</property>
<property name="maximum">
<number>4096</number>
</property>
<property name="singleStep">
<number>4</number>
</property>
<property name="value">
<number>64</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="uiIomemLabel">
<property name="text">
<string>I/O memory :</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="uiIomemSpinBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="suffix">
<string> %</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>304</width>
<height>251</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>uiTabWidget</tabstop>
<tabstop>uiMidplaneComboBox</tabstop>
<tabstop>uiNPEComboBox</tabstop>
<tabstop>uiRamSpinBox</tabstop>
<tabstop>uiNvramSpinBox</tabstop>
<tabstop>uiDisk0SpinBox</tabstop>
<tabstop>uiDisk1SpinBox</tabstop>
<tabstop>uiSlot0comboBox</tabstop>
<tabstop>uiSlot1comboBox</tabstop>
<tabstop>uiSlot2comboBox</tabstop>
<tabstop>uiSlot3comboBox</tabstop>
<tabstop>uiSlot4comboBox</tabstop>
<tabstop>uiSlot5comboBox</tabstop>
<tabstop>uiSlot6comboBox</tabstop>
<tabstop>uiWic0comboBox</tabstop>
<tabstop>uiWic1comboBox</tabstop>
<tabstop>uiWic2comboBox</tabstop>
<tabstop>uiConfregLineEdit</tabstop>
<tabstop>uiBaseMACLineEdit</tabstop>
<tabstop>uiExecAreaSpinBox</tabstop>
<tabstop>uiIomemSpinBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,409 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/modules/dynamips/ui/router_configuration_page.ui'
#
# Created: Wed Jan 29 11:33:10 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_routerConfigPageWidget(object):
def setupUi(self, routerConfigPageWidget):
routerConfigPageWidget.setObjectName(_fromUtf8("routerConfigPageWidget"))
routerConfigPageWidget.resize(439, 488)
self.vboxlayout = QtGui.QVBoxLayout(routerConfigPageWidget)
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
self.uiTabWidget = QtGui.QTabWidget(routerConfigPageWidget)
self.uiTabWidget.setObjectName(_fromUtf8("uiTabWidget"))
self.uiGeneralTabWidget = QtGui.QWidget()
self.uiGeneralTabWidget.setObjectName(_fromUtf8("uiGeneralTabWidget"))
self.gridlayout = QtGui.QGridLayout(self.uiGeneralTabWidget)
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
self.uiPlatformLabel = QtGui.QLabel(self.uiGeneralTabWidget)
self.uiPlatformLabel.setObjectName(_fromUtf8("uiPlatformLabel"))
self.gridlayout.addWidget(self.uiPlatformLabel, 0, 0, 1, 1)
self.uiPlatformTextLabel = QtGui.QLabel(self.uiGeneralTabWidget)
self.uiPlatformTextLabel.setText(_fromUtf8(""))
self.uiPlatformTextLabel.setObjectName(_fromUtf8("uiPlatformTextLabel"))
self.gridlayout.addWidget(self.uiPlatformTextLabel, 0, 1, 1, 1)
self.uiIOSImageLabel = QtGui.QLabel(self.uiGeneralTabWidget)
self.uiIOSImageLabel.setObjectName(_fromUtf8("uiIOSImageLabel"))
self.gridlayout.addWidget(self.uiIOSImageLabel, 1, 0, 1, 1)
self.uiIOSImageTextLabel = QtGui.QLabel(self.uiGeneralTabWidget)
self.uiIOSImageTextLabel.setText(_fromUtf8(""))
self.uiIOSImageTextLabel.setObjectName(_fromUtf8("uiIOSImageTextLabel"))
self.gridlayout.addWidget(self.uiIOSImageTextLabel, 1, 1, 1, 1)
self.uiStartupConfigLabel = QtGui.QLabel(self.uiGeneralTabWidget)
self.uiStartupConfigLabel.setObjectName(_fromUtf8("uiStartupConfigLabel"))
self.gridlayout.addWidget(self.uiStartupConfigLabel, 2, 0, 1, 1)
self.uiStartupConfigTextLabel = QtGui.QLabel(self.uiGeneralTabWidget)
self.uiStartupConfigTextLabel.setText(_fromUtf8(""))
self.uiStartupConfigTextLabel.setObjectName(_fromUtf8("uiStartupConfigTextLabel"))
self.gridlayout.addWidget(self.uiStartupConfigTextLabel, 2, 1, 1, 1)
self.uiMidplaneLabel = QtGui.QLabel(self.uiGeneralTabWidget)
self.uiMidplaneLabel.setObjectName(_fromUtf8("uiMidplaneLabel"))
self.gridlayout.addWidget(self.uiMidplaneLabel, 3, 0, 1, 1)
self.uiMidplaneComboBox = QtGui.QComboBox(self.uiGeneralTabWidget)
self.uiMidplaneComboBox.setEnabled(True)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiMidplaneComboBox.sizePolicy().hasHeightForWidth())
self.uiMidplaneComboBox.setSizePolicy(sizePolicy)
self.uiMidplaneComboBox.setObjectName(_fromUtf8("uiMidplaneComboBox"))
self.gridlayout.addWidget(self.uiMidplaneComboBox, 3, 1, 1, 1)
self.uiNPELabel = QtGui.QLabel(self.uiGeneralTabWidget)
self.uiNPELabel.setObjectName(_fromUtf8("uiNPELabel"))
self.gridlayout.addWidget(self.uiNPELabel, 4, 0, 1, 1)
self.uiNPEComboBox = QtGui.QComboBox(self.uiGeneralTabWidget)
self.uiNPEComboBox.setEnabled(True)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiNPEComboBox.sizePolicy().hasHeightForWidth())
self.uiNPEComboBox.setSizePolicy(sizePolicy)
self.uiNPEComboBox.setObjectName(_fromUtf8("uiNPEComboBox"))
self.gridlayout.addWidget(self.uiNPEComboBox, 4, 1, 1, 1)
spacerItem = QtGui.QSpacerItem(263, 151, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout.addItem(spacerItem, 5, 1, 1, 1)
self.uiTabWidget.addTab(self.uiGeneralTabWidget, _fromUtf8(""))
self.uiMemoriesTabWidget = QtGui.QWidget()
self.uiMemoriesTabWidget.setObjectName(_fromUtf8("uiMemoriesTabWidget"))
self.vboxlayout1 = QtGui.QVBoxLayout(self.uiMemoriesTabWidget)
self.vboxlayout1.setObjectName(_fromUtf8("vboxlayout1"))
self.uiMemoriesGroupBox = QtGui.QGroupBox(self.uiMemoriesTabWidget)
self.uiMemoriesGroupBox.setObjectName(_fromUtf8("uiMemoriesGroupBox"))
self.gridlayout1 = QtGui.QGridLayout(self.uiMemoriesGroupBox)
self.gridlayout1.setObjectName(_fromUtf8("gridlayout1"))
self.uiRamLabel = QtGui.QLabel(self.uiMemoriesGroupBox)
self.uiRamLabel.setObjectName(_fromUtf8("uiRamLabel"))
self.gridlayout1.addWidget(self.uiRamLabel, 0, 0, 1, 1)
self.uiRamSpinBox = QtGui.QSpinBox(self.uiMemoriesGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiRamSpinBox.sizePolicy().hasHeightForWidth())
self.uiRamSpinBox.setSizePolicy(sizePolicy)
self.uiRamSpinBox.setMaximum(4096)
self.uiRamSpinBox.setSingleStep(4)
self.uiRamSpinBox.setProperty("value", 128)
self.uiRamSpinBox.setObjectName(_fromUtf8("uiRamSpinBox"))
self.gridlayout1.addWidget(self.uiRamSpinBox, 0, 1, 1, 1)
self.uiNvramLabel = QtGui.QLabel(self.uiMemoriesGroupBox)
self.uiNvramLabel.setObjectName(_fromUtf8("uiNvramLabel"))
self.gridlayout1.addWidget(self.uiNvramLabel, 1, 0, 1, 1)
self.uiNvramSpinBox = QtGui.QSpinBox(self.uiMemoriesGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiNvramSpinBox.sizePolicy().hasHeightForWidth())
self.uiNvramSpinBox.setSizePolicy(sizePolicy)
self.uiNvramSpinBox.setMaximum(4096)
self.uiNvramSpinBox.setSingleStep(4)
self.uiNvramSpinBox.setProperty("value", 128)
self.uiNvramSpinBox.setObjectName(_fromUtf8("uiNvramSpinBox"))
self.gridlayout1.addWidget(self.uiNvramSpinBox, 1, 1, 1, 1)
self.vboxlayout1.addWidget(self.uiMemoriesGroupBox)
self.uiDisksGroupBox = QtGui.QGroupBox(self.uiMemoriesTabWidget)
self.uiDisksGroupBox.setObjectName(_fromUtf8("uiDisksGroupBox"))
self.gridlayout2 = QtGui.QGridLayout(self.uiDisksGroupBox)
self.gridlayout2.setObjectName(_fromUtf8("gridlayout2"))
self.uiDisk0Label = QtGui.QLabel(self.uiDisksGroupBox)
self.uiDisk0Label.setObjectName(_fromUtf8("uiDisk0Label"))
self.gridlayout2.addWidget(self.uiDisk0Label, 0, 0, 1, 1)
self.uiDisk0SpinBox = QtGui.QSpinBox(self.uiDisksGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiDisk0SpinBox.sizePolicy().hasHeightForWidth())
self.uiDisk0SpinBox.setSizePolicy(sizePolicy)
self.uiDisk0SpinBox.setMaximum(99999)
self.uiDisk0SpinBox.setSingleStep(4)
self.uiDisk0SpinBox.setObjectName(_fromUtf8("uiDisk0SpinBox"))
self.gridlayout2.addWidget(self.uiDisk0SpinBox, 0, 1, 1, 1)
self.uiDisk1Label = QtGui.QLabel(self.uiDisksGroupBox)
self.uiDisk1Label.setObjectName(_fromUtf8("uiDisk1Label"))
self.gridlayout2.addWidget(self.uiDisk1Label, 1, 0, 1, 1)
self.uiDisk1SpinBox = QtGui.QSpinBox(self.uiDisksGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiDisk1SpinBox.sizePolicy().hasHeightForWidth())
self.uiDisk1SpinBox.setSizePolicy(sizePolicy)
self.uiDisk1SpinBox.setMaximum(99999)
self.uiDisk1SpinBox.setSingleStep(4)
self.uiDisk1SpinBox.setObjectName(_fromUtf8("uiDisk1SpinBox"))
self.gridlayout2.addWidget(self.uiDisk1SpinBox, 1, 1, 1, 1)
self.vboxlayout1.addWidget(self.uiDisksGroupBox)
spacerItem1 = QtGui.QSpacerItem(20, 21, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.vboxlayout1.addItem(spacerItem1)
self.uiTabWidget.addTab(self.uiMemoriesTabWidget, _fromUtf8(""))
self.uiSlotsTabWidget = QtGui.QWidget()
self.uiSlotsTabWidget.setObjectName(_fromUtf8("uiSlotsTabWidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.uiSlotsTabWidget)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.uiAdaptersGroupBox = QtGui.QGroupBox(self.uiSlotsTabWidget)
self.uiAdaptersGroupBox.setObjectName(_fromUtf8("uiAdaptersGroupBox"))
self.gridLayout = QtGui.QGridLayout(self.uiAdaptersGroupBox)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.uiSlot1comboBox = QtGui.QComboBox(self.uiAdaptersGroupBox)
self.uiSlot1comboBox.setObjectName(_fromUtf8("uiSlot1comboBox"))
self.gridLayout.addWidget(self.uiSlot1comboBox, 1, 1, 1, 1)
self.uiSlot0Label = QtGui.QLabel(self.uiAdaptersGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSlot0Label.sizePolicy().hasHeightForWidth())
self.uiSlot0Label.setSizePolicy(sizePolicy)
self.uiSlot0Label.setObjectName(_fromUtf8("uiSlot0Label"))
self.gridLayout.addWidget(self.uiSlot0Label, 0, 0, 1, 1)
self.uiSlot0comboBox = QtGui.QComboBox(self.uiAdaptersGroupBox)
self.uiSlot0comboBox.setObjectName(_fromUtf8("uiSlot0comboBox"))
self.gridLayout.addWidget(self.uiSlot0comboBox, 0, 1, 1, 1)
self.uiSlot1Label = QtGui.QLabel(self.uiAdaptersGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSlot1Label.sizePolicy().hasHeightForWidth())
self.uiSlot1Label.setSizePolicy(sizePolicy)
self.uiSlot1Label.setObjectName(_fromUtf8("uiSlot1Label"))
self.gridLayout.addWidget(self.uiSlot1Label, 1, 0, 1, 1)
self.uiSlot2Label = QtGui.QLabel(self.uiAdaptersGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSlot2Label.sizePolicy().hasHeightForWidth())
self.uiSlot2Label.setSizePolicy(sizePolicy)
self.uiSlot2Label.setObjectName(_fromUtf8("uiSlot2Label"))
self.gridLayout.addWidget(self.uiSlot2Label, 2, 0, 1, 1)
self.uiSlot2comboBox = QtGui.QComboBox(self.uiAdaptersGroupBox)
self.uiSlot2comboBox.setObjectName(_fromUtf8("uiSlot2comboBox"))
self.gridLayout.addWidget(self.uiSlot2comboBox, 2, 1, 1, 1)
self.uiSlot3Label = QtGui.QLabel(self.uiAdaptersGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSlot3Label.sizePolicy().hasHeightForWidth())
self.uiSlot3Label.setSizePolicy(sizePolicy)
self.uiSlot3Label.setObjectName(_fromUtf8("uiSlot3Label"))
self.gridLayout.addWidget(self.uiSlot3Label, 3, 0, 1, 1)
self.uiSlot3comboBox = QtGui.QComboBox(self.uiAdaptersGroupBox)
self.uiSlot3comboBox.setObjectName(_fromUtf8("uiSlot3comboBox"))
self.gridLayout.addWidget(self.uiSlot3comboBox, 3, 1, 1, 1)
self.uiSlot4Label = QtGui.QLabel(self.uiAdaptersGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSlot4Label.sizePolicy().hasHeightForWidth())
self.uiSlot4Label.setSizePolicy(sizePolicy)
self.uiSlot4Label.setObjectName(_fromUtf8("uiSlot4Label"))
self.gridLayout.addWidget(self.uiSlot4Label, 4, 0, 1, 1)
self.uiSlot4comboBox = QtGui.QComboBox(self.uiAdaptersGroupBox)
self.uiSlot4comboBox.setObjectName(_fromUtf8("uiSlot4comboBox"))
self.gridLayout.addWidget(self.uiSlot4comboBox, 4, 1, 1, 1)
self.uiSlot5Label = QtGui.QLabel(self.uiAdaptersGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSlot5Label.sizePolicy().hasHeightForWidth())
self.uiSlot5Label.setSizePolicy(sizePolicy)
self.uiSlot5Label.setObjectName(_fromUtf8("uiSlot5Label"))
self.gridLayout.addWidget(self.uiSlot5Label, 5, 0, 1, 1)
self.uiSlot5comboBox = QtGui.QComboBox(self.uiAdaptersGroupBox)
self.uiSlot5comboBox.setObjectName(_fromUtf8("uiSlot5comboBox"))
self.gridLayout.addWidget(self.uiSlot5comboBox, 5, 1, 1, 1)
self.uiSlot6Label = QtGui.QLabel(self.uiAdaptersGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiSlot6Label.sizePolicy().hasHeightForWidth())
self.uiSlot6Label.setSizePolicy(sizePolicy)
self.uiSlot6Label.setObjectName(_fromUtf8("uiSlot6Label"))
self.gridLayout.addWidget(self.uiSlot6Label, 6, 0, 1, 1)
self.uiSlot6comboBox = QtGui.QComboBox(self.uiAdaptersGroupBox)
self.uiSlot6comboBox.setObjectName(_fromUtf8("uiSlot6comboBox"))
self.gridLayout.addWidget(self.uiSlot6comboBox, 6, 1, 1, 1)
self.verticalLayout.addWidget(self.uiAdaptersGroupBox)
self.uiWicsGroupBox = QtGui.QGroupBox(self.uiSlotsTabWidget)
self.uiWicsGroupBox.setObjectName(_fromUtf8("uiWicsGroupBox"))
self.gridlayout3 = QtGui.QGridLayout(self.uiWicsGroupBox)
self.gridlayout3.setObjectName(_fromUtf8("gridlayout3"))
self.uiWic0Label = QtGui.QLabel(self.uiWicsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiWic0Label.sizePolicy().hasHeightForWidth())
self.uiWic0Label.setSizePolicy(sizePolicy)
self.uiWic0Label.setObjectName(_fromUtf8("uiWic0Label"))
self.gridlayout3.addWidget(self.uiWic0Label, 0, 0, 1, 1)
self.uiWic0comboBox = QtGui.QComboBox(self.uiWicsGroupBox)
self.uiWic0comboBox.setObjectName(_fromUtf8("uiWic0comboBox"))
self.gridlayout3.addWidget(self.uiWic0comboBox, 0, 1, 1, 1)
self.uiWic1Label = QtGui.QLabel(self.uiWicsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiWic1Label.sizePolicy().hasHeightForWidth())
self.uiWic1Label.setSizePolicy(sizePolicy)
self.uiWic1Label.setObjectName(_fromUtf8("uiWic1Label"))
self.gridlayout3.addWidget(self.uiWic1Label, 1, 0, 1, 1)
self.uiWic1comboBox = QtGui.QComboBox(self.uiWicsGroupBox)
self.uiWic1comboBox.setObjectName(_fromUtf8("uiWic1comboBox"))
self.gridlayout3.addWidget(self.uiWic1comboBox, 1, 1, 1, 1)
self.uiWic2Label = QtGui.QLabel(self.uiWicsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiWic2Label.sizePolicy().hasHeightForWidth())
self.uiWic2Label.setSizePolicy(sizePolicy)
self.uiWic2Label.setObjectName(_fromUtf8("uiWic2Label"))
self.gridlayout3.addWidget(self.uiWic2Label, 2, 0, 1, 1)
self.uiWic2comboBox = QtGui.QComboBox(self.uiWicsGroupBox)
self.uiWic2comboBox.setObjectName(_fromUtf8("uiWic2comboBox"))
self.gridlayout3.addWidget(self.uiWic2comboBox, 2, 1, 1, 1)
self.verticalLayout.addWidget(self.uiWicsGroupBox)
spacerItem2 = QtGui.QSpacerItem(325, 31, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem2)
self.uiTabWidget.addTab(self.uiSlotsTabWidget, _fromUtf8(""))
self.uiAdvancedTabWidget = QtGui.QWidget()
self.uiAdvancedTabWidget.setObjectName(_fromUtf8("uiAdvancedTabWidget"))
self.gridlayout4 = QtGui.QGridLayout(self.uiAdvancedTabWidget)
self.gridlayout4.setObjectName(_fromUtf8("gridlayout4"))
self.uiConfregLabel = QtGui.QLabel(self.uiAdvancedTabWidget)
self.uiConfregLabel.setObjectName(_fromUtf8("uiConfregLabel"))
self.gridlayout4.addWidget(self.uiConfregLabel, 0, 0, 1, 1)
self.uiConfregLineEdit = QtGui.QLineEdit(self.uiAdvancedTabWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiConfregLineEdit.sizePolicy().hasHeightForWidth())
self.uiConfregLineEdit.setSizePolicy(sizePolicy)
self.uiConfregLineEdit.setObjectName(_fromUtf8("uiConfregLineEdit"))
self.gridlayout4.addWidget(self.uiConfregLineEdit, 0, 1, 1, 1)
self.uiBaseMacLabel = QtGui.QLabel(self.uiAdvancedTabWidget)
self.uiBaseMacLabel.setObjectName(_fromUtf8("uiBaseMacLabel"))
self.gridlayout4.addWidget(self.uiBaseMacLabel, 1, 0, 1, 1)
self.uiBaseMACLineEdit = QtGui.QLineEdit(self.uiAdvancedTabWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiBaseMACLineEdit.sizePolicy().hasHeightForWidth())
self.uiBaseMACLineEdit.setSizePolicy(sizePolicy)
self.uiBaseMACLineEdit.setText(_fromUtf8(""))
self.uiBaseMACLineEdit.setObjectName(_fromUtf8("uiBaseMACLineEdit"))
self.gridlayout4.addWidget(self.uiBaseMACLineEdit, 1, 1, 1, 1)
self.uiExecAreaLabel = QtGui.QLabel(self.uiAdvancedTabWidget)
self.uiExecAreaLabel.setObjectName(_fromUtf8("uiExecAreaLabel"))
self.gridlayout4.addWidget(self.uiExecAreaLabel, 2, 0, 1, 1)
self.uiExecAreaSpinBox = QtGui.QSpinBox(self.uiAdvancedTabWidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiExecAreaSpinBox.sizePolicy().hasHeightForWidth())
self.uiExecAreaSpinBox.setSizePolicy(sizePolicy)
self.uiExecAreaSpinBox.setMaximum(4096)
self.uiExecAreaSpinBox.setSingleStep(4)
self.uiExecAreaSpinBox.setProperty("value", 64)
self.uiExecAreaSpinBox.setObjectName(_fromUtf8("uiExecAreaSpinBox"))
self.gridlayout4.addWidget(self.uiExecAreaSpinBox, 2, 1, 1, 1)
self.uiIomemLabel = QtGui.QLabel(self.uiAdvancedTabWidget)
self.uiIomemLabel.setObjectName(_fromUtf8("uiIomemLabel"))
self.gridlayout4.addWidget(self.uiIomemLabel, 3, 0, 1, 1)
self.uiIomemSpinBox = QtGui.QSpinBox(self.uiAdvancedTabWidget)
self.uiIomemSpinBox.setEnabled(True)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiIomemSpinBox.sizePolicy().hasHeightForWidth())
self.uiIomemSpinBox.setSizePolicy(sizePolicy)
self.uiIomemSpinBox.setMaximum(100)
self.uiIomemSpinBox.setSingleStep(5)
self.uiIomemSpinBox.setProperty("value", 5)
self.uiIomemSpinBox.setObjectName(_fromUtf8("uiIomemSpinBox"))
self.gridlayout4.addWidget(self.uiIomemSpinBox, 3, 1, 1, 1)
spacerItem3 = QtGui.QSpacerItem(304, 251, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridlayout4.addItem(spacerItem3, 4, 0, 1, 2)
self.uiTabWidget.addTab(self.uiAdvancedTabWidget, _fromUtf8(""))
self.vboxlayout.addWidget(self.uiTabWidget)
self.retranslateUi(routerConfigPageWidget)
self.uiTabWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(routerConfigPageWidget)
routerConfigPageWidget.setTabOrder(self.uiTabWidget, self.uiMidplaneComboBox)
routerConfigPageWidget.setTabOrder(self.uiMidplaneComboBox, self.uiNPEComboBox)
routerConfigPageWidget.setTabOrder(self.uiNPEComboBox, self.uiRamSpinBox)
routerConfigPageWidget.setTabOrder(self.uiRamSpinBox, self.uiNvramSpinBox)
routerConfigPageWidget.setTabOrder(self.uiNvramSpinBox, self.uiDisk0SpinBox)
routerConfigPageWidget.setTabOrder(self.uiDisk0SpinBox, self.uiDisk1SpinBox)
routerConfigPageWidget.setTabOrder(self.uiDisk1SpinBox, self.uiSlot0comboBox)
routerConfigPageWidget.setTabOrder(self.uiSlot0comboBox, self.uiSlot1comboBox)
routerConfigPageWidget.setTabOrder(self.uiSlot1comboBox, self.uiSlot2comboBox)
routerConfigPageWidget.setTabOrder(self.uiSlot2comboBox, self.uiSlot3comboBox)
routerConfigPageWidget.setTabOrder(self.uiSlot3comboBox, self.uiSlot4comboBox)
routerConfigPageWidget.setTabOrder(self.uiSlot4comboBox, self.uiSlot5comboBox)
routerConfigPageWidget.setTabOrder(self.uiSlot5comboBox, self.uiSlot6comboBox)
routerConfigPageWidget.setTabOrder(self.uiSlot6comboBox, self.uiWic0comboBox)
routerConfigPageWidget.setTabOrder(self.uiWic0comboBox, self.uiWic1comboBox)
routerConfigPageWidget.setTabOrder(self.uiWic1comboBox, self.uiWic2comboBox)
routerConfigPageWidget.setTabOrder(self.uiWic2comboBox, self.uiConfregLineEdit)
routerConfigPageWidget.setTabOrder(self.uiConfregLineEdit, self.uiBaseMACLineEdit)
routerConfigPageWidget.setTabOrder(self.uiBaseMACLineEdit, self.uiExecAreaSpinBox)
routerConfigPageWidget.setTabOrder(self.uiExecAreaSpinBox, self.uiIomemSpinBox)
def retranslateUi(self, routerConfigPageWidget):
routerConfigPageWidget.setWindowTitle(_translate("routerConfigPageWidget", "Dynamips IOS Router configuration", None))
self.uiPlatformLabel.setText(_translate("routerConfigPageWidget", "Platform:", None))
self.uiIOSImageLabel.setText(_translate("routerConfigPageWidget", "IOS image:", None))
self.uiStartupConfigLabel.setText(_translate("routerConfigPageWidget", "Startup-config:", None))
self.uiMidplaneLabel.setText(_translate("routerConfigPageWidget", "Midplane:", None))
self.uiNPELabel.setText(_translate("routerConfigPageWidget", "NPE:", None))
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiGeneralTabWidget), _translate("routerConfigPageWidget", "General", None))
self.uiMemoriesGroupBox.setTitle(_translate("routerConfigPageWidget", "Memories", None))
self.uiRamLabel.setText(_translate("routerConfigPageWidget", "RAM size:", None))
self.uiRamSpinBox.setSuffix(_translate("routerConfigPageWidget", " MiB", None))
self.uiNvramLabel.setText(_translate("routerConfigPageWidget", "NVRAM size:", None))
self.uiNvramSpinBox.setSuffix(_translate("routerConfigPageWidget", " KiB", None))
self.uiDisksGroupBox.setTitle(_translate("routerConfigPageWidget", "Disks", None))
self.uiDisk0Label.setText(_translate("routerConfigPageWidget", "PCMCIA disk0 size:", None))
self.uiDisk0SpinBox.setSuffix(_translate("routerConfigPageWidget", " MiB", None))
self.uiDisk1Label.setText(_translate("routerConfigPageWidget", "PCMCIA disk1 size:", None))
self.uiDisk1SpinBox.setSuffix(_translate("routerConfigPageWidget", " MiB", None))
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiMemoriesTabWidget), _translate("routerConfigPageWidget", "Memories and disks", None))
self.uiAdaptersGroupBox.setTitle(_translate("routerConfigPageWidget", "Adapters", None))
self.uiSlot0Label.setText(_translate("routerConfigPageWidget", "slot 0:", None))
self.uiSlot1Label.setText(_translate("routerConfigPageWidget", "slot 1:", None))
self.uiSlot2Label.setText(_translate("routerConfigPageWidget", "slot 2:", None))
self.uiSlot3Label.setText(_translate("routerConfigPageWidget", "slot 3:", None))
self.uiSlot4Label.setText(_translate("routerConfigPageWidget", "slot 4:", None))
self.uiSlot5Label.setText(_translate("routerConfigPageWidget", "slot 5:", None))
self.uiSlot6Label.setText(_translate("routerConfigPageWidget", "slot 6:", None))
self.uiWicsGroupBox.setTitle(_translate("routerConfigPageWidget", "WICs", None))
self.uiWic0Label.setText(_translate("routerConfigPageWidget", "wic 0:", None))
self.uiWic1Label.setText(_translate("routerConfigPageWidget", "wic 1:", None))
self.uiWic2Label.setText(_translate("routerConfigPageWidget", "wic 2:", None))
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiSlotsTabWidget), _translate("routerConfigPageWidget", "Slots", None))
self.uiConfregLabel.setText(_translate("routerConfigPageWidget", "Confreg:", None))
self.uiConfregLineEdit.setText(_translate("routerConfigPageWidget", "0x2102", None))
self.uiBaseMacLabel.setText(_translate("routerConfigPageWidget", "Base MAC:", None))
self.uiExecAreaLabel.setText(_translate("routerConfigPageWidget", "Exec area:", None))
self.uiExecAreaSpinBox.setSuffix(_translate("routerConfigPageWidget", " MiB", None))
self.uiIomemLabel.setText(_translate("routerConfigPageWidget", "I/O memory :", None))
self.uiIomemSpinBox.setSuffix(_translate("routerConfigPageWidget", " %", None))
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiAdvancedTabWidget), _translate("routerConfigPageWidget", "Advanced", None))

View File

@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
WICS matrix to create Port objects with the correct parameters.
"""
from gns3.ports.ethernet_port import EthernetPort
from gns3.ports.serial_port import SerialPort
WIC_MATRIX = {"WIC-1ENET": {"nb_ports": 1,
"port": EthernetPort},
"WIC-1T": {"nb_ports": 1,
"port": SerialPort},
"WIC-2T": {"nb_ports": 2,
"port": SerialPort}
}

55
gns3/modules/module.py Normal file
View File

@@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Base class (interface) for modules.
"""
import logging
log = logging.getLogger(__name__)
class Module(object):
"""
Module interface.
"""
def __init__(self):
pass
@staticmethod
def nodes(self):
"""
Returns all nodes supported by this module.
Must be overloaded.
:returns: list of node classes
"""
raise NotImplementedError()
@staticmethod
def preferencePages():
"""
Returns all the preference pages used by this module.
Must be overloaded.
:returns: list of preference page classes
"""
raise NotImplementedError()

0
gns3/nios/__init__.py Normal file
View File

27
gns3/nios/nio.py Normal file
View File

@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Base class for NIOs (Network Input/Output).
"""
class NIO(object):
def __init__(self):
pass

View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Interface for generic Ethernet NIOs (PCAP library).
"""
from .nio import NIO
class NIO_GenericEthernet(NIO):
"""
Generic Ethernet NIO.
:param ethernet_device: Ethernet device name (e.g. eth0)
"""
def __init__(self, ethernet_device):
NIO.__init__(self)
self._ethernet_device = ethernet_device
def __str__(self):
return "NIO_GenericEthernet"
@property
def ethernet_device(self):
"""
Returns the Ethernet device used by this NIO.
:returns: the Ethernet device name
"""
return self._ethernet_device

View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Interface for Linux Ethernet NIOs (Linux only).
"""
from .nio import NIO
class NIO_LinuxEthernet(NIO):
"""
Linux Ethernet NIO.
:param ethernet_device: Ethernet device name (e.g. eth0)
"""
def __init__(self, ethernet_device):
NIO.__init__(self)
self._ethernet_device = ethernet_device
def __str__(self):
return "NIO_LinuxEthernet"
@property
def ethernet_device(self):
"""
Returns the Ethernet device used by this NIO.
:returns: the Ethernet device name
"""
return self._ethernet_device

47
gns3/nios/nio_null.py Normal file
View File

@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Interface for dummy NIOs (mostly for tests or fake connections).
"""
from .nio import NIO
class NIO_Null(NIO):
"""
NULL NIO.
"""
def __init__(self, identifier):
NIO.__init__(self)
self._identifier = identifier
def __str__(self):
return "NIO_Null"
@property
def identifier(self):
"""
Returns the identifier used by this NIO.
:returns: the identifier
"""
return self._identifier

49
gns3/nios/nio_tap.py Normal file
View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Interface for TAP NIOs (UNIX based OSes only).
"""
from .nio import NIO
class NIO_TAP(NIO):
"""
TAP NIO.
:param tap_device: TAP device name (e.g. tap0)
"""
def __init__(self, tap_device):
NIO.__init__(self)
self._tap_device = tap_device
def __str__(self):
return "NIO_TAP"
@property
def tap_device(self):
"""
Returns the TAP device used by this NIO.
:returns: the TAP device name
"""
return self._tap_device

74
gns3/nios/nio_udp.py Normal file
View File

@@ -0,0 +1,74 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
NIO (Network Input/Output) for UDP tunnel connections.
"""
from .nio import NIO
class NIO_UDP(NIO):
"""
NIO UDP.
:param lport: local port number
:param rhost: remote address/host
:param rport: remote port number
"""
def __init__(self, lport, rhost, rport):
NIO.__init__(self)
self._lport = lport
self._rhost = rhost
self._rport = rport
def __str__(self):
return "NIO_UDP"
@property
def lport(self):
"""
Returns the local port
:returns: local port number
"""
return self._lport
@property
def rhost(self):
"""
Returns the remote host
:returns: remote address/host
"""
return self._rhost
@property
def rport(self):
"""
Returns the remote port
:returns: remote port number
"""
return self._rport

61
gns3/nios/nio_unix.py Normal file
View File

@@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Interface for UNIX NIOs (Unix based OSes only).
"""
from .nio import NIO
class NIO_UNIX(NIO):
"""
UNIX NIO.
:param local_file: local UNIX socket filename
:param remote_file: remote UNIX socket filename
"""
def __init__(self, local_file, remote_file):
NIO.__init__(self)
self._local_file = local_file
self._remote_file = remote_file
def __str__(self):
return "NIO_UNIX"
@property
def local_file(self):
"""
Returns the local UNIX socket.
:returns: local UNIX socket filename
"""
return self._local_file
@property
def remote_file(self):
"""
Returns the remote UNIX socket.
:returns: remote UNIX socket filename
"""
return self._remote_file

61
gns3/nios/nio_vde.py Normal file
View File

@@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Interface for VDE (Virtual Distributed Ethernet) NIOs (Unix based OSes only).
"""
from .nio import NIO
class NIO_VDE(NIO):
"""
VDE NIO.
:param control_file: VDE control filename
:param local_file: VDE local filename
"""
def __init__(self, control_file, local_file):
NIO.__init__(self)
self._control_file = control_file
self._local_file = local_file
def __str__(self):
return "NIO_VDE"
@property
def control_file(self):
"""
Returns the VDE control file.
:returns: VDE control filename
"""
return self._control_file
@property
def local_file(self):
"""
Returns the VDE local file.
:returns: VDE local filename
"""
return self._local_file

148
gns3/node.py Normal file
View File

@@ -0,0 +1,148 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Base class for node classes.
"""
from .qt import QtCore
class Node(QtCore.QObject):
"""
Node implementation.
"""
# signals used to let the GUI view know about some events.
newname_signal = QtCore.Signal(str)
started_signal = QtCore.Signal()
stopped_signal = QtCore.Signal()
suspended_signal = QtCore.Signal()
delete_links_signal = QtCore.Signal()
delete_signal = QtCore.Signal()
error_signal = QtCore.Signal(str, int, str)
nio_signal = QtCore.Signal(int)
allocate_udp_nio_signal = QtCore.Signal(int, int, str)
_instance_count = 1
def __init__(self):
super(Node, self).__init__()
# create an unique ID
self._id = Node._instance_count
Node._instance_count += 1
@property
def id(self):
"""
Returns this node identifier.
:returns: node identifier (integer)
"""
return self._id
def name(self):
"""
Returns the name of this node.
Must be overloaded.
:returns: name (string)
"""
raise NotImplementedError()
def update(self, new_settings):
"""
Updates the settings for this node.
Must be overloaded.
:param new_settings: settings dictionary
"""
raise NotImplementedError()
def ports(self):
"""
Returns all the ports for this node.
Must be overloaded.
:returns: list of Port objects
"""
raise NotImplementedError()
def configPage(self):
"""
Returns the configuration page widget to be used by the node configurator.
Must be overloaded.
:returns: QWidget object.
"""
raise NotImplementedError()
def settings(self):
"""
Returns all the node settings.
Must be overloaded.
:returns: settings dictionary
"""
raise NotImplementedError()
@staticmethod
def defaultSymbol():
"""
Returns the default symbol path for this node.
Must be overloaded.
:returns: symbol path (or resource).
"""
raise NotImplementedError()
@staticmethod
def hoverSymbol():
"""
Returns the symbol to use when the node is hovered.
Must be overloaded.
:returns: symbol path (or resource).
"""
raise NotImplementedError()
@staticmethod
def symbolName():
"""
Returns the symbol name (for the nodes view).
:returns: name (string)
"""
raise NotImplementedError()
def __str__(self):
"""
Must be overloaded.
"""
raise NotImplementedError()

259
gns3/node_configurator.py Normal file
View File

@@ -0,0 +1,259 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dialog to configure and update node settings.
"""
from .qt import QtCore, QtGui
from .ui.node_configurator_ui import Ui_NodeConfiguratorDialog
class NodeConfigurator(QtGui.QDialog, Ui_NodeConfiguratorDialog):
"""
Node configurator implementation.
:param node_items: list of NodeItem objects
:param parent: parent widget
"""
def __init__(self, node_items, parent):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self._node_items = node_items
self._parent_items = {}
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).setEnabled(False)
self.uiButtonBox.button(QtGui.QDialogButtonBox.Reset).setEnabled(False)
self.previousItem = None
self.previousPage = None
# load the empty page widget by default
self.uiEmptyPageWidget = self.uiConfigStackedWidget.findChildren(QtGui.QWidget, "uiEmptyPageWidget")[0]
self.uiConfigStackedWidget.setCurrentWidget(self.uiEmptyPageWidget)
self._loadNodeItems()
self.splitter.setSizes([250, 600])
self.uiNodesTreeWidget.itemClicked.connect(self.showConfigurationPageSlot)
def _loadNodeItems(self):
"""
Loads the nodes into the Node configurator QTreeWidget
"""
# create the parent (group) items
for node_item in self._node_items:
group_name = " {} group".format(str(node_item.node()))
parent = group_name
if not parent in self._parent_items:
item = QtGui.QTreeWidgetItem(self.uiNodesTreeWidget, [group_name])
item.setIcon(0, QtGui.QIcon(node_item.node().defaultSymbol()))
item.setExpanded(True)
self._parent_items[parent] = item
# create the children items (configuration page items)
for node_item in self._node_items:
parent = " {} group".format(str(node_item.node()))
item = ConfigurationPageItem(self._parent_items[parent], node_item.node())
# sort the tree
self.uiNodesTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
def showConfigurationPageSlot(self, item, column):
"""
Shows a configuration page widget.
:param item: reference to the selected item in the QTreeWidget
:param column: ignored
"""
# save the previous item temporary settings from the
# previous page before showing another one
if self.previousItem:
try:
self.previousPage.saveSettings(self.previousItem.settings(), self.previousItem.node())
except ConfigurationError:
pass
if not item.parent():
# this is a group item, let load
# the page of its first child.
self.uiTitleLabel.setText("{} configuration".format(item.text(0)))
item = item.child(0)
page = item.page()
else:
self.uiTitleLabel.setText("{} configuration".format(item.node().name()))
page = item.page()
self.previousItem = item
self.previousPage = page
# load the item temporary settings onto the page
page.loadSettings(item.settings(), item.node())
self.uiConfigStackedWidget.addWidget(page)
self.uiConfigStackedWidget.setCurrentWidget(page)
if page != self.uiEmptyPageWidget:
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).setEnabled(True)
self.uiButtonBox.button(QtGui.QDialogButtonBox.Reset).setEnabled(True)
else:
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).setEnabled(False)
self.uiButtonBox.button(QtGui.QDialogButtonBox.Reset).setEnabled(False)
def on_uiButtonBox_clicked(self, button):
"""
Slot called when a button of the uiButtonBox is clicked.
:param button: button that was clicked (QAbstractButton)
"""
try:
if button == self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply):
self.applySettings()
elif button == self.uiButtonBox.button(QtGui.QDialogButtonBox.Reset):
self.resetSettings()
elif button == self.uiButtonBox.button(QtGui.QDialogButtonBox.Cancel):
QtGui.QDialog.reject(self)
else:
self.applySettings()
QtGui.QDialog.accept(self)
except ConfigurationError:
pass
def applySettings(self):
"""
Applies the temporary settings to the nodes.
"""
if self.uiConfigStackedWidget.currentWidget() != self.uiEmptyPageWidget:
page = self.uiConfigStackedWidget.currentWidget()
item = self.uiNodesTreeWidget.currentItem()
if item and item.parent():
# save the temporary setting for the current page
page.saveSettings(item.settings(), item.node())
elif item:
# save the temporary settings for the current group
# by applying the first child temporary settings to
# all children for that group
settings = item.child(0).settings()
node = item.child(0).node()
page.saveSettings(settings, node)
for index in range(0, item.childCount()):
child = item.child(index)
child.setSettings(settings.copy())
# update the nodes with the settings
for item in self._parent_items.values():
for index in range(0, item.childCount()):
child = item.child(index)
child.node().update(child.settings())
def resetSettings(self):
"""
Resets the temporary settings by reloading the settings from the nodes.
"""
if self.uiConfigStackedWidget.currentWidget() != self.uiEmptyPageWidget:
page = self.uiConfigStackedWidget.currentWidget()
item = self.uiNodesTreeWidget.currentItem()
if item and item.parent():
# reload the settings on the current page.
item.setSettings(item.node().settings().copy())
page.loadSettings(item.settings(), item.node())
else:
# this is a group item (no parent), reload the settings
# on the current page by taking the settings of the first child.
page.loadSettings(item.child(0).settings(), item.child(0).node())
# reset the settings
for item in self._parent_items.values():
settings = item.child(0).node().settings()
for index in range(0, item.childCount()):
child = item.child(index)
child.setSettings(settings.copy())
class ConfigurationPageItem(QtGui.QTreeWidgetItem):
"""
Item for the QTreeWidget object.
Store temporary node settings configured in a page widget.
:param parent: parent widget
:param node: Node object
"""
def __init__(self, parent, node):
name = node.name()
self._node = node
QtGui.QTreeWidgetItem.__init__(self, parent, [name])
# return the configuration page widget used to configure the node.
self._page = node.configPage()
# make a copy of the node settings
self.setSettings(node.settings().copy())
def page(self):
"""
Returns the page widget to be displayed by the node configurator.
:returns: QWidget object.
"""
return self._page()
def node(self):
"""
Returns node associated with this item.
:returns: Node object.
"""
return self._node
def settings(self):
"""
Returns all the temporary settings.
:returns: dictionary
"""
return self._settings
def setSettings(self, settings):
"""
Sets new temporary settings.
:param settings: dictionary
"""
self._settings = settings
class ConfigurationError(Exception):
"""
Exception to be raised when a configuration error occurs.
"""
def __init__(self):
Exception.__init__(self)

77
gns3/nodes_view.py Normal file
View File

@@ -0,0 +1,77 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Nodes view that list all the available nodes to be dragged and dropped on the QGraphics scene.
"""
import pickle
from .qt import QtCore, QtGui
from .modules.dynamips import Dynamips
class NodesView(QtGui.QTreeWidget):
"""
Nodes view to list the nodes.
:param parent: parent widget
"""
def __init__(self, parent=None):
QtGui.QTreeWidget.__init__(self, parent)
# enables the possibility to drag items.
self.setDragEnabled(True)
# FIXME: generic creation of the node list
for node in Dynamips.nodes():
item = QtGui.QTreeWidgetItem(self)
item.setIcon(0, QtGui.QIcon(node.defaultSymbol()))
item.setText(0, node.symbolName())
# add the node class in the item data
item.setData(0, QtCore.Qt.UserRole, node)
def mouseMoveEvent(self, event):
"""
Handles all mouse move events.
This is the starting point to drag & drop a node on the scene.
:param: QMouseEvent object
"""
# check the left button isn't used and that an item has been selected.
if event.buttons() != QtCore.Qt.LeftButton or self.currentItem() == None:
return
item = self.currentItem()
icon = item.icon(0)
# retrieve the node class from the item data
node = item.data(0, QtCore.Qt.UserRole)
mimedata = QtCore.QMimeData()
# pickle the node class, set the Mime type and data
# and start dragging the item.
data = pickle.dumps(node)
mimedata.setData("application/x-gns3-node", data)
drag = QtGui.QDrag(self)
drag.setMimeData(mimedata)
drag.setPixmap(icon.pixmap(self.iconSize()))
drag.setHotSpot(QtCore.QPoint(drag.pixmap().width(), drag.pixmap().height()))
drag.exec_(QtCore.Qt.CopyAction)
event.accept()

0
gns3/pages/__init__.py Normal file
View File

View File

@@ -0,0 +1,152 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Configuration page for server preferences.
"""
from gns3.qt import QtNetwork, QtGui
from ..ui.server_preferences_page_ui import Ui_ServerPreferencesPageWidget
from ..servers import Servers
class ServerPreferencesPage(QtGui.QWidget, Ui_ServerPreferencesPageWidget):
"""
QWidget configuration page for server preferences.
"""
def __init__(self):
QtGui.QWidget.__init__(self)
self.setupUi(self)
self._remote_servers = {}
# connect the slots
self.uiAddRemoteServerPushButton.clicked.connect(self._remoteServerAddSlot)
self.uiDeleteRemoteServerPushButton.clicked.connect(self._remoteServerDeleteSlot)
self.uiRemoteServersTreeWidget.itemClicked.connect(self._remoteServerClickedSlot)
self.uiRemoteServersTreeWidget.itemSelectionChanged.connect(self._remoteServerChangedSlot)
# load all available addresses
self.uiLocalServerHostComboBox.addItems(["0.0.0.0", "::", QtNetwork.QHostInfo.localHostName()])
for address in QtNetwork.QNetworkInterface.allAddresses():
self.uiLocalServerHostComboBox.addItem(address.toString())
def _remoteServerClickedSlot(self, item, column):
"""
Loads a selected remote server from the tree widget.
:param item: selected QTreeWidgetItem object
:param column: ignored
"""
host = item.text(0)
port = int(item.text(1))
self.uiRemoteServerPortLineEdit.setText(host)
self.uiRemoteServerPortSpinBox.setValue(port)
def _remoteServerChangedSlot(self):
"""
Enables the use of the delete button.
"""
item = self.uiRemoteServersTreeWidget.currentItem()
if item:
self.uiDeleteRemoteServerPushButton.setEnabled(True)
else:
self.uiDeleteRemoteServerPushButton.setEnabled(False)
def _remoteServerAddSlot(self):
"""
Adds a new remote server.
"""
host = self.uiRemoteServerPortLineEdit.text()
port = self.uiRemoteServerPortSpinBox.value()
# check if the remote server is already defined
remote_server = "{host}:{port}".format(host=host, port=port)
if remote_server in self._remote_servers:
QtGui.QMessageBox.critical(self, "Remote server", "Remote server {} is already defined.".format(remote_server))
return
# add a new entry in the tree widget
item = QtGui.QTreeWidgetItem(self.uiRemoteServersTreeWidget)
item.setText(0, host)
item.setText(1, str(port))
# keep track of this remote server
self._remote_servers[remote_server] = {"host": host,
"port": port}
self.uiRemoteServerPortSpinBox.setValue(self.uiRemoteServerPortSpinBox.value() + 1)
self.uiRemoteServersTreeWidget.resizeColumnToContents(0)
def _remoteServerDeleteSlot(self):
"""
Deletes a remote server.
"""
item = self.uiRemoteServersTreeWidget.currentItem()
if item:
host = item.text(0)
port = int(item.text(1))
remote_server = "{host}:{port}".format(host=host, port=port)
del self._remote_servers[remote_server]
self.uiRemoteServersTreeWidget.takeTopLevelItem(self.uiRemoteServersTreeWidget.indexOfTopLevelItem(item))
def loadPreferences(self):
"""
Loads the server preferences.
"""
servers = Servers.instance()
# load the local server preferences
local_server = servers.localServer()
index = self.uiLocalServerHostComboBox.findText(local_server.host)
if index != -1:
self.uiLocalServerHostComboBox.setCurrentIndex(index)
self.uiLocalServerPortSpinBox.setValue(local_server.port)
# load remote server preferences
self._remote_servers.clear()
self.uiRemoteServersTreeWidget.clear()
for server_id, server in servers.remoteServers().items():
host = server.host
port = server.port
self._remote_servers[server_id] = {"host": host,
"port": port}
item = QtGui.QTreeWidgetItem(self.uiRemoteServersTreeWidget)
item.setText(0, host)
item.setText(1, str(port))
def savePreferences(self):
"""
Saves the server preferences.
"""
servers = Servers.instance()
# save the local server preferences
local_server_host = self.uiLocalServerHostComboBox.currentText()
local_server_port = self.uiLocalServerPortSpinBox.value()
# save the remote server preferences
servers.setLocalServer(local_server_host, local_server_port)
servers.updateRemoteServers(self._remote_servers)
servers.save()

0
gns3/ports/__init__.py Normal file
View File

65
gns3/ports/atm_port.py Normal file
View File

@@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
ATM port for ATM link end points.
"""
from .port import Port
class ATMPort(Port):
"""
ATM port.
:param name: port name (string)
:param nio: NIO object to attach to this port
"""
def __init__(self, name, nio=None):
Port.__init__(self, name, nio)
@staticmethod
def longNameType():
"""
Returns the long name type for this port.
:returns: string
"""
return "ATM"
@staticmethod
def shortNameType():
"""
Returns the short name type for this port.
:returns: string
"""
return "a"
@staticmethod
def linkType():
"""
Returns the link type to be used to connect this port.
:returns: string
"""
return "Serial"

View File

@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Ethernet port for Ethernet link end points.
"""
from .port import Port
class EthernetPort(Port):
"""
Ethernet port.
:param name: port name (string)
:param nio: NIO object to attach to this port
"""
def __init__(self, name, nio=None):
Port.__init__(self, name, nio)
@staticmethod
def longNameType():
"""
Returns the long name type for this port.
:returns: string
"""
return "Ethernet"
@staticmethod
def shortNameType():
"""
Returns the short name type for this port.
:returns: string
"""
return "e"

View File

@@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
FastEthernet port for Ethernet link end points.
"""
from .port import Port
class FastEthernetPort(Port):
"""
FastEthernet port.
:param name: port name (string)
:param nio: NIO object to attach to this port
"""
def __init__(self, name, nio=None):
Port.__init__(self, name, nio)
@staticmethod
def longNameType():
"""
Returns the long name type for this port.
:returns: string
"""
return "FastEthernet"
@staticmethod
def shortNameType():
"""
Returns the short name type for this port.
:returns: string
"""
return "f"

View File

@@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
GigabitEthernet port for Ethernet link end points.
"""
from .port import Port
class GigabitEthernetPort(Port):
"""
GigabitEthernet port.
:param name: port name (string)
:param nio: NIO object to attach to this port
"""
def __init__(self, name, nio=None):
Port.__init__(self, name, nio)
@staticmethod
def longNameType():
"""
Returns the long name type for this port.
:returns: string
"""
return "GigabitEthernet"
@staticmethod
def shortNameType():
"""
Returns the short name type for this port.
:returns: string
"""
return "g"

162
gns3/ports/port.py Normal file
View File

@@ -0,0 +1,162 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Base class for port objects.
"""
from ..nios.nio_udp import NIO_UDP
class Port(object):
"""
Base port.
:param name: port name (string)
:param nio: NIO object to attach to this port
"""
def __init__(self, name, default_nio=None, stub=False):
self._name = name
self._slot = None
self._port = None
self._stub = stub
if default_nio == None:
self._default_nio = NIO_UDP
else:
self._default_nio = default_nio
self._nio = None
@property
def name(self):
"""
Returns the name of this port.
:returns: current port name (string)
"""
return self._name
@name.setter
def name(self, new_name):
"""
Sets a new name for this port.
:param new_name: new port name (string)
"""
self._name = new_name
@property
def slot(self):
"""
Returns the slot number for this port.
:returns: current slot number (integer)
"""
return self._slot
@slot.setter
def slot(self, slot):
"""
Sets the slot number for this port.
:param slot: new slot number (integer)
"""
self._slot = slot
@property
def port(self):
"""
Returns the port number for this port.
:returns: current port number (integer)
"""
return self._port
@port.setter
def port(self, port):
"""
Sets the port number for this port.
:param port: new port number (integer)
"""
self._port = port
@property
def default_nio(self):
return self._default_nio
@property
def nio(self):
"""
Returns the NIO attached to this port.
:returns: NIO object
"""
return self._nio
@nio.setter
def nio(self, nio):
"""
Attach a NIO to this port.
:param nio: NIO object
"""
self._nio = nio
def isFree(self):
"""
Checks if this port is free to use (no NIO attached).
:returns: boolean
"""
if self._nio:
return False
return True
def isStub(self):
"""
Checks if this is a stub port.
:returns: boolean
"""
return self._stub
@staticmethod
def linkType():
"""
Default link type to be used.
:returns: string
"""
return "Ethernet"
def __str__(self):
return self._name

55
gns3/ports/pos_port.py Normal file
View File

@@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
POS port for Packet over SONET link end points.
"""
from .port import Port
class POSPort(Port):
"""
Packet over SONET port.
:param name: port name (string)
:param nio: NIO object to attach to this port
"""
def __init__(self, name, nio=None):
Port.__init__(self, name, nio)
@staticmethod
def longNameType():
"""
Returns the long name type for this port.
:returns: string
"""
return "POS"
@staticmethod
def shortNameType():
"""
Returns the short name type for this port.
:returns: string
"""
return "p"

65
gns3/ports/serial_port.py Normal file
View File

@@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Serial port for serial link end points.
"""
from .port import Port
class SerialPort(Port):
"""
Serial port.
:param name: port name (string)
:param nio: NIO object to attach to this port
"""
def __init__(self, name, nio=None):
Port.__init__(self, name, nio)
@staticmethod
def longNameType():
"""
Returns the long name type for this port.
:returns: string
"""
return "Serial"
@staticmethod
def shortNameType():
"""
Returns the short name type for this port.
:returns: string
"""
return "s"
@staticmethod
def linkType():
"""
Returns the link type to be used to connect this port.
:returns: string
"""
return "Serial"

119
gns3/preferences_dialog.py Normal file
View File

@@ -0,0 +1,119 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dialog to load module and built-in preference pages.
"""
from .qt import QtCore, QtGui
from .ui.preferences_dialog_ui import Ui_PreferencesDialog
from .pages.server_preferences_page import ServerPreferencesPage
from .modules.dynamips import Dynamips
class PreferencesDialog(QtGui.QDialog, Ui_PreferencesDialog):
"""
Preferences dialog implementation.
:param parent: parent widget
"""
def __init__(self, parent):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.uiListWidget.currentItemChanged.connect(self._showPreferencesPageSlot)
self.uiButtonBox.button(QtGui.QDialogButtonBox.Apply).clicked.connect(self._applyPreferences)
self._items = []
self._loadPreferencePages()
# select the first available page
self._items[0].setSelected(True)
def _loadPreferencePages(self):
"""
Loads all preference pages (built-ins and from modules).
"""
# load servers page
servers_page = ServerPreferencesPage()
servers_page.loadPreferences()
name = servers_page.windowTitle()
item = QtGui.QListWidgetItem(name, self.uiListWidget)
item.setData(QtCore.Qt.UserRole, servers_page)
self.uiStackedWidget.addWidget(servers_page)
self._items.append(item)
# load Dynamips pages
#TODO: generic way to go thru all modules
for cls in Dynamips.preferencePages():
preferences_page = cls()
preferences_page.loadPreferences()
name = preferences_page.windowTitle()
item = QtGui.QListWidgetItem(name, self.uiListWidget)
item.setData(QtCore.Qt.UserRole, preferences_page)
self.uiStackedWidget.addWidget(preferences_page)
self._items.append(item)
def _showPreferencesPageSlot(self, current, previous):
"""
Shows a preference page in the current dialog.
:param current: current preference page widget
:param previous: ignored
"""
if current == None:
current = previous
preferences_page = current.data(QtCore.Qt.UserRole)
name = preferences_page.windowTitle()
self.uiTitleLabel.setText("{} preferences".format(name))
index = self.uiStackedWidget.indexOf(preferences_page)
widget = self.uiStackedWidget.widget(index)
self.uiStackedWidget.setMinimumSize(widget.size())
self.uiStackedWidget.resize(widget.size())
self.uiStackedWidget.setCurrentIndex(index)
def _applyPreferences(self):
"""
Saves all the preferences.
"""
for item in self._items:
preferences_page = item.data(QtCore.Qt.UserRole)
preferences_page.savePreferences()
return True
def reject(self):
"""
Closes this dialog.
"""
#TODO: refresh the devices list when closing the window
QtGui.QDialog.reject(self)
def accept(self):
"""
Saves the preferences and closes this dialog.
"""
#TODO: refresh the devices list when closing the window
#globals.GApp.mainWindow.nodesDock.populateNodeDock(globals.GApp.workspace.dockWidget_NodeTypes.windowTitle())
if self._applyPreferences():
QtGui.QDialog.accept(self)

75
gns3/qt.py Normal file
View File

@@ -0,0 +1,75 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Compatibility layer for Qt bindings, so it is easier to switch from PyQt4 to PySide and
vice-versa. Possibility to add PyQt5 in the future as well. Current default is PyQt4.
"""
# based on https://gist.github.com/remram44/5985681
from __future__ import unicode_literals
import sys
import sip
DEFAULT_BINDING = 'PyQt'
if DEFAULT_BINDING == 'PyQt':
sip.setapi('QDate', 2)
sip.setapi('QDateTime', 2)
sip.setapi('QString', 2)
sip.setapi('QTextStream', 2)
sip.setapi('QTime', 2)
sip.setapi('QUrl', 2)
sip.setapi('QVariant', 2)
from PyQt4 import QtCore, QtGui, QtNetwork, QtSvg
sys.modules[__name__ + '.QtCore'] = QtCore
sys.modules[__name__ + '.QtGui'] = QtGui
sys.modules[__name__ + '.QtNetwork'] = QtNetwork
sys.modules[__name__ + '.QtSvg'] = QtSvg
try:
from PyQt4 import QtWebKit
sys.modules[__name__ + '.QtWebKit'] = QtWebKit
except ImportError:
pass
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
QtCore.Property = QtCore.pyqtProperty
QtCore.BINDING_VERSION_STR = QtCore.PYQT_VERSION_STR
elif DEFAULT_BINDING == 'PySide':
from PySide import QtCore, QtGui, QtNetwork, QtSvg, __version__
sys.modules[__name__ + '.QtCore'] = QtCore
sys.modules[__name__ + '.QtGui'] = QtGui
sys.modules[__name__ + '.QtNetwork'] = QtNetwork
sys.modules[__name__ + '.QtSvg'] = QtSvg
try:
from PySide import QtWebKit
sys.modules[__name__ + '.QtWebKit'] = QtWebKit
except ImportError:
pass
QtCore.QT_VERSION_STR = QtCore.__version__
QtCore.BINDING_VERSION_STR = __version__
else:
raise ImportError("Python binding not specified.")

238295
gns3/resources_rc.py Normal file

File diff suppressed because it is too large Load Diff

27
gns3/scene.py Normal file
View File

@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from .qt import QtGui
#FIXME: do we need this?
class Scene(QtGui.QGraphicsScene):
def __init__(self, parent=None):
QtGui.QGraphicsScene.__init__(self, parent)

187
gns3/servers.py Normal file
View File

@@ -0,0 +1,187 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Keeps track of all the local and remote servers and their settings.
"""
from .qt import QtCore
from .websocket_client import WebSocketClient
class Servers(object):
"""
Server management class.
"""
def __init__(self):
self._local_server = None
self._remote_servers = {}
self._loadSettings()
def _loadSettings(self):
"""
Loads the server settings from the persistent settings file.
"""
# load the settings
settings = QtCore.QSettings()
settings.beginGroup(self.__class__.__name__)
# set the local server
local_server_host = settings.value("local_server_host", "127.0.0.1")
local_server_port = settings.value("local_server_port", 8000, type=int)
self.setLocalServer(local_server_host, local_server_port)
# load the remote servers
size = settings.beginReadArray("remote")
for index in range(0, size):
settings.setArrayIndex(index)
host = settings.value("host", "")
port = settings.value("port", 0, type=int)
if host and port:
self._addRemoteServer(host, port)
settings.endArray()
settings.endGroup()
def _saveSettings(self):
"""
Saves the server settings to a persistent settings file.
"""
# save the settings
settings = QtCore.QSettings()
settings.beginGroup(self.__class__.__name__)
settings.remove("")
# save the local server
if self._local_server:
settings.setValue("local_server_host", self._local_server.host)
settings.setValue("local_server_port", self._local_server.port)
# save the remote servers
settings.beginWriteArray("remote", len(self._remote_servers))
index = 0
for server in self._remote_servers.values():
settings.setArrayIndex(index)
settings.setValue("host", server.host)
settings.setValue("port", server.port)
index += 1
settings.endArray()
settings.endGroup()
def setLocalServer(self, host, port):
"""
Sets the local server.
:param host: host or address of the server
:param port: port of the server (integer)
"""
if self._local_server:
if self._local_server.host == host and self._local_server.port == port:
return
elif self._local_server.connected:
self._local_server.close()
url = "ws://{host}:{port}".format(host=host, port=port)
self._local_server = WebSocketClient(url)
def localServer(self):
"""
Returns the local server.
:returns: local server (object)
"""
return self._local_server
def _addRemoteServer(self, host, port):
"""
Adds a new remote server.
:param host: host or address of the server
:param port: port of the server (integer)
"""
server_socket = "{host}:{port}".format(host=host, port=port)
url = "ws://{server_socket}".format(server_socket=server_socket)
server = WebSocketClient(url)
self._remote_servers[server_socket] = server
def updateRemoteServers(self, servers):
"""
Updates the remote servers list.
:param servers: servers dictionary.
"""
for server_id, server in self._remote_servers.copy().items():
if not server_id in servers:
if server.connected:
server.close()
del self._remote_servers[server_id]
for server_id, server in servers.items():
if server_id in self._remote_servers:
continue
host = server["host"]
port = server["port"]
url = "ws://{host}:{port}".format(host=host, port=port)
new_server = WebSocketClient(url)
self._remote_servers[server_id] = new_server
def remoteServers(self):
"""
Returns all the remote servers.
:returns: remote servers dictionary
"""
return self._remote_servers
def save(self):
"""
Saves the settings.
"""
self._saveSettings()
def disconnectAllServers(self):
"""
Disconnects all servers (local and remote).
"""
if self._local_server.connected:
self._local_server.close_connection()
for server in self._remote_servers:
if server.connected:
server.close_connection()
@staticmethod
def instance():
"""
Singleton to return only on instance of Servers.
:returns: instance of Servers
"""
if not hasattr(Servers, "_instance"):
Servers._instance = Servers()
return Servers._instance

0
gns3/ui/__init__.py Normal file
View File

1390
gns3/ui/main_window.ui Normal file

File diff suppressed because it is too large Load Diff

768
gns3/ui/main_window_ui.py Normal file
View File

@@ -0,0 +1,768 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/ui/main_window.ui'
#
# Created: Sun Jan 26 13:50:52 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.setWindowModality(QtCore.Qt.NonModal)
MainWindow.resize(980, 719)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/images/logo_icon.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
MainWindow.setWindowIcon(icon)
MainWindow.setStyleSheet(_fromUtf8("#toolBar_Devices QToolButton {\n"
"width: 50px;\n"
"height: 55px;\n"
"border:solid 1px black opacity 0.4;\n"
"background-none;\n"
"}\n"
"\n"
"#toolBar_General QToolButton {\n"
"width: 36px;\n"
"height: 36px;\n"
"border:solid 1px black opacity 0.4;\n"
"background-none;\n"
"}\n"
"\n"
""))
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.gridlayout = QtGui.QGridLayout(self.centralwidget)
self.gridlayout.setMargin(0)
self.gridlayout.setSpacing(0)
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
self.uiGraphicsView = GraphicsView(self.centralwidget)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiGraphicsView.sizePolicy().hasHeightForWidth())
self.uiGraphicsView.setSizePolicy(sizePolicy)
self.uiGraphicsView.setObjectName(_fromUtf8("uiGraphicsView"))
self.gridlayout.addWidget(self.uiGraphicsView, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 980, 25))
self.menubar.setObjectName(_fromUtf8("menubar"))
self.menu_Edit = QtGui.QMenu(self.menubar)
self.menu_Edit.setObjectName(_fromUtf8("menu_Edit"))
self.menu_File = QtGui.QMenu(self.menubar)
self.menu_File.setObjectName(_fromUtf8("menu_File"))
self.menu_About = QtGui.QMenu(self.menubar)
self.menu_About.setObjectName(_fromUtf8("menu_About"))
self.menu_View = QtGui.QMenu(self.menubar)
self.menu_View.setObjectName(_fromUtf8("menu_View"))
self.menuWindow_Style = QtGui.QMenu(self.menu_View)
self.menuWindow_Style.setObjectName(_fromUtf8("menuWindow_Style"))
self.menuControl = QtGui.QMenu(self.menubar)
self.menuControl.setObjectName(_fromUtf8("menuControl"))
self.menuAnnotate = QtGui.QMenu(self.menubar)
self.menuAnnotate.setObjectName(_fromUtf8("menuAnnotate"))
self.menuDevice = QtGui.QMenu(self.menubar)
self.menuDevice.setObjectName(_fromUtf8("menuDevice"))
self.menu_Tools = QtGui.QMenu(self.menubar)
self.menu_Tools.setObjectName(_fromUtf8("menu_Tools"))
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName(_fromUtf8("statusbar"))
MainWindow.setStatusBar(self.statusbar)
self.toolBar_General = QtGui.QToolBar(MainWindow)
self.toolBar_General.setToolTip(_fromUtf8(""))
self.toolBar_General.setStatusTip(_fromUtf8(""))
self.toolBar_General.setOrientation(QtCore.Qt.Horizontal)
self.toolBar_General.setIconSize(QtCore.QSize(32, 32))
self.toolBar_General.setObjectName(_fromUtf8("toolBar_General"))
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar_General)
self.uiNodesDockWidget = QtGui.QDockWidget(MainWindow)
self.uiNodesDockWidget.setEnabled(True)
self.uiNodesDockWidget.setVisible(True)
self.uiNodesDockWidget.setFloating(False)
self.uiNodesDockWidget.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea|QtCore.Qt.RightDockWidgetArea)
self.uiNodesDockWidget.setObjectName(_fromUtf8("uiNodesDockWidget"))
self.uiNodesDockWidgetContents = QtGui.QWidget()
self.uiNodesDockWidgetContents.setObjectName(_fromUtf8("uiNodesDockWidgetContents"))
self.vboxlayout = QtGui.QVBoxLayout(self.uiNodesDockWidgetContents)
self.vboxlayout.setSpacing(0)
self.vboxlayout.setMargin(0)
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
self.uiNodesView = NodesView(self.uiNodesDockWidgetContents)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiNodesView.sizePolicy().hasHeightForWidth())
self.uiNodesView.setSizePolicy(sizePolicy)
self.uiNodesView.setDragEnabled(False)
self.uiNodesView.setIconSize(QtCore.QSize(24, 24))
self.uiNodesView.setRootIsDecorated(False)
self.uiNodesView.setObjectName(_fromUtf8("uiNodesView"))
self.uiNodesView.header().setVisible(False)
self.vboxlayout.addWidget(self.uiNodesView)
self.uiNodesDockWidget.setWidget(self.uiNodesDockWidgetContents)
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.uiNodesDockWidget)
self.toolBar_Devices = QtGui.QToolBar(MainWindow)
self.toolBar_Devices.setIconSize(QtCore.QSize(64, 64))
self.toolBar_Devices.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
self.toolBar_Devices.setObjectName(_fromUtf8("toolBar_Devices"))
MainWindow.addToolBar(QtCore.Qt.LeftToolBarArea, self.toolBar_Devices)
self.toolBar_Emulation = QtGui.QToolBar(MainWindow)
self.toolBar_Emulation.setIconSize(QtCore.QSize(32, 32))
self.toolBar_Emulation.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly)
self.toolBar_Emulation.setObjectName(_fromUtf8("toolBar_Emulation"))
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar_Emulation)
self.dockWidget_Console = QtGui.QDockWidget(MainWindow)
self.dockWidget_Console.setMaximumSize(QtCore.QSize(524287, 524287))
self.dockWidget_Console.setAllowedAreas(QtCore.Qt.AllDockWidgetAreas)
self.dockWidget_Console.setObjectName(_fromUtf8("dockWidget_Console"))
self.dockWidgetContents_5 = QtGui.QWidget()
self.dockWidgetContents_5.setObjectName(_fromUtf8("dockWidgetContents_5"))
self.vboxlayout1 = QtGui.QVBoxLayout(self.dockWidgetContents_5)
self.vboxlayout1.setSpacing(0)
self.vboxlayout1.setMargin(0)
self.vboxlayout1.setObjectName(_fromUtf8("vboxlayout1"))
self.textEditConsole = QtGui.QTextEdit(self.dockWidgetContents_5)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.textEditConsole.sizePolicy().hasHeightForWidth())
self.textEditConsole.setSizePolicy(sizePolicy)
self.textEditConsole.setObjectName(_fromUtf8("textEditConsole"))
self.vboxlayout1.addWidget(self.textEditConsole)
self.dockWidget_Console.setWidget(self.dockWidgetContents_5)
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.dockWidget_Console)
self.toolBar_drawing = QtGui.QToolBar(MainWindow)
self.toolBar_drawing.setIconSize(QtCore.QSize(32, 32))
self.toolBar_drawing.setObjectName(_fromUtf8("toolBar_drawing"))
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar_drawing)
self.dockWidget_UndoView = QtGui.QDockWidget(MainWindow)
self.dockWidget_UndoView.setEnabled(True)
self.dockWidget_UndoView.setObjectName(_fromUtf8("dockWidget_UndoView"))
self.dockWidgetContents = QtGui.QWidget()
self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
self.verticalLayout = QtGui.QVBoxLayout(self.dockWidgetContents)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setMargin(0)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.UndoViewDock = QtGui.QListView(self.dockWidgetContents)
self.UndoViewDock.setObjectName(_fromUtf8("UndoViewDock"))
self.verticalLayout.addWidget(self.UndoViewDock)
self.dockWidget_UndoView.setWidget(self.dockWidgetContents)
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidget_UndoView)
self.dockWidget_Capture = QtGui.QDockWidget(MainWindow)
self.dockWidget_Capture.setObjectName(_fromUtf8("dockWidget_Capture"))
self.dockWidgetContents_2 = QtGui.QWidget()
self.dockWidgetContents_2.setObjectName(_fromUtf8("dockWidgetContents_2"))
self.verticalLayout_2 = QtGui.QVBoxLayout(self.dockWidgetContents_2)
self.verticalLayout_2.setMargin(0)
self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
self.capturesDock = QtGui.QTreeWidget(self.dockWidgetContents_2)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.capturesDock.sizePolicy().hasHeightForWidth())
self.capturesDock.setSizePolicy(sizePolicy)
self.capturesDock.setIconSize(QtCore.QSize(24, 24))
self.capturesDock.setRootIsDecorated(False)
self.capturesDock.setObjectName(_fromUtf8("capturesDock"))
self.verticalLayout_2.addWidget(self.capturesDock)
self.dockWidget_Capture.setWidget(self.dockWidgetContents_2)
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidget_Capture)
self.dockWidget_TopoSum = QtGui.QDockWidget(MainWindow)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.dockWidget_TopoSum.sizePolicy().hasHeightForWidth())
self.dockWidget_TopoSum.setSizePolicy(sizePolicy)
self.dockWidget_TopoSum.setMinimumSize(QtCore.QSize(84, 109))
self.dockWidget_TopoSum.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea|QtCore.Qt.RightDockWidgetArea)
self.dockWidget_TopoSum.setObjectName(_fromUtf8("dockWidget_TopoSum"))
self.dockWidgetContents_7 = QtGui.QWidget()
self.dockWidgetContents_7.setObjectName(_fromUtf8("dockWidgetContents_7"))
self.gridlayout1 = QtGui.QGridLayout(self.dockWidgetContents_7)
self.gridlayout1.setMargin(0)
self.gridlayout1.setSpacing(0)
self.gridlayout1.setObjectName(_fromUtf8("gridlayout1"))
self.treeWidget_TopologySummary = QtGui.QTreeWidget(self.dockWidgetContents_7)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.treeWidget_TopologySummary.sizePolicy().hasHeightForWidth())
self.treeWidget_TopologySummary.setSizePolicy(sizePolicy)
self.treeWidget_TopologySummary.setObjectName(_fromUtf8("treeWidget_TopologySummary"))
self.gridlayout1.addWidget(self.treeWidget_TopologySummary, 0, 0, 1, 1)
self.dockWidget_TopoSum.setWidget(self.dockWidgetContents_7)
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidget_TopoSum)
self.action_About = QtGui.QAction(MainWindow)
self.action_About.setMenuRole(QtGui.QAction.AboutRole)
self.action_About.setObjectName(_fromUtf8("action_About"))
self.action_Quit = QtGui.QAction(MainWindow)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/quit.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_Quit.setIcon(icon1)
self.action_Quit.setObjectName(_fromUtf8("action_Quit"))
self.action_Open = QtGui.QAction(MainWindow)
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/open.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_Open.setIcon(icon2)
self.action_Open.setObjectName(_fromUtf8("action_Open"))
self.action_Save = QtGui.QAction(MainWindow)
icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/save.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_Save.setIcon(icon3)
self.action_Save.setObjectName(_fromUtf8("action_Save"))
self.action_IOS_images = QtGui.QAction(MainWindow)
icon4 = QtGui.QIcon()
icon4.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/binary.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_IOS_images.setIcon(icon4)
self.action_IOS_images.setObjectName(_fromUtf8("action_IOS_images"))
self.action_OnlineHelp = QtGui.QAction(MainWindow)
icon5 = QtGui.QIcon()
icon5.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/help.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_OnlineHelp.setIcon(icon5)
self.action_OnlineHelp.setObjectName(_fromUtf8("action_OnlineHelp"))
self.action_Export = QtGui.QAction(MainWindow)
icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/camera-photo.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon6.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/camera-photo-hover.svg")), QtGui.QIcon.Active, QtGui.QIcon.Off)
self.action_Export.setIcon(icon6)
self.action_Export.setObjectName(_fromUtf8("action_Export"))
self.action_StartAll = QtGui.QAction(MainWindow)
self.action_StartAll.setEnabled(True)
icon7 = QtGui.QIcon()
icon7.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/play7-test.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon7.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/play7-test.svg")), QtGui.QIcon.Normal, QtGui.QIcon.On)
icon7.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/play2-test.svg")), QtGui.QIcon.Active, QtGui.QIcon.Off)
icon7.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/play2-test.svg")), QtGui.QIcon.Active, QtGui.QIcon.On)
self.action_StartAll.setIcon(icon7)
self.action_StartAll.setObjectName(_fromUtf8("action_StartAll"))
self.action_StopAll = QtGui.QAction(MainWindow)
self.action_StopAll.setEnabled(True)
icon8 = QtGui.QIcon()
icon8.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/stop3-test.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon8.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/stop2-test.svg")), QtGui.QIcon.Active, QtGui.QIcon.Off)
icon8.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/stop2-test.svg")), QtGui.QIcon.Active, QtGui.QIcon.On)
self.action_StopAll.setIcon(icon8)
self.action_StopAll.setObjectName(_fromUtf8("action_StopAll"))
self.action_ShowHostnames = QtGui.QAction(MainWindow)
self.action_ShowHostnames.setCheckable(True)
icon9 = QtGui.QIcon()
icon9.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/show-hostname.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_ShowHostnames.setIcon(icon9)
self.action_ShowHostnames.setObjectName(_fromUtf8("action_ShowHostnames"))
self.action_TelnetAll = QtGui.QAction(MainWindow)
self.action_TelnetAll.setEnabled(True)
icon10 = QtGui.QIcon()
icon10.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/console.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_TelnetAll.setIcon(icon10)
self.action_TelnetAll.setObjectName(_fromUtf8("action_TelnetAll"))
self.action_SaveAs = QtGui.QAction(MainWindow)
icon11 = QtGui.QIcon()
icon11.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/save-as.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_SaveAs.setIcon(icon11)
self.action_SaveAs.setObjectName(_fromUtf8("action_SaveAs"))
self.action_AboutQt = QtGui.QAction(MainWindow)
self.action_AboutQt.setMenuRole(QtGui.QAction.AboutQtRole)
self.action_AboutQt.setObjectName(_fromUtf8("action_AboutQt"))
self.action_ZoomIn = QtGui.QAction(MainWindow)
icon12 = QtGui.QIcon()
icon12.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/zoom-in.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon12.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/zoom-in-hover.png")), QtGui.QIcon.Active, QtGui.QIcon.Off)
self.action_ZoomIn.setIcon(icon12)
self.action_ZoomIn.setObjectName(_fromUtf8("action_ZoomIn"))
self.action_ZoomOut = QtGui.QAction(MainWindow)
icon13 = QtGui.QIcon()
icon13.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/zoom-out.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon13.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/zoom-out-hover.png")), QtGui.QIcon.Active, QtGui.QIcon.Off)
self.action_ZoomOut.setIcon(icon13)
self.action_ZoomOut.setObjectName(_fromUtf8("action_ZoomOut"))
self.action_ZoomReset = QtGui.QAction(MainWindow)
self.action_ZoomReset.setObjectName(_fromUtf8("action_ZoomReset"))
self.action_SelectAll = QtGui.QAction(MainWindow)
self.action_SelectAll.setObjectName(_fromUtf8("action_SelectAll"))
self.action_SelectNone = QtGui.QAction(MainWindow)
self.action_SelectNone.setObjectName(_fromUtf8("action_SelectNone"))
self.uiPreferencesAction = QtGui.QAction(MainWindow)
icon14 = QtGui.QIcon()
icon14.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/applications.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.uiPreferencesAction.setIcon(icon14)
self.uiPreferencesAction.setObjectName(_fromUtf8("uiPreferencesAction"))
self.action_Undo = QtGui.QAction(MainWindow)
self.action_Undo.setEnabled(True)
icon15 = QtGui.QIcon()
icon15.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/edit-undo.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_Undo.setIcon(icon15)
self.action_Undo.setObjectName(_fromUtf8("action_Undo"))
self.action_Redo = QtGui.QAction(MainWindow)
self.action_Redo.setEnabled(True)
icon16 = QtGui.QIcon()
icon16.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/edit-redo.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_Redo.setIcon(icon16)
self.action_Redo.setObjectName(_fromUtf8("action_Redo"))
self.action_SuspendAll = QtGui.QAction(MainWindow)
icon17 = QtGui.QIcon()
icon17.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/pause3-test.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon17.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/pause2-test.svg")), QtGui.QIcon.Active, QtGui.QIcon.Off)
icon17.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/pause2-test.svg")), QtGui.QIcon.Active, QtGui.QIcon.On)
self.action_SuspendAll.setIcon(icon17)
self.action_SuspendAll.setObjectName(_fromUtf8("action_SuspendAll"))
self.action_Clear = QtGui.QAction(MainWindow)
icon18 = QtGui.QIcon()
icon18.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/new.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_Clear.setIcon(icon18)
self.action_Clear.setObjectName(_fromUtf8("action_Clear"))
self.action_AddNote = QtGui.QAction(MainWindow)
self.action_AddNote.setCheckable(True)
icon19 = QtGui.QIcon()
icon19.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/add-note.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_AddNote.setIcon(icon19)
self.action_AddNote.setObjectName(_fromUtf8("action_AddNote"))
self.action_New = QtGui.QAction(MainWindow)
icon20 = QtGui.QIcon()
icon20.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/new-project.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_New.setIcon(icon20)
self.action_New.setObjectName(_fromUtf8("action_New"))
self.action_config = QtGui.QAction(MainWindow)
icon21 = QtGui.QIcon()
icon21.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/import_export_configs.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_config.setIcon(icon21)
self.action_config.setObjectName(_fromUtf8("action_config"))
self.action_InsertImage = QtGui.QAction(MainWindow)
icon22 = QtGui.QIcon()
icon22.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/image.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_InsertImage.setIcon(icon22)
self.action_InsertImage.setObjectName(_fromUtf8("action_InsertImage"))
self.action_Symbol_Manager = QtGui.QAction(MainWindow)
icon23 = QtGui.QIcon()
icon23.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/node_conception.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_Symbol_Manager.setIcon(icon23)
self.action_Symbol_Manager.setObjectName(_fromUtf8("action_Symbol_Manager"))
self.action_DrawRectangle = QtGui.QAction(MainWindow)
self.action_DrawRectangle.setCheckable(True)
icon24 = QtGui.QIcon()
icon24.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/rectangle3-test.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon24.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/rectangle2-test.svg")), QtGui.QIcon.Active, QtGui.QIcon.Off)
icon24.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/rectangle2-test.svg")), QtGui.QIcon.Active, QtGui.QIcon.On)
self.action_DrawRectangle.setIcon(icon24)
self.action_DrawRectangle.setObjectName(_fromUtf8("action_DrawRectangle"))
self.action_DrawEllipse = QtGui.QAction(MainWindow)
self.action_DrawEllipse.setCheckable(True)
icon25 = QtGui.QIcon()
icon25.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/ellipse3-test.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon25.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/ellipse2-test.svg")), QtGui.QIcon.Active, QtGui.QIcon.Off)
icon25.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/ellipse2-test.svg")), QtGui.QIcon.Active, QtGui.QIcon.On)
self.action_DrawEllipse.setIcon(icon25)
self.action_DrawEllipse.setObjectName(_fromUtf8("action_DrawEllipse"))
self.action_ShowinterfaceNames = QtGui.QAction(MainWindow)
self.action_ShowinterfaceNames.setCheckable(True)
icon26 = QtGui.QIcon()
icon26.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/show-interface-names.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_ShowinterfaceNames.setIcon(icon26)
self.action_ShowinterfaceNames.setObjectName(_fromUtf8("action_ShowinterfaceNames"))
self.action_Snapshot = QtGui.QAction(MainWindow)
icon27 = QtGui.QIcon()
icon27.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/snapshot.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_Snapshot.setIcon(icon27)
self.action_Snapshot.setObjectName(_fromUtf8("action_Snapshot"))
self.action_ShowLayers = QtGui.QAction(MainWindow)
self.action_ShowLayers.setCheckable(True)
self.action_ShowLayers.setObjectName(_fromUtf8("action_ShowLayers"))
self.action_SaveProjectAs = QtGui.QAction(MainWindow)
icon28 = QtGui.QIcon()
icon28.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/save-as-project.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_SaveProjectAs.setIcon(icon28)
self.action_SaveProjectAs.setObjectName(_fromUtf8("action_SaveProjectAs"))
self.action_ReloadAll = QtGui.QAction(MainWindow)
icon29 = QtGui.QIcon()
icon29.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/reload.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_ReloadAll.setIcon(icon29)
self.action_ReloadAll.setObjectName(_fromUtf8("action_ReloadAll"))
self.action_ConsoleAuxAll = QtGui.QAction(MainWindow)
self.action_ConsoleAuxAll.setEnabled(True)
icon30 = QtGui.QIcon()
icon30.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/aux-console.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_ConsoleAuxAll.setIcon(icon30)
self.action_ConsoleAuxAll.setObjectName(_fromUtf8("action_ConsoleAuxAll"))
self.action_ResetInterfaceLabels = QtGui.QAction(MainWindow)
self.action_ResetInterfaceLabels.setObjectName(_fromUtf8("action_ResetInterfaceLabels"))
self.action_CheckForUpdate = QtGui.QAction(MainWindow)
self.action_CheckForUpdate.setObjectName(_fromUtf8("action_CheckForUpdate"))
self.action_ShowVirtualBoxManager = QtGui.QAction(MainWindow)
icon31 = QtGui.QIcon()
icon31.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/virtualbox.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.action_ShowVirtualBoxManager.setIcon(icon31)
self.action_ShowVirtualBoxManager.setObjectName(_fromUtf8("action_ShowVirtualBoxManager"))
self.action_EnergySavingStyle = QtGui.QAction(MainWindow)
self.action_EnergySavingStyle.setCheckable(True)
self.action_EnergySavingStyle.setObjectName(_fromUtf8("action_EnergySavingStyle"))
self.action_DefaultStyle = QtGui.QAction(MainWindow)
self.action_DefaultStyle.setCheckable(True)
self.action_DefaultStyle.setChecked(True)
self.action_DefaultStyle.setObjectName(_fromUtf8("action_DefaultStyle"))
self.action_Router = QtGui.QAction(MainWindow)
icon32 = QtGui.QIcon()
icon32.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/router.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon32.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/router-hover.png")), QtGui.QIcon.Active, QtGui.QIcon.Off)
self.action_Router.setIcon(icon32)
self.action_Router.setObjectName(_fromUtf8("action_Router"))
self.action_Switch = QtGui.QAction(MainWindow)
icon33 = QtGui.QIcon()
icon33.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/switch.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon33.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/switch-hover.png")), QtGui.QIcon.Active, QtGui.QIcon.Off)
self.action_Switch.setIcon(icon33)
self.action_Switch.setObjectName(_fromUtf8("action_Switch"))
self.action_EndDevices = QtGui.QAction(MainWindow)
icon34 = QtGui.QIcon()
icon34.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/PC.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon34.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/PC-hover.png")), QtGui.QIcon.Active, QtGui.QIcon.Off)
self.action_EndDevices.setIcon(icon34)
self.action_EndDevices.setObjectName(_fromUtf8("action_EndDevices"))
self.action_SecurityDevices = QtGui.QAction(MainWindow)
icon35 = QtGui.QIcon()
icon35.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/firewall.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon35.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/firewall-hover.png")), QtGui.QIcon.Active, QtGui.QIcon.Off)
self.action_SecurityDevices.setIcon(icon35)
self.action_SecurityDevices.setObjectName(_fromUtf8("action_SecurityDevices"))
self.action_HighContrastStyle = QtGui.QAction(MainWindow)
self.action_HighContrastStyle.setCheckable(True)
self.action_HighContrastStyle.setObjectName(_fromUtf8("action_HighContrastStyle"))
self.action_BrowseAllDevices = QtGui.QAction(MainWindow)
icon36 = QtGui.QIcon()
icon36.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/browse-all-icons.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon36.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/browse-all-icons-hover.png")), QtGui.QIcon.Active, QtGui.QIcon.Off)
self.action_BrowseAllDevices.setIcon(icon36)
self.action_BrowseAllDevices.setObjectName(_fromUtf8("action_BrowseAllDevices"))
self.uiAddLinkAction = QtGui.QAction(MainWindow)
self.uiAddLinkAction.setCheckable(True)
icon37 = QtGui.QIcon()
icon37.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/connection-new.svg")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon37.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/connection-new-hover.svg")), QtGui.QIcon.Active, QtGui.QIcon.Off)
self.uiAddLinkAction.setIcon(icon37)
self.uiAddLinkAction.setObjectName(_fromUtf8("uiAddLinkAction"))
self.action_Console = QtGui.QAction(MainWindow)
self.action_Console.setIcon(icon10)
self.action_Console.setObjectName(_fromUtf8("action_Console"))
self.action_Export_in_a_PDF = QtGui.QAction(MainWindow)
self.action_Export_in_a_PDF.setObjectName(_fromUtf8("action_Export_in_a_PDF"))
self.action_Deployement_Wizard = QtGui.QAction(MainWindow)
self.action_Deployement_Wizard.setObjectName(_fromUtf8("action_Deployement_Wizard"))
self.action_DisableMouseWheel = QtGui.QAction(MainWindow)
self.action_DisableMouseWheel.setCheckable(True)
self.action_DisableMouseWheel.setObjectName(_fromUtf8("action_DisableMouseWheel"))
self.action_ZoomUsingMouseWheel = QtGui.QAction(MainWindow)
self.action_ZoomUsingMouseWheel.setCheckable(True)
self.action_ZoomUsingMouseWheel.setObjectName(_fromUtf8("action_ZoomUsingMouseWheel"))
self.action_Tips = QtGui.QAction(MainWindow)
self.action_Tips.setObjectName(_fromUtf8("action_Tips"))
self.action_Instructions = QtGui.QAction(MainWindow)
self.action_Instructions.setObjectName(_fromUtf8("action_Instructions"))
self.menu_Edit.addAction(self.action_SelectAll)
self.menu_Edit.addAction(self.action_SelectNone)
self.menu_Edit.addSeparator()
self.menu_Edit.addAction(self.action_IOS_images)
self.menu_Edit.addAction(self.action_Symbol_Manager)
self.menu_Edit.addAction(self.uiPreferencesAction)
self.menu_File.addAction(self.action_New)
self.menu_File.addAction(self.action_Open)
self.menu_File.addAction(self.action_Save)
self.menu_File.addAction(self.action_SaveProjectAs)
self.menu_File.addSeparator()
self.menu_File.addAction(self.action_config)
self.menu_File.addAction(self.action_Export)
self.menu_File.addAction(self.action_Snapshot)
self.menu_File.addSeparator()
self.menu_File.addAction(self.action_Quit)
self.menu_About.addAction(self.action_OnlineHelp)
self.menu_About.addAction(self.action_CheckForUpdate)
self.menu_About.addAction(self.action_Instructions)
self.menu_About.addAction(self.action_Tips)
self.menu_About.addAction(self.action_AboutQt)
self.menu_About.addAction(self.action_About)
self.menuWindow_Style.addAction(self.action_DefaultStyle)
self.menuWindow_Style.addAction(self.action_EnergySavingStyle)
self.menu_View.addAction(self.action_ZoomIn)
self.menu_View.addAction(self.action_ZoomOut)
self.menu_View.addAction(self.action_ZoomReset)
self.menu_View.addAction(self.action_ZoomUsingMouseWheel)
self.menu_View.addAction(self.action_DisableMouseWheel)
self.menu_View.addSeparator()
self.menu_View.addAction(self.action_ShowLayers)
self.menu_View.addAction(self.action_ResetInterfaceLabels)
self.menu_View.addAction(self.action_ShowHostnames)
self.menu_View.addAction(self.action_ShowinterfaceNames)
self.menu_View.addAction(self.menuWindow_Style.menuAction())
self.menuControl.addAction(self.action_StartAll)
self.menuControl.addAction(self.action_SuspendAll)
self.menuControl.addAction(self.action_StopAll)
self.menuControl.addAction(self.action_ReloadAll)
self.menuControl.addAction(self.action_ShowVirtualBoxManager)
self.menuControl.addAction(self.action_ConsoleAuxAll)
self.menuControl.addAction(self.action_TelnetAll)
self.menuAnnotate.addAction(self.action_AddNote)
self.menuAnnotate.addAction(self.action_InsertImage)
self.menuAnnotate.addAction(self.action_DrawRectangle)
self.menuAnnotate.addAction(self.action_DrawEllipse)
self.menubar.addAction(self.menu_File.menuAction())
self.menubar.addAction(self.menu_Edit.menuAction())
self.menubar.addAction(self.menu_View.menuAction())
self.menubar.addAction(self.menuControl.menuAction())
self.menubar.addAction(self.menuDevice.menuAction())
self.menubar.addAction(self.menuAnnotate.menuAction())
self.menubar.addAction(self.menu_Tools.menuAction())
self.menubar.addAction(self.menu_About.menuAction())
self.toolBar_General.addAction(self.action_New)
self.toolBar_General.addAction(self.action_Open)
self.toolBar_General.addAction(self.action_Save)
self.toolBar_Devices.addAction(self.action_Router)
self.toolBar_Devices.addSeparator()
self.toolBar_Devices.addAction(self.action_Switch)
self.toolBar_Devices.addSeparator()
self.toolBar_Devices.addAction(self.action_EndDevices)
self.toolBar_Devices.addSeparator()
self.toolBar_Devices.addAction(self.action_SecurityDevices)
self.toolBar_Devices.addSeparator()
self.toolBar_Devices.addAction(self.action_BrowseAllDevices)
self.toolBar_Devices.addSeparator()
self.toolBar_Devices.addAction(self.uiAddLinkAction)
self.toolBar_Devices.addSeparator()
self.toolBar_Emulation.addAction(self.action_Snapshot)
self.toolBar_Emulation.addAction(self.action_config)
self.toolBar_Emulation.addAction(self.action_ShowinterfaceNames)
self.toolBar_Emulation.addAction(self.action_Console)
self.toolBar_Emulation.addSeparator()
self.toolBar_Emulation.addAction(self.action_StartAll)
self.toolBar_Emulation.addAction(self.action_SuspendAll)
self.toolBar_Emulation.addAction(self.action_StopAll)
self.toolBar_Emulation.addAction(self.action_ReloadAll)
self.toolBar_Emulation.addAction(self.action_ShowVirtualBoxManager)
self.toolBar_drawing.addAction(self.action_AddNote)
self.toolBar_drawing.addAction(self.action_InsertImage)
self.toolBar_drawing.addAction(self.action_DrawRectangle)
self.toolBar_drawing.addAction(self.action_DrawEllipse)
self.toolBar_drawing.addAction(self.action_ZoomIn)
self.toolBar_drawing.addAction(self.action_ZoomOut)
self.toolBar_drawing.addAction(self.action_Export)
self.retranslateUi(MainWindow)
QtCore.QObject.connect(self.action_Quit, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.close)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
MainWindow.setTabOrder(self.uiGraphicsView, self.uiNodesView)
MainWindow.setTabOrder(self.uiNodesView, self.textEditConsole)
MainWindow.setTabOrder(self.textEditConsole, self.UndoViewDock)
MainWindow.setTabOrder(self.UndoViewDock, self.capturesDock)
MainWindow.setTabOrder(self.capturesDock, self.treeWidget_TopologySummary)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "GNS3", None))
self.uiGraphicsView.setStatusTip(_translate("MainWindow", "Topology Graphic View (Workspace).", None))
self.menu_Edit.setTitle(_translate("MainWindow", "&Edit", None))
self.menu_File.setTitle(_translate("MainWindow", "&File", None))
self.menu_About.setTitle(_translate("MainWindow", "&Help", None))
self.menu_View.setTitle(_translate("MainWindow", "&View", None))
self.menuWindow_Style.setTitle(_translate("MainWindow", "Window Style", None))
self.menuControl.setTitle(_translate("MainWindow", "Control", None))
self.menuAnnotate.setTitle(_translate("MainWindow", "Annotate", None))
self.menuDevice.setTitle(_translate("MainWindow", "Device", None))
self.menu_Tools.setTitle(_translate("MainWindow", "&Tools", None))
self.toolBar_General.setWindowTitle(_translate("MainWindow", "General", None))
self.uiNodesDockWidget.setWindowTitle(_translate("MainWindow", "Node Types", None))
self.uiNodesView.setToolTip(_translate("MainWindow", "Drag Node to Workspace (press SHIFT while dragging for multiple nodes).", None))
self.uiNodesView.setStatusTip(_translate("MainWindow", "Available Node types are colored and can be dragged to the Workspace. Press SHIFT while dragging a device to add multiple identical nodes.", None))
self.uiNodesView.headerItem().setText(0, _translate("MainWindow", "1", None))
self.toolBar_Devices.setWindowTitle(_translate("MainWindow", "Devices", None))
self.toolBar_Emulation.setWindowTitle(_translate("MainWindow", "Emulation", None))
self.dockWidget_Console.setWindowTitle(_translate("MainWindow", "Console", None))
self.textEditConsole.setStatusTip(_translate("MainWindow", "GNS3 Management Console. Right-click for edit options. Type help for command line help.", None))
self.toolBar_drawing.setWindowTitle(_translate("MainWindow", "Drawing", None))
self.dockWidget_UndoView.setWindowTitle(_translate("MainWindow", "Undo Stack", None))
self.UndoViewDock.setToolTip(_translate("MainWindow", "Click on timepoint to restore device/link history to that timepoint.", None))
self.UndoViewDock.setStatusTip(_translate("MainWindow", "Undo stack holds device and link creation/deletion history. Click on timepoint to restore device/link history to that timepoint.", None))
self.dockWidget_Capture.setWindowTitle(_translate("MainWindow", "Captures", None))
self.capturesDock.setToolTip(_translate("MainWindow", "Select capture and right-click for menu.", None))
self.capturesDock.setStatusTip(_translate("MainWindow", "Captures lists all Wireshark captures for this session. Select capture and right-click for menu.", None))
self.capturesDock.headerItem().setText(0, _translate("MainWindow", "Hostname", None))
self.capturesDock.headerItem().setText(1, _translate("MainWindow", "Interface", None))
self.dockWidget_TopoSum.setWindowTitle(_translate("MainWindow", "Topology Summary", None))
self.treeWidget_TopologySummary.setToolTip(_translate("MainWindow", "Expand device to view connections. Select link and Right-click for menu.", None))
self.treeWidget_TopologySummary.setStatusTip(_translate("MainWindow", "Topology Summary shows device and connection status. Expand device to view connections. Select link and Right-click for menu.", None))
self.treeWidget_TopologySummary.headerItem().setText(0, _translate("MainWindow", "1", None))
self.action_About.setText(_translate("MainWindow", "&About", None))
self.action_About.setStatusTip(_translate("MainWindow", "About", None))
self.action_Quit.setText(_translate("MainWindow", "&Quit", None))
self.action_Quit.setStatusTip(_translate("MainWindow", "Quit", None))
self.action_Quit.setShortcut(_translate("MainWindow", "Ctrl+Q", None))
self.action_Open.setText(_translate("MainWindow", "&Open Project", None))
self.action_Open.setToolTip(_translate("MainWindow", "Open project or topology file", None))
self.action_Open.setStatusTip(_translate("MainWindow", "Open project or topology file", None))
self.action_Open.setShortcut(_translate("MainWindow", "Ctrl+O", None))
self.action_Save.setText(_translate("MainWindow", "&Save project", None))
self.action_Save.setToolTip(_translate("MainWindow", "Save project", None))
self.action_Save.setStatusTip(_translate("MainWindow", "Save project", None))
self.action_Save.setShortcut(_translate("MainWindow", "Ctrl+S", None))
self.action_IOS_images.setText(_translate("MainWindow", "IOS images and hypervisors", None))
self.action_IOS_images.setStatusTip(_translate("MainWindow", "IOS images and hypervisors", None))
self.action_IOS_images.setShortcut(_translate("MainWindow", "Ctrl+Shift+I", None))
self.action_OnlineHelp.setText(_translate("MainWindow", "&Online help", None))
self.action_OnlineHelp.setToolTip(_translate("MainWindow", "Online help", None))
self.action_OnlineHelp.setStatusTip(_translate("MainWindow", "Online Help", None))
self.action_Export.setText(_translate("MainWindow", "Take a screenshot", None))
self.action_Export.setToolTip(_translate("MainWindow", "Take a screenshot", None))
self.action_Export.setStatusTip(_translate("MainWindow", "Take a creenshot", None))
self.action_StartAll.setText(_translate("MainWindow", "Start/Resume all devices", None))
self.action_StartAll.setToolTip(_translate("MainWindow", "Start/Resume all devices", None))
self.action_StartAll.setStatusTip(_translate("MainWindow", "Start/Resume all devices", None))
self.action_StopAll.setText(_translate("MainWindow", "Stop all devices", None))
self.action_StopAll.setToolTip(_translate("MainWindow", "Stop all devices", None))
self.action_StopAll.setStatusTip(_translate("MainWindow", "Stop all devices", None))
self.action_ShowHostnames.setText(_translate("MainWindow", "Show hostnames", None))
self.action_ShowHostnames.setToolTip(_translate("MainWindow", "Show hostnames", None))
self.action_ShowHostnames.setStatusTip(_translate("MainWindow", "Show hostnames", None))
self.action_TelnetAll.setText(_translate("MainWindow", "Console connect to all devices", None))
self.action_TelnetAll.setToolTip(_translate("MainWindow", "Console connect to all devices", None))
self.action_TelnetAll.setStatusTip(_translate("MainWindow", "Console to all devices", None))
self.action_SaveAs.setText(_translate("MainWindow", "Save topology &as…", None))
self.action_SaveAs.setIconText(_translate("MainWindow", "Save As", None))
self.action_SaveAs.setToolTip(_translate("MainWindow", "Save topology file as...", None))
self.action_SaveAs.setStatusTip(_translate("MainWindow", "Save topology file as...", None))
self.action_AboutQt.setText(_translate("MainWindow", "About &Qt", None))
self.action_AboutQt.setStatusTip(_translate("MainWindow", "About Qt", None))
self.action_ZoomIn.setText(_translate("MainWindow", "Zoom in", None))
self.action_ZoomIn.setToolTip(_translate("MainWindow", "Zoom in", None))
self.action_ZoomIn.setStatusTip(_translate("MainWindow", "Zoom in", None))
self.action_ZoomIn.setShortcut(_translate("MainWindow", "Ctrl++", None))
self.action_ZoomOut.setText(_translate("MainWindow", "Zoom out", None))
self.action_ZoomOut.setToolTip(_translate("MainWindow", "Zoom out", None))
self.action_ZoomOut.setStatusTip(_translate("MainWindow", "Zoom out", None))
self.action_ZoomOut.setShortcut(_translate("MainWindow", "Ctrl+-", None))
self.action_ZoomReset.setText(_translate("MainWindow", "Zoom 1:1", None))
self.action_ZoomReset.setStatusTip(_translate("MainWindow", "Zoom Reset (1:1)", None))
self.action_ZoomReset.setShortcut(_translate("MainWindow", "Ctrl+/", None))
self.action_SelectAll.setText(_translate("MainWindow", "Select &all", None))
self.action_SelectAll.setStatusTip(_translate("MainWindow", "Select All", None))
self.action_SelectAll.setShortcut(_translate("MainWindow", "Ctrl+A", None))
self.action_SelectNone.setText(_translate("MainWindow", "Select &none", None))
self.action_SelectNone.setStatusTip(_translate("MainWindow", "Select None", None))
self.action_SelectNone.setShortcut(_translate("MainWindow", "Ctrl+Shift+A", None))
self.uiPreferencesAction.setText(_translate("MainWindow", "&Preferences...", None))
self.uiPreferencesAction.setStatusTip(_translate("MainWindow", "Preferences", None))
self.uiPreferencesAction.setShortcut(_translate("MainWindow", "Ctrl+Shift+P", None))
self.action_Undo.setText(_translate("MainWindow", "&Undo", None))
self.action_Undo.setShortcut(_translate("MainWindow", "Ctrl+Z", None))
self.action_Redo.setText(_translate("MainWindow", "&Redo", None))
self.action_Redo.setShortcut(_translate("MainWindow", "Ctrl+Y", None))
self.action_SuspendAll.setText(_translate("MainWindow", "Suspend all devices", None))
self.action_SuspendAll.setToolTip(_translate("MainWindow", "Suspend all devices", None))
self.action_SuspendAll.setStatusTip(_translate("MainWindow", "Suspend all devices", None))
self.action_Clear.setText(_translate("MainWindow", "New blank topology", None))
self.action_Clear.setToolTip(_translate("MainWindow", "New blank topology", None))
self.action_Clear.setStatusTip(_translate("MainWindow", "New blank topology", None))
self.action_AddNote.setText(_translate("MainWindow", "Add note", None))
self.action_AddNote.setToolTip(_translate("MainWindow", "Add a note", None))
self.action_AddNote.setStatusTip(_translate("MainWindow", "Add a note", None))
self.action_New.setText(_translate("MainWindow", "&New blank project", None))
self.action_New.setIconText(_translate("MainWindow", "New Project", None))
self.action_New.setToolTip(_translate("MainWindow", "New blank project", None))
self.action_New.setStatusTip(_translate("MainWindow", "New blank project", None))
self.action_New.setShortcut(_translate("MainWindow", "Ctrl+N", None))
self.action_config.setText(_translate("MainWindow", "&Import/Export IOS Startup Configs", None))
self.action_config.setToolTip(_translate("MainWindow", "Import/Export IOS Startup Configs", None))
self.action_config.setStatusTip(_translate("MainWindow", "Import/Export IOS Startup Configs", None))
self.action_InsertImage.setText(_translate("MainWindow", "Insert picture", None))
self.action_InsertImage.setToolTip(_translate("MainWindow", "Insert a picture", None))
self.action_InsertImage.setStatusTip(_translate("MainWindow", "Insert a picture", None))
self.action_Symbol_Manager.setText(_translate("MainWindow", "&Symbol manager", None))
self.action_Symbol_Manager.setToolTip(_translate("MainWindow", "Symbol manager", None))
self.action_Symbol_Manager.setStatusTip(_translate("MainWindow", "Symbol Manager", None))
self.action_Symbol_Manager.setShortcut(_translate("MainWindow", "Ctrl+Shift+S", None))
self.action_DrawRectangle.setText(_translate("MainWindow", "Draw rectangle", None))
self.action_DrawRectangle.setToolTip(_translate("MainWindow", "Draw a rectangle", None))
self.action_DrawRectangle.setStatusTip(_translate("MainWindow", "Draw a rectangle", None))
self.action_DrawEllipse.setText(_translate("MainWindow", "Draw ellipse", None))
self.action_DrawEllipse.setToolTip(_translate("MainWindow", "Draw an ellipse", None))
self.action_DrawEllipse.setStatusTip(_translate("MainWindow", "Draw an ellipse", None))
self.action_ShowinterfaceNames.setText(_translate("MainWindow", "Show/Hide interface labels", None))
self.action_ShowinterfaceNames.setToolTip(_translate("MainWindow", "Show/Hide interface labels", None))
self.action_ShowinterfaceNames.setStatusTip(_translate("MainWindow", "Show/Hide interface labels", None))
self.action_Snapshot.setText(_translate("MainWindow", "Manage snapshots", None))
self.action_Snapshot.setToolTip(_translate("MainWindow", "Manage snapshots", None))
self.action_Snapshot.setStatusTip(_translate("MainWindow", "Manage snapshots", None))
self.action_ShowLayers.setText(_translate("MainWindow", "Show layers", None))
self.action_ShowLayers.setStatusTip(_translate("MainWindow", "Show layers", None))
self.action_SaveProjectAs.setText(_translate("MainWindow", "&Save project as…", None))
self.action_SaveProjectAs.setToolTip(_translate("MainWindow", "Save project as...", None))
self.action_SaveProjectAs.setStatusTip(_translate("MainWindow", "Save project as...", None))
self.action_ReloadAll.setText(_translate("MainWindow", "Reload all devices", None))
self.action_ReloadAll.setToolTip(_translate("MainWindow", "Reload all devices", None))
self.action_ReloadAll.setStatusTip(_translate("MainWindow", "Reload all devices", None))
self.action_ConsoleAuxAll.setText(_translate("MainWindow", "Console connect via AUX to all devices", None))
self.action_ConsoleAuxAll.setToolTip(_translate("MainWindow", "Console connect via AUX to all devices", None))
self.action_ConsoleAuxAll.setStatusTip(_translate("MainWindow", "Console AUX to all devices", None))
self.action_ResetInterfaceLabels.setText(_translate("MainWindow", "Reset interface labels", None))
self.action_ResetInterfaceLabels.setToolTip(_translate("MainWindow", "Reset interface labels", None))
self.action_ResetInterfaceLabels.setStatusTip(_translate("MainWindow", "Reset Interface Labels", None))
self.action_CheckForUpdate.setText(_translate("MainWindow", "Check for Update", None))
self.action_CheckForUpdate.setStatusTip(_translate("MainWindow", "Check for Update", None))
self.action_ShowVirtualBoxManager.setText(_translate("MainWindow", "Show VirtualBox Manager", None))
self.action_ShowVirtualBoxManager.setToolTip(_translate("MainWindow", "Show VirtualBox Manager", None))
self.action_ShowVirtualBoxManager.setStatusTip(_translate("MainWindow", "Show VirtualBox Manager", None))
self.action_EnergySavingStyle.setText(_translate("MainWindow", "Energy Saving", None))
self.action_EnergySavingStyle.setStatusTip(_translate("MainWindow", "Energy Saving Mode", None))
self.action_DefaultStyle.setText(_translate("MainWindow", "Default", None))
self.action_Router.setText(_translate("MainWindow", "Browse Routers", None))
self.action_Router.setIconText(_translate("MainWindow", "Browse Routers", None))
self.action_Router.setToolTip(_translate("MainWindow", "Browse Routers", None))
self.action_Router.setStatusTip(_translate("MainWindow", "Browse Routers", None))
self.action_Switch.setText(_translate("MainWindow", "Browse Switches", None))
self.action_Switch.setIconText(_translate("MainWindow", "Browse Switches", None))
self.action_Switch.setToolTip(_translate("MainWindow", "Browse Switches", None))
self.action_Switch.setStatusTip(_translate("MainWindow", "Browse Switches", None))
self.action_EndDevices.setText(_translate("MainWindow", "Browse End Devices", None))
self.action_EndDevices.setIconText(_translate("MainWindow", "Browse End Devices", None))
self.action_EndDevices.setToolTip(_translate("MainWindow", "Browse End Devices", None))
self.action_EndDevices.setStatusTip(_translate("MainWindow", "Browse End Devices", None))
self.action_SecurityDevices.setText(_translate("MainWindow", "Browse Security Devices", None))
self.action_SecurityDevices.setIconText(_translate("MainWindow", "Browse Security Devices", None))
self.action_SecurityDevices.setToolTip(_translate("MainWindow", "Browse Security Devices", None))
self.action_SecurityDevices.setStatusTip(_translate("MainWindow", "Browse Security Devices", None))
self.action_HighContrastStyle.setText(_translate("MainWindow", "High Contrast", None))
self.action_HighContrastStyle.setStatusTip(_translate("MainWindow", "High Contrast Mode", None))
self.action_BrowseAllDevices.setText(_translate("MainWindow", "Browse all devices", None))
self.action_BrowseAllDevices.setToolTip(_translate("MainWindow", "Browse all devices", None))
self.action_BrowseAllDevices.setStatusTip(_translate("MainWindow", "Browse all devices", None))
self.uiAddLinkAction.setText(_translate("MainWindow", "Add a link", None))
self.uiAddLinkAction.setToolTip(_translate("MainWindow", "Add a link", None))
self.uiAddLinkAction.setStatusTip(_translate("MainWindow", "Add a link", None))
self.action_Console.setText(_translate("MainWindow", "Console", None))
self.action_Console.setToolTip(_translate("MainWindow", "Start Console...", None))
self.action_Console.setStatusTip(_translate("MainWindow", "Start Console...", None))
self.action_Export_in_a_PDF.setText(_translate("MainWindow", "Export in a PDF", None))
self.action_Deployement_Wizard.setText(_translate("MainWindow", "Deployement Wizard", None))
self.action_DisableMouseWheel.setText(_translate("MainWindow", "Disable Mouse Wheel", None))
self.action_DisableMouseWheel.setToolTip(_translate("MainWindow", "Disable Mouse Wheel", None))
self.action_ZoomUsingMouseWheel.setText(_translate("MainWindow", "Zoom using Mouse Wheel", None))
self.action_ZoomUsingMouseWheel.setToolTip(_translate("MainWindow", "Zoom in/out using the mouse whee", None))
self.action_Tips.setText(_translate("MainWindow", "Tips", None))
self.action_Tips.setToolTip(_translate("MainWindow", "Show Tips", None))
self.action_Instructions.setText(_translate("MainWindow", "Instructions", None))
from ..nodes_view import NodesView
from ..graphics_view import GraphicsView
from . import resources_rc

172
gns3/ui/node_configurator.ui Executable file
View File

@@ -0,0 +1,172 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NodeConfiguratorDialog</class>
<widget class="QDialog" name="NodeConfiguratorDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>689</width>
<height>454</height>
</rect>
</property>
<property name="windowTitle">
<string>Node configurator</string>
</property>
<property name="windowIcon">
<iconset resource="../../resources/resources.qrc">
<normaloff>:/images/logo_icon.png</normaloff>:/images/logo_icon.png</iconset>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTreeWidget" name="uiNodesTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Nodes</string>
</property>
</column>
</widget>
<widget class="QWidget" name="verticalLayout">
<layout class="QVBoxLayout">
<property name="spacing">
<number>4</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="uiTitleLabel">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>Node Configuration</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="uiConfigStackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="uiEmptyPageWidget">
<layout class="QVBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="textLabel">
<property name="text">
<string>Please select a node in the list
to display the configuration page.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="uiButtonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../resources/resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -0,0 +1,104 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/ui/node_configurator.ui'
#
# Created: Sun Jan 26 13:41:56 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_NodeConfiguratorDialog(object):
def setupUi(self, NodeConfiguratorDialog):
NodeConfiguratorDialog.setObjectName(_fromUtf8("NodeConfiguratorDialog"))
NodeConfiguratorDialog.resize(689, 454)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/images/logo_icon.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
NodeConfiguratorDialog.setWindowIcon(icon)
self.gridlayout = QtGui.QGridLayout(NodeConfiguratorDialog)
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
self.splitter = QtGui.QSplitter(NodeConfiguratorDialog)
self.splitter.setOrientation(QtCore.Qt.Horizontal)
self.splitter.setObjectName(_fromUtf8("splitter"))
self.uiNodesTreeWidget = QtGui.QTreeWidget(self.splitter)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiNodesTreeWidget.sizePolicy().hasHeightForWidth())
self.uiNodesTreeWidget.setSizePolicy(sizePolicy)
self.uiNodesTreeWidget.setObjectName(_fromUtf8("uiNodesTreeWidget"))
self.uiNodesTreeWidget.header().setVisible(False)
self.verticalLayout = QtGui.QWidget(self.splitter)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.vboxlayout = QtGui.QVBoxLayout(self.verticalLayout)
self.vboxlayout.setSpacing(4)
self.vboxlayout.setMargin(0)
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
self.uiTitleLabel = QtGui.QLabel(self.verticalLayout)
font = QtGui.QFont()
font.setPointSize(16)
self.uiTitleLabel.setFont(font)
self.uiTitleLabel.setFrameShape(QtGui.QFrame.Box)
self.uiTitleLabel.setFrameShadow(QtGui.QFrame.Sunken)
self.uiTitleLabel.setTextFormat(QtCore.Qt.PlainText)
self.uiTitleLabel.setObjectName(_fromUtf8("uiTitleLabel"))
self.vboxlayout.addWidget(self.uiTitleLabel)
self.uiConfigStackedWidget = QtGui.QStackedWidget(self.verticalLayout)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiConfigStackedWidget.sizePolicy().hasHeightForWidth())
self.uiConfigStackedWidget.setSizePolicy(sizePolicy)
self.uiConfigStackedWidget.setFrameShape(QtGui.QFrame.Box)
self.uiConfigStackedWidget.setFrameShadow(QtGui.QFrame.Sunken)
self.uiConfigStackedWidget.setObjectName(_fromUtf8("uiConfigStackedWidget"))
self.uiEmptyPageWidget = QtGui.QWidget()
self.uiEmptyPageWidget.setObjectName(_fromUtf8("uiEmptyPageWidget"))
self.vboxlayout1 = QtGui.QVBoxLayout(self.uiEmptyPageWidget)
self.vboxlayout1.setSpacing(0)
self.vboxlayout1.setContentsMargins(0, 4, 0, 0)
self.vboxlayout1.setObjectName(_fromUtf8("vboxlayout1"))
spacerItem = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.vboxlayout1.addItem(spacerItem)
self.textLabel = QtGui.QLabel(self.uiEmptyPageWidget)
self.textLabel.setAlignment(QtCore.Qt.AlignCenter)
self.textLabel.setObjectName(_fromUtf8("textLabel"))
self.vboxlayout1.addWidget(self.textLabel)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.vboxlayout1.addItem(spacerItem1)
self.uiConfigStackedWidget.addWidget(self.uiEmptyPageWidget)
self.vboxlayout.addWidget(self.uiConfigStackedWidget)
self.gridlayout.addWidget(self.splitter, 0, 0, 1, 1)
self.uiButtonBox = QtGui.QDialogButtonBox(NodeConfiguratorDialog)
self.uiButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.uiButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Apply|QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok|QtGui.QDialogButtonBox.Reset)
self.uiButtonBox.setObjectName(_fromUtf8("uiButtonBox"))
self.gridlayout.addWidget(self.uiButtonBox, 1, 0, 1, 1)
self.retranslateUi(NodeConfiguratorDialog)
self.uiConfigStackedWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(NodeConfiguratorDialog)
def retranslateUi(self, NodeConfiguratorDialog):
NodeConfiguratorDialog.setWindowTitle(_translate("NodeConfiguratorDialog", "Node configurator", None))
self.uiNodesTreeWidget.headerItem().setText(0, _translate("NodeConfiguratorDialog", "Nodes", None))
self.uiTitleLabel.setText(_translate("NodeConfiguratorDialog", "Node Configuration", None))
self.textLabel.setText(_translate("NodeConfiguratorDialog", "Please select a node in the list \n"
"to display the configuration page.", None))
from . import resources_rc

153
gns3/ui/preferences_dialog.ui Executable file
View File

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PreferencesDialog</class>
<widget class="QDialog" name="PreferencesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>652</width>
<height>585</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>2</horstretch>
<verstretch>2</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Preferences</string>
</property>
<property name="windowIcon">
<iconset resource="../../resources/resources.qrc">
<normaloff>:/images/logo_icon.png</normaloff>:/images/logo_icon.png</iconset>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QListWidget" name="uiListWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>160</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout">
<property name="spacing">
<number>3</number>
</property>
<item>
<widget class="QLabel" name="uiTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
<underline>false</underline>
</font>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="uiStackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<widget class="QWidget" name="uiPageWidget"/>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="Line" name="uiLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QDialogButtonBox" name="uiButtonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>uiListWidget</tabstop>
<tabstop>uiButtonBox</tabstop>
</tabstops>
<resources>
<include location="../../resources/resources.qrc"/>
</resources>
<connections>
<connection>
<sender>uiButtonBox</sender>
<signal>accepted()</signal>
<receiver>PreferencesDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>270</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>uiButtonBox</sender>
<signal>rejected()</signal>
<receiver>PreferencesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>276</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -0,0 +1,104 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/ui/preferences_dialog.ui'
#
# Created: Sun Jan 26 13:44:53 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_PreferencesDialog(object):
def setupUi(self, PreferencesDialog):
PreferencesDialog.setObjectName(_fromUtf8("PreferencesDialog"))
PreferencesDialog.resize(652, 585)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(2)
sizePolicy.setVerticalStretch(2)
sizePolicy.setHeightForWidth(PreferencesDialog.sizePolicy().hasHeightForWidth())
PreferencesDialog.setSizePolicy(sizePolicy)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/images/logo_icon.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
PreferencesDialog.setWindowIcon(icon)
PreferencesDialog.setModal(True)
self.gridlayout = QtGui.QGridLayout(PreferencesDialog)
self.gridlayout.setObjectName(_fromUtf8("gridlayout"))
self.uiListWidget = QtGui.QListWidget(PreferencesDialog)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiListWidget.sizePolicy().hasHeightForWidth())
self.uiListWidget.setSizePolicy(sizePolicy)
self.uiListWidget.setMaximumSize(QtCore.QSize(160, 16777215))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.uiListWidget.setFont(font)
self.uiListWidget.setObjectName(_fromUtf8("uiListWidget"))
self.gridlayout.addWidget(self.uiListWidget, 0, 0, 1, 1)
self.vboxlayout = QtGui.QVBoxLayout()
self.vboxlayout.setSpacing(3)
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
self.uiTitleLabel = QtGui.QLabel(PreferencesDialog)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.uiTitleLabel.sizePolicy().hasHeightForWidth())
self.uiTitleLabel.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setPointSize(16)
font.setUnderline(False)
self.uiTitleLabel.setFont(font)
self.uiTitleLabel.setFrameShape(QtGui.QFrame.Box)
self.uiTitleLabel.setFrameShadow(QtGui.QFrame.Plain)
self.uiTitleLabel.setObjectName(_fromUtf8("uiTitleLabel"))
self.vboxlayout.addWidget(self.uiTitleLabel)
self.uiStackedWidget = QtGui.QStackedWidget(PreferencesDialog)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(1)
sizePolicy.setHeightForWidth(self.uiStackedWidget.sizePolicy().hasHeightForWidth())
self.uiStackedWidget.setSizePolicy(sizePolicy)
self.uiStackedWidget.setObjectName(_fromUtf8("uiStackedWidget"))
self.uiPageWidget = QtGui.QWidget()
self.uiPageWidget.setObjectName(_fromUtf8("uiPageWidget"))
self.uiStackedWidget.addWidget(self.uiPageWidget)
self.vboxlayout.addWidget(self.uiStackedWidget)
self.gridlayout.addLayout(self.vboxlayout, 0, 1, 1, 1)
self.uiLine = QtGui.QFrame(PreferencesDialog)
self.uiLine.setFrameShape(QtGui.QFrame.HLine)
self.uiLine.setFrameShadow(QtGui.QFrame.Sunken)
self.uiLine.setObjectName(_fromUtf8("uiLine"))
self.gridlayout.addWidget(self.uiLine, 1, 0, 1, 2)
self.uiButtonBox = QtGui.QDialogButtonBox(PreferencesDialog)
self.uiButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.uiButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Apply|QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.uiButtonBox.setObjectName(_fromUtf8("uiButtonBox"))
self.gridlayout.addWidget(self.uiButtonBox, 2, 0, 1, 2)
self.retranslateUi(PreferencesDialog)
QtCore.QObject.connect(self.uiButtonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), PreferencesDialog.accept)
QtCore.QObject.connect(self.uiButtonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), PreferencesDialog.reject)
QtCore.QMetaObject.connectSlotsByName(PreferencesDialog)
PreferencesDialog.setTabOrder(self.uiListWidget, self.uiButtonBox)
def retranslateUi(self, PreferencesDialog):
PreferencesDialog.setWindowTitle(_translate("PreferencesDialog", "Preferences", None))
from . import resources_rc

238295
gns3/ui/resources_rc.py Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,265 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ServerPreferencesPageWidget</class>
<widget class="QWidget" name="ServerPreferencesPageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>433</width>
<height>508</height>
</rect>
</property>
<property name="windowTitle">
<string>Server</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QTabWidget" name="uiTabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="uiLocalTabWidget">
<attribute name="title">
<string>Local server</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="uiLocalServerPathLabel">
<property name="text">
<string>Path:</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="uiLocalServerPathLineEdit"/>
</item>
<item>
<widget class="QToolButton" name="uiLocalServerToolButton">
<property name="text">
<string>...</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="uiLocalServerHostLabel">
<property name="text">
<string>Host:</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QComboBox" name="uiLocalServerHostComboBox"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="uiLocalServerPortLabel">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="uiTestSettingsPushButton">
<property name="text">
<string>Test settings</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="uiRestoreDefaultsPushButton">
<property name="text">
<string>Restore defaults</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>164</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="0" colspan="2">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>390</width>
<height>193</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0" colspan="2">
<widget class="QSpinBox" name="uiLocalServerPortSpinBox">
<property name="suffix">
<string notr="true"> TCP</string>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>8000</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="uiRemoteTabWidget">
<attribute name="title">
<string>Remote servers</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<widget class="QTreeWidget" name="uiRemoteServersTreeWidget">
<column>
<property name="text">
<string>Host</string>
</property>
</column>
<column>
<property name="text">
<string>Port</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="uiRemoteServerHostLabel">
<property name="text">
<string>Host:</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLineEdit" name="uiRemoteServerPortLineEdit">
<property name="text">
<string>localhost</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="uiRemoteServerPortLabel">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="uiAddRemoteServerPushButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="uiDeleteRemoteServerPushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>206</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0" colspan="2">
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>390</width>
<height>12</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0" colspan="2">
<widget class="QSpinBox" name="uiRemoteServerPortSpinBox">
<property name="suffix">
<string notr="true"> TCP</string>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>8000</number>
</property>
</widget>
</item>
</layout>
<zorder>spacer_2</zorder>
<zorder>uiRemoteServerPortLabel</zorder>
<zorder>uiRemoteServerPortSpinBox</zorder>
<zorder>uiRemoteServerHostLabel</zorder>
<zorder>uiRemoteServerPortLineEdit</zorder>
<zorder>uiRemoteServersTreeWidget</zorder>
<zorder>horizontalSpacer_2</zorder>
</widget>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>uiLocalServerPathLineEdit</tabstop>
<tabstop>uiLocalServerToolButton</tabstop>
<tabstop>uiLocalServerPortSpinBox</tabstop>
<tabstop>uiRemoteServerPortSpinBox</tabstop>
</tabstops>
<resources/>
<connections/>
<designerdata>
<property name="gridDeltaX">
<number>10</number>
</property>
<property name="gridDeltaY">
<number>10</number>
</property>
<property name="gridSnapX">
<bool>true</bool>
</property>
<property name="gridSnapY">
<bool>true</bool>
</property>
<property name="gridVisible">
<bool>true</bool>
</property>
</designerdata>
</ui>

View File

@@ -0,0 +1,143 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/workspace/git/gns3-gui/gns3/ui/server_preferences_page.ui'
#
# Created: Wed Jan 29 19:21:19 2014
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_ServerPreferencesPageWidget(object):
def setupUi(self, ServerPreferencesPageWidget):
ServerPreferencesPageWidget.setObjectName(_fromUtf8("ServerPreferencesPageWidget"))
ServerPreferencesPageWidget.resize(433, 508)
self.vboxlayout = QtGui.QVBoxLayout(ServerPreferencesPageWidget)
self.vboxlayout.setObjectName(_fromUtf8("vboxlayout"))
self.uiTabWidget = QtGui.QTabWidget(ServerPreferencesPageWidget)
self.uiTabWidget.setObjectName(_fromUtf8("uiTabWidget"))
self.uiLocalTabWidget = QtGui.QWidget()
self.uiLocalTabWidget.setObjectName(_fromUtf8("uiLocalTabWidget"))
self.gridLayout = QtGui.QGridLayout(self.uiLocalTabWidget)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.uiLocalServerPathLabel = QtGui.QLabel(self.uiLocalTabWidget)
self.uiLocalServerPathLabel.setObjectName(_fromUtf8("uiLocalServerPathLabel"))
self.gridLayout.addWidget(self.uiLocalServerPathLabel, 0, 0, 1, 1)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.uiLocalServerPathLineEdit = QtGui.QLineEdit(self.uiLocalTabWidget)
self.uiLocalServerPathLineEdit.setObjectName(_fromUtf8("uiLocalServerPathLineEdit"))
self.horizontalLayout.addWidget(self.uiLocalServerPathLineEdit)
self.uiLocalServerToolButton = QtGui.QToolButton(self.uiLocalTabWidget)
self.uiLocalServerToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
self.uiLocalServerToolButton.setObjectName(_fromUtf8("uiLocalServerToolButton"))
self.horizontalLayout.addWidget(self.uiLocalServerToolButton)
self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 2)
self.uiLocalServerHostLabel = QtGui.QLabel(self.uiLocalTabWidget)
self.uiLocalServerHostLabel.setObjectName(_fromUtf8("uiLocalServerHostLabel"))
self.gridLayout.addWidget(self.uiLocalServerHostLabel, 2, 0, 1, 1)
self.uiLocalServerHostComboBox = QtGui.QComboBox(self.uiLocalTabWidget)
self.uiLocalServerHostComboBox.setObjectName(_fromUtf8("uiLocalServerHostComboBox"))
self.gridLayout.addWidget(self.uiLocalServerHostComboBox, 3, 0, 1, 2)
self.uiLocalServerPortLabel = QtGui.QLabel(self.uiLocalTabWidget)
self.uiLocalServerPortLabel.setObjectName(_fromUtf8("uiLocalServerPortLabel"))
self.gridLayout.addWidget(self.uiLocalServerPortLabel, 4, 0, 1, 1)
self.horizontalLayout_2 = QtGui.QHBoxLayout()
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.uiTestSettingsPushButton = QtGui.QPushButton(self.uiLocalTabWidget)
self.uiTestSettingsPushButton.setObjectName(_fromUtf8("uiTestSettingsPushButton"))
self.horizontalLayout_2.addWidget(self.uiTestSettingsPushButton)
self.uiRestoreDefaultsPushButton = QtGui.QPushButton(self.uiLocalTabWidget)
self.uiRestoreDefaultsPushButton.setObjectName(_fromUtf8("uiRestoreDefaultsPushButton"))
self.horizontalLayout_2.addWidget(self.uiRestoreDefaultsPushButton)
self.gridLayout.addLayout(self.horizontalLayout_2, 6, 0, 1, 1)
spacerItem = QtGui.QSpacerItem(164, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem, 6, 1, 1, 1)
spacerItem1 = QtGui.QSpacerItem(390, 193, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem1, 7, 0, 1, 2)
self.uiLocalServerPortSpinBox = QtGui.QSpinBox(self.uiLocalTabWidget)
self.uiLocalServerPortSpinBox.setSuffix(_fromUtf8(" TCP"))
self.uiLocalServerPortSpinBox.setMaximum(65535)
self.uiLocalServerPortSpinBox.setProperty("value", 8000)
self.uiLocalServerPortSpinBox.setObjectName(_fromUtf8("uiLocalServerPortSpinBox"))
self.gridLayout.addWidget(self.uiLocalServerPortSpinBox, 5, 0, 1, 2)
self.uiTabWidget.addTab(self.uiLocalTabWidget, _fromUtf8(""))
self.uiRemoteTabWidget = QtGui.QWidget()
self.uiRemoteTabWidget.setObjectName(_fromUtf8("uiRemoteTabWidget"))
self.gridLayout_2 = QtGui.QGridLayout(self.uiRemoteTabWidget)
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
self.uiRemoteServersTreeWidget = QtGui.QTreeWidget(self.uiRemoteTabWidget)
self.uiRemoteServersTreeWidget.setObjectName(_fromUtf8("uiRemoteServersTreeWidget"))
self.gridLayout_2.addWidget(self.uiRemoteServersTreeWidget, 0, 0, 1, 2)
self.uiRemoteServerHostLabel = QtGui.QLabel(self.uiRemoteTabWidget)
self.uiRemoteServerHostLabel.setObjectName(_fromUtf8("uiRemoteServerHostLabel"))
self.gridLayout_2.addWidget(self.uiRemoteServerHostLabel, 1, 0, 1, 1)
self.uiRemoteServerPortLineEdit = QtGui.QLineEdit(self.uiRemoteTabWidget)
self.uiRemoteServerPortLineEdit.setObjectName(_fromUtf8("uiRemoteServerPortLineEdit"))
self.gridLayout_2.addWidget(self.uiRemoteServerPortLineEdit, 2, 0, 1, 2)
self.uiRemoteServerPortLabel = QtGui.QLabel(self.uiRemoteTabWidget)
self.uiRemoteServerPortLabel.setObjectName(_fromUtf8("uiRemoteServerPortLabel"))
self.gridLayout_2.addWidget(self.uiRemoteServerPortLabel, 3, 0, 1, 1)
self.horizontalLayout_3 = QtGui.QHBoxLayout()
self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
self.uiAddRemoteServerPushButton = QtGui.QPushButton(self.uiRemoteTabWidget)
self.uiAddRemoteServerPushButton.setObjectName(_fromUtf8("uiAddRemoteServerPushButton"))
self.horizontalLayout_3.addWidget(self.uiAddRemoteServerPushButton)
self.uiDeleteRemoteServerPushButton = QtGui.QPushButton(self.uiRemoteTabWidget)
self.uiDeleteRemoteServerPushButton.setEnabled(False)
self.uiDeleteRemoteServerPushButton.setObjectName(_fromUtf8("uiDeleteRemoteServerPushButton"))
self.horizontalLayout_3.addWidget(self.uiDeleteRemoteServerPushButton)
self.gridLayout_2.addLayout(self.horizontalLayout_3, 5, 0, 1, 1)
spacerItem2 = QtGui.QSpacerItem(206, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_2.addItem(spacerItem2, 5, 1, 1, 1)
spacerItem3 = QtGui.QSpacerItem(390, 12, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout_2.addItem(spacerItem3, 6, 0, 1, 2)
self.uiRemoteServerPortSpinBox = QtGui.QSpinBox(self.uiRemoteTabWidget)
self.uiRemoteServerPortSpinBox.setSuffix(_fromUtf8(" TCP"))
self.uiRemoteServerPortSpinBox.setMaximum(65535)
self.uiRemoteServerPortSpinBox.setProperty("value", 8000)
self.uiRemoteServerPortSpinBox.setObjectName(_fromUtf8("uiRemoteServerPortSpinBox"))
self.gridLayout_2.addWidget(self.uiRemoteServerPortSpinBox, 4, 0, 1, 2)
self.uiTabWidget.addTab(self.uiRemoteTabWidget, _fromUtf8(""))
self.vboxlayout.addWidget(self.uiTabWidget)
self.retranslateUi(ServerPreferencesPageWidget)
self.uiTabWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(ServerPreferencesPageWidget)
ServerPreferencesPageWidget.setTabOrder(self.uiLocalServerPathLineEdit, self.uiLocalServerToolButton)
ServerPreferencesPageWidget.setTabOrder(self.uiLocalServerToolButton, self.uiLocalServerPortSpinBox)
ServerPreferencesPageWidget.setTabOrder(self.uiLocalServerPortSpinBox, self.uiRemoteServerPortSpinBox)
def retranslateUi(self, ServerPreferencesPageWidget):
ServerPreferencesPageWidget.setWindowTitle(_translate("ServerPreferencesPageWidget", "Server", None))
self.uiLocalServerPathLabel.setText(_translate("ServerPreferencesPageWidget", "Path:", None))
self.uiLocalServerToolButton.setText(_translate("ServerPreferencesPageWidget", "...", None))
self.uiLocalServerHostLabel.setText(_translate("ServerPreferencesPageWidget", "Host:", None))
self.uiLocalServerPortLabel.setText(_translate("ServerPreferencesPageWidget", "Port:", None))
self.uiTestSettingsPushButton.setText(_translate("ServerPreferencesPageWidget", "Test settings", None))
self.uiRestoreDefaultsPushButton.setText(_translate("ServerPreferencesPageWidget", "Restore defaults", None))
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiLocalTabWidget), _translate("ServerPreferencesPageWidget", "Local server", None))
self.uiRemoteServersTreeWidget.headerItem().setText(0, _translate("ServerPreferencesPageWidget", "Host", None))
self.uiRemoteServersTreeWidget.headerItem().setText(1, _translate("ServerPreferencesPageWidget", "Port", None))
self.uiRemoteServerHostLabel.setText(_translate("ServerPreferencesPageWidget", "Host:", None))
self.uiRemoteServerPortLineEdit.setText(_translate("ServerPreferencesPageWidget", "localhost", None))
self.uiRemoteServerPortLabel.setText(_translate("ServerPreferencesPageWidget", "Port:", None))
self.uiAddRemoteServerPushButton.setText(_translate("ServerPreferencesPageWidget", "Add", None))
self.uiDeleteRemoteServerPushButton.setText(_translate("ServerPreferencesPageWidget", "Delete", None))
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiRemoteTabWidget), _translate("ServerPreferencesPageWidget", "Remote servers", None))

0
gns3/utils/__init__.py Normal file
View File

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,13 +15,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# __version__ is a human-readable version number.
"""
__version__ is a human-readable version number.
# __version_info__ is a four-tuple for programmatic comparison. The first
# three numbers are the components of the version number. The fourth
# is zero for an official release, positive for a development branch,
# or negative for a release candidate or beta (after the base version
# number has been incremented)
__version_info__ is a four-tuple for programmatic comparison. The first
three numbers are the components of the version number. The fourth
is zero for an official release, positive for a development branch,
or negative for a release candidate or beta (after the base version
number has been incremented)
"""
__version__ = "0.1.dev"
__version_info__ = (0, 1, 0, -99)

177
gns3/websocket_client.py Normal file
View File

@@ -0,0 +1,177 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Non-blocking Websocket client with JSON-RPC support to connect to GNS3 servers.
Based on the ws4py websocket client.
"""
import json
import jsonrpc
from ws4py.client import WebSocketBaseClient
from .qt import QtCore
import logging
log = logging.getLogger(__name__)
class WebSocketClient(WebSocketBaseClient):
"""
Websocket client.
:param url: websocket URL to connect to the server
"""
def __init__(self, url, protocols=None, extensions=None, heartbeat_freq=None,
ssl_options=None, headers=None):
WebSocketBaseClient.__init__(self, url, protocols, extensions, heartbeat_freq,
ssl_options, headers=headers)
self.callbacks = {}
self._connected = False
def opened(self):
"""
Called when the connection with the server is successful.
"""
log.info("connected to {}:{}".format(self.host, self.port))
self._connected = True
@property
def connected(self):
"""
Returns if the client is connected.
:returns: True or False
"""
return self._connected
def handshake_ok(self):
"""
Called when the connection has been established with the server and
monitors the connection using the QSocketNotifier.
"""
fd = self.connection.fileno()
# we are interested in all data received.
self.fd_notifier = QtCore.QSocketNotifier(fd, QtCore.QSocketNotifier.Read)
self.fd_notifier.activated.connect(self.data_received)
self.opened()
def closed(self, code, reason):
"""
Called when the connection has been closed.
:param code: code (integer)
:param reason: reason (string)
"""
log.info("Connection closed down: {} (code {})".format(reason, code))
self._connected = False
def received_message(self, message):
"""
Called when a new message has been received from the server.
:param message: message object
"""
# TODO: WSAEWOULDBLOCK on Windows
if not message.is_text:
log.warning("received data is not text")
return
try:
reply = json.loads(message.data.decode("utf-8"))
except:
log.warning("received data is not valid JSON")
return
if "result" in reply:
# This is a JSON-RPC result
request_id = reply.get("id")
result = reply.get("result")
if request_id in self.callbacks:
self.callbacks[request_id](result)
del self.callbacks[request_id]
else:
log.warning("unknown JSON-RPC request ID received {}".format(request_id))
elif "error" in reply:
# This is a JSON-RPC error
error_message = reply["error"].get("message")
error_code = reply["error"].get("code")
request_id = reply.get("id")
if request_id in self.callbacks:
self.callbacks[request_id](reply["error"], True)
del self.callbacks[request_id]
else:
log.warning("received JSON-RPC error {}: {} for request ID {}".format(error_code,
error_message,
request_id))
elif "method" in reply:
# This is a JSON-RPC notification
method = reply.get("method")
params = reply.get("params")
#TODO: handle notifications from servers
print("This is a notification! {} {}".format(method, params))
def send_message(self, destination, params, callback):
"""
Sends a message to the server.
:param destination: server destination method
:param params: params to send (dictionary)
:param callback: callback method to call when the server replies.
"""
request = jsonrpc.JSONRPCRequest(destination, params)
self.callbacks[request.id] = callback
self.send(str(request))
def send_notification(self, destination, params=None):
"""
Sends a notification to the server. No reply is expected from the server.
:param destination: server destination method
:param params: params to send (dictionary)
"""
request = jsonrpc.JSONRPCNotification(destination, params)
self.send(str(request))
def close_connection(self):
"""
Closes the connection to the server and remove the monitoring by
the QSocketNotifier.
"""
WebSocketBaseClient.close_connection(self)
self.fd_notifier.setEnabled(False)
def data_received(self, fd):
"""
Callback called when data is received from the server.
"""
# read the data, if successful received_message() is called by once()
if self.once() == False:
log.warning("lost connection with server {}:{}".format(self.host, self.port))
self.close_connection()