Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new Kore SIMs to static APN map #2276

Merged
merged 2 commits into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hal/network/ncp/cellular/network_config_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const NetworkConfig NETWORK_CONFIG[] = {
{ CellularNetworkProvider::TELEFONICA, "214", "07", "", "spark.telefonica.com", "", "" }, // Telefonica
{ CellularNetworkProvider::KORE_VODAFONE, "204", "04", "", "vfd1.korem2m.com", "kore", "kore" }, // Kore/Vodafone
{ CellularNetworkProvider::KORE_ATT, "310", "410", "", "10569.mcs", "", "" }, // Kore/AT&T
{ CellularNetworkProvider::KORE_ATT, "310", "030", "", "10569.mcs", "", "" }, // Kore/AT&T SIMs with a prefix of 89010 with MCC + MNC: 310 030
{ CellularNetworkProvider::TWILIO, "", "", "8988323", "super", "", "" }, // Twilio Super SIM
{ CellularNetworkProvider::TWILIO, "", "", "8988307", "super", "", "" }, // Twilio Super SIM
};
Expand Down
4 changes: 4 additions & 0 deletions hal/src/electron/cellular_hal_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const char TWILIO_ICCID_1[] = "8988323";
const char TWILIO_ICCID_2[] = "8988307";
const char TELEFONICA_MCC_MNC[] = "21407";
const char KORE_ATT_MCC_MNC[] = "310410";
const char KORE_ATT2_MCC_MNC[] = "310030";
const char KORE_VODAFONE_MCC_MNC[] = "20404";

const int MCC_MNC_MIN_SIZE = 5;
Expand All @@ -32,6 +33,9 @@ CellularNetProv cellular_sim_to_network_provider_impl(const char* imsi, const ch
} else if (strncmp(imsi, KORE_ATT_MCC_MNC, strlen(KORE_ATT_MCC_MNC)) == 0) {
// LOG(INFO, "CELLULAR_NETPROV_KORE_ATT");
return CELLULAR_NETPROV_KORE_ATT;
} else if (strncmp(imsi, KORE_ATT2_MCC_MNC, strlen(KORE_ATT2_MCC_MNC)) == 0) {
// LOG(INFO, "CELLULAR_NETPROV_KORE_ATT");
return CELLULAR_NETPROV_KORE_ATT;
} else if (strncmp(imsi, KORE_VODAFONE_MCC_MNC, strlen(KORE_VODAFONE_MCC_MNC)) == 0) {
// LOG(INFO, "CELLULAR_NETPROV_KORE_VODAFONE");
return CELLULAR_NETPROV_KORE_VODAFONE;
Expand Down
13 changes: 13 additions & 0 deletions test/unit_tests/cellular/cellular.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ TEST_CASE("Gen 2 cellular credentials") {
REQUIRE(cellular_sim_to_network_provider_impl("310410999999999", nullptr) == CELLULAR_NETPROV_KORE_ATT);
}

SECTION("IMSI range2 should set Kore AT&T as Network Provider", "[cellular]") {
REQUIRE(cellular_sim_to_network_provider_impl("310030000000000", nullptr) == CELLULAR_NETPROV_KORE_ATT);
REQUIRE(cellular_sim_to_network_provider_impl("310030555555555", nullptr) == CELLULAR_NETPROV_KORE_ATT);
REQUIRE(cellular_sim_to_network_provider_impl("310030999999999", nullptr) == CELLULAR_NETPROV_KORE_ATT);
}

SECTION("IMSI range should set Telefonica as Network Provider", "[cellular]") {
REQUIRE(cellular_sim_to_network_provider_impl("214070000000000", nullptr) == CELLULAR_NETPROV_TELEFONICA);
REQUIRE(cellular_sim_to_network_provider_impl("214075555555555", nullptr) == CELLULAR_NETPROV_TELEFONICA);
Expand All @@ -97,6 +103,7 @@ TEST_CASE("Gen 2 cellular credentials") {
REQUIRE(cellular_sim_to_network_provider_impl("732123200003364", "89883234500011906351") == CELLULAR_NETPROV_TWILIO); // Twilio IMSI and Twilio ICCID
REQUIRE(cellular_sim_to_network_provider_impl("214070000000000", "89883235555555555555") == CELLULAR_NETPROV_TWILIO); // Kore IMSI and Twilio ICCID just in case
REQUIRE(cellular_sim_to_network_provider_impl("310410999999999", "89883071234567891011") == CELLULAR_NETPROV_TWILIO); // Kore IMSI and Twilio ICCID just in case
REQUIRE(cellular_sim_to_network_provider_impl("310030999999999", "89883071234567891011") == CELLULAR_NETPROV_TWILIO); // Kore IMSI and Twilio ICCID just in case
}
}

Expand Down Expand Up @@ -141,6 +148,12 @@ TEST_CASE("Gen 3 cellular credentials") {
auto creds = networkConfigForImsi(imsi, sizeof(imsi) - 1);
REQUIRE(creds.netProv() == CellularNetworkProvider::KORE_ATT);
}
SECTION("Kore ATT2") {
const char imsi[] = "310030900000000";
auto creds = networkConfigForImsi(imsi, sizeof(imsi) - 1);
REQUIRE(creds.netProv() == CellularNetworkProvider::KORE_ATT);
}

}

TEST_CASE("cellular_signal()") {
Expand Down
2 changes: 1 addition & 1 deletion test/unit_tests/services/simple_file_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ TEST_CASE("SimpleFileStorage") {
CHECK(buf[2] == 0);
}
SECTION("can read a record larger than the filesystem block") {
size_t n = FILESYSTEM_BLOCK_SIZE * 2;
const size_t n = FILESYSTEM_BLOCK_SIZE * 2;
auto d = test::randString(n);
std::string h(4, '\0');
h[0] = n & 0xff;
Expand Down