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 LLDP configuration support #167

Merged
merged 1 commit into from
Jan 7, 2025
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
16 changes: 16 additions & 0 deletions src/network_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ void Manager::createInterface(const AllIntfInfo& info, bool enabled)
auto ptr = intf.get();
interfaces.insert_or_assign(*info.intf.name, std::move(intf));
interfacesByIdx.insert_or_assign(info.intf.idx, ptr);
loadDefaultLLDPConfig();
}

void Manager::addInterface(const InterfaceInfo& info)
Expand Down Expand Up @@ -529,6 +530,21 @@ void Manager::handleAdminState(std::string_view state, unsigned ifidx)
}
}

void Manager::loadDefaultLLDPConfig()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name is loadDefaultLLDPConfig or storeDefaultLLDPConfig?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basically its updating lldp config file with default config during network daemon start

{
std::ofstream lldpdConfig(lldpFilePath);

lldpdConfig << "configure system description BMC" << std::endl;

for (const auto& intf : interfaces)
{
lldpdConfig << "configure ports " << intf.second->interfaceName()
<< " lldp status disabled" << std::endl;
}

lldpdConfig.close();
}

void Manager::writeLLDPDConfigurationFile()
{
std::ofstream lldpdConfig(lldpFilePath);
Expand Down
4 changes: 4 additions & 0 deletions src/network_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ class Manager : public ManagerIface
*/
void reloadLLDPService();

/** Load default LLDP configuration
*/
void loadDefaultLLDPConfig();

/** @brief Persistent map of EthernetInterface dbus objects and their names
*/
stdplus::string_umap<std::unique_ptr<EthernetInterface>> interfaces;
Expand Down