Beispiel #1
0
 def __init__(self):
     logging.debug("ConnectionManageGuacRDP(): instantiated")
     ConnectionManage.__init__(self)
     self.guacifx = GuacIFX()
     self.eco = ExperimentConfigIO.getInstance()
     self.usersConnsStatus = {}
     self.lock = RLock()
Beispiel #2
0
    def __init__(self, parent, configname, actionname, experimentHostname, rdpBrokerHostname="<unspecified>", users_file="", itype="", name=""):
        logging.debug("ConnectionActionDialog(): instantiated")
        super(ConnectionActionDialog, self).__init__(parent)
        self.parent = parent
        self.eco = ExperimentConfigIO.getInstance()
        self.s = SystemConfigIO()
        self.configname = configname
        self.actionname = actionname
        self.experimentHostname = experimentHostname
        self.usersFile = users_file
        self.itype = itype
        self.name = name
        if rdpBrokerHostname.strip() == "":
            self.rdpBrokerHostname = "<unspecified>"
            self.setEnabled(False)
        else:
            self.rdpBrokerHostname = rdpBrokerHostname
        self.cm = ConnectionManage()
        self.setMinimumWidth(450)

        self.createFormGroupBox()
        
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
        
        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.formGroupBox)
        mainLayout.addWidget(buttonBox)
        self.setLayout(mainLayout)
        
        self.setWindowTitle(str(actionname) + " Connection")
Beispiel #3
0
    def __init__(self,
                 parent=None,
                 configname=None,
                 widgetname="",
                 rolledoutjson=None,
                 interest_vmnames=[],
                 vmuser_mapping={},
                 status_bar=None):
        logging.debug("ConnectionStatusWidget instantiated")
        if configname == None:
            logging.error("configname cannot be empty")
            return None
        QtWidgets.QWidget.__init__(self, parent=None)
        self.parent = parent
        self.statusBar = status_bar
        self.widgetname = widgetname
        self.configname = configname
        self.rolledoutjson = rolledoutjson
        self.eco = ExperimentConfigIO.getInstance()

        self.setWindowTitle("ConnectionStatusWidget")
        self.setObjectName("ConnectionStatusWidget")
        self.layoutWidget = QtWidgets.QWidget()
        self.layoutWidget.setObjectName("layoutWidget")
        self.outerVertBox = QtWidgets.QVBoxLayout()
        self.outerVertBox.setObjectName("outerVertBox")
        self.layoutWidget.setLayout(self.outerVertBox)

        self.connStatusTable = QtWidgets.QTableWidget(parent)
        self.connStatusTable.setObjectName("connStatusTable")
        self.connStatusTable.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.connStatusTable.setSelectionBehavior(QTableView.SelectRows)
        self.connStatusTable.setSelectionMode(QTableView.SingleSelection)

        self.connStatusTable.setRowCount(0)
        self.connStatusTable.setColumnCount(5)
        self.connStatusTable.setHorizontalHeaderLabels(
            ("Connection Name", "Generated User", "Generated Pass",
             "User Status", "Conn Status"))

        # Context menus
        self.connStatusTable.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.connStatusTable.customContextMenuRequested.connect(
            self.showContextMenu)
        self.connsContextMenu = QtWidgets.QMenu()
        self.createGuac = self.connsContextMenu.addAction("Create Users")
        self.createGuac.triggered.connect(self.menuItemSelected)
        self.removeGuac = self.connsContextMenu.addAction("Remove Users")
        self.removeGuac.triggered.connect(self.menuItemSelected)
        self.clearGuac = self.connsContextMenu.addAction("Clear All Entries")
        self.clearGuac.triggered.connect(self.menuItemSelected)
        self.openGuac = self.connsContextMenu.addAction("Open Connections")
        self.openGuac.triggered.connect(self.menuItemSelected)

        self.connStatusTable.setSortingEnabled(True)
        self.outerVertBox.addWidget(self.connStatusTable)

        self.setLayout(self.outerVertBox)
        self.retranslateUi(rolledoutjson, interest_vmnames, vmuser_mapping)
Beispiel #4
0
    password = sys.argv[2]
    host = sys.argv[3]
    period = 0
    if len(sys.argv) > 6:
        period = int(sys.argv[5])
    if len(sys.argv) == 7:
        logging_level = sys.argv[6]

        if "debug" in logging_level.lower():
            logging.getLogger().setLevel(logging.DEBUG)
        elif "error" in logging_level.lower():
            logging.getLogger().setLevel(logging.ERROR)
        elif "info" in logging_level.lower():
            logging.getLogger().setLevel(logging.INFO)
    configname = sys.argv[4]
    e = ExperimentConfigIO.getInstance()
    data, numclones = e.getExperimentVMRolledOut(configname)

    configvms = []
    for vmlist in data.values():
        logging.debug("VM_LIST: " + str(vmlist))
        for vm_rolled_out in vmlist:
            configvms.append(vm_rolled_out["name"])
            logging.debug("CONFIG VMS: " + str(configvms))
    try:
        client = paramiko.SSHClient()
        client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        client.connect(host, username=username, password=password)

        logging.info("Retrieving UUIDs for : " + str(len(configvms)) +
                     " VMs...")
Beispiel #5
0
    def __init__(self, parent=None, statusBar=None):
        logging.debug("ExperimentActionsWidget instantiated")
        QtWidgets.QWidget.__init__(self, parent=None)
        self.statusBar = statusBar
        self.experimentItemNames = {}
        self.experimentActionsBaseWidgets = {}
        self.eco = ExperimentConfigIO.getInstance()
        self.rolledoutjson = None

        self.setObjectName("ExperimentActionsWidget")

        self.windowWidget = QtWidgets.QWidget()
        self.windowWidget.setObjectName("windowWidget")
        self.windowBoxHLayout = QtWidgets.QHBoxLayout()
        #self.windowBoxHLayout.setContentsMargins(0, 0, 0, 0)
        self.windowBoxHLayout.setObjectName("windowBoxHLayout")
        self.windowWidget.setLayout(self.windowBoxHLayout)

        self.experimentTree = QtWidgets.QTreeWidget(parent)
        self.experimentTree.setObjectName("experimentTree")
        self.experimentTree.header().resizeSection(0, 150)
        self.experimentTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.experimentTree.customContextMenuRequested.connect(
            self.showContextMenu)
        self.experimentTree.itemSelectionChanged.connect(self.onItemSelected)
        self.experimentTree.setEnabled(True)
        self.experimentTree.setMinimumSize(200, 521)
        self.experimentTree.setMaximumWidth(350)
        self.experimentTree.setObjectName("experimentTree")
        self.experimentTree.headerItem().setText(0, "Experiments New")
        self.experimentTree.setSortingEnabled(False)
        self.windowBoxHLayout.addWidget(self.experimentTree)

        self.windowBoxVLayout = QtWidgets.QVBoxLayout()
        #self.windowBoxHLayout.setContentsMargins(0, 0, 0, 0)
        self.windowBoxVLayout.setObjectName("windowBoxVLayout")

        self.basedataStackedWidget = QStackedWidget()
        self.basedataStackedWidget.setObjectName("basedataStackedWidget")
        self.basedataStackedWidget.setEnabled(False)
        self.windowBoxVLayout.addWidget(self.basedataStackedWidget)

        self.refreshVMsButton = QtWidgets.QPushButton("Refresh Status")
        self.refreshVMsButton.clicked.connect(self.refreshVMStatus)
        self.refreshVMsButton.setEnabled(False)
        self.windowBoxVLayout.addWidget(self.refreshVMsButton)

        self.windowBoxHLayout.addLayout(self.windowBoxVLayout)

        # Context menus
        self.experimentMenu = QtWidgets.QMenu()
        self.startupContextMenu = QtWidgets.QMenu("Startup")
        self.shutdownContextMenu = QtWidgets.QMenu("Shutdown")
        self.stateContextMenu = QtWidgets.QMenu("State")
        self.experimentMenu.addMenu(self.startupContextMenu)
        self.experimentMenu.addMenu(self.shutdownContextMenu)
        self.experimentMenu.addMenu(self.stateContextMenu)

        self.cloneExperiment = self.startupContextMenu.addAction(
            "Signal - Create Clones")
        self.cloneExperiment.triggered.connect(self.menuItemSelected)

        self.startVMs = self.startupContextMenu.addAction(
            "Signal - Start VMs (headless)")
        self.startVMs.triggered.connect(self.menuItemSelected)

        self.restoreSnapshots = self.startupContextMenu.addAction(
            "Signal - Restore Snapshots")
        self.restoreSnapshots.triggered.connect(self.menuItemSelected)

        self.pauseVMs = self.shutdownContextMenu.addAction(
            "Signal - Pause VMs")
        self.pauseVMs.triggered.connect(self.menuItemSelected)

        self.suspendVMs = self.shutdownContextMenu.addAction(
            "Signal - Suspend & Save States")
        self.suspendVMs.triggered.connect(self.menuItemSelected)

        self.poweroffVMs = self.shutdownContextMenu.addAction(
            "Signal - Power Off VMs")
        self.poweroffVMs.triggered.connect(self.menuItemSelected)

        self.deleteClones = self.shutdownContextMenu.addAction(
            "Signal - Delete Clones")
        self.deleteClones.triggered.connect(self.menuItemSelected)
        self.shutdownContextMenu.addAction(self.deleteClones)

        self.snapshotVMs = self.stateContextMenu.addAction(
            "Signal - Snapshot VMs")
        self.snapshotVMs.triggered.connect(self.menuItemSelected)

        self.setLayout(self.windowBoxHLayout)
        self.retranslateUi()
Beispiel #6
0
    def __init__(self, parent=None, statusBar=None):
        logging.debug("ConnectionWidget instantiated")
        QtWidgets.QWidget.__init__(self, parent=None)
        self.statusBar = statusBar
        self.experimentItemNames = {}
        self.connectionBaseWidgets = {}
        self.eco = ExperimentConfigIO.getInstance()

        self.setObjectName("ConnectionWidget")

        self.windowWidget = QtWidgets.QWidget()
        self.windowWidget.setObjectName("windowWidget")
        self.windowBoxHLayout = QtWidgets.QHBoxLayout()
        #self.windowBoxHLayout.setContentsMargins(0, 0, 0, 0)
        self.windowBoxHLayout.setObjectName("windowBoxHLayout")
        self.windowWidget.setLayout(self.windowBoxHLayout)

        self.experimentTree = QtWidgets.QTreeWidget(parent)
        self.experimentTree.setObjectName("experimentTree")
        self.experimentTree.header().resizeSection(0, 150)
        self.experimentTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.experimentTree.customContextMenuRequested.connect(
            self.showContextMenu)
        self.experimentTree.itemSelectionChanged.connect(self.onItemSelected)
        self.experimentTree.setEnabled(True)
        self.experimentTree.setMinimumSize(200, 521)
        self.experimentTree.setMaximumWidth(350)
        self.experimentTree.setObjectName("experimentTree")
        self.experimentTree.headerItem().setText(0, "Experiments New")
        self.experimentTree.setSortingEnabled(False)
        self.windowBoxHLayout.addWidget(self.experimentTree)

        self.windowBoxVLayout = QtWidgets.QVBoxLayout()
        #self.windowBoxHLayout.setContentsMargins(0, 0, 0, 0)
        self.windowBoxVLayout.setObjectName("windowBoxVLayout")

        self.basedataStackedWidget = QStackedWidget()
        self.basedataStackedWidget.setObjectName("basedataStackedWidget")
        self.basedataStackedWidget.setEnabled(False)
        self.windowBoxVLayout.addWidget(self.basedataStackedWidget)

        self.refreshConnsButton = QtWidgets.QPushButton("Refresh Status")
        self.refreshConnsButton.clicked.connect(self.refreshConnsStatus)
        self.refreshConnsButton.setEnabled(False)
        self.windowBoxVLayout.addWidget(self.refreshConnsButton)

        self.windowBoxHLayout.addLayout(self.windowBoxVLayout)

        # Context menu
        self.connsContextMenu = QtWidgets.QMenu()
        self.createGuac = self.connsContextMenu.addAction("Create Users")
        self.createGuac.triggered.connect(self.menuItemSelected)
        self.removeGuac = self.connsContextMenu.addAction("Remove Users")
        self.removeGuac.triggered.connect(self.menuItemSelected)
        self.clearGuac = self.connsContextMenu.addAction("Clear All Entries")
        self.clearGuac.triggered.connect(self.menuItemSelected)
        self.openGuac = self.connsContextMenu.addAction("Open Connections")
        self.openGuac.triggered.connect(self.menuItemSelected)

        self.setLayout(self.windowBoxHLayout)
        self.retranslateUi()
 def __init__(self, vmManage):
     logging.debug("ExperimentManageVBox(): instantiated")
     ExperimentManage.__init__(self)
     #Create an instance of vmManage
     self.vmManage = vmManage
     self.eco = ExperimentConfigIO.getInstance()
Beispiel #8
0
    def __init__(self, parent=None):
        logging.debug("MainApp:init() instantiated")
        super().__init__()
        self.baseWidgets = {}
        self.vmWidgets = {}
        self.materialWidgets = {}
        self.cf = SystemConfigIO()
        self.ec = ExperimentConfigIO.getInstance()
        self.statusBar = QStatusBar()

        self.setMinimumSize(670, 565)
        quit = QAction("Quit", self)
        quit.triggered.connect(self.closeEvent)
        self.setWindowTitle("ARL South RES v0.1")

        self.tabWidget = QtWidgets.QTabWidget()
        self.tabWidget.setGeometry(QtCore.QRect(0, 15, 668, 565))
        self.tabWidget.setObjectName("tabWidget")

        # Configuration Window (windowBox) contains:
        ## windowBoxHLayout contains:
        ###experimentTree (Left)
        ###basedataStackedWidget (Right)
        self.windowWidget = QtWidgets.QWidget()
        self.windowWidget.setObjectName("windowWidget")
        self.windowBoxHLayout = QtWidgets.QHBoxLayout()
        #self.windowBoxHLayout.setContentsMargins(0, 0, 0, 0)
        self.windowBoxHLayout.setObjectName("windowBoxHLayout")
        self.windowWidget.setLayout(self.windowBoxHLayout)

        self.experimentTree = QtWidgets.QTreeWidget()
        self.experimentTree.itemSelectionChanged.connect(self.onItemSelected)
        self.experimentTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.experimentTree.customContextMenuRequested.connect(
            self.showContextMenu)
        self.experimentTree.setEnabled(True)
        self.experimentTree.setMinimumSize(200, 521)
        self.experimentTree.setMaximumWidth(350)
        self.experimentTree.setObjectName("experimentTree")
        self.experimentTree.headerItem().setText(0, "Experiments")
        self.experimentTree.setSortingEnabled(False)
        self.windowBoxHLayout.addWidget(self.experimentTree)

        self.basedataStackedWidget = QStackedWidget()
        self.basedataStackedWidget.setObjectName("basedataStackedWidget")
        self.basedataStackedWidget.setEnabled(False)
        self.windowBoxHLayout.addWidget(self.basedataStackedWidget)
        self.tabWidget.addTab(self.windowWidget, "Configuration")

        # VBox Actions Tab
        self.experimentActionsWidget = ExperimentActionsWidget(
            statusBar=self.statusBar)
        self.experimentActionsWidget.setObjectName("experimentActionsWidget")
        self.tabWidget.addTab(self.experimentActionsWidget,
                              "Experiment Actions")

        # Remote Connections Tab
        self.connectionWidget = ConnectionWidget(statusBar=self.statusBar)
        self.connectionWidget.setObjectName("connectionsWidget")
        self.tabWidget.addTab(self.connectionWidget, "Remote Connections")

        #Create the bottom layout so that we can access the status bar
        self.bottomLayout = QHBoxLayout()
        self.statusBar.showMessage("Loading GUI...")
        self.bottomLayout.addWidget(self.statusBar)
        self.saveButton = QtWidgets.QPushButton("Save Current")
        self.saveButton.clicked.connect(self.saveExperimentButton)
        self.saveButton.setEnabled(False)
        self.bottomLayout.addWidget(self.saveButton)

        self.populateUi()
        self.setupContextMenus()

        self.initMenu()
        self.mainLayout = QVBoxLayout()
        self.mainLayout.addWidget(self.mainMenu)
        self.mainLayout.addWidget(self.tabWidget)
        self.mainLayout.addLayout(self.bottomLayout)

        self.setLayout(self.mainLayout)
        #self.setCentralWidget(self.outerBox)
        self.tabWidget.setCurrentIndex(0)

        #self.statusBar.showMessage("Finished Loading GUI Components")

        # Plugin Section
        self.tabWidget.addTab(CTFi2GUI(), "CTFi2")