1111#include " netdispatcher.h"
1212#include " netlink.h"
1313#include " producerstatetable.h"
14+ #include " producertable.h"
1415#include " portsyncd/linksync.h"
1516#include " subscriberstatetable.h"
1617#include " exec.h"
@@ -38,10 +39,11 @@ void usage()
3839 cout << " use configDB data if not specified" << endl;
3940}
4041
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);
4345void 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);
4547
4648int main (int argc, char **argv)
4749{
@@ -69,7 +71,7 @@ int main(int argc, char **argv)
6971 DBConnector cfgDb (CONFIG_DB, DBConnector::DEFAULT_UNIXSOCKET, 0 );
7072 DBConnector appl_db (APPL_DB, DBConnector::DEFAULT_UNIXSOCKET, 0 );
7173 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);
7375 SubscriberStateTable portCfg (&cfgDb, CFG_PORT_TABLE_NAME);
7476
7577 LinkSync sync (&appl_db, &state_db);
@@ -157,15 +159,15 @@ int main(int argc, char **argv)
157159 return 1 ;
158160}
159161
160- static void notifyPortConfigDone (ProducerStateTable &p)
162+ static void notifyPortConfigDone (ProducerTable &p)
161163{
162164 /* Notify that all ports added */
163165 FieldValueTuple finish_notice (" count" , to_string (g_portSet.size ()));
164166 vector<FieldValueTuple> attrs = { finish_notice };
165167 p.set (" PortConfigDone" , attrs);
166168}
167169
168- void handlePortConfigFromConfigDB (ProducerStateTable &p, DBConnector &cfgDb)
170+ void handlePortConfigFromConfigDB (ProducerTable &p, DBConnector &cfgDb)
169171{
170172 cout << " Get port configuration from ConfigDB..." << endl;
171173
@@ -188,7 +190,7 @@ void handlePortConfigFromConfigDB(ProducerStateTable &p, DBConnector &cfgDb)
188190 notifyPortConfigDone (p);
189191}
190192
191- void handlePortConfigFile (ProducerStateTable &p, string file)
193+ void handlePortConfigFile (ProducerTable &p, string file)
192194{
193195 cout << " Read port configuration file..." << endl;
194196
@@ -273,7 +275,7 @@ void handlePortConfigFile(ProducerStateTable &p, string file)
273275 notifyPortConfigDone (p);
274276}
275277
276- void handlePortConfig (ProducerStateTable &p, map<string, KeyOpFieldsValuesTuple> &port_cfg_map)
278+ void handlePortConfig (ProducerTable &p, map<string, KeyOpFieldsValuesTuple> &port_cfg_map)
277279{
278280
279281 auto it = port_cfg_map.begin ();
0 commit comments