Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 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()
Пример #4
0
 def _build_control_service_conf(self, topo_id, ia, base, name, infra_elem,
                                 ca):
     config_dir = '/share/conf' if self.args.docker else base
     sd_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),
         },
         'beacon_db': {
             'connection': os.path.join(self.db_dir, '%s.beacon.db' % name),
         },
         'path_db': {
             'connection': os.path.join(self.db_dir, '%s.path.db' % name),
         },
         'drkey': {
             'cert_file':
             os.path.join(base, 'crypto', 'as',
                          f'{topo_id.ISD()}-{topo_id.AS_file()}.pem'),
             'key_file':
             os.path.join(base, 'crypto', 'as', 'cp-as.key'),
             'drkey_db': {
                 'connection': os.path.join(self.db_dir,
                                            '%s.drkey.db' % name),
             },
             'delegation': {
                 'colibri':
                 [str(sd_ip)
                  ],  # local daemon must be able to get the colibri DS
                 'piskes':
                 [str(sd_ip)],  # local daemon must be able to use piskes
             },
         },
         'tracing': self._tracing_entry(),
         'metrics': self._metrics_entry(infra_elem, CS_PROM_PORT),
         'api': self._api_entry(infra_elem, CS_PROM_PORT + 700),
         'features': translate_features(self.args.features),
     }
     if ca:
         raw_entry['ca'] = {'mode': 'in-process'}
     return raw_entry