Commit 47da9a26 authored by Mohammed Ismail's avatar Mohammed Ismail

Merge branch 'fqdn_ausf' into 'develop'

Support FQDN for AUSF

See merge request oai/cn5g/oai-cn5g-amf!52
parents 4ed0fefa eedb57aa
......@@ -84,6 +84,7 @@ services:
- AUSF_IPV4_ADDRESS=0.0.0.0
- AUSF_PORT=80
- AUSF_API_VERSION=v1
- AUSF_FQDN=localhost
depends_on:
- cicd_mysql
networks:
......
......@@ -85,7 +85,7 @@ AMF =
IPV4_ADDRESS = "@NRF_IPV4_ADDRESS@"; # YOUR NRF CONFIG HERE
PORT = @NRF_PORT@; # YOUR NRF CONFIG HERE (default: 80)
API_VERSION = "@NRF_API_VERSION@"; # YOUR NRF API VERSION FOR SBI CONFIG HERE
FQDN = "@NRF_FQDN@"
FQDN = "@NRF_FQDN@" # YOUR NRF FQDN CONFIG HERE
};
AUSF :
......@@ -93,6 +93,7 @@ AMF =
IPV4_ADDRESS = "@AUSF_IPV4_ADDRESS@"; # YOUR AUSF CONFIG HERE
PORT = @AUSF_PORT@; # YOUR AUSF CONFIG HERE (default: 80)
API_VERSION = "@AUSF_API_VERSION@"; # YOUR AUSF API VERSION FOR SBI CONFIG HERE
FQDN = "@AUSF_FQDN@" # YOUR AUSF FQDN CONFIG HERE
};
};
......
......@@ -132,7 +132,7 @@ int amf_config::load(const std::string& config_file) {
const Setting& amf_cfg = root[AMF_CONFIG_STRING_AMF_CONFIG];
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error("%s : %s", nfex.what(), nfex.getPath());
return -1;
return RETURNerror;
}
// Instance
......@@ -286,7 +286,7 @@ int amf_config::load(const std::string& config_file) {
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
return RETURNerror;
}
// Network interfaces
......@@ -399,12 +399,13 @@ int amf_config::load(const std::string& config_file) {
}
// AUSF
// TODO: add FQDN option
if (enable_external_ausf) {
const Setting& ausf_cfg = new_if_cfg[AMF_CONFIG_STRING_AUSF];
struct in_addr ausf_ipv4_addr = {};
unsigned int ausf_port = {};
std::string ausf_api_version = {};
if (!use_fqdn_dns) {
ausf_cfg.lookupValue(AMF_CONFIG_STRING_IPV4_ADDRESS, address);
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), ausf_ipv4_addr,
......@@ -422,11 +423,28 @@ int amf_config::load(const std::string& config_file) {
throw(AMF_CONFIG_STRING_API_VERSION "failed");
}
ausf_addr.api_version = ausf_api_version;
} else {
std::string ausf_fqdn = {};
ausf_cfg.lookupValue(AMF_CONFIG_STRING_FQDN_DNS, ausf_fqdn);
uint8_t addr_type = {};
fqdn::resolve(ausf_fqdn, address, ausf_port, addr_type);
if (addr_type != 0) { // IPv6: TODO
throw("DO NOT SUPPORT IPV6 ADDR FOR AUSF!");
} else { // IPv4
IPV4_STR_ADDR_TO_INADDR(
util::trim(address).c_str(), ausf_ipv4_addr,
"BAD IPv4 ADDRESS FORMAT FOR AUSF !");
ausf_addr.ipv4_addr = ausf_ipv4_addr;
ausf_addr.port = ausf_port;
ausf_addr.api_version = "v1"; // TODO: get API version
}
}
}
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
return RETURNerror;
}
// Emergency support
......@@ -437,7 +455,7 @@ int amf_config::load(const std::string& config_file) {
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
return RETURNerror;
}
// Authentication Info
......@@ -455,7 +473,7 @@ int amf_config::load(const std::string& config_file) {
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
return RETURNerror;
}
// Integrity/Ciphering algorithms (NAS)
......@@ -496,7 +514,7 @@ int amf_config::load(const std::string& config_file) {
} catch (const SettingNotFoundException& nfex) {
Logger::amf_app().error(
"%s : %s, using defaults", nfex.what(), nfex.getPath());
return -1;
return RETURNerror;
}
return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment