Skip to content

Commit

Permalink
DELIA-65238 : Added connectivity monitoring in onInterfaceIPAddressCh…
Browse files Browse the repository at this point in the history
…anged

Reason for change: Fixed the test code for the code modification done in DELIA-65238
Test Procedure: Verify L1 test cases
Risks: Low
Priority: P1
Signed-off-by: Gururaaja ESR [email protected]
  • Loading branch information
Gururaaja E S R authored and Gururaaja E S R committed May 17, 2024
1 parent 62ca5cb commit 26d7ebc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
2 changes: 2 additions & 0 deletions Network/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ All notable changes to this RDK Service will be documented in this file.
### Added
- Added connectivity monitor in onInterfaceIPAddressChanged
- Removed connectivity monitor from InterfaceConnectionStatusChanged
### Fixed
- Fixed the L1 test case failure

## [1.3.10] - 2024-04-17
### Added
Expand Down
1 change: 0 additions & 1 deletion Network/Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,6 @@ typedef struct _IARM_BUS_NetSrvMgr_Iface_EventData_t {
}
connectivityMonitor.stopInitialConnectivityMonitoring();
}
connectivityMonitor.signalConnectivityMonitor();
}

void Network::onDefaultInterfaceChanged(string oldInterface, string newInterface)
Expand Down
22 changes: 4 additions & 18 deletions Tests/L1Tests/tests/test_Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1303,42 +1303,27 @@ TEST_F(NetworkInitializedEventTest, onInterfaceStatusChanged)
handler.Unsubscribe(0, _T("onInterfaceStatusChanged"), _T("org.rdk.Network"), message);
}

#if 0 /* Disabling temporarily */
TEST_F(NetworkInitializedEventTest, onConnectionStatusChanged)
{
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("setConnectivityTestEndpoints"), _T("{\"endpoints\": [\"http://localhost:8000\"]}"), response));
EXPECT_EQ(response, string("{\"success\":true}"));

Core::Event onInternetStatusChange(false, true);
EXPECT_CALL(service, Submit(::testing::_, ::testing::_))
.Times(2)
.Times(1)
.WillOnce(::testing::Invoke(
[&](const uint32_t, const Core::ProxyType<Core::JSON::IElement>& json) {
string text;
EXPECT_TRUE(json->ToString(text));
EXPECT_EQ(text, string(_T("{\"jsonrpc\":\"2.0\",\"method\":\"org.rdk.Network.onConnectionStatusChanged\",\"params\":{\"interface\":\"ETHERNET\",\"status\":\"CONNECTED\"}}")));
return Core::ERROR_NONE;
}))
.WillOnce(::testing::Invoke(
[&](const uint32_t, const Core::ProxyType<Core::JSON::IElement>& json) {
string text;
EXPECT_TRUE(json->ToString(text));
EXPECT_EQ(text, string(_T("{\"jsonrpc\":\"2.0\",\"method\":\"org.rdk.Network.onInternetStatusChange\",\"params\":{\"state\":0,\"status\":\"NO_INTERNET\"}}")));
onInternetStatusChange.SetEvent();
return Core::ERROR_NONE;
}));
}));

IARM_BUS_NetSrvMgr_Iface_EventInterfaceConnectionStatus_t intData;
intData.status = 1;
strcpy(intData.interface,"eth0");
handler.Subscribe(0, _T("onConnectionStatusChanged"), _T("org.rdk.Network"), message);
handler.Subscribe(0, _T("onInternetStatusChange"), _T("org.rdk.Network"), message);
plugin->eventHandler("NET_SRV_MGR", IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_CONNECTION_STATUS, static_cast<void*>(&intData), sizeof(intData));
handler.Unsubscribe(0, _T("onConnectionStatusChanged"), _T("org.rdk.Network"), message);
EXPECT_EQ(Core::ERROR_NONE, onInternetStatusChange.Lock());
handler.Unsubscribe(0, _T("onInternetStatusChange"), _T("org.rdk.Network"), message);
EXPECT_NE(Core::ERROR_GENERAL, handler.Invoke(connection, _T("stopConnectivityMonitoring"), _T("{}"), response));
EXPECT_EQ(response, string("{\"success\":true}"));
}

TEST_F(NetworkInitializedEventTest, onIPAddressStatusChanged)
Expand All @@ -1360,8 +1345,9 @@ TEST_F(NetworkInitializedEventTest, onIPAddressStatusChanged)
handler.Subscribe(0, _T("onIPAddressStatusChanged"), _T("org.rdk.Network"), message);
plugin->eventHandler("NET_SRV_MGR", IARM_BUS_NETWORK_MANAGER_EVENT_INTERFACE_IPADDRESS, static_cast<void*>(&intData), sizeof(intData));
handler.Unsubscribe(0, _T("onIPAddressStatusChanged"), _T("org.rdk.Network"), message);
EXPECT_NE(Core::ERROR_GENERAL, handler.Invoke(connection, _T("stopConnectivityMonitoring"), _T("{}"), response));
EXPECT_EQ(response, string("{\"success\":true}"));
}
#endif

TEST_F(NetworkInitializedEventTest, onDefaultInterfaceChanged)
{
Expand Down

0 comments on commit 26d7ebc

Please sign in to comment.