def get_forwarding_list(self): """Get forwarding_list of the domain in the core node Returns: bytes: query_id """ dat = self._make_message_structure(MsgType.REQUEST_GET_FORWARDING_LIST) admin_info = {KeyType.random: bbclib.get_random_value(32)} self.include_admin_info(dat, admin_info, self.node_keypair) return self._send_msg(dat)
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, self.node_keypair) return self._send_msg(dat)
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, self.node_keypair) return self._send_msg(dat)
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, self.node_keypair) return self._send_msg(dat)
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, self.node_keypair) return self._send_msg(dat)
def notify_domain_key_update(self): """Notify update of bbc_core This method should be used by a system administrator. Returns: bytes: query_id """ dat = self._make_message_structure(MsgType.NOTIFY_DOMAIN_KEY_UPDATE) admin_info = {KeyType.random: bbclib.get_random_value(32)} self.include_admin_info(dat, admin_info, self.node_keypair) return self._send_msg(dat)
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, self.node_keypair) return self._send_msg(dat)
def get_domain_neighborlist(self, domain_id): """Get peer list of the domain from the core node This method should be used by a system administrator. Args: domain_id (bytes): domain_id of the neighbor list Returns: bytes: query_id """ dat = self._make_message_structure(MsgType.REQUEST_GET_NEIGHBORLIST) dat[KeyType.domain_id] = domain_id admin_info = {KeyType.random: bbclib.get_random_value(32)} self.include_admin_info(dat, admin_info, self.node_keypair) return self._send_msg(dat)
def manipulate_ledger_subsystem(self, enable=False, domain_id=None): """Start/stop ledger_subsystem on the bbc_core This method should be used by a system administrator. Args: enable (bool): True->start, False->stop domain_id (bytes): target domain_id to enable/disable ledger_subsystem Returns: bytes: query_id """ dat = self._make_message_structure(MsgType.REQUEST_MANIP_LEDGER_SUBSYS) dat[KeyType.domain_id] = domain_id admin_info = { KeyType.ledger_subsys_manip: enable, KeyType.random: bbclib.get_random_value(32) } self.include_admin_info(dat, admin_info, self.node_keypair) return self._send_msg(dat)
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, self.node_keypair) return self._send_msg(dat)
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, self.node_keypair) return self._send_msg(dat)