Skip to content

Commit b5603a2

Browse files
authored
Merge branch 'master' into mclag_enhacements
2 parents cc73dc5 + 40b255b commit b5603a2

60 files changed

Lines changed: 3135 additions & 504 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,50 @@
33
*.la
44
*.lo
55
*.o
6+
*.swp
67

78
# Generated Source #
89
####################
910
pyext/swsscommon.py
1011
pyext/swsscommon_wrap.cpp
12+
pyext/py2/swsscommon.py
13+
pyext/py2/swsscommon_wrap.cpp
14+
pyext/py3/swsscommon.py
15+
pyext/py3/swsscommon_wrap.cpp
1116

1217
# Packaging Files #
1318
###################
19+
debian/.debhelper/
20+
debian/autoreconf.after
21+
debian/autoreconf.before
22+
debian/debhelper-build-stamp
1423
debian/files
15-
debian/libswsscommon-dev.debhelper.log
16-
debian/libswsscommon-dev.substvars
17-
debian/libswsscommon.debhelper.log
24+
debian/*.debhelper.log
25+
debian/*.substvars
26+
debian/libswsscommon/
27+
debian/libswsscommon-dbg/
28+
debian/libswsscommon-dev/
1829
debian/libswsscommon.postinst.debhelper
1930
debian/libswsscommon.postrm.debhelper
20-
debian/libswsscommon.substvars
21-
22-
debian/libswsscommon-dev/
23-
debian/libswsscommon/
31+
debian/python-swsscommon/
32+
debian/python3-swsscommon/
2433
debian/tmp/
2534

2635
aclocal.m4
36+
autom4te.cache/
2737
config
2838
config.h
2939
config.h.in
40+
config.h.in~
3041
config.log
3142
config.status
3243
configure
3344
libtool
45+
m4/libtool.m4
46+
m4/ltoptions.m4
47+
m4/ltsugar.m4
48+
m4/ltversion.m4
49+
m4/lt~obsolete.m4
3450
Makefile.in
3551
stamp-h1
3652
**/.deps/
@@ -41,5 +57,3 @@ stamp-h1
4157
###############
4258
common/swssloglevel
4359
tests/tests
44-
45-

common/Makefile.am

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ EXTRA_DIST = \
77
consumer_table_pops.lua \
88
producer_state_table_apply_view.lua \
99
table_dump.lua \
10+
redis_multi.lua \
1011
fdb_flush.lua
1112

1213
EXTRA_CONF_DIST = database_config.json
@@ -29,11 +30,12 @@ libswsscommon_la_SOURCES = \
2930
logger.cpp \
3031
redisreply.cpp \
3132
dbconnector.cpp \
33+
dbinterface.cpp \
34+
sonicv2connector.cpp \
3235
table.cpp \
3336
json.cpp \
3437
producertable.cpp \
3538
producerstatetable.cpp \
36-
redisclient.cpp \
3739
rediscommand.cpp \
3840
redistran.cpp \
3941
redisselect.cpp \

common/consumer_table_pops.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ for i = n, 1, -3 do
2323
end
2424
table.insert(rets, ret)
2525

26-
if op == 'bulkset' or op == 'bulkcreate' or op == 'bulkremove' then
26+
if ARGV[2] == "0" then
27+
-- do nothing, we don't want to modify redis during pop
28+
elseif op == 'bulkset' or op == 'bulkcreate' or op == 'bulkremove' then
2729

2830
-- key is "OBJECT_TYPE:num", extract object type from key
2931
key = key:sub(1, string.find(key, ':') - 1)
@@ -81,6 +83,8 @@ for i = n, 1, -3 do
8183
op == 'notify' or
8284
op == 'get_stats' or
8385
op == 'clear_stats' or
86+
op == 'attribute_capability_query' or
87+
op == 'attribute_capability_response' or
8488
op == 'attr_enum_values_capability_query' or
8589
op == 'attr_enum_values_capability_response' or
8690
op == 'object_type_get_availability_query' or

common/consumertable.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace swss {
1717
ConsumerTable::ConsumerTable(DBConnector *db, const string &tableName, int popBatchSize, int pri)
1818
: ConsumerTableBase(db, tableName, popBatchSize, pri)
1919
, TableName_KeyValueOpQueues(tableName)
20+
, m_modifyRedis(true)
2021
{
2122
std::string luaScript = loadLuaScript("consumer_table_pops.lua");
2223
m_shaPop = loadRedisScript(db, luaScript);
@@ -39,15 +40,23 @@ ConsumerTable::ConsumerTable(DBConnector *db, const string &tableName, int popBa
3940
setQueueLength(len/3);
4041
}
4142

43+
void ConsumerTable::setModifyRedis(bool modify)
44+
{
45+
SWSS_LOG_ENTER();
46+
47+
m_modifyRedis = modify;
48+
}
49+
4250
void ConsumerTable::pops(deque<KeyOpFieldsValuesTuple> &vkco, const string &prefix)
4351
{
4452
RedisCommand command;
4553
command.format(
46-
"EVALSHA %s 2 %s %s %d ''",
54+
"EVALSHA %s 2 %s %s %d %d",
4755
m_shaPop.c_str(),
4856
getKeyValueOpQueueTableName().c_str(),
4957
(prefix+getTableName()).c_str(),
50-
POP_BATCH_SIZE);
58+
POP_BATCH_SIZE,
59+
m_modifyRedis ? 1 : 0);
5160

5261
RedisReply r(m_db, command, REDIS_REPLY_ARRAY);
5362

common/consumertable.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,19 @@ class ConsumerTable : public ConsumerTableBase, public TableName_KeyValueOpQueue
1818
/* Get multiple pop elements */
1919
void pops(std::deque<KeyOpFieldsValuesTuple> &vkco, const std::string &prefix = EMPTY_PREFIX);
2020

21+
void setModifyRedis(bool modify);
2122
private:
2223
std::string m_shaPop;
24+
25+
/**
26+
* @brief Modify Redis database.
27+
*
28+
* If set to false, will not make changes to database during POPs operation.
29+
* This will be utilized during synchronous mode.
30+
*
31+
* Default is true.
32+
*/
33+
bool m_modifyRedis;
2334
};
2435

2536
}

common/database_config.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"hostname" : "127.0.0.1",
55
"port" : 6379,
66
"unix_socket_path" : "/var/run/redis/redis.sock"
7+
},
8+
"redis_chassis":{
9+
"hostname" : "redis_chassis.server",
10+
"port" : 6380,
11+
"unix_socket_path" : "/var/run/redis/redis_chassis.sock"
712
}
813
},
914
"DATABASES" : {
@@ -51,6 +56,36 @@
5156
"id" : 7,
5257
"separator": "|",
5358
"instance" : "redis"
59+
},
60+
"RESTAPI_DB" : {
61+
"id" : 8,
62+
"separator": "|",
63+
"instance" : "redis"
64+
},
65+
"GB_ASIC_DB" : {
66+
"id" : 9,
67+
"separator": "|",
68+
"instance" : "redis"
69+
},
70+
"GB_COUNTERS_DB" : {
71+
"id" : 10,
72+
"separator": "|",
73+
"instance" : "redis"
74+
},
75+
"GB_FLEX_COUNTER_DB" : {
76+
"id" : 11,
77+
"separator": "|",
78+
"instance" : "redis"
79+
},
80+
"CHASSIS_APP_DB" : {
81+
"id" : 12,
82+
"separator": "|",
83+
"instance" : "redis_chassis"
84+
},
85+
"CHASSIS_STATE_DB" : {
86+
"id" : 13,
87+
"separator": "|",
88+
"instance" : "redis_chassis"
5489
}
5590
},
5691
"VERSION" : "1.0"

0 commit comments

Comments
 (0)