11
11
#include " netdispatcher.h"
12
12
#include " netlink.h"
13
13
#include " producerstatetable.h"
14
+ #include " producertable.h"
14
15
#include " portsyncd/linksync.h"
15
16
#include " subscriberstatetable.h"
16
17
#include " exec.h"
@@ -38,10 +39,11 @@ void usage()
38
39
cout << " use configDB data if not specified" << endl;
39
40
}
40
41
41
- void handlePortConfigFile (ProducerStateTable &p, string file);
42
- void handlePortConfigFromConfigDB (ProducerStateTable &p, DBConnector &cfgDb);
42
+ // TODO: find a common base class for ProducerTable and ProducerStateTable
43
+ void handlePortConfigFile (ProducerTable &p, string file);
44
+ void handlePortConfigFromConfigDB (ProducerTable &p, DBConnector &cfgDb);
43
45
void handleVlanIntfFile (string file);
44
- void handlePortConfig (ProducerStateTable &p, map<string, KeyOpFieldsValuesTuple> &port_cfg_map);
46
+ void handlePortConfig (ProducerTable &p, map<string, KeyOpFieldsValuesTuple> &port_cfg_map);
45
47
46
48
int main (int argc, char **argv)
47
49
{
@@ -69,7 +71,7 @@ int main(int argc, char **argv)
69
71
DBConnector cfgDb (CONFIG_DB, DBConnector::DEFAULT_UNIXSOCKET, 0 );
70
72
DBConnector appl_db (APPL_DB, DBConnector::DEFAULT_UNIXSOCKET, 0 );
71
73
DBConnector state_db (STATE_DB, DBConnector::DEFAULT_UNIXSOCKET, 0 );
72
- ProducerStateTable p (&appl_db, APP_PORT_TABLE_NAME);
74
+ ProducerTable p (&appl_db, APP_PORT_TABLE_NAME);
73
75
SubscriberStateTable portCfg (&cfgDb, CFG_PORT_TABLE_NAME);
74
76
75
77
LinkSync sync (&appl_db, &state_db);
@@ -157,15 +159,15 @@ int main(int argc, char **argv)
157
159
return 1 ;
158
160
}
159
161
160
- static void notifyPortConfigDone (ProducerStateTable &p)
162
+ static void notifyPortConfigDone (ProducerTable &p)
161
163
{
162
164
/* Notify that all ports added */
163
165
FieldValueTuple finish_notice (" count" , to_string (g_portSet.size ()));
164
166
vector<FieldValueTuple> attrs = { finish_notice };
165
167
p.set (" PortConfigDone" , attrs);
166
168
}
167
169
168
- void handlePortConfigFromConfigDB (ProducerStateTable &p, DBConnector &cfgDb)
170
+ void handlePortConfigFromConfigDB (ProducerTable &p, DBConnector &cfgDb)
169
171
{
170
172
cout << " Get port configuration from ConfigDB..." << endl;
171
173
@@ -188,7 +190,7 @@ void handlePortConfigFromConfigDB(ProducerStateTable &p, DBConnector &cfgDb)
188
190
notifyPortConfigDone (p);
189
191
}
190
192
191
- void handlePortConfigFile (ProducerStateTable &p, string file)
193
+ void handlePortConfigFile (ProducerTable &p, string file)
192
194
{
193
195
cout << " Read port configuration file..." << endl;
194
196
@@ -273,7 +275,7 @@ void handlePortConfigFile(ProducerStateTable &p, string file)
273
275
notifyPortConfigDone (p);
274
276
}
275
277
276
- void handlePortConfig (ProducerStateTable &p, map<string, KeyOpFieldsValuesTuple> &port_cfg_map)
278
+ void handlePortConfig (ProducerTable &p, map<string, KeyOpFieldsValuesTuple> &port_cfg_map)
277
279
{
278
280
279
281
auto it = port_cfg_map.begin ();
0 commit comments