예제 #1
0
    def domain_setup(self, domain_id, src_user_id=None, config=None):
        """Set up domain with the specified network module and storage

        This method should be used by a system administrator.

        Args:
            domain_id (bytes): domain_id to create
            src_user_id(bytes): user_id of the sender
            config (str): system config in json format
        Returns:
            bytes: query_id
        """
        dat = self._make_message_structure(MsgType.REQUEST_SETUP_DOMAIN, src_user_id=src_user_id)
        admin_info = {
            KeyType.domain_id: domain_id,
            KeyType.random: bbclib.get_random_value(32)
        }
        if config is not None:
            admin_info[KeyType.bbc_configuration] = config
        self.include_admin_info(dat, admin_info, None)

        if self.use_query_id_based_message_wait:
            qid = self._send_msg(dat)
            return self.callback.sync_by_queryid(qid, timeout=self.timeout)
        return self._send_msg(dat)
예제 #2
0
    def get_stats(self):
        """Get statistics of bbc_core

        Returns:
            bytes: query_id
        """
        dat = self._make_message_structure(MsgType.REQUEST_GET_STATS)
        admin_info = {KeyType.random: bbclib.get_random_value(32)}
        self.include_admin_info(dat, admin_info, None)
        return self._send_msg(dat)
예제 #3
0
    def get_user_list(self):
        """Get user_ids in the domain that are connecting to the core node

        Returns:
            bytes: query_id
        """
        dat = self._make_message_structure(MsgType.REQUEST_GET_USERS)
        admin_info = {KeyType.random: bbclib.get_random_value(32)}
        self.include_admin_info(dat, admin_info, None)
        return self._send_msg(dat)
예제 #4
0
    def get_domain_list(self):
        """Get domain_id list in bbc_core

        Returns:
            bytes: query_id
        """
        dat = self._make_message_structure(MsgType.REQUEST_GET_DOMAINLIST)
        admin_info = {KeyType.random: bbclib.get_random_value(32)}
        self.include_admin_info(dat, admin_info, None)
        return self._send_msg(dat)
예제 #5
0
    def get_notification_list(self):
        """Get notification_list of the core node

        Returns:
            bytes: query_id
        """
        dat = self._make_message_structure(
            MsgType.REQUEST_GET_NOTIFICATION_LIST)
        admin_info = {KeyType.random: bbclib.get_random_value(32)}
        self.include_admin_info(dat, admin_info, None)
        return self._send_msg(dat)
예제 #6
0
    def get_bbc_config(self):
        """Get config file of bbc_core

        This method should be used by a system administrator.

        Returns:
            bytes: query_id
        """
        dat = self._make_message_structure(MsgType.REQUEST_GET_CONFIG)
        admin_info = {KeyType.random: bbclib.get_random_value(32)}
        self.include_admin_info(dat, admin_info, None)
        return self._send_msg(dat)
예제 #7
0
파일: bbc_app.py 프로젝트: imony/bbc-simple
    def get_stats(self, domain_id=None, src_user_id=None):
        """Get statistics of bbc_core

        Args:
            domain_id(bytes): target domain_id
            src_user_id(bytes): user_id of the sender
        Returns:
            bytes: query_id
        """
        dat = self._make_message_structure(MsgType.REQUEST_GET_STATS, domain_id=domain_id, src_user_id=src_user_id)
        admin_info = {
            KeyType.random: bbclib.get_random_value(32)
        }
        self.include_admin_info(dat, admin_info, None)
        return self._send_msg(dat)
예제 #8
0
파일: bbc_app.py 프로젝트: imony/bbc-simple
    def get_notification_list(self, domain_id=None, src_user_id=None):
        """Get notification_list of the core node

        Args:
            domain_id(bytes): target domain_id
            src_user_id(bytes): user_id of the sender
        Returns:
            bytes: query_id
        """
        dat = self._make_message_structure(MsgType.REQUEST_GET_NOTIFICATION_LIST, domain_id=domain_id, src_user_id=src_user_id)
        admin_info = {
            KeyType.random: bbclib.get_random_value(32)
        }
        self.include_admin_info(dat, admin_info, None)
        return self._send_msg(dat)
예제 #9
0
파일: bbc_app.py 프로젝트: imony/bbc-simple
    def get_user_list(self, domain_id=None, src_user_id=None):
        """Get user_ids in the domain that are connecting to the core node

        Args:
            domain_id(bytes): target domain_id
            src_user_id(bytes): user_id of the sender
        Returns:
            bytes: query_id
        """
        dat = self._make_message_structure(MsgType.REQUEST_GET_USERS, domain_id=domain_id, src_user_id=src_user_id)
        admin_info = {
            KeyType.random: bbclib.get_random_value(32)
        }
        self.include_admin_info(dat, admin_info, None)
        return self._send_msg(dat)
예제 #10
0
파일: bbc_app.py 프로젝트: imony/bbc-simple
    def get_bbc_config(self, domain_id=None, src_user_id=None):
        """Get config file of bbc_core

        This method should be used by a system administrator.

        Args:
            domain_id(bytes): target domain_id
            src_user_id(bytes): user_id of the sender
        Returns:
            bytes: query_id
        """
        dat = self._make_message_structure(MsgType.REQUEST_GET_CONFIG, domain_id=domain_id, src_user_id=src_user_id)
        admin_info = {
            KeyType.random: bbclib.get_random_value(32)
        }
        self.include_admin_info(dat, admin_info, None)
        return self._send_msg(dat)
예제 #11
0
    def domain_close(self, domain_id=None):
        """Close domain leading to remove_domain in the core

        Args:
            domain_id (bytes): domain_id to delete
        Returns:
            bytes: query_id
        """
        if domain_id is None and self.domain_id is not None:
            domain_id = self.domain_id
        if domain_id is None:
            return None
        dat = self._make_message_structure(MsgType.REQUEST_CLOSE_DOMAIN)
        admin_info = {
            KeyType.domain_id: domain_id,
            KeyType.random: bbclib.get_random_value(32)
        }
        self.include_admin_info(dat, admin_info, None)
        return self._send_msg(dat)
예제 #12
0
    def get_domain_list(self, domain_id=None, src_user_id=None):
        """Get domain_id list in bbc_core

        Args:
            domain_id(bytes): target domain_id
            src_user_id(bytes): user_id of the sender
        Returns:
            bytes: query_id
        """
        dat = self._make_message_structure(MsgType.REQUEST_GET_DOMAINLIST, domain_id=domain_id, src_user_id=src_user_id)
        admin_info = {
            KeyType.random: bbclib.get_random_value(32)
        }
        self.include_admin_info(dat, admin_info, None)

        if self.use_query_id_based_message_wait:
            qid = self._send_msg(dat)
            return self.callback.sync_by_queryid(qid, timeout=self.timeout)
        return self._send_msg(dat)
예제 #13
0
    def domain_setup(self, domain_id, config=None):
        """Set up domain with the specified network module and storage

        This method should be used by a system administrator.

        Args:
            domain_id (bytes): domain_id to create
            config (str): system config in json format
        Returns:
            bytes: query_id
        """
        dat = self._make_message_structure(MsgType.REQUEST_SETUP_DOMAIN)
        admin_info = {
            KeyType.domain_id: domain_id,
            KeyType.random: bbclib.get_random_value(32)
        }
        if config is not None:
            admin_info[KeyType.bbc_configuration] = config
        self.include_admin_info(dat, admin_info, None)
        return self._send_msg(dat)
예제 #14
0
    def domain_close(self, domain_id=None, src_user_id=None):
        """Close domain leading to remove_domain in the core

        Args:
            domain_id (bytes): domain_id to delete
            src_user_id(bytes): user_id of the sender
        Returns:
            bytes: query_id
        """
        if domain_id is None and self.domain_id is not None:
            domain_id = self.domain_id
        if domain_id is None:
            return None
        dat = self._make_message_structure(MsgType.REQUEST_CLOSE_DOMAIN, src_user_id=src_user_id)
        admin_info = {
            KeyType.domain_id: domain_id,
            KeyType.random: bbclib.get_random_value(32)
        }
        self.include_admin_info(dat, admin_info, None)

        if self.use_query_id_based_message_wait:
            qid = self._send_msg(dat)
            return self.callback.sync_by_queryid(qid, timeout=self.timeout)
        return self._send_msg(dat)