Skip to content

Commit 8439623

Browse files
committed
WIP
1 parent 39235c9 commit 8439623

File tree

6 files changed

+589
-536
lines changed

6 files changed

+589
-536
lines changed

include/ipfixprobe/input.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ class InputPlugin : public TelemetryUtils, public Plugin
6868
std::shared_ptr<telemetry::Directory> plugin_dir,
6969
std::shared_ptr<telemetry::Directory> queues_dir);
7070

71+
#ifdef WITH_CTT
72+
virtual std::pair<std::string, unsigned> get_ctt_config() const {
73+
throw PluginError("CTT is not supported by this input plugin");
74+
}
75+
#endif /* WITH_CTT */
76+
7177
protected:
7278
virtual void configure_telemetry_dirs(
7379
std::shared_ptr<telemetry::Directory> plugin_dir,

input/ndp.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,31 @@ void NdpPacketReader::init(const char *params)
9797
m_ctt_metadata = true;
9898
}
9999
init_ifc(parser.m_dev);
100+
m_device = parser.m_dev;
100101
}
101102

102103
void NdpPacketReader::close()
103104
{
104105
ndpReader.close();
105106
}
106107

108+
#ifdef WITH_CTT
109+
110+
std::pair<std::string, unsigned> NdpPacketReader::get_ctt_config() const
111+
{
112+
std::string dev = m_device;
113+
int channel_id = 0;
114+
std::size_t delimiter_found = m_device.find_last_of(":");
115+
if (delimiter_found != std::string::npos) {
116+
std::string channel_str = m_device.substr(delimiter_found + 1);
117+
dev = m_device.substr(0, delimiter_found);
118+
channel_id = std::stoi(channel_str);
119+
}
120+
return std::make_pair(dev, channel_id);
121+
}
122+
123+
#endif /* WITH_CTT */
124+
107125
void NdpPacketReader::init_ifc(const std::string &dev)
108126
{
109127
if (ndpReader.init_interface(dev) != 0) {

input/ndp.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ class NdpPacketReader : public InputPlugin
7373
std::shared_ptr<telemetry::Directory> plugin_dir,
7474
std::shared_ptr<telemetry::Directory> queues_dir) override;
7575

76+
#ifdef WITH_CTT
77+
virtual std::pair<std::string, unsigned> get_ctt_config() const override;
78+
#endif /* WITH_CTT */
79+
7680
private:
7781
struct RxStats {
7882
uint64_t receivedPackets;
@@ -87,6 +91,8 @@ class NdpPacketReader : public InputPlugin
8791

8892
bool m_ctt_metadata = false;
8993

94+
std::string m_device;
95+
9096
void init_ifc(const std::string &dev);
9197
int parse_ctt_metadata(const ndp_packet *ndp_packet, Metadata_CTT &ctt);
9298
};

ipfixprobe.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ bool process_plugin_args(ipxp_conf_t &conf, IpfixprobeOptParser &parser)
358358
if (storage_plugin == nullptr) {
359359
throw IPXPError("invalid storage plugin " + storage_name);
360360
}
361+
#ifdef WITH_CTT
362+
const auto& [device, comp_idx] = input_plugin->get_ctt_config();
363+
storage_plugin->set_ctt_config(device, comp_idx);
364+
#endif /* WITH_CTT */
361365
storage_plugin->set_queue(output_queue);
362366
storage_plugin->init(storage_params.c_str());
363367
storage_plugin->set_telemetry_dir(pipeline_queue_dir);

0 commit comments

Comments
 (0)