def _build_sciond_conf(self, topo_id, ia, base): name = sciond_name(topo_id) config_dir = '/share/conf' if self.args.docker else os.path.join( base, COMMON_DIR) ip = sciond_ip(self.args.docker, topo_id, self.args.networks) raw_entry = { 'general': { 'ID': name, 'ConfigDir': config_dir, 'ReconnectToDispatcher': True, }, 'logging': self._log_entry(name), 'trustDB': { 'Backend': 'sqlite', 'Connection': os.path.join(self.db_dir, '%s.trust.db' % name), }, 'sd': { 'address': socket_address_str(ip, SD_API_PORT), 'pathDB': { 'Connection': os.path.join(self.db_dir, '%s.path.db' % name), }, }, 'tracing': self._tracing_entry(), 'metrics': { 'Prometheus': socket_address_str(ip, SCIOND_PROM_PORT) }, 'quic': self._quic_conf_entry(SD_QUIC_PORT, self.args.svcfrac), } raw_entry['quic']['address'] = socket_address_str(ip, SD_QUIC_PORT) return raw_entry
def _build_sciond_conf(self, topo_id, ia, base): name = sciond_name(topo_id) config_dir = '/share/conf' if self.args.docker else base ip = sciond_ip(self.args.docker, topo_id, self.args.networks) raw_entry = { 'general': { 'id': name, 'config_dir': config_dir, 'reconnect_to_dispatcher': True, }, 'log': self._log_entry(name), 'trust_db': { 'connection': os.path.join(self.db_dir, '%s.trust.db' % name), }, 'path_db': { 'connection': os.path.join(self.db_dir, '%s.path.db' % name), }, 'sd': { 'address': socket_address_str(ip, SD_API_PORT), }, 'tracing': self._tracing_entry(), 'metrics': { 'prometheus': socket_address_str(ip, SCIOND_PROM_PORT) }, 'features': translate_features(self.args.features), 'api': { 'addr': socket_address_str(ip, SD_API_PORT + 700), } } return raw_entry
def _sig_toml(self, topo_id, topo): name = 'sig%s' % topo_id.file_fmt() net = self.args.networks[name][0] log_level = 'trace' if self.args.trace else 'debug' ipv = 'ipv4' if ipv not in net: ipv = 'ipv6' sciond_net = self.args.networks["sd" + topo_id.file_fmt()][0] ipv = 'ipv4' if ipv not in sciond_net: ipv = 'ipv6' sciond_ip = sciond_net[ipv] sig_conf = { 'sig': { 'ID': name, 'SIGConfig': 'conf/cfg.json', 'IA': str(topo_id), 'IP': str(net[ipv]), }, 'sd_client': { 'address': socket_address_str(sciond_ip, SD_API_PORT), }, 'logging': { 'file': { 'Level': log_level, 'Path': '/share/logs/%s.log' % name }, 'console': { 'Level': 'error', } }, 'metrics': { 'Prometheus': '0.0.0.0:%s' % SIG_PROM_PORT } } path = os.path.join(topo_id.base_dir(self.args.output_dir), name, SIG_CONFIG_NAME) write_file(path, toml.dumps(sig_conf))
def _sig_toml(self, topo_id, topo): name = 'sig%s' % topo_id.file_fmt() net = self.args.networks[name][0] log_level = 'debug' ipv = 'ipv4' if ipv not in net: ipv = 'ipv6' sciond_net = self.args.networks["sd" + topo_id.file_fmt()][0] ipv = 'ipv4' if ipv not in sciond_net: ipv = 'ipv6' sciond_ip = sciond_net[ipv] sig_conf = { 'gateway': { 'id': name, 'traffic_policy_file': 'conf/sig.json', 'ctrl_addr': str(net[ipv]), }, 'sciond_connection': { 'address': socket_address_str(sciond_ip, SD_API_PORT), }, 'log': { 'console': { 'level': log_level, } }, 'metrics': { 'prometheus': '0.0.0.0:%s' % SIG_PROM_PORT }, 'api': { 'addr': '0.0.0.0:%s' % (SIG_PROM_PORT + 700) }, 'features': translate_features(self.args.features), } path = os.path.join(topo_id.base_dir(self.args.output_dir), SIG_CONFIG_NAME) write_file(path, toml.dumps(sig_conf))