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, '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': self.args.features, } 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 = '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 }, '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))
def _build_co_conf(self, topo_id, ia, base, name, infra_elem): daemon_ip = sciond_ip(self.args.docker, topo_id, self.args.networks) config_dir = '/share/conf' if self.args.docker else base raw_entry = { 'general': { 'id': name, 'config_dir': config_dir, 'reconnect_to_dispatcher': True, }, 'log': self._log_entry(name), 'metrics': self._metrics_entry(infra_elem, CO_PROM_PORT), 'tracing': self._tracing_entry(), 'sciond_connection': { 'address': socket_address_str(daemon_ip, SD_API_PORT), }, 'colibri': { 'delta': 0.3, 'capacities': os.path.join(base, 'capacities.json'), 'reservations': os.path.join(base, 'reservations.json'), 'db': { 'connection': os.path.join(self.db_dir, '%s.reservation.db' % name), }, }, } 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 = '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, 'sig_config': 'conf/cfg.json', 'isd_as': str(topo_id), 'ip': str(net[ipv]), }, 'sciond_connection': { 'address': socket_address_str(sciond_ip, SD_API_PORT), }, 'log': { 'file': { 'level': log_level, 'path': '/share/logs/%s.log' % name }, 'console': { 'level': 'error', } }, 'metrics': { 'prometheus': '0.0.0.0:%s' % SIG_PROM_PORT }, 'features': { 'sig_egress_v2': True, }, } path = os.path.join(topo_id.base_dir(self.args.output_dir), name, SIG_CONFIG_NAME) write_file(path, toml.dumps(sig_conf))