def generate(self): config_dict = {} for topo_id, as_topo in self.args.topo_dicts.items(): ele_dict = defaultdict(list) for br_id, br_ele in as_topo["border_routers"].items(): a = prom_addr(br_ele["internal_addr"], DEFAULT_BR_PROM_PORT) ele_dict["BorderRouters"].append(a) for elem_id, elem in as_topo["control_service"].items(): a = prom_addr(elem["addr"], CS_PROM_PORT) ele_dict["ControlService"].append(a) if self.args.docker: host_dispatcher = prom_addr_dispatcher(self.args.docker, topo_id, self.args.networks, DISP_PROM_PORT, "") br_dispatcher = prom_addr_dispatcher(self.args.docker, topo_id, self.args.networks, DISP_PROM_PORT, "br") ele_dict["Dispatcher"] = [host_dispatcher, br_dispatcher] sd_prom_addr = '[%s]:%d' % (sciond_ip( self.args.docker, topo_id, self.args.networks), SCIOND_PROM_PORT) ele_dict["Sciond"].append(sd_prom_addr) config_dict[topo_id] = ele_dict self._write_config_files(config_dict) self._write_dc_file() self._write_disp_file()
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 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': trust_db_conf_entry(self.args, name), 'discovery': self._discovery_entry(), 'sd': { 'Reliable': os.path.join(SCIOND_API_SOCKDIR, "%s.sock" % name), 'Unix': os.path.join(SCIOND_API_SOCKDIR, "%s.unix" % name), 'Public': '[%s]:0' % ip, 'pathDB': { 'Connection': os.path.join(self.db_dir, '%s.path.db' % name), }, }, 'tracing': self._tracing_entry(), 'metrics': { 'Prometheus': '[%s]:%d' % (ip, SCIOND_PROM_PORT) }, 'quic': self._quic_conf_entry(SD_QUIC_PORT, self.args.svcfrac), } raw_entry['quic']['Address'] = '[%s]:%d' % (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 _build_control_service_conf(self, topo_id, ia, base, name, infra_elem): sciond = "[%s]:%d" % (sciond_ip(self.args.docker, topo_id, self.args.networks), SD_API_PORT) config_dir = '/share/conf' if self.args.docker else os.path.join( base, name) 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), }, 'beaconDB': { 'Backend': 'sqlite', 'Connection': os.path.join(self.db_dir, '%s.beacon.db' % name), }, 'tracing': self._tracing_entry(), 'metrics': self._metrics_entry(name, infra_elem, CS_PROM_PORT), 'quic': self._quic_conf_entry(CS_QUIC_PORT, self.args.svcfrac, infra_elem), 'sd_client': { 'address': sciond, }, 'cs': { 'LeafReissueLeadTime': "6h", 'IssuerReissueLeadTime': "3d", 'ReissueRate': "10s", 'ReissueTimeout': "5s", }, 'ps': { 'pathDB': { 'Backend': 'sqlite', 'Connection': os.path.join(self.db_dir, '%s.path.db' % name), }, 'SegSync': True, }, } return raw_entry
def generate(self): config_dict = {} for topo_id, as_topo in self.args.topo_dicts.items(): ele_dict = defaultdict(list) for br_id, br_ele in as_topo["BorderRouters"].items(): ele_dict["BorderRouters"].append( prom_addr_br(br_id, br_ele, DEFAULT_BR_PROM_PORT)) for elem_id, elem in as_topo["BeaconService"].items(): prom_addr = prom_addr_infra(self.args.docker, elem_id, elem, BS_PROM_PORT) ele_dict["BeaconService"].append(prom_addr) for elem_id, elem in as_topo["PathService"].items(): prom_addr = prom_addr_infra(self.args.docker, elem_id, elem, PS_PROM_PORT) ele_dict["PathService"].append(prom_addr) for elem_id, elem in as_topo["CertificateService"].items(): prom_addr = prom_addr_infra(self.args.docker, elem_id, elem, CS_PROM_PORT) ele_dict["CertificateService"].append(prom_addr) if self.args.docker: host_dispatcher = prom_addr_dispatcher(self.args.docker, topo_id, self.args.networks, DISP_PROM_PORT, "") br_dispatcher = prom_addr_dispatcher(self.args.docker, topo_id, self.args.networks, DISP_PROM_PORT, "br") ele_dict["Dispatcher"] = [host_dispatcher, br_dispatcher] sd_prom_addr = '[%s]:%d' % (sciond_ip( self.args.docker, topo_id, self.args.networks), SCIOND_PROM_PORT) ele_dict["Sciond"].append(sd_prom_addr) config_dict[topo_id] = ele_dict self._write_config_files(config_dict) self._write_dc_file() self._write_disp_file()