Skip to content

Commit

Permalink
Adding required script & services
Browse files Browse the repository at this point in the history
  • Loading branch information
renukamanavalan committed Jun 11, 2022
1 parent 0f64cc8 commit 5fe6502
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
16 changes: 16 additions & 0 deletions files/build_templates/eventd.service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=EVENTD container
Requires=updategraph.service
Requisite=swss.service
After=updategraph.service swss.service syncd.service
BindsTo=sonic.target
After=sonic.target
Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3

[Service]
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
ExecStart=/usr/bin/{{docker_container_name}}.sh wait
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
RestartSec=30
1 change: 1 addition & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ sudo LANG=C cp $SCRIPTS_DIR/bgp.sh $FILESYSTEM_ROOT/usr/local/bin/bgp.sh
sudo LANG=C cp $SCRIPTS_DIR/teamd.sh $FILESYSTEM_ROOT/usr/local/bin/teamd.sh
sudo LANG=C cp $SCRIPTS_DIR/lldp.sh $FILESYSTEM_ROOT/usr/local/bin/lldp.sh
sudo LANG=C cp $SCRIPTS_DIR/radv.sh $FILESYSTEM_ROOT/usr/local/bin/radv.sh
sudo LANG=C cp $SCRIPTS_DIR/eventd.sh $FILESYSTEM_ROOT/usr/local/bin/eventd.sh
sudo LANG=C cp $SCRIPTS_DIR/asic_status.sh $FILESYSTEM_ROOT/usr/local/bin/asic_status.sh
sudo LANG=C cp $SCRIPTS_DIR/asic_status.py $FILESYSTEM_ROOT/usr/local/bin/asic_status.py

Expand Down
27 changes: 22 additions & 5 deletions src/sonic-eventd/tests/eventd_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,18 @@ void run_sub(void *zctx, bool &term, string &read_source, internal_events_lst_t
EXPECT_EQ(0, zmq_setsockopt(mock_sub, ZMQ_SUBSCRIBE, "", 0));
EXPECT_EQ(0, zmq_setsockopt(mock_sub, ZMQ_RCVTIMEO, &block_ms, sizeof (block_ms)));

while(!term) {
if (0 == zmq_message_read(mock_sub, 0, source, ev_int)) {
lst.push_back(ev_int);
read_source.swap(source);
cnt = (int)lst.size();
if (cnt == 0) {
while(!term) {
if (0 == zmq_message_read(mock_sub, 0, source, ev_int)) {
lst.push_back(ev_int);
read_source.swap(source);
cnt = (int)lst.size();
}
}
}
else {
while(!term) {
this_thread::sleep_for(chrono::milliseconds(100));
}
}

Expand Down Expand Up @@ -349,6 +356,11 @@ TEST(eventd, capture)
EXPECT_EQ(0, pxy->init());

/* Run subscriber; Else publisher will drop events on floor, with no subscriber. */
/*
* Block sub from calling zmq_message_read as capture service is calling
* and zmq_message_read crashes on access from more than one thread.
*/
sub_evts_sz = -1;
thread thr_sub(&run_sub, zctx, ref(term_sub), ref(sub_source), ref(sub_evts), ref(sub_evts_sz));

/* Create capture service */
Expand Down Expand Up @@ -469,6 +481,11 @@ TEST(eventd, captureCacheMax)
EXPECT_EQ(0, pxy->init());

/* Run subscriber; Else publisher will drop events on floor, with no subscriber. */
/*
* Block sub from calling zmq_message_read as capture service is calling
* and zmq_message_read crashes on access from more than one thread.
*/
sub_evts_sz = -1;
thread thr_sub(&run_sub, zctx, ref(term_sub), ref(sub_source), ref(sub_evts), ref(sub_evts_sz));

/* Create capture service */
Expand Down

0 comments on commit 5fe6502

Please sign in to comment.