-
Notifications
You must be signed in to change notification settings - Fork 686
[portsorch] fix PortsOrch::allPortsReady() returns true when it should not #1103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8c005c6
2be41b4
9912333
59ad10b
c3fd43c
50bc218
bb345ba
39c950b
6a2073b
51c230e
86b45eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ CFLAGS_SAI = -I /usr/include/sai | |
|
|
||
| TESTS = tests | ||
|
|
||
| SUBDIRS = mock_tests | ||
|
|
||
| noinst_PROGRAMS = tests | ||
|
|
||
| if DEBUG | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| tests |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| CFLAGS_SAI = -I /usr/include/sai | ||
|
|
||
| bin_PROGRAMS = tests | ||
| TESTS = tests | ||
|
|
||
| noinst_PROGRAMS = tests | ||
|
|
||
| LDADD_SAI = -lsaimeta -lsaimetadata -lsaivs -lsairedis | ||
|
|
||
|
|
@@ -13,42 +15,48 @@ endif | |
| CFLAGS_GTEST = | ||
| LDADD_GTEST = -L/usr/src/gtest | ||
|
|
||
| tests_SOURCES = swssnet_ut.cpp request_parser_ut.cpp aclorch_ut.cpp saispy_ut.cpp \ | ||
| tests_SOURCES = aclorch_ut.cpp \ | ||
| portsorch_ut.cpp \ | ||
| saispy_ut.cpp \ | ||
| ut_saihelper.cpp \ | ||
| mock_orchagent_main.cpp \ | ||
| mock_dbconnector.cpp \ | ||
| mock_consumerstatetable.cpp \ | ||
| mock_table.cpp \ | ||
| mock_hiredis.cpp \ | ||
| mock_redisreply.cpp \ | ||
| ../orchagent/orchdaemon.cpp \ | ||
| ../orchagent/orch.cpp \ | ||
| ../orchagent/notifications.cpp \ | ||
| ../orchagent/routeorch.cpp \ | ||
| ../orchagent/neighorch.cpp \ | ||
| ../orchagent/intfsorch.cpp \ | ||
| ../orchagent/portsorch.cpp \ | ||
| ../orchagent/copporch.cpp \ | ||
| ../orchagent/tunneldecaporch.cpp \ | ||
| ../orchagent/qosorch.cpp \ | ||
| ../orchagent/bufferorch.cpp \ | ||
| ../orchagent/mirrororch.cpp \ | ||
| ../orchagent/fdborch.cpp \ | ||
| ../orchagent/aclorch.cpp \ | ||
| ../orchagent/saihelper.cpp \ | ||
| ../orchagent/switchorch.cpp \ | ||
| ../orchagent/pfcwdorch.cpp \ | ||
| ../orchagent/pfcactionhandler.cpp \ | ||
| ../orchagent/policerorch.cpp \ | ||
| ../orchagent/crmorch.cpp \ | ||
| ../orchagent/request_parser.cpp \ | ||
| ../orchagent/vrforch.cpp \ | ||
| ../orchagent/countercheckorch.cpp \ | ||
| ../orchagent/vxlanorch.cpp \ | ||
| ../orchagent/vnetorch.cpp \ | ||
| ../orchagent/dtelorch.cpp \ | ||
| ../orchagent/flexcounterorch.cpp \ | ||
| ../orchagent/watermarkorch.cpp | ||
| $(top_srcdir)/orchagent/orchdaemon.cpp \ | ||
| $(top_srcdir)/orchagent/orch.cpp \ | ||
| $(top_srcdir)/orchagent/notifications.cpp \ | ||
| $(top_srcdir)/orchagent/routeorch.cpp \ | ||
| $(top_srcdir)/orchagent/neighorch.cpp \ | ||
| $(top_srcdir)/orchagent/intfsorch.cpp \ | ||
| $(top_srcdir)/orchagent/portsorch.cpp \ | ||
| $(top_srcdir)/orchagent/copporch.cpp \ | ||
| $(top_srcdir)/orchagent/tunneldecaporch.cpp \ | ||
| $(top_srcdir)/orchagent/qosorch.cpp \ | ||
| $(top_srcdir)/orchagent/bufferorch.cpp \ | ||
| $(top_srcdir)/orchagent/mirrororch.cpp \ | ||
| $(top_srcdir)/orchagent/fdborch.cpp \ | ||
| $(top_srcdir)/orchagent/aclorch.cpp \ | ||
| $(top_srcdir)/orchagent/saihelper.cpp \ | ||
| $(top_srcdir)/orchagent/switchorch.cpp \ | ||
| $(top_srcdir)/orchagent/pfcwdorch.cpp \ | ||
| $(top_srcdir)/orchagent/pfcactionhandler.cpp \ | ||
| $(top_srcdir)/orchagent/policerorch.cpp \ | ||
| $(top_srcdir)/orchagent/crmorch.cpp \ | ||
| $(top_srcdir)/orchagent/request_parser.cpp \ | ||
| $(top_srcdir)/orchagent/vrforch.cpp \ | ||
| $(top_srcdir)/orchagent/countercheckorch.cpp \ | ||
| $(top_srcdir)/orchagent/vxlanorch.cpp \ | ||
| $(top_srcdir)/orchagent/vnetorch.cpp \ | ||
| $(top_srcdir)/orchagent/dtelorch.cpp \ | ||
| $(top_srcdir)/orchagent/flexcounterorch.cpp \ | ||
| $(top_srcdir)/orchagent/watermarkorch.cpp \ | ||
| $(top_srcdir)/orchagent/chassisorch.cpp \ | ||
| $(top_srcdir)/orchagent/sfloworch.cpp | ||
|
Comment on lines
+28
to
+57
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @stepanblyschak @Pterosaur @nazariig @lguohan please make orchagent as library *.la, it will be one file, orchagent is already compiled, and here in tests you are compiling it again, which is twice the same compilation, it extend compilation time twice !, now it takes 19 minutes to compile and using it as a lib it could take 10 min |
||
|
|
||
| tests_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI) | ||
| tests_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI) -I../orchagent | ||
| tests_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_SAI) -I$(top_srcdir)/orchagent | ||
| tests_LDADD = $(LDADD_GTEST) $(LDADD_SAI) -lnl-genl-3 -lhiredis -lhiredis -lpthread \ | ||
| -lswsscommon -lswsscommon -lgtest -lgtest_main | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,4 +7,4 @@ namespace swss | |
| TableName_KeySet(tableName) | ||
| { | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,6 @@ namespace swss | |
|
|
||
| int DBConnector::getDbId() const | ||
| { | ||
| return 12345; | ||
| return m_dbId; | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #pragma once | ||
|
|
||
| #include "orch.h" | ||
| #include "switchorch.h" | ||
| #include "crmorch.h" | ||
| #include "portsorch.h" | ||
| #include "routeorch.h" | ||
| #include "intfsorch.h" | ||
| #include "neighorch.h" | ||
| #include "fdborch.h" | ||
| #include "mirrororch.h" | ||
| #include "bufferorch.h" | ||
| #include "vrforch.h" | ||
| #include "vnetorch.h" | ||
| #include "vxlanorch.h" | ||
| #include "policerorch.h" | ||
|
|
||
| extern int gBatchSize; | ||
| extern bool gSwssRecord; | ||
| extern bool gSairedisRecord; | ||
| extern bool gLogRotate; | ||
| extern ofstream gRecordOfs; | ||
| extern string gRecordFile; | ||
|
|
||
| extern MacAddress gMacAddress; | ||
| extern MacAddress gVxlanMacAddress; | ||
|
|
||
| extern sai_object_id_t gSwitchId; | ||
| extern sai_object_id_t gVirtualRouterId; | ||
| extern sai_object_id_t gUnderlayIfId; | ||
|
|
||
| extern SwitchOrch *gSwitchOrch; | ||
| extern CrmOrch *gCrmOrch; | ||
| extern PortsOrch *gPortsOrch; | ||
| extern RouteOrch *gRouteOrch; | ||
| extern IntfsOrch *gIntfsOrch; | ||
| extern NeighOrch *gNeighOrch; | ||
| extern FdbOrch *gFdbOrch; | ||
| extern MirrorOrch *gMirrorOrch; | ||
| extern BufferOrch *gBufferOrch; | ||
| extern VRFOrch *gVrfOrch; | ||
|
|
||
| extern sai_acl_api_t *sai_acl_api; | ||
| extern sai_switch_api_t *sai_switch_api; | ||
| extern sai_virtual_router_api_t *sai_virtual_router_api; | ||
| extern sai_port_api_t *sai_port_api; | ||
| extern sai_lag_api_t *sai_lag_api; | ||
| extern sai_vlan_api_t *sai_vlan_api; | ||
| extern sai_bridge_api_t *sai_bridge_api; | ||
| extern sai_router_interface_api_t *sai_router_intfs_api; | ||
| extern sai_route_api_t *sai_route_api; | ||
| extern sai_neighbor_api_t *sai_neighbor_api; | ||
| extern sai_tunnel_api_t *sai_tunnel_api; | ||
| extern sai_next_hop_api_t *sai_next_hop_api; | ||
| extern sai_hostif_api_t *sai_hostif_api; | ||
| extern sai_buffer_api_t *sai_buffer_api; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| #include "table.h" | ||
|
|
||
| using TableDataT = std::map<std::string, std::vector<swss::FieldValueTuple>>; | ||
| using TablesT = std::map<std::string, TableDataT>; | ||
|
|
||
| namespace testing_db | ||
| { | ||
|
|
||
| TableDataT gTableData; | ||
| TablesT gTables; | ||
| std::map<int, TablesT> gDB; | ||
|
|
||
| void reset() | ||
| { | ||
| gDB.clear(); | ||
| } | ||
| } | ||
|
|
||
| namespace swss | ||
| { | ||
|
|
||
| using namespace testing_db; | ||
|
|
||
| bool Table::get(const std::string &key, std::vector<FieldValueTuple> &ovalues) | ||
| { | ||
| auto table = gDB[getDbId()][getTableName()]; | ||
| if (table.find(key) == table.end()) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| ovalues = table[key]; | ||
| return true; | ||
| } | ||
|
|
||
| bool Table::hget(const std::string &key, const std::string &field, std::string &value) | ||
| { | ||
| auto table = gDB[getDbId()][getTableName()]; | ||
| if (table.find(key) == table.end()) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| for (const auto &it : table[key]) | ||
| { | ||
| if (it.first == field) | ||
| { | ||
| value = it.second; | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| void Table::set(const std::string &key, | ||
| const std::vector<FieldValueTuple> &values, | ||
| const std::string &op, | ||
| const std::string &prefix) | ||
| { | ||
| auto &table = gDB[getDbId()][getTableName()]; | ||
| table[key] = values; | ||
| } | ||
|
|
||
| void Table::getKeys(std::vector<std::string> &keys) | ||
| { | ||
| keys.clear(); | ||
| auto table = gDB[getDbId()][getTableName()]; | ||
| for (const auto &it : table) | ||
| { | ||
| keys.push_back(it.first); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #include "table.h" | ||
|
|
||
| namespace testing_db | ||
| { | ||
| void reset(); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.