Skip to content

Commit 52fe3e1

Browse files
Merge branch 'master' into chassis-voq-pr1
2 parents 8e235e6 + 18fc06e commit 52fe3e1

36 files changed

+2900
-266
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Install dependencies:
2323

2424
sudo apt-get install redis-server -t trusty
2525
sudo apt-get install libhiredis0.13 -t trusty
26+
sudo apt-get install libzmq5 libzmq3-dev
2627

2728
Install building dependencies:
2829

cfgmgr/teammgr.cpp

+3-68
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@
1010
#include <iostream>
1111
#include <fstream>
1212
#include <sstream>
13-
#include <fstream>
1413
#include <thread>
1514

1615
#include <net/if.h>
1716
#include <sys/ioctl.h>
1817
#include <sys/stat.h>
1918
#include <signal.h>
2019

21-
#define PID_FILE_PATH "/var/run/teamd/"
2220

2321
using namespace std;
2422
using namespace swss;
@@ -115,75 +113,14 @@ void TeamMgr::doTask(Consumer &consumer)
115113
}
116114

117115

118-
pid_t TeamMgr::getTeamPid(const string &alias)
116+
void TeamMgr::cleanTeamProcesses()
119117
{
120-
SWSS_LOG_ENTER();
121-
pid_t pid = 0;
122-
123-
string file = string(PID_FILE_PATH) + alias + string(".pid");
124-
ifstream infile(file);
125-
if (!infile.is_open())
126-
{
127-
SWSS_LOG_WARN("The LAG PID file: %s is not readable", file.c_str());
128-
return 0;
129-
}
130-
131-
string line;
132-
getline(infile, line);
133-
if (line.empty())
134-
{
135-
SWSS_LOG_WARN("The LAG PID file: %s is empty", file.c_str());
136-
}
137-
else
138-
{
139-
/*Store the PID value */
140-
pid = stoi(line, nullptr, 10);
141-
}
142-
143-
/* Close the file and return */
144-
infile.close();
145-
146-
return pid;
147-
}
148-
149-
150-
void TeamMgr::addLagPid(const string &alias)
151-
{
152-
SWSS_LOG_ENTER();
153-
m_lagPIDList[alias] = getTeamPid(alias);
154-
}
155-
156-
void TeamMgr::removeLagPid(const string &alias)
157-
{
158-
SWSS_LOG_ENTER();
159-
m_lagPIDList.erase(alias);
160-
}
161-
162-
void TeamMgr::cleanTeamProcesses(int signo)
163-
{
164-
pid_t pid = 0;
165-
166118
SWSS_LOG_ENTER();
167119
SWSS_LOG_NOTICE("Cleaning up LAGs during shutdown...");
168120
for (const auto& it: m_lagList)
169121
{
170-
pid = m_lagPIDList[it];
171-
if(!pid) {
172-
SWSS_LOG_WARN("Invalid PID found for LaG %s ", it.c_str());
173-
174-
/* Try to get the PID again */
175-
pid = getTeamPid(it);
176-
}
177-
178-
if(pid > 0)
179-
{
180-
SWSS_LOG_INFO("Sending TERM Signal to (PID: %d) for LaG %s ", pid, it.c_str());
181-
kill(pid, signo);
182-
}
183-
else
184-
{
185-
SWSS_LOG_ERROR("Can't send TERM signal to LAG %s. PID wasn't found", it.c_str());
186-
}
122+
//This will call team -k kill -t <teamdevicename> which internally send SIGTERM
123+
removeLag(it);
187124
}
188125

189126
return;
@@ -252,7 +189,6 @@ void TeamMgr::doLagTask(Consumer &consumer)
252189
}
253190

254191
m_lagList.insert(alias);
255-
addLagPid(alias);
256192
}
257193

258194
setLagAdminStatus(alias, admin_status);
@@ -269,7 +205,6 @@ void TeamMgr::doLagTask(Consumer &consumer)
269205
{
270206
removeLag(alias);
271207
m_lagList.erase(alias);
272-
removeLagPid(alias);
273208
}
274209
}
275210

cfgmgr/teammgr.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TeamMgr : public Orch
1818
const std::vector<TableConnector> &tables);
1919

2020
using Orch::doTask;
21-
void cleanTeamProcesses(int signo);
21+
void cleanTeamProcesses();
2222

2323
private:
2424
Table m_cfgMetadataTable; // To retrieve MAC address
@@ -50,9 +50,6 @@ class TeamMgr : public Orch
5050
bool setLagMtu(const std::string &alias, const std::string &mtu);
5151
bool setLagLearnMode(const std::string &alias, const std::string &learn_mode);
5252

53-
pid_t getTeamPid(const std::string &alias);
54-
void addLagPid(const std::string &alias);
55-
void removeLagPid(const std::string &alias);
5653

5754
bool isPortEnslaved(const std::string &);
5855
bool findPortMaster(std::string &, const std::string &);

cfgmgr/teammgrd.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int main(int argc, char **argv)
8585
auto *c = (Executor *)sel;
8686
c->execute();
8787
}
88-
teammgr.cleanTeamProcesses(SIGTERM);
88+
teammgr.cleanTeamProcesses();
8989
SWSS_LOG_NOTICE("Exiting");
9090
}
9191
catch (const exception &e)

mclagsyncd/mclaglink.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ using namespace std;
3838
void MclagLink::getOidToPortNameMap(std::unordered_map<std::string, std:: string> & port_map)
3939
{
4040
std::unordered_map<std::string, std:: string>::iterator it;
41-
auto hash = p_redisClient_to_counters->hgetall("COUNTERS_PORT_NAME_MAP");
41+
auto hash = p_counters_db->hgetall("COUNTERS_PORT_NAME_MAP");
4242

4343
for (it = hash.begin(); it != hash.end(); ++it)
4444
port_map.insert(pair<string, string>(it->second, it->first));
@@ -53,14 +53,14 @@ void MclagLink::getBridgePortIdToAttrPortIdMap(std::map<std::string, std:: strin
5353

5454
std::unordered_map<string, string>::iterator attr_port_id;
5555

56-
auto keys = p_redisClient_to_asic->keys("ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT:*");
56+
auto keys = p_asic_db->keys("ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT:*");
5757

5858
for (auto& key : keys)
5959
{
6060
pos1 = key.find("oid:", 0);
6161
bridge_port_id = key.substr(pos1);
6262

63-
auto hash = p_redisClient_to_asic->hgetall(key);
63+
auto hash = p_asic_db->hgetall(key);
6464
attr_port_id = hash.find("SAI_BRIDGE_PORT_ATTR_PORT_ID");
6565
if (attr_port_id == hash.end())
6666
{
@@ -81,7 +81,7 @@ void MclagLink::getVidByBvid(std::string &bvid, std::string &vlanid)
8181
std::string pre = "ASIC_STATE:SAI_OBJECT_TYPE_VLAN:";
8282
std::string key = pre + bvid;
8383

84-
auto hash = p_redisClient_to_asic->hgetall(key.c_str());
84+
auto hash = p_asic_db->hgetall(key.c_str());
8585

8686
attr_vlan_id = hash.find("SAI_VLAN_ATTR_VLAN_ID");
8787
if (attr_vlan_id == hash.end())
@@ -109,7 +109,7 @@ void MclagLink::getFdbSet(std::set<mclag_fdb> *fdb_set)
109109
std::map<std::string, std::string>::iterator brPortId_to_attrPortId_it;
110110
std::unordered_map<std::string, std::string>::iterator oid_to_portName_it;
111111

112-
auto keys = p_redisClient_to_asic->keys("ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY:*");
112+
auto keys = p_asic_db->keys("ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY:*");
113113

114114
for (auto& key : keys)
115115
{
@@ -136,7 +136,7 @@ void MclagLink::getFdbSet(std::set<mclag_fdb> *fdb_set)
136136
mac = key.substr(pos1, pos2 - pos1 + 1);
137137

138138
/*get type*/
139-
auto hash = p_redisClient_to_asic->hgetall(key);
139+
auto hash = p_asic_db->hgetall(key);
140140
type_it = hash.find("SAI_FDB_ENTRY_ATTR_TYPE");
141141
if (type_it == hash.end())
142142
{

mclagsyncd/mclaglink.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ class MclagLink : public Selectable {
102102
ProducerStateTable *p_acl_table_tbl;
103103
ProducerStateTable *p_acl_rule_tbl;
104104
DBConnector *p_appl_db;
105-
RedisClient *p_redisClient_to_asic;/*redis client access to ASIC_DB*/
106-
RedisClient *p_redisClient_to_counters;/*redis client access to COUNTERS_DB*/
105+
DBConnector *p_asic_db; /*redis client access to ASIC_DB*/
106+
DBConnector *p_counters_db; /*redis client access to COUNTERS_DB*/
107107
std::set <mclag_fdb> *p_old_fdb;
108108

109109
MclagLink(uint16_t port = MCLAG_DEFAULT_PORT);

mclagsyncd/mclagsyncd.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ int main(int argc, char **argv)
4141
ProducerStateTable fdb_tbl(&appl_db, APP_FDB_TABLE_NAME);
4242
ProducerStateTable acl_table_tbl(&appl_db, APP_ACL_TABLE_TABLE_NAME);
4343
ProducerStateTable acl_rule_tbl(&appl_db, APP_ACL_RULE_TABLE_NAME);
44-
RedisClient redisClient_to_asicDb(&asic_db);
45-
RedisClient redisClient_to_countersDb(&counters_db);
4644
map <string, string> isolate;
4745
RedisPipeline pipeline(&appl_db);
4846
set <mclag_fdb> old_fdb;
@@ -62,8 +60,8 @@ int main(int argc, char **argv)
6260
mclag.p_acl_table_tbl = &acl_table_tbl;
6361
mclag.p_acl_rule_tbl = &acl_rule_tbl;
6462
mclag.p_appl_db = &appl_db;
65-
mclag.p_redisClient_to_asic = &redisClient_to_asicDb;
66-
mclag.p_redisClient_to_counters = &redisClient_to_countersDb;
63+
mclag.p_asic_db = &asic_db;
64+
mclag.p_counters_db = &counters_db;
6765
mclag.p_old_fdb = &old_fdb;
6866

6967
cout << "Waiting for connection..." << endl;

orchagent/Makefile.am

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ orchagent_SOURCES = \
3535
neighorch.cpp \
3636
intfsorch.cpp \
3737
portsorch.cpp \
38+
fgnhgorch.cpp \
3839
copporch.cpp \
3940
tunneldecaporch.cpp \
4041
qosorch.cpp \
@@ -66,7 +67,7 @@ orchagent_SOURCES += debug_counter/debug_counter.cpp debug_counter/drop_counter.
6667

6768
orchagent_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
6869
orchagent_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
69-
orchagent_LDADD = -lnl-3 -lnl-route-3 -lpthread -lsairedis -lswsscommon -lsaimeta -lsaimetadata
70+
orchagent_LDADD = -lnl-3 -lnl-route-3 -lpthread -lsairedis -lswsscommon -lsaimeta -lsaimetadata -lzmq
7071

7172
routeresync_SOURCES = routeresync.cpp
7273
routeresync_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON)

orchagent/aclorch.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,12 @@ bool AclRuleL3V6::validateAddMatch(string attr_name, string attr_value)
10361036
return false;
10371037
}
10381038

1039+
if (attr_name == MATCH_ETHER_TYPE)
1040+
{
1041+
SWSS_LOG_ERROR("Ethertype match is not supported for table type L3V6");
1042+
return false;
1043+
}
1044+
10391045
return AclRule::validateAddMatch(attr_name, attr_value);
10401046
}
10411047

@@ -1356,7 +1362,7 @@ bool AclTable::create()
13561362
return status == SAI_STATUS_SUCCESS;
13571363
}
13581364

1359-
if (type != ACL_TABLE_MIRRORV6)
1365+
if (type != ACL_TABLE_MIRRORV6 && type != ACL_TABLE_L3V6)
13601366
{
13611367
attr.id = SAI_ACL_TABLE_ATTR_FIELD_ETHER_TYPE;
13621368
attr.value.booldata = true;

0 commit comments

Comments
 (0)