Esempio n. 1
0
    def getNetworkList(self):
        """
        Get network list.

            Returns:
                [networks]
            Throws:
                UserNotAuthorized
                TortugaException
        """
        try:
            return NetworkManager().getNetworkList()
        except TortugaException as ex:
            raise
        except Exception as ex:
            self.getLogger().exception('%s' % ex)
            raise TortugaException(exception=ex)
Esempio n. 2
0
    def getNetworkList(self, session: Session) -> TortugaObjectList:
        """
        Get network list.

            Returns:
                [networks]
            Throws:
                UserNotAuthorized
                TortugaException
        """
        try:
            return NetworkManager().getNetworkList(session)
        except TortugaException as ex:
            raise
        except Exception as ex:
            self._logger.exception(str(ex))
            raise TortugaException(exception=ex)
Esempio n. 3
0
    def addNetwork(self, session: Session, network: Network) -> int:
        """
        Add a new network to the system.

            Returns:
                new network id
            Throws:
                NetworkAlreadyExists
                UserNotAuthorized
                TortugaException
        """
        try:
            return NetworkManager().addNetwork(session, network)
        except TortugaException as ex:
            raise
        except Exception as ex:
            self._logger.exception(str(ex))
            raise TortugaException(exception=ex)
Esempio n. 4
0
    def getNetworkById(self, session: Session, id_: str):
        """
        Get network information by id.

            Returns:
                network
            Throws:
                UserNotAuthorized
                NetworkNotFound
                TortugaException
        """
        try:
            return NetworkManager().getNetworkById(session, id_)
        except TortugaException as ex:
            raise
        except Exception as ex:
            self._logger.exception(str(ex))
            raise TortugaException(exception=ex)
Esempio n. 5
0
    def updateNetwork(self, session: Session, network: Network) -> Network:
        """
        Update a network in the DB.

            Returns:
                network
            Throws:
                UserNotAuthorized
                NetworkNotFound
                TortugaException
        """
        try:
            return NetworkManager().updateNetwork(session, network)
        except TortugaException as ex:
            raise
        except Exception as ex:
            self._logger.exception(str(ex))
            raise TortugaException(exception=ex)
Esempio n. 6
0
    def deleteNetwork(self, session: Session, id_: str):
        """
        Delete a network from the DB.

            Returns:
                None
            Throws:
                UserNotAuthorized
                NetworkNotFound
                TortugaException
        """
        try:
            return NetworkManager().deleteNetwork(session, id_)
        except TortugaException as ex:
            raise
        except Exception as ex:
            self._logger.exception(str(ex))
            raise TortugaException(exception=ex)
Esempio n. 7
0
    def addNetwork(self, network):
        """
        Add a new network to the system.

            Returns:
                new network id
            Throws:
                NetworkAlreadyExists
                UserNotAuthorized
                TortugaException
        """
        try:
            return NetworkManager().addNetwork(network)
        except TortugaException as ex:
            raise
        except Exception as ex:
            self.getLogger().exception('%s' % ex)
            raise TortugaException(exception=ex)
Esempio n. 8
0
    def getNetworkById(self, id_):
        """
        Get network information by id.

            Returns:
                network
            Throws:
                UserNotAuthorized
                NetworkNotFound
                TortugaException
        """
        try:
            return NetworkManager().getNetworkById(id_)
        except TortugaException as ex:
            raise
        except Exception as ex:
            self.getLogger().exception('%s' % ex)
            raise TortugaException(exception=ex)
Esempio n. 9
0
    def updateNetwork(self, network):
        """
        Update a network in the DB.

            Returns:
                network
            Throws:
                UserNotAuthorized
                NetworkNotFound
                TortugaException
        """
        try:
            return NetworkManager().updateNetwork(network)
        except TortugaException as ex:
            raise
        except Exception as ex:
            self.getLogger().exception('%s' % ex)
            raise TortugaException(exception=ex)
Esempio n. 10
0
    def deleteNetwork(self, id_):
        """
        Delete a network from the DB.

            Returns:
                None
            Throws:
                UserNotAuthorized
                NetworkNotFound
                TortugaException
        """
        try:
            return NetworkManager().deleteNetwork(id_)
        except TortugaException as ex:
            raise
        except Exception as ex:
            self.getLogger().exception('%s' % ex)
            raise TortugaException(exception=ex)
Esempio n. 11
0
    def getNetwork(self, networkAddress, networkSubnet):
        """
        Get network information.

            Returns:
                network
            Throws:
                UserNotAuthorized
                NetworkNotFound
                TortugaException
        """
        try:
            return NetworkManager().\
                getNetwork(networkAddress, networkSubnet)
        except TortugaException as ex:
            raise
        except Exception as ex:
            self.getLogger().exception('%s' % ex)
            raise TortugaException(exception=ex)
Esempio n. 12
0
    def getNetwork(self, session: Session, networkAddress: str,
                   networkSubnet: str):
        """
        Get network information.

            Returns:
                network
            Throws:
                UserNotAuthorized
                NetworkNotFound
                TortugaException
        """
        try:
            return NetworkManager().getNetwork(session, networkAddress,
                                               networkSubnet)
        except TortugaException as ex:
            raise
        except Exception as ex:
            self._logger.exception(str(ex))
            raise TortugaException(exception=ex)