forked from sonic-net/sonic-sairedis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotificationFactory.cpp
More file actions
43 lines (32 loc) · 1.68 KB
/
NotificationFactory.cpp
File metadata and controls
43 lines (32 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "NotificationFactory.h"
#include "NotificationFdbEvent.h"
#include "NotificationNatEvent.h"
#include "NotificationPortStateChange.h"
#include "NotificationQueuePfcDeadlock.h"
#include "NotificationSwitchShutdownRequest.h"
#include "NotificationSwitchStateChange.h"
#include "NotificationBfdSessionStateChange.h"
#include "sairediscommon.h"
#include "swss/logger.h"
using namespace sairedis;
std::shared_ptr<Notification> NotificationFactory::deserialize(
_In_ const std::string& name,
_In_ const std::string& serializedNotification)
{
SWSS_LOG_ENTER();
if (name == SAI_SWITCH_NOTIFICATION_NAME_FDB_EVENT)
return std::make_shared<NotificationFdbEvent>(serializedNotification);
if (name == SAI_SWITCH_NOTIFICATION_NAME_NAT_EVENT)
return std::make_shared<NotificationNatEvent>(serializedNotification);
if (name == SAI_SWITCH_NOTIFICATION_NAME_PORT_STATE_CHANGE)
return std::make_shared<NotificationPortStateChange>(serializedNotification);
if (name == SAI_SWITCH_NOTIFICATION_NAME_QUEUE_PFC_DEADLOCK)
return std::make_shared<NotificationQueuePfcDeadlock>(serializedNotification);
if (name == SAI_SWITCH_NOTIFICATION_NAME_SWITCH_SHUTDOWN_REQUEST)
return std::make_shared<NotificationSwitchShutdownRequest>(serializedNotification);
if (name == SAI_SWITCH_NOTIFICATION_NAME_SWITCH_STATE_CHANGE)
return std::make_shared<NotificationSwitchStateChange>(serializedNotification);
if (name == SAI_SWITCH_NOTIFICATION_NAME_BFD_SESSION_STATE_CHANGE)
return std::make_shared<NotificationBfdSessionStateChange>(serializedNotification);
SWSS_LOG_THROW("unknown notification: '%s', FIXME", name.c_str());
}