Skip to content
Open
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 cli/bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ inline std::vector<bus_request_info> get_bus_requests(common::sdp::DataPlaneInSh
{common::idp::requestType::dump_physical_port, "dump_physical_port"},
{common::idp::requestType::balancer_state_clear, "balancer_state_clear"},
{common::idp::requestType::neighbor_show, "neighbor_show"},
{common::idp::requestType::neighbor_show_cache, "neighbor_show_cache"},
{common::idp::requestType::neighbor_insert, "neighbor_insert"},
{common::idp::requestType::neighbor_remove, "neighbor_remove"},
{common::idp::requestType::neighbor_clear, "neighbor_clear"},
Expand Down
1 change: 1 addition & 0 deletions cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ std::vector<std::tuple<std::string,
{"route counters", "", [](const auto& args) { Call(route::counters, args); }},
{"route tunnel counters", "", [](const auto& args) { Call(route::tunnel::counters, args); }},
{"neighbor show", "", [](const auto& args) { Call(neighbor::show, args); }},
{"neighbor show cache", "", [](const auto& args) { Call(neighbor::show_cache, args); }},
{"neighbor insert", "[route_name] [interface_name] [ip_address] [mac_address]", [](const auto& args) { Call(neighbor::insert, args); }},
{"neighbor remove", "[route_name] [interface_name] [ip_address]", [](const auto& args) { Call(neighbor::remove, args); }},
{"neighbor flush", "", [](const auto& args) { Call(neighbor::flush, args); }},
Expand Down
12 changes: 12 additions & 0 deletions cli/neighbor.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ void show()

FillAndPrintTable({"route_name",
"interface_name",
"ip_address",
"mac_address"},
response,
{.optional_null = "static"});
}

void show_cache()
{
interface::dataPlane dataplane;
const auto response = dataplane.neighbor_show_cache();

FillAndPrintTable({"interface_name",
"ip_address",
"mac_address",
"last_update",
Expand Down
10 changes: 10 additions & 0 deletions common/idataplane.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ class dataPlane
return get<common::idp::requestType::neighbor_show, common::idp::neighbor_show::response>();
}

auto neighbor_show_cache() const
{
return get<common::idp::requestType::neighbor_show_cache, common::idp::neighbor_show_cache::response>();
}

auto neighbor_insert(const common::idp::neighbor_insert::request& request) const
{
return get<common::idp::requestType::neighbor_insert, eResult>(request);
Expand Down Expand Up @@ -250,6 +255,11 @@ class dataPlane
return get<common::idp::requestType::memory_manager_stats, common::idp::memory_manager_stats::response>();
}

auto neighbor_interfaces_switch() const
{
return get<common::idp::requestType::neighbor_interfaces_switch, eResult>();
}

protected:
void connectToDataPlane() const
{
Expand Down
12 changes: 12 additions & 0 deletions common/idp.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ enum class requestType : uint32_t
dump_physical_port,
balancer_state_clear,
neighbor_show,
neighbor_show_cache,
neighbor_insert,
neighbor_remove,
neighbor_clear,
Expand All @@ -82,6 +83,7 @@ enum class requestType : uint32_t
neighbor_stats,
memory_manager_update,
memory_manager_stats,
neighbor_interfaces_switch,
size, // size should always be at the bottom of the list, this enum allows us to find out the size of the enum list
};

Expand Down Expand Up @@ -965,6 +967,15 @@ namespace neighbor_show
{
using entry = std::tuple<std::string, ///< route_name
std::string, ///< interface_name
ip_address_t, ///< ip_address
mac_address_t>; ///< mac_address

using response = std::vector<entry>;
}

namespace neighbor_show_cache
{
using entry = std::tuple<std::string, ///< interface_name
ip_address_t, ///< ip_address
mac_address_t, ///< mac_address
std::optional<uint32_t>, ///< last_update_timestamp
Expand Down Expand Up @@ -1068,6 +1079,7 @@ using response = std::variant<std::tuple<>,
get_shm_info::response,
get_shm_tsc_info::response,
neighbor_show::response,
neighbor_show_cache::response,
neighbor_stats::response,
memory_manager_stats::response>;
}
1 change: 1 addition & 0 deletions controlplane/route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,7 @@ void route_t::reload_after()
generations.switch_generation();
generations_neighbors.next_unlock();
generations.next_unlock();
dataplane.neighbor_interfaces_switch();
}

void route_t::prefix_flush_prefixes(common::idp::updateGlobalBase::request& globalbase)
Expand Down
8 changes: 8 additions & 0 deletions dataplane/bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ void cBus::clientThread(int clientSocket)
{
response = dataPlane->neighbor.neighbor_show();
}
else if (type == common::idp::requestType::neighbor_show_cache)
{
response = dataPlane->neighbor.neighbor_show_cache();
}
else if (type == common::idp::requestType::neighbor_insert)
{
response = dataPlane->neighbor.neighbor_insert(std::get<common::idp::neighbor_insert::request>(std::get<1>(request)));
Expand Down Expand Up @@ -350,6 +354,10 @@ void cBus::clientThread(int clientSocket)
{
response = dataPlane->memory_manager.memory_manager_stats();
}
else if (type == common::idp::requestType::neighbor_interfaces_switch)
{
response = dataPlane->neighbor.neighbor_interfaces_switch();
}
else
{
stats.errors[(uint32_t)common::idp::errorType::busParse]++;
Expand Down
1 change: 1 addition & 0 deletions dataplane/controlplane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ common::idp::updateGlobalBase::response cControlPlane::updateGlobalBase(const co
{
return result;
}
dataPlane->neighbor.UpdateFromCache(false, true);

DEBUG_LATCH_WAIT(common::idp::debug_latch_update::id::global_base_switch);

Expand Down
Loading