Ejemplo n.º 1
0
def _get_non_eps_service_control():
    if (load_service_mconfig('mme').non_eps_service_control):
        if (load_service_mconfig('mme').non_eps_service_control == 0):
            return "OFF"
        elif (load_service_mconfig('mme').non_eps_service_control == 1):
            return "CSFB_SMS"
        elif (load_service_mconfig('mme').non_eps_service_control == 2):
            return "SMS"
    return "OFF"
Ejemplo n.º 2
0
def _get_non_eps_service_control():
    if load_service_mconfig("mme").non_eps_service_control:
        if load_service_mconfig("mme").non_eps_service_control == 0:
            return "OFF"
        elif load_service_mconfig("mme").non_eps_service_control == 1:
            return "CSFB_SMS"
        elif load_service_mconfig("mme").non_eps_service_control == 2:
            return "SMS"
    return "OFF"
Ejemplo n.º 3
0
def get_context():
    """
    Provide context to pass to Jinja2 for templating.
    """
    context = {}
    cfg = load_service_config("dnsd")
    try:
        mconfig = load_service_mconfig("dnsd")
    except LoadConfigError as err:
        logging.warn("Error! Using default config because: %s", err)
        mconfig = DnsD()
    ip = get_ip_from_if_cidr(cfg['enodeb_interface'])
    dhcp_block_size = cfg['dhcp_block_size']
    available_hosts = list(ipaddress.IPv4Interface(ip).network.hosts())

    if dhcp_block_size < len(available_hosts):
        context['dhcp_range'] = {
            "lower": str(available_hosts[-dhcp_block_size]),
            "upper": str(available_hosts[-1]),
        }
    else:
        logging.fatal("Not enough available hosts to allocate a DHCP block of \
            %d addresses." % (dhcp_block_size))

    context['addresses'] = _get_addresses(cfg, mconfig)
    return context
Ejemplo n.º 4
0
def get_context():
    """
    Provide context to pass to Jinja2 for templating.
    """
    context = {}
    cfg = load_service_config("dnsd")
    try:
        mconfig = load_service_mconfig('dnsd', DnsD())
    except LoadConfigError as err:
        logging.warning("Error! Using default config because: %s", err)
        mconfig = DnsD()
    ip = get_ip_from_if_cidr(cfg['enodeb_interface'])
    if int(ip.split('/')[1]) < 16:
        logging.fatal("Large interface netmasks hang dnsmasq, consider using a "
                      "netmask in range /16 - /24")
        raise Exception("Interface %s netmask is to large."
                        % cfg['enodeb_interface'])

    dhcp_block_size = cfg['dhcp_block_size']
    available_hosts = list(ipaddress.IPv4Interface(ip).network.hosts())

    context['dhcp_server_enabled'] = mconfig.dhcp_server_enabled
    if dhcp_block_size < len(available_hosts):
        context['dhcp_range'] = {
            "lower": str(available_hosts[-dhcp_block_size]),
            "upper": str(available_hosts[-1]),
        }
    else:
        logging.fatal("Not enough available hosts to allocate a DHCP block of \
            %d addresses." % (dhcp_block_size))

    context['addresses'] = _get_addresses(cfg, mconfig)
    return context
Ejemplo n.º 5
0
def main():
    parser = create_parser()
    args = parser.parse_args()

    # import after parsing command line because import is sluggish
    from magma.configuration.mconfig_managers import load_service_mconfig

    # set up logging
    logging.basicConfig(
        level=logging.INFO,
        format='[%(asctime)s %(levelname)s %(name)s] %(message)s')

    mconfig = load_service_mconfig(args.service)

    # if a variable was not specified, pretty print config and exit
    if args.variable is None:
        print(mconfig, end="")
        sys.exit(0)

    var = getattr(mconfig, args.variable)

    if args.test:
        if var:
            # if true, then return 0 (zero means success)
            sys.exit(0)
        # exit code 2 to distinguish from exit code 1,
        #    which is returned after python exceptions.
        sys.exit(2)

    # not a boolean, print the config
    print(var)
    sys.exit(0)
Ejemplo n.º 6
0
def main():
    logging.basicConfig(
        level=logging.INFO,
        format='[%(asctime)s %(levelname)s %(name)s] %(message)s',
    )

    mc = load_service_mconfig('td-agent-bit', FluentBit())

    control_proxy_config = load_service_config('control_proxy')
    host = control_proxy_config['fluentd_address']
    port = control_proxy_config['fluentd_port']
    cacert = control_proxy_config['rootca_cert']
    certfile = control_proxy_config['gateway_cert']
    keyfile = control_proxy_config['gateway_key']

    context = {
        'host': host,
        'port': port,
        'cacert': cacert,
        'certfile': certfile,
        'keyfile': keyfile,
        'extra_tags': mc.extra_tags.items(),
        'throttle_rate': mc.throttle_rate or 1000,
        'throttle_window': mc.throttle_window or 5,
        'throttle_interval': mc.throttle_interval or '1m',
        'files': mc.files_by_tag.items(),
    }
    if certfile and os.path.exists(certfile):
        context['is_tls_enabled'] = True
    else:
        context['is_tls_enabled'] = False

    generate_template_config('td-agent-bit', 'td-agent-bit',
                             CONFIG_OVERRIDE_DIR, context.copy())
Ejemplo n.º 7
0
    def process_update(self, stream_name, updates, resync):
        """
        Handle config updates. Resync is ignored since the entire config
        structure is passed in every update.
        Inputs:
         - updates - list of GatewayConfigs protobuf structures
         - resync - boolean indicating whether all database information will be
                    resent (hence cached data can be discarded). This is ignored
                    since config is contained in one DB element, hence all
                    data is sent in every update.
        """
        if len(updates) == 0:
            logging.info('No config update to process')
            return

        # We will only take the last update
        for update in updates[:-1]:
            logging.info('Ignoring config update %s', update.key)

        # Deserialize and store the last config update
        logging.info('Processing config update %s', updates[-1].key)
        mconfig_str = updates[-1].value.decode()
        mconfig = self._mconfig_manager.deserialize_mconfig(
            mconfig_str,
            self._allow_unknown_fields,
        )

        if 'magmad' not in mconfig.configs_by_key:
            logging.error('Invalid config! Magmad service config missing')
            return

        self._mconfig_manager.update_stored_mconfig(mconfig_str)
        self._magmad_service.reload_mconfig()

        def did_mconfig_change(serv_name):
            return mconfig.configs_by_key.get(serv_name) != \
                self._mconfig.configs_by_key.get(serv_name)

        # Reload magmad configs locally
        if did_mconfig_change('magmad'):
            self._loop.create_task(
                self._service_manager.update_dynamic_services(
                    load_service_mconfig(
                        'magmad', mconfigs_pb2.MagmaD()).dynamic_services, ), )

        services_to_restart = [
            srv for srv in self._services if did_mconfig_change(srv)
        ]
        if services_to_restart:
            self._loop.create_task(
                self._service_manager.restart_services(services_to_restart), )

        self._mconfig = mconfig

        configs_by_key = {}
        for srv in self._services:
            if srv in mconfig.configs_by_key:
                configs_by_key[srv] = mconfig.configs_by_key.get(srv)

        magmad_events.processed_updates(configs_by_key)
def main():
    """
    conditionally start a systemd service based on an mconfig
    Example usage:
        ExecStart=/usr/sbin/magma_conditional_service.py \
                  --service service \
                  --variable enable \
                  service.sh start
    """

    parser = create_parser()
    args = parser.parse_args()

    logging.basicConfig(
        level=logging.INFO,
        format='[%(asctime)s %(levelname)s %(name)s] %(message)s')

    mconfig = load_service_mconfig(args.service)

    var = getattr(mconfig, args.variable)

    serviceEnabled = bool(var)
    if getattr(args, "not"):  # 'not' is a reserved keyword
        serviceEnabled = not serviceEnabled

    execArgs = [args.command] + args.args

    if serviceEnabled:
        logging.info("service enabled, starting: %s" %
                     " ".join([shlex.quote(a) for a in execArgs]))
        os.execv(execArgs[0], execArgs)
    else:
        info = "service disabled since config %s.%s==%s %%s" % (
            args.service,
            args.variable,
            bool(var),
        )
        if args.oneshot:
            logging.info(info, "(oneshot, exiting...)")
            return 0
        elif args.forking:
            writePIDCmd = ""
            if args.forking_pid_file:
                writePIDCmd = "( echo $! > %s )" % args.forking_pid_file
            logging.info(info,
                         "(forking, pid_file=%s)" % args.forking_pid_file)
            # TODO: use os.fork(), when it works on all devices.
            forkArgs = [
                "/bin/sh",
                "-c",
                "while true; do sleep 600; done & %s "
                "# conditional_service disabled since config %s.%s==%s" %
                (writePIDCmd, args.service, args.variable, bool(var)),
            ]
            os.execv(forkArgs[0], forkArgs)
        else:
            logging.info(info, "(simple)")
            while True:
                time.sleep(600)
Ejemplo n.º 9
0
def _get_attached_enodeb_tacs():
    mme_config = load_service_mconfig("mme", MME())
    # attachedEnodebTacs overrides 'tac', which is being deprecated, but for
    # now, both are supported
    tac = mme_config.tac
    attached_enodeb_tacs = mme_config.attached_enodeb_tacs
    if len(attached_enodeb_tacs) == 0:
        return [tac]
    return attached_enodeb_tacs
Ejemplo n.º 10
0
def _get_enable_nat():
    nat_enabled = get_service_config_value("mme", "enable_nat", None)

    if nat_enabled is None:
        nat_enabled = load_service_mconfig("mme", MME()).nat_enabled

    if nat_enabled is not None:
        return nat_enabled

    return True
Ejemplo n.º 11
0
def _get_dns_ip(iface_config):
    """
    Get dnsd interface IP without netmask.
    If caching is enabled, use the ip of interface that dnsd listens over.
    Otherwise, just use dns server in yml.
    """
    if load_service_mconfig('mme').enable_dns_caching:
        iface_name = get_service_config_value('dnsd', iface_config, '')
        return get_ip_from_if(iface_name)
    return get_service_config_value('spgw', 'ipv4_dns', '')
Ejemplo n.º 12
0
def _get_dns_ip(iface_config):
    """
    Get dnsd interface IP without netmask.
    If caching is enabled, use the ip of interface that dnsd listens over.
    Otherwise, just use dns server in yml.
    """
    if load_service_mconfig("mme", MME()).enable_dns_caching:
        iface_name = get_service_config_value("dnsd", iface_config, "")
        return get_ip_from_if(iface_name)
    return get_service_config_value("spgw", "ipv4_dns", "")
Ejemplo n.º 13
0
def _get_context():
    """
    Create the context which has the interface IP and the OAI log level to use.
    """
    mme_service_config = load_service_mconfig("mme", MME())

    context = {
        "mme_s11_ip": _get_iface_ip("mme", "s11_iface_name"),
        "sgw_s11_ip": _get_iface_ip("spgw", "s11_iface_name"),
        "sgw_s5s8_up_ip": _get_iface_ip("spgw", "sgw_s5s8_up_iface_name"),
        "remote_sgw_ip": get_service_config_value("mme", "remote_sgw_ip", ""),
        "s1ap_ip": _get_iface_ip("mme", "s1ap_iface_name"),
        "oai_log_level": _get_oai_log_level(),
        "ipv4_dns": _get_primary_dns_ip(mme_service_config, "dns_iface_name"),
        "ipv4_sec_dns": _get_secondary_dns_ip(mme_service_config),
        "ipv4_p_cscf_address": _get_ipv4_pcscf_ip(mme_service_config),
        "ipv6_dns": _get_ipv6_dns_ip(mme_service_config),
        "ipv6_p_cscf_address": _get_ipv6_pcscf_ip(mme_service_config),
        "identity": _get_identity(),
        "relay_enabled": _get_relay_enabled(mme_service_config),
        "non_eps_service_control": _get_non_eps_service_control(mme_service_config),
        "csfb_mcc": _get_csfb_mcc(mme_service_config),
        "csfb_mnc": _get_csfb_mnc(mme_service_config),
        "lac": _get_lac(mme_service_config),
        "use_stateless": get_service_config_value("mme", "use_stateless", ""),
        "attached_enodeb_tacs": _get_attached_enodeb_tacs(mme_service_config),
        "enable_nat": _get_enable_nat(mme_service_config),
        "federated_mode_map": _get_federated_mode_map(mme_service_config),
        "restricted_plmns": _get_restricted_plmns(mme_service_config),
        "restricted_imeis": _get_restricted_imeis(mme_service_config),
    }

    context["s1u_ip"] = mme_service_config.ipv4_sgw_s1u_addr or _get_iface_ip(
        "spgw", "s1u_iface_name"
    )

    # set ovs params
    for key in (
        "ovs_bridge_name",
        "ovs_gtp_port_number",
        "ovs_mtr_port_number",
        "ovs_internal_sampling_port_number",
        "ovs_internal_sampling_fwd_tbl",
        "ovs_uplink_port_number",
        "ovs_uplink_mac",
    ):
        context[key] = get_service_config_value("spgw", key, "")
    context["enable_apn_correction"] = get_service_config_value(
        "mme", "enable_apn_correction", ""
    )
    context["apn_correction_map_list"] = _get_apn_correction_map_list(
        mme_service_config
    )

    return context
Ejemplo n.º 14
0
    def _is_enabled(self) -> bool:
        """Return whether SMS should act as a relay

        SMS_ORC8R has value 3
        Returns:
        bool: True if MME's NON_EPS_SERVICE_CONFIG is set to SMS_ORC8R
        False otherwise
        """
        mme_service_config = load_service_mconfig("mme", MME())
        non_eps_service_control = mme_service_config.non_eps_service_control
        return non_eps_service_control and non_eps_service_control == 3
Ejemplo n.º 15
0
 def _is_enabled(self):
     """ 
     Returns True if MME's NON_EPS_SERVICE_CONFIG is set to SMS_ORC8R, False
     otherwise. smsd should only act as a relay when that config paramater
     is set to SMS_ORC8R (value 3).
     """
     mme_service_config = load_service_mconfig("mme", MME())
     non_eps_service_control = mme_service_config.non_eps_service_control
     if non_eps_service_control and non_eps_service_control == 3:
         return True
     return False
Ejemplo n.º 16
0
def _get_primary_dns_ip(iface_config):
    """
    Get dnsd interface IP without netmask.
    If caching is enabled, use the ip of interface that dnsd listens over.
    Otherwise, use dns server from service mconfig.
    """
    service_config = load_service_mconfig("mme", MME())
    if service_config.enable_dns_caching:
        iface_name = get_service_config_value("dnsd", iface_config, "")
        return get_ip_from_if(iface_name)
    else:
        return service_config.dns_primary or DEFAULT_DNS_IP_PRIMARY_ADDR
Ejemplo n.º 17
0
def _get_non_eps_service_control():
    non_eps_service_control = \
        load_service_mconfig("mme", MME()).non_eps_service_control
    if non_eps_service_control:
        if non_eps_service_control == 0:
            return "OFF"
        elif non_eps_service_control == 1:
            return "CSFB_SMS"
        elif non_eps_service_control == 2:
            return "SMS"
        elif non_eps_service_control == 3:
            return "SMS_ORC8R"
    return "OFF"
Ejemplo n.º 18
0
 def _monitor(self, poll_interval=15):
     """
     Main thread that polls config updates and updates LI mirror flows
     """
     while True:
         li_imsis = load_service_mconfig('pipelined',
                                         mconfigs_pb2.PipelineD()).li_imsis
         imsis_to_add = [
             imsi for imsi in li_imsis if imsi not in self._li_imsis
         ]
         self._install_mirror_flows(imsis_to_add)
         imsis_to_rm = [
             imsi for imsi in self._li_imsis if imsi not in li_imsis
         ]
         self._remove_mirror_flows(imsis_to_rm)
         self._li_imsis = li_imsis
         hub.sleep(poll_interval)
Ejemplo n.º 19
0
def generate_template_config(service, template, out_dirname, context):
    """
    Generate the config from the jinja template.

    Args:
        service (str): Name of the magma service. Used for looking up the
                        config and mconfig
        template (str): Name of the input template, which is also used for
                        choosing the output filename
        out_dirname (str): Path of the output file
        context (map): Context to use for Jinja (the .yml config and mconfig
                        will be added into this context)
    """
    # Get the template and the output filenames
    template_filename = _get_template_filename(template)
    out_filename = _get_template_out_filename(template, out_dirname)
    logging.info("Generating config file: [%s] using template: [%s]" %
                 (out_filename, template_filename))
    template_context = {}
    # Generate the content to use from the service yml config and mconfig.
    try:
        template_context.update(load_service_config(service))
    except LoadConfigError as err:
        logging.warning(err)

    template_context.update(context)
    try:
        mconfig = load_service_mconfig(service)
        template_context.update(
            json.loads(
                MessageToJson(mconfig, including_default_value_fields=True)))
    except LoadConfigError as err:
        logging.warning(err)

    # Export snowflake to template.
    # TODO: export a hardware-derived ID that can be used by a field tech
    # to easily identify a specific device.
    template_context.setdefault("snowflake", make_snowflake())

    # Create the config file based on the template
    template_str = open(template_filename, 'r').read()
    output = Template(template_str).render(template_context)
    os.makedirs(out_dirname, exist_ok=True)
    write_to_file_atomically(out_filename, output)
Ejemplo n.º 20
0
def _get_oai_log_level():
    """
    Convert the logLevel in mconfig into the level which OAI code
    uses. We use OAI's 'TRACE' as the debugging log level and 'CRITICAL'
    as the fatal log level.
    """
    mconfig = load_service_mconfig('mme')
    oai_log_level = 'INFO'
    if mconfig.log_level == common_pb2.DEBUG:
        oai_log_level = 'TRACE'
    elif mconfig.log_level == common_pb2.INFO:
        oai_log_level = 'INFO'
    elif mconfig.log_level == common_pb2.WARNING:
        oai_log_level = 'WARNING'
    elif mconfig.log_level == common_pb2.ERROR:
        oai_log_level = 'ERROR'
    elif mconfig.log_level == common_pb2.FATAL:
        oai_log_level = 'CRITICAL'
    return oai_log_level
Ejemplo n.º 21
0
def get_context():
    """
    Provide context to pass to Jinja2 for templating.
    """
    context = {}
    cfg = load_service_config("lighttpd")
    ip = "127.0.0.1"
    enable_caching = False
    try:
        mconfig = load_service_mconfig('lighttpd')
        enable_caching = mconfig.enable_caching
    except LoadConfigError:
        logging.info("Using default values for service 'lighttpd'")

    if enable_caching:
        ip = get_ip_from_if(cfg['interface'])

    context['interface_ip'] = ip
    context['store_root'] = cfg['store_root']

    return context
Ejemplo n.º 22
0
    def _monitor(self, poll_interval=15):
        """
        Main thread that polls config updates and updates LI mirror flows
        """
        while True:
            mconfg_li_imsis = load_service_mconfig(
                'pipelined',
                mconfigs_pb2.PipelineD(),
            ).li_ues.imsis

            li_imsis = []
            for imsi in mconfg_li_imsis:
                if any(i.isdigit() for i in imsi):
                    li_imsis.append(imsi)
            imsis_to_add = [
                imsi for imsi in li_imsis if imsi not in self._li_imsis
            ]
            self._install_mirror_flows(imsis_to_add)
            imsis_to_rm = [
                imsi for imsi in self._li_imsis if imsi not in li_imsis
            ]
            self._remove_mirror_flows(imsis_to_rm)
            self._li_imsis = li_imsis
            hub.sleep(poll_interval)
Ejemplo n.º 23
0
def _get_context():
    """
    Create the context which has the interface IP and the OAI log level to use.
    """
    mme_service_config = load_service_mconfig('mme', MME())
    nat = _get_enable_nat(mme_service_config)
    if nat:
        iface_name = get_service_config_value(
            'spgw',
            'sgw_s5s8_up_iface_name',
            '',
        )
    else:
        iface_name = get_service_config_value(
            'spgw',
            'sgw_s5s8_up_iface_name_non_nat',
            '',
        )
    context = {
        "mme_s11_ip":
        _get_iface_ip("mme", "s11_iface_name"),
        "sgw_s11_ip":
        _get_iface_ip("spgw", "s11_iface_name"),
        'sgw_s5s8_up_iface_name':
        iface_name,
        "remote_sgw_ip":
        get_service_config_value("mme", "remote_sgw_ip", ""),
        "s1ap_ip":
        _get_iface_ip("mme", "s1ap_iface_name"),
        "s1ap_ipv6":
        _get_iface_ipv6("mme", "s1ap_iface_name"),
        "s1ap_ipv6_enabled":
        get_service_config_value(
            "mme",
            "s1ap_ipv6_enabled",
            default=False,
        ),
        "oai_log_level":
        _get_oai_log_level(),
        "ipv4_dns":
        _get_primary_dns_ip(mme_service_config, "dns_iface_name"),
        "ipv4_sec_dns":
        _get_secondary_dns_ip(mme_service_config),
        "ipv4_p_cscf_address":
        _get_ipv4_pcscf_ip(mme_service_config),
        "ipv6_dns":
        _get_ipv6_dns_ip(mme_service_config),
        "ipv6_p_cscf_address":
        _get_ipv6_pcscf_ip(mme_service_config),
        "identity":
        _get_identity(),
        "relay_enabled":
        _get_relay_enabled(mme_service_config),
        "non_eps_service_control":
        _get_non_eps_service_control(mme_service_config, ),
        "csfb_mcc":
        _get_csfb_mcc(mme_service_config),
        "csfb_mnc":
        _get_csfb_mnc(mme_service_config),
        "lac":
        _get_lac(mme_service_config),
        "use_stateless":
        get_service_config_value("mme", "use_stateless", ""),
        "attached_enodeb_tacs":
        _get_attached_enodeb_tacs(mme_service_config),
        'enable_nat':
        nat,
        "federated_mode_map":
        _get_federated_mode_map(mme_service_config),
        "restricted_plmns":
        _get_restricted_plmns(mme_service_config),
        "restricted_imeis":
        _get_restricted_imeis(mme_service_config),
        "congestion_control_enabled":
        _get_congestion_control_config(mme_service_config, ),
        "service_area_map":
        _get_service_area_maps(mme_service_config),
        "accept_combined_attach_tau_wo_csfb":
        get_service_config_value("mme", "accept_combined_attach_tau_wo_csfb",
                                 ""),
        "sentry_config":
        mme_service_config.sentry_config,
        "enable5g_features":
        _get_converged_core_config(mme_service_config),
        "amf_default_slice_service_type":
        _get_default_slice_service_type_config(mme_service_config, ),
        "amf_default_slice_differentiator":
        _get_default_slice_differentiator_type_config(mme_service_config, ),
        "amf_name":
        _get_amf_name_config(mme_service_config),
        "amf_region_id":
        _get_amf_region_id(mme_service_config),
        "amf_set_id":
        _get_amf_set_id(mme_service_config),
        "amf_pointer":
        _get_amf_pointer(mme_service_config),
        "default_dnn":
        _get_default_dnn_config(mme_service_config),
        "auth_retry_max_count":
        _get_default_auth_retry_count(),
        "auth_retry_interval":
        _get_default_auth_timer_expire_msec(),
    }

    context["s1u_ip"] = mme_service_config.ipv4_sgw_s1u_addr or _get_iface_ip(
        "spgw",
        "s1u_iface_name",
    )

    context[
        "s1u_ipv6"] = mme_service_config.ipv6_sgw_s1u_addr or _get_iface_ipv6(
            "spgw",
            "s1u_iface_name",
        )

    try:
        sgw_s5s8_up_ip = get_ip_from_if_cidr(iface_name,
                                             IpPreference.IPV4_ONLY)
    except ValueError:
        # ignore the error to avoid MME crash
        logging.warning("Could not read IP of interface: %s", iface_name)
        sgw_s5s8_up_ip = "127.0.0.1/8"
    context["sgw_s5s8_up_ip"] = sgw_s5s8_up_ip

    # set ovs params
    for key in (
            "ovs_bridge_name",
            "ovs_gtp_port_number",
            "ovs_mtr_port_number",
            "ovs_internal_sampling_port_number",
            "ovs_internal_sampling_fwd_tbl",
            "ovs_uplink_port_number",
            "ovs_uplink_mac",
            "pipelined_managed_tbl0",
            "ebpf_enabled",
    ):
        context[key] = get_service_config_value("spgw", key, "")
    context["enable_apn_correction"] = get_service_config_value(
        "mme",
        "enable_apn_correction",
        "",
    )
    context["apn_correction_map_list"] = _get_apn_correction_map_list(
        mme_service_config, )

    return context
Ejemplo n.º 24
0
def _get_csfb_mnc():
    csfb_mnc = load_service_mconfig("mme", MME()).csfb_mnc
    if csfb_mnc:
        return csfb_mnc
    return ""
Ejemplo n.º 25
0
def _get_lac():
    lac = load_service_mconfig("mme", MME()).lac
    if lac:
        return lac
    return 0
Ejemplo n.º 26
0
def _get_relay_enabled():
    if load_service_mconfig("mme", MME()).relay_enabled:
        return "yes"
    return "no"
Ejemplo n.º 27
0
def _get_secondary_dns_ip():
    """
    Get the secondary dns ip from the service mconfig.
    """
    service_config = load_service_mconfig("mme", MME())
    return service_config.dns_secondary or DEFAULT_DNS_IP_SECONDARY_ADDR
Ejemplo n.º 28
0
def _get_lac():
    if load_service_mconfig("mme").lac:
        return load_service_mconfig("mme").lac
    return 0
Ejemplo n.º 29
0
def _get_apn_correction_map_list():
    mme_config = load_service_mconfig("mme", MME())
    if len(mme_config.apn_correction_map_list) == 0:
        return get_service_config_value("mme", "apn_correction_map_list", None)
    return mme_config.apn_correction_map_list
Ejemplo n.º 30
0
def _get_csfb_mnc():
    if load_service_mconfig("mme").csfb_mnc:
        return load_service_mconfig("mme").csfb_mnc
    return ""