Refactor network manager#528
Refactor network manager#528MykolaSuperman wants to merge 6 commits intoaosedge:feature_release_9.1from
Conversation
529ffc6 to
f022560
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature_release_9.1 #528 +/- ##
=======================================================
- Coverage 85.27% 85.20% -0.08%
=======================================================
Files 311 309 -2
Lines 27931 27835 -96
Branches 3762 3732 -30
=======================================================
- Hits 23818 23716 -102
- Misses 4113 4119 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b90964f to
1aede72
Compare
| @@ -0,0 +1,75 @@ | |||
| /* | |||
| * Copyright (C) 2025 EPAM Systems, Inc. | |||
| /** | ||
| * Network provider interface (SM -> CM network service). | ||
| */ | ||
| class NetworkProviderItf { |
There was a problem hiding this comment.
Add unit test for this interface and network.md file that describes the purpose if this interfae.
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #ifndef AOS_CORE_COMMON_NETWORK_ITF_NETWORKPROVIDER_HPP_ |
There was a problem hiding this comment.
As it is part of networkmanager then it should be in networkmanager folder and networkmanager namespace.
|
|
||
| void Balancer::Init(InstanceManager& instanceManager, imagemanager::ItemInfoProviderItf& itemInfoProvider, | ||
| oci::OCISpecItf& ociSpec, NodeManager& nodeManager, MonitoringProviderItf& monitorProvider, | ||
| InstanceRunnerItf& runner, NetworkManager& networkManager) |
There was a problem hiding this comment.
Do launcher unit tests work after these changes?
src/core/common/types/network.hpp
Outdated
| StaticString<cSubnetLen> mSubnet; | ||
| StaticString<cIPLen> mIP; | ||
| uint64_t mVlanID {}; | ||
| struct NetworkServiceData { |
There was a problem hiding this comment.
We don't have services any more. Rename to UpdateItemNetworkParameters.
Shortcut parameters to params:
NetworkParams
InstanceNetworkParams
UpdateItemNetworkParamsCan InstanceNetworkParams have the following fields:
struct InstanceNetworkParams {
NetworkParams mNetworkParams;
StaticArray<StaticString<cIPLen>, cMaxNumDNSServers> mDNSServers;
StaticArray<FirewallRule, cMaxNumFirewallRules> mFirewallRules;
...?
| * @param networks network parameters. | ||
| * @return Error. | ||
| * @param period traffic period. | ||
| * @return Error |
| LOG_DBG() << "Update networks"; | ||
| LOG_DBG() << "Get system traffic"; | ||
|
|
||
| return AOS_ERROR_WRAP(mNetMonitor->GetSystemTraffic(inputTraffic, outputTraffic)); |
There was a problem hiding this comment.
Do not put operators in macro. It reduces readability.
| { | ||
| LOG_DBG() << "Get instance traffic" << Log::Field("instanceID", instanceID); | ||
|
|
||
| return AOS_ERROR_WRAP(mNetMonitor->GetInstanceTraffic(instanceID, inputTraffic, outputTraffic)); |
| */ | ||
| Error SetTrafficPeriod(TrafficPeriod period) override; | ||
|
|
||
| Error PrepareInstanceNetwork(const String& instanceID, const String& networkID, |
| Error PrepareInstanceNetwork(const String& instanceID, const String& networkID, | ||
| const InstanceNetworkParameters& instanceNetworkParameters, const NetworkServiceData& serviceData) override; | ||
|
|
||
| Error CleanupInstanceNetwork( |
1c36656 to
3c0f471
Compare
- NetworkParameters -> NetworkParams - InstanceNetworkParameters -> InstanceNetworkAllocation - UpdateNetworkParameters -> UpdateItemNetworkParams (NetworkServiceData) Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
c3523c3 to
3d896e4
Compare
| /** | ||
| * Instance network runtime parameters for Start (not stored in DB). | ||
| */ | ||
| struct InstanceNetworkRuntimeParameters { |
There was a problem hiding this comment.
InstanceNetworkRuntimeParams
57f1298 to
1a1bfd6
Compare
Add network provider interface for SM to communicate with CM for network allocation and release operations. Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
- Remove CM networkmanager module (moved to SM-driven model) - Update CM launcher to remove network management - Update smcontroller to use NetworkProviderItf Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Add types.hpp with: - InstanceNetworkConfig: network config for Create (stored in DB) - InstanceNetworkRuntimeParameters: runtime paths for Start Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Replace PrepareInstanceNetwork/CleanupInstanceNetwork with 4 methods: - CreateInstanceNetwork: CM allocation + DB (idempotent) - StartInstanceNetwork: physical setup from cached params - StopInstanceNetwork: physical cleanup, clears bridge/VLAN if last - ReleaseInstanceNetwork: DB + CM release, requires Stop first Key changes: - InstanceNetworkInfo extended with InstanceNetworkConfig and InstanceNetworkAllocation for offline Start after reboot - Init no longer removes instance network info from DB - Init no longer creates bridge/VLAN (deferred to Start) - EnsureNodeNetwork split into logical (CM) and physical parts - Thread-safe access to mInstanceNetworkInfos cache - networkID validation in Start/Stop/Release Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
- Update all NM tests to use Create+Start / Stop+Release - Add tests: networkID mismatch, Release without Stop, idempotent Create - Update NetworkManagerMock with 4 methods - Add NetworkProviderMock - Update launcher tests for new API Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
1a1bfd6 to
550fa1e
Compare
|



No description provided.