@@ -16,7 +16,7 @@ swss::Select swssSelect;
16
16
*
17
17
* @return none
18
18
*/
19
- void initialize_swss (std::vector< relay_config> * vlans)
19
+ void initialize_swss (std::unordered_map<std::string, relay_config> & vlans)
20
20
{
21
21
try {
22
22
std::shared_ptr<swss::DBConnector> configDbPtr = std::make_shared<swss::DBConnector> (" CONFIG_DB" , 0 );
@@ -48,13 +48,14 @@ void deinitialize_swss()
48
48
49
49
50
50
/* *
51
- * @code void get_dhcp(std::vector< relay_config> * vlans)
51
+ * @code void get_dhcp(std::unordered_map<std::string, relay_config> vlans)
52
52
*
53
53
* @brief initialize and get vlan table information from DHCP_RELAY
54
54
*
55
55
* @return none
56
56
*/
57
- void get_dhcp (std::vector<relay_config> *vlans, swss::SubscriberStateTable *ipHelpersTable) {
57
+ void get_dhcp (std::unordered_map<std::string, relay_config> &vlans, swss::SubscriberStateTable *ipHelpersTable)
58
+ {
58
59
swss::Selectable *selectable;
59
60
int ret = swssSelect.select (&selectable, DEFAULT_TIMEOUT_MSEC);
60
61
if (ret == swss::Select::ERROR) {
@@ -70,7 +71,7 @@ void get_dhcp(std::vector<relay_config> *vlans, swss::SubscriberStateTable *ipHe
70
71
*
71
72
* @brief main thread for handling SWSS notification
72
73
*
73
- * @param context list of vlans/argument config that contains strings of server and option
74
+ * @param context map of vlans/argument config that contains strings of server and option
74
75
*
75
76
* @return none
76
77
*/
@@ -82,16 +83,16 @@ void handleSwssNotification(swssNotification test)
82
83
}
83
84
84
85
/* *
85
- * @code void handleRelayNotification(swss::SubscriberStateTable &ipHelpersTable, std::vector< relay_config> * vlans)
86
+ * @code void handleRelayNotification(swss::SubscriberStateTable &ipHelpersTable, std::unordered_map<std::string, relay_config> & vlans)
86
87
*
87
88
* @brief handles DHCPv6 relay configuration change notification
88
89
*
89
90
* @param ipHelpersTable DHCP table
90
- * @param vlans list of vlans/argument config that contains strings of server and option
91
+ * @param vlans map of vlans/argument config that contains strings of server and option
91
92
*
92
93
* @return none
93
94
*/
94
- void handleRelayNotification (swss::SubscriberStateTable &ipHelpersTable, std::vector< relay_config> * vlans)
95
+ void handleRelayNotification (swss::SubscriberStateTable &ipHelpersTable, std::unordered_map<std::string, relay_config> & vlans)
95
96
{
96
97
std::deque<swss::KeyOpFieldsValuesTuple> entries;
97
98
@@ -100,16 +101,16 @@ void handleRelayNotification(swss::SubscriberStateTable &ipHelpersTable, std::ve
100
101
}
101
102
102
103
/* *
103
- * @code void processRelayNotification(std::deque<swss::KeyOpFieldsValuesTuple> &entries, std::vector< relay_config> * vlans)
104
+ * @code void processRelayNotification(std::deque<swss::KeyOpFieldsValuesTuple> &entries, std::unordered_map<std::string, relay_config> vlans)
104
105
*
105
106
* @brief process DHCPv6 relay servers and options configuration change notification
106
107
*
107
108
* @param entries queue of std::tuple<std::string, std::string, std::vector<FieldValueTuple>> entries in DHCP table
108
- * @param vlans list of vlans/argument config that contains strings of server and option
109
+ * @param vlans map of vlans/argument config that contains strings of server and option
109
110
*
110
111
* @return none
111
112
*/
112
- void processRelayNotification (std::deque<swss::KeyOpFieldsValuesTuple> &entries, std::vector< relay_config> * vlans)
113
+ void processRelayNotification (std::deque<swss::KeyOpFieldsValuesTuple> &entries, std::unordered_map<std::string, relay_config> & vlans)
113
114
{
114
115
std::vector<std::string> servers;
115
116
@@ -143,7 +144,9 @@ void processRelayNotification(std::deque<swss::KeyOpFieldsValuesTuple> &entries,
143
144
intf.is_interface_id = true ;
144
145
}
145
146
}
146
- vlans->push_back (intf);
147
+ syslog (LOG_INFO, " add %s relay config, option79 %s interface-id %s\n " , vlan.c_str (),
148
+ intf.is_option_79 ? " enable" : " disable" , intf.is_interface_id ? " enable" : " disable" );
149
+ vlans[vlan] = intf;
147
150
}
148
151
}
149
152
0 commit comments