Skip to content
Closed
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
3 changes: 3 additions & 0 deletions agent-ovs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ libopflex_agent_la_include_HEADERS = \
lib/include/opflexagent/FSPacketDropLogConfigSource.h \
lib/include/opflexagent/PacketDropLogConfig.h \
lib/include/opflexagent/Faults.h \
lib/include/opflexagent/EventNotificationManager.h \
lib/include/opflexagent/PrometheusManager.h

noinst_HEADERS = \
Expand Down Expand Up @@ -231,6 +232,7 @@ libopflex_agent_la_SOURCES = \
lib/SnatSource.cpp \
lib/FSNetpolSource.cpp \
lib/FSPacketDropLogConfigSource.cpp \
lib/EventNotificationManager.cpp \
lib/AgentPrometheusManager.cpp

libopflex_agent_la_LDFLAGS = -shared -version-info ${VERSION_INFO}
Expand Down Expand Up @@ -483,6 +485,7 @@ agent_test_SOURCES = \
lib/test/SnatManager_test.cpp \
lib/test/QosManager_test.cpp \
lib/test/FaultManager_test.cpp \
lib/test/EventNotificationManager_test.cpp \
server/test/AgentStats_test.cpp \
server/ServerPrometheusManager.cpp \
cmd/test/agent_test.cpp
Expand Down
21 changes: 20 additions & 1 deletion agent-ovs/lib/Agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ Agent::Agent(OFFramework& framework_, const LogParams& _logParams)
endpointManager(*this, framework, policyManager, prometheusManager),
serviceManager(*this, framework, prometheusManager),
extraConfigManager(framework),
notifServer(agent_io),rendererFwdMode(opflex_elem_t::INVALID_MODE),
notifServer(agent_io),
eventNotificationManager(*this, ""),
rendererFwdMode(opflex_elem_t::INVALID_MODE),
faultManager(*this, framework),
sysStatsManager(this),
started(false), presetFwdMode(opflex_elem_t::INVALID_MODE),
Expand Down Expand Up @@ -155,6 +157,7 @@ void Agent::setProperties(const boost::property_tree::ptree& properties) {
static const std::string NETPOL_SOURCE_PATH("netpol-sources.filesystem");
static const std::string DROP_LOG_CFG_SOURCE_FSPATH("drop-log-config-sources.filesystem");
static const std::string FAULT_SOURCE_FSPATH("host-agent-fault-sources.filesystem");
static const std::string EVENT_NOTIFICATION_DIR("event-notifications.filesystem");
static const std::string PACKET_EVENT_NOTIF_SOCK("packet-event-notif.socket-name");
static const std::string OPFLEX_PEERS("opflex.peers");
static const std::string OPFLEX_SSL_MODE("opflex.ssl.mode");
Expand Down Expand Up @@ -358,6 +361,13 @@ void Agent::setProperties(const boost::property_tree::ptree& properties) {
hostAgentFaultPaths.insert(v.second.data());
}

optional<string> eventNotificationDir =
properties.get_optional<string>(EVENT_NOTIFICATION_DIR);
if (eventNotificationDir) {
eventNotificationPath = eventNotificationDir.get();
eventNotificationManager.setEventsDirectory(eventNotificationPath);
}

optional<const ptree&> packetEventNotifSock =
properties.get_child_optional(PACKET_EVENT_NOTIF_SOCK);

Expand Down Expand Up @@ -766,6 +776,11 @@ void Agent::start() {
new FSFaultSource(&faultManager, fsWatcher, path, *this);
faultSources.emplace_back(source);
}

if (!eventNotificationPath.empty()) {
eventNotificationManager.start();
}

fsWatcher.start();

for (const host_t& h : opflexPeers)
Expand Down Expand Up @@ -826,6 +841,10 @@ void Agent::stop() {
} catch (const std::runtime_error& e) {
LOG(WARNING) << "failed to stop fswatcher: " << e.what();
}

if (!eventNotificationPath.empty()) {
eventNotificationManager.stop();
}

notifServer.stop();
endpointManager.stop();
Expand Down
1 change: 1 addition & 0 deletions agent-ovs/lib/EndpointManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,7 @@ void EndpointManager::configUpdated(const URI& uri) {
if (!config) {
LOG(WARNING) << "Platform config has been deleted. Disconnect from existing peers and fallback to configured list";
agent.updateResetTime();
agent.getEventNotificationManager().handlePlatformConfigDeleted(uri);
framework.resetAllUnconfiguredPeers();
}
}
Expand Down
Loading