5
5
#include " observer.h"
6
6
#include " portsorch.h"
7
7
8
+ enum FdbOrigin
9
+ {
10
+ FDB_ORIGIN_INVALID = 0 ,
11
+ FDB_ORIGIN_LEARN = 1 ,
12
+ FDB_ORIGIN_PROVISIONED = 2 ,
13
+ FDB_ORIGIN_VXLAN_ADVERTIZED = 4
14
+ };
15
+
8
16
struct FdbEntry
9
17
{
10
18
MacAddress mac;
@@ -15,12 +23,17 @@ struct FdbEntry
15
23
{
16
24
return tie (mac, bv_id) < tie (other.mac , other.bv_id );
17
25
}
26
+ bool operator ==(const FdbEntry& other) const
27
+ {
28
+ return tie (mac, bv_id) == tie (other.mac , other.bv_id );
29
+ }
18
30
};
19
31
20
32
struct FdbUpdate
21
33
{
22
34
FdbEntry entry;
23
35
Port port;
36
+ string type;
24
37
bool add;
25
38
};
26
39
@@ -30,10 +43,35 @@ struct FdbFlushUpdate
30
43
Port port;
31
44
};
32
45
33
- struct SavedFdbEntry
46
+ struct FdbData
34
47
{
35
- FdbEntry entry ;
48
+ sai_object_id_t bridge_port_id ;
36
49
string type;
50
+ FdbOrigin origin;
51
+ /* *
52
+ {"dynamic", FDB_ORIGIN_LEARN} => dynamically learnt
53
+ {"dynamic", FDB_ORIGIN_PROVISIONED} => provisioned dynamic with swssconfig in APPDB
54
+ {"dynamic", FDB_ORIGIN_ADVERTIZED} => synced from remote device e.g. BGP MAC route
55
+ {"static", FDB_ORIGIN_LEARN} => Invalid
56
+ {"static", FDB_ORIGIN_PROVISIONED} => statically provisioned
57
+ {"static", FDB_ORIGIN_ADVERTIZED} => sticky synced from remote device
58
+ */
59
+
60
+ /* Remote FDB related info */
61
+ string remote_ip;
62
+ string esi;
63
+ unsigned int vni;
64
+ };
65
+
66
+ struct SavedFdbEntry
67
+ {
68
+ MacAddress mac;
69
+ unsigned short vlanId;
70
+ FdbData fdbData;
71
+ bool operator ==(const SavedFdbEntry& other) const
72
+ {
73
+ return tie (mac, vlanId) == tie (other.mac , other.vlanId );
74
+ }
37
75
};
38
76
39
77
typedef unordered_map<string, vector<SavedFdbEntry>> fdb_entries_by_port_t ;
@@ -42,7 +80,7 @@ class FdbOrch: public Orch, public Subject, public Observer
42
80
{
43
81
public:
44
82
45
- FdbOrch (TableConnector applDbConnector, TableConnector stateDbConnector , PortsOrch *port);
83
+ FdbOrch (DBConnector* applDbConnector, vector< table_name_with_pri_t > appFdbTables, TableConnector stateDbFdbConnector , PortsOrch *port);
46
84
47
85
~FdbOrch ()
48
86
{
@@ -53,15 +91,19 @@ class FdbOrch: public Orch, public Subject, public Observer
53
91
void update (sai_fdb_event_t , const sai_fdb_entry_t *, sai_object_id_t );
54
92
void update (SubjectType type, void *cntx);
55
93
bool getPort (const MacAddress&, uint16_t , Port&);
94
+
95
+ bool removeFdbEntry (const FdbEntry& entry, FdbOrigin origin=FDB_ORIGIN_PROVISIONED);
96
+
97
+ static const int fdborch_pri;
56
98
void flushFDBEntries (sai_object_id_t bridge_port_oid,
57
99
sai_object_id_t vlan_oid);
58
100
void notifyObserversFDBFlush (Port &p, sai_object_id_t &);
59
101
60
102
private:
61
103
PortsOrch *m_portsOrch;
62
- set <FdbEntry> m_entries;
104
+ map <FdbEntry, FdbData > m_entries;
63
105
fdb_entries_by_port_t saved_fdb_entries;
64
- Table m_table ;
106
+ vector< Table*> m_appTables ;
65
107
Table m_fdbStateTable;
66
108
NotificationConsumer* m_flushNotificationsConsumer;
67
109
NotificationConsumer* m_fdbNotificationConsumer;
@@ -71,9 +113,12 @@ class FdbOrch: public Orch, public Subject, public Observer
71
113
72
114
void updateVlanMember (const VlanMemberUpdate&);
73
115
void updatePortOperState (const PortOperStateUpdate&);
74
- bool addFdbEntry (const FdbEntry&, const string&);
75
- bool removeFdbEntry (const FdbEntry&);
116
+
117
+ bool addFdbEntry (const FdbEntry&, const string&, FdbData fdbData);
118
+ void deleteFdbEntryFromSavedFDB (const MacAddress &mac, const unsigned short &vlanId, FdbOrigin origin, const string portName=" " );
119
+
76
120
bool storeFdbEntryState (const FdbUpdate& update);
121
+ void notifyTunnelOrch (Port& port);
77
122
};
78
123
79
124
#endif /* SWSS_FDBORCH_H */
0 commit comments