Esempio n. 1
0
    def createContainer(self,
                        cTag,
                        group='',
                        groupIp='',
                        size=1,
                        cpu=0,
                        memory=0,
                        bandwidth=0,
                        specialFeatures=[]):
        if not self._rce:
            raise ConnectionError('No connection to RCE.')

        # ensure all whitespace characters around group are stripped
        group = group.strip()

        if groupIp and not _IP_V4_REGEX.match(groupIp):
            raise ValueError('Invalid IPv4 address')

        self._rce.createContainer(cTag, group, groupIp, size, cpu, memory,
                                  bandwidth, specialFeatures)
Esempio n. 2
0
    def connect(self, masterUrl, deferred):
        """ Connect to RCE.

            @param masterUrl:   URL of Authentication Handler of Master Manager
            @type  masterUrl:   str

            @param deferred:    Deferred which is called as soon as the
                                connection was successfully established.
            @type  deferred:    twisted.internet.defer.Deferred

            @raise:             ConnectionError, if no connection could be
                                established.
        """
        if self._rce:
            raise ConnectionError('There is already a connection registered.')

        self._rce = RCE(self, self._userID, self._robotID, self._password,
                        self._reactor)

        # Connect
        self._rce.connect(masterUrl, deferred)
Esempio n. 3
0
    def removeConnection(self, tagA, tagB):
        if not self._rce:
            raise ConnectionError('No connection to RCE.')

        self._rce.removeConnection(tagA, tagB)
Esempio n. 4
0
    def removeInterface(self, eTag, iTag):
        if not self._rce:
            raise ConnectionError('No connection to RCE.')

        self._rce.removeInterface(eTag, iTag)
Esempio n. 5
0
    def addInterface(self, eTag, iTag, iType, iCls, addr=''):
        if not self._rce:
            raise ConnectionError('No connection to RCE.')

        iType = self.INTERFACE_MAP.get(iType, iType)
        self._rce.addInterface(eTag, iTag, iType, iCls, addr)
Esempio n. 6
0
    def removeParameter(self, cTag, name):
        if not self._rce:
            raise ConnectionError('No connection to RCE.')

        self._rce.removeParameter(cTag, name)
Esempio n. 7
0
    def addParameter(self, cTag, name, value):
        if not self._rce:
            raise ConnectionError('No connection to RCE.')

        self._rce.addParameter(cTag, name, value)
Esempio n. 8
0
    def removeNode(self, cTag, nTag):
        if not self._rce:
            raise ConnectionError('No connection to RCE.')

        self._rce.removeNode(cTag, nTag)
Esempio n. 9
0
    def addNode(self, cTag, nTag, pkg, exe, args='', name='', namespace=''):
        if not self._rce:
            raise ConnectionError('No connection to RCE.')

        self._rce.addNode(cTag, nTag, pkg, exe, args, name, namespace)
Esempio n. 10
0
    def destroyContainer(self, cTag):
        if not self._rce:
            raise ConnectionError('No connection to RCE.')

        self._rce.destroyContainer(cTag)
Esempio n. 11
0
    def sendMessage(self, dest, msgType, msg, msgID):
        if not self._rce:
            raise ConnectionError('No connection to RCE.')

        self._rce.sendMessage(dest, msgType, msg, msgID)