Skip to content

Commit fcf8d63

Browse files
Merge branch 'master' of https://github.com/divyagayathri-hcl/sonic-swss-common into one-to-one
2 parents 896e09e + fc35dd0 commit fcf8d63

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

common/schema.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ namespace swss {
116116
#define APP_ISOLATION_GROUP_TABLE_NAME "ISOLATION_GROUP_TABLE"
117117
#define APP_BFD_SESSION_TABLE_NAME "BFD_SESSION_TABLE"
118118
#define APP_ICMP_ECHO_SESSION_TABLE_NAME "ICMP_ECHO_SESSION_TABLE"
119+
#define APP_STP_MST_INST_TABLE_NAME "STP_MST_INST_TABLE"
120+
#define APP_STP_MST_PORT_TABLE_NAME "STP_MST_PORT_TABLE"
121+
#define APP_STP_INST_PORT_FLUSH_TABLE_NAME "STP_INST_PORT_FLUSH_TABLE"
119122

120123

121124
#define APP_SAG_TABLE_NAME "SAG_TABLE"
@@ -283,6 +286,7 @@ namespace swss {
283286
#define PG_ATTR_ID_LIST "PG_ATTR_ID_LIST"
284287
#define RIF_COUNTER_ID_LIST "RIF_COUNTER_ID_LIST"
285288
#define TUNNEL_COUNTER_ID_LIST "TUNNEL_COUNTER_ID_LIST"
289+
#define SWITCH_COUNTER_ID_LIST "SWITCH_COUNTER_ID_LIST"
286290
#define SWITCH_DEBUG_COUNTER_ID_LIST "SWITCH_DEBUG_COUNTER_ID_LIST"
287291
#define MACSEC_FLOW_COUNTER_ID_LIST "MACSEC_FLOW_COUNTER_ID_LIST"
288292
#define MACSEC_SA_COUNTER_ID_LIST "MACSEC_SA_COUNTER_ID_LIST"
@@ -440,6 +444,10 @@ namespace swss {
440444
#define CFG_STP_VLAN_PORT_TABLE_NAME "STP_VLAN_PORT"
441445
#define CFG_STP_PORT_TABLE_NAME "STP_PORT"
442446

447+
#define CFG_STP_MST_GLOBAL_TABLE_NAME "STP_MST"
448+
#define CFG_STP_MST_INST_TABLE_NAME "STP_MST_INST"
449+
#define CFG_STP_MST_PORT_TABLE_NAME "STP_MST_PORT"
450+
443451
#define CFG_MCLAG_TABLE_NAME "MCLAG_DOMAIN"
444452
#define CFG_MCLAG_INTF_TABLE_NAME "MCLAG_INTERFACE"
445453
#define CFG_MCLAG_UNIQUE_IP_TABLE_NAME "MCLAG_UNIQUE_IP"

crates/swss-common/src/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,3 @@ pub fn sonic_db_config_initialize_global(path: &str) -> Result<(), Exception> {
1717
let path = cstr(path);
1818
unsafe { swss_try!(bindings::SWSSSonicDBConfig_initializeGlobalConfig(path.as_ptr())) }
1919
}
20-
21-
/// Trait for objects that can be stored in a Sonic DB table.
22-
pub trait SonicDbTable {
23-
fn key_separator() -> char;
24-
fn table_name() -> &'static str;
25-
fn db_name() -> &'static str;
26-
fn is_dpu() -> bool;
27-
}

tests/performancetimer_ut.cpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,46 @@ using namespace std;
99

1010
TEST(PerformancetimerTest, basic)
1111
{
12-
std::string expected;
13-
1412
static swss::PerformanceTimer timer("basic", PRINT_ALL);
13+
14+
// First measurement
1515
timer.start();
1616
this_thread::sleep_for(chrono::milliseconds(100));
1717
timer.stop();
1818
std::string output = timer.inc(1000);
1919

20-
expected = R"({"API":"basic","RPS[k]":10.0,"Tasks":1000,"Total[ms]":100,"busy[ms]":100,"idle[ms]":0})";
21-
EXPECT_EQ(output, expected);
20+
auto actualJson = nlohmann::json::parse(output);
21+
EXPECT_EQ(actualJson["API"], "basic");
22+
EXPECT_EQ(actualJson["Tasks"], 1000);
23+
EXPECT_NEAR(actualJson["RPS[k]"].get<double>(), 10.0, 0.1);
24+
EXPECT_NEAR(static_cast<double>(actualJson["busy[ms]"].get<uint64_t>()), 100.0, 10.0);
25+
EXPECT_LE(actualJson["idle[ms]"].get<uint64_t>(), 10u);
2226

27+
// Configuration changes
2328
timer.setTimerName("basic_set_name");
2429
timer.setTimerVerbose(true);
2530
timer.setTimerThreshold(3000);
2631

32+
// Second measurement
2733
timer.start();
2834
this_thread::sleep_for(chrono::milliseconds(100));
2935
timer.stop();
3036
output = timer.inc(1000);
3137
EXPECT_EQ(output, "");
3238

39+
// Third measurement
3340
this_thread::sleep_for(chrono::milliseconds(200));
34-
3541
timer.start();
3642
this_thread::sleep_for(chrono::milliseconds(300));
3743
timer.stop();
3844
output = timer.inc(2000);
3945

40-
expected = R"({"API":"basic_set_name","RPS[k]":5.0,"Tasks":3000,"Total[ms]":600,"busy[ms]":400,"idle[ms]":200,"m_gaps":[0,200],"m_incs":[1000,2000],"m_intervals":[100,300]})";
41-
42-
EXPECT_EQ(output, expected);
43-
}
46+
actualJson = nlohmann::json::parse(output);
47+
EXPECT_EQ(actualJson["API"], "basic_set_name");
48+
EXPECT_EQ(actualJson["Tasks"], 3000);
49+
EXPECT_NEAR(actualJson["RPS[k]"].get<double>(), 5.0, 0.1);
50+
EXPECT_NEAR(static_cast<double>(actualJson["busy[ms]"].get<uint64_t>()), 400.0, 20.0);
51+
EXPECT_NEAR(static_cast<double>(actualJson["idle[ms]"].get<uint64_t>()), 200.0, 20.0);
52+
EXPECT_EQ(actualJson["m_incs"].get<std::vector<uint64_t>>(), std::vector<uint64_t>({1000, 2000}));
53+
EXPECT_EQ(actualJson["m_intervals"].get<std::vector<uint64_t>>(), std::vector<uint64_t>({100, 300}));
54+
}

0 commit comments

Comments
 (0)