Skip to content

Commit

Permalink
controlplane: remove get_mac_address(). resolve neighbor in dataplane…
Browse files Browse the repository at this point in the history
… now
  • Loading branch information
Timur Aitov authored and taitov committed Feb 7, 2024
1 parent 43400d9 commit 31a5dae
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 33 deletions.
17 changes: 0 additions & 17 deletions controlplane/controlplane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,23 +259,6 @@ eResult cControlPlane::getPhysicalPortName(const tPortId& portId,
return eResult::invalidPortId;
}

std::optional<common::mac_address_t> cControlPlane::get_mac_address(const std::string& vrf,
const std::string& interface_name,
const common::ip_address_t& address)
{
std::lock_guard mac_addresses_lock(mac_addresses_mutex);

const auto key = std::make_tuple(vrf, interface_name, address);

auto it = mac_addresses.find(key);
if (it == mac_addresses.end())
{
it = mac_addresses.emplace_hint(it, key, system.getMacAddress(interface_name, address));
}

return it->second;
}

common::icp::getPhysicalPorts::response cControlPlane::getPhysicalPorts() const
{
common::icp::getPhysicalPorts::response response;
Expand Down
8 changes: 0 additions & 8 deletions controlplane/controlplane.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class cControlPlane
eResult reloadConfig();

eResult getPhysicalPortName(const tPortId& portId, std::string& name) const;
std::optional<common::mac_address_t> get_mac_address(const std::string& vrf, const std::string& interface_name, const common::ip_address_t& address);

template<typename T_function>
void register_command(const common::icp::requestType& type, const T_function& function)
Expand Down Expand Up @@ -196,12 +195,5 @@ class cControlPlane
/// used only in loadConfig()
controlplane::base_t base;

/// @todo: move to new module
std::mutex mac_addresses_mutex;
std::map<std::tuple<std::string, ///< vrf
std::string, ///< interface_name
common::ip_address_t>, ///< neighbor
std::optional<common::mac_address_t>>
mac_addresses;
void register_service(google::protobuf::Service* service);
};
8 changes: 0 additions & 8 deletions controlplane/route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,10 +777,6 @@ void route_t::compile_interface(common::idp::updateGlobalBase::request& globalba
{
neighbor_mac_address_v4 = *interface.static_neighbor_mac_address_v4;
}
else
{
neighbor_mac_address_v4 = controlPlane->get_mac_address(route.vrf, interface_name, *interface.neighborIPv4Address);
}
}

if (interface.neighborIPv6Address)
Expand All @@ -789,10 +785,6 @@ void route_t::compile_interface(common::idp::updateGlobalBase::request& globalba
{
neighbor_mac_address_v6 = *interface.static_neighbor_mac_address_v6;
}
else
{
neighbor_mac_address_v6 = controlPlane->get_mac_address(route.vrf, interface_name, *interface.neighborIPv6Address);
}
}

if (neighbor_mac_address_v4)
Expand Down

0 comments on commit 31a5dae

Please sign in to comment.