Skip to content

Commit

Permalink
gNOI Cold Reboot - Integrated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rkavitha-hcl authored and KAVITHA RAMALINGAM committed Nov 21, 2024
1 parent d6d5a19 commit 624101c
Show file tree
Hide file tree
Showing 22 changed files with 180 additions and 205 deletions.
2 changes: 1 addition & 1 deletion dockers/docker-framework/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

ARG docker_container_name
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
Expand Down
3 changes: 0 additions & 3 deletions files/build/versions/dockers/docker-framework/versions-mirror

This file was deleted.

140 changes: 140 additions & 0 deletions files/build/versions/dockers/docker-sonic-vs/versions-deb-bookworm
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
arping==2.21-2
bash-completion==1:2.11-2
bridge-utils==1.7-1
bzip2==1.0.8-4
comerr-dev==2.1-1.46.2-2
conntrack==1:1.4.6-2
cron==3.0pl1-137
dbus==1.12.28-0+deb11u1
dirmngr==2.2.27-2+deb11u2
dmsetup==2:1.02.175-2.1
ethtool==1:5.9-1
fontconfig-config==2.13.1-4.2
fonts-dejavu-core==2.37-2
fonts-font-awesome==5.0.10+really4.7.0~dfsg-4.1
fonts-lato==2.0-2.1
framework==1.0.0
frr==8.5.4-sonic-0
gettext-base==0.21-4
gir1.2-glib-2.0==1.66.1-1+b1
gnupg==2.2.27-2+deb11u2
gnupg-l10n==2.2.27-2+deb11u2
gnupg-utils==2.2.27-2+deb11u2
gpg==2.2.27-2+deb11u2
gpg-agent==2.2.27-2+deb11u2
gpg-wks-client==2.2.27-2+deb11u2
gpg-wks-server==2.2.27-2+deb11u2
gpgconf==2.2.27-2+deb11u2
gpgsm==2.2.27-2+deb11u2
grub-common==2.06-3~deb11u6
grub2-common==2.06-3~deb11u6
icu-devtools==67.1-7
ifupdown==0.8.36
iproute2==6.1.0-3~bpo11+1
iptables==1.8.7-1
krb5-multidev==1.18.3-6+deb11u5+fips
libapparmor1==2.13.6-10
libassuan0==2.5.3-7.1
libblkid-dev==2.36.1-8+deb11u2
libblkid1==2.36.1-8+deb11u2
libbsd-dev==0.11.3-1+deb11u1
libc-ares2==1.17.1-1+deb11u3
libc-dev-bin==2.31-13+deb11u10
libc6-dev==2.31-13+deb11u10
libcbor0==0.5.0+dfsg-2
libcrypt-dev==1:4.4.18-4
libdevmapper1.02.1==2:1.02.175-2.1
libdouble-conversion3==3.1.5-6.1
libedit2==3.1-20191231-2+b1
libefiboot1==37-6
libefivar1==37-6
libfido2-1==1.6.0-2
libfreetype6==2.10.4+dfsg-1+deb11u1
libfreetype6-dev==2.10.4+dfsg-1+deb11u1
libfuse2==2.9.9-5
libgirepository-1.0-1==1.66.1-1+b1
libglib2.0-0==2.66.8-1+deb11u4
libglib2.0-data==2.66.8-1+deb11u4
libgssapi-krb5-2==1.18.3-6+deb11u5+fips
libgssrpc4==1.18.3-6+deb11u5+fips
libicu-dev==67.1-7
libicu67==67.1-7
libip4tc2==1.8.7-1
libip6tc2==1.8.7-1
libjs-sphinxdoc==3.4.3-2
libjs-underscore==1.9.1~dfsg-3
libjson-c5==0.15-2+deb11u1
libjudydebian1==1.0.5-5+b2
libk5crypto3==1.18.3-6+deb11u4
libkadm5clnt-mit12==1.18.3-6+deb11u5+fips
libkadm5srv-mit12==1.18.3-6+deb11u5+fips
libkdb5-10==1.18.3-6+deb11u5
libkrb5-3==1.18.3-6+deb11u5+fips
libkrb5-dev==1.18.3-6+deb11u5+fips
libkrb5support0==1.18.3-6+deb11u5+fips
libksba8==1.5.0-3+deb11u2
libmd-dev==1.0.3-3
libmount1==2.36.1-8+deb11u2
libnet1==1.1.6+dfsg-3.1
libnetfilter-conntrack3==1.0.8-3
libnfnetlink0==1.0.1-3+b1
libnftnl11==1.1.9-1
libnorm-dev==1.5.9+dfsg-2
libnpth0==1.6-3
libnsl-dev==1.3.0-2
libpcap0.8==1.10.0-2
libpcre2-16-0==10.36-2+deb11u1
libpgm-dev==5.3.128~dfsg-2
libpng16-16==1.6.37-3
libpopt0==1.18-2
libpython2-stdlib==2.7.18-3
libpython2.7-minimal==2.7.18-8+deb11u1
libpython2.7-stdlib==2.7.18-8+deb11u1
libqt5core5a==5.15.2+dfsg-9+deb11u1
libqt5dbus5==5.15.2+dfsg-9+deb11u1
libqt5network5==5.15.2+dfsg-9+deb11u1
libsaivs==1.0.0
libsodium-dev==1.0.18-1
libssl1.1==1.1.1w-0+deb11u1
libsystemd0==247.3-7+deb11u2
libteam-utils==1.31-1
libtirpc-dev==1.3.1-1+deb11u1
libunwind8==1.3.2-2
libuuid1==2.36.1-8+deb11u2
libxml2==2.9.10+dfsg-6.7+deb11u4
libxml2-dev==2.9.10+dfsg-6.7+deb11u4
libyang2==2.0.112-6
libzmq3-dev==4.3.4-1+deb11u1
linux-libc-dev==5.10.221-1
logrotate==3.18.0-2+deb11u2
lsof==4.93.2+dfsg-1.1
mailcap==3.69
mime-support==3.66
ndisc6==1.0.4-2
netbase==6.3
openssh-client==1:8.4p1-5+deb11u3
openssh-server==1:8.4p1-5+deb11u3
openssh-sftp-server==1:8.4p1-5+deb11u3
openssl==1.1.1w-0+deb11u1
pinentry-curses==1.1.0-4
psmisc==23.4-2
python-ply==3.11-4
python2==2.7.18-3
python2-minimal==2.7.18-3
python2.7==2.7.18-8+deb11u1
python2.7-minimal==2.7.18-8+deb11u1
python3-scapy==2.4.4-4
redis-server==5:6.0.16-1+deb11u2
runit-helper==2.10.3
sensible-utils==0.0.14
shared-mime-info==2.0-1
sonic-device-data==1.0-1
sonic-host-services-data==1.0-1
sonic-utilities-data==1.0-1
sphinx-rtd-theme-common==0.5.1+dfsg-1
syncd-vs==1.0.0
tcpdump==4.99.0-2+deb11u1
ucf==3.0043
uuid-dev==2.36.1-8+deb11u2
x11-common==1:7.7+22
xz-utils==5.2.5-2.1~deb11u1
12 changes: 6 additions & 6 deletions rules/docker-framework.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ DOCKER_FRAMEWORK_DBG = $(DOCKER_FRAMEWORK_STEM)-$(DBG_IMAGE_MARK).gz
$(DOCKER_FRAMEWORK)_PATH = $(DOCKERS_PATH)/$(DOCKER_FRAMEWORK_STEM)

$(DOCKER_FRAMEWORK)_DEPENDS += $(FRAMEWORK)
$(DOCKER_FRAMEWORK)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS)
$(DOCKER_FRAMEWORK)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_DEPENDS)
$(DOCKER_FRAMEWORK)_DBG_DEPENDS += $(FRAMEWORK_DBG) $(LIBSWSSCOMMON_DBG)
$(DOCKER_FRAMEWORK)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES)
$(DOCKER_FRAMEWORK)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES)

$(DOCKER_FRAMEWORK)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE)
$(DOCKER_FRAMEWORK)_LOAD_DOCKERS += $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_LOAD_DOCKERS)
$(DOCKER_FRAMEWORK)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM)
$(DOCKER_FRAMEWORK)_LOAD_DOCKERS += $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_LOAD_DOCKERS)

$(DOCKER_FRAMEWORK)_VERSION = 1.0.0
$(DOCKER_FRAMEWORK)_PACKAGE_NAME = framework
Expand All @@ -31,5 +31,5 @@ $(DOCKER_FRAMEWORK)_GIT_REPOSITORIES += "sonic-swss-common"

$(DOCKER_FRAMEWORK)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)

SONIC_BULLSEYE_DOCKERS += $(DOCKER_FRAMEWORK)
SONIC_BULLSEYE_DBG_DOCKERS += $(DOCKER_FRAMEWORK_DBG)
SONIC_BOOKWORM_DOCKERS += $(DOCKER_FRAMEWORK)
SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_FRAMEWORK_DBG)
4 changes: 3 additions & 1 deletion sonic-slave-bookworm/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ RUN apt-get update && apt-get install -y eatmydata && eatmydata apt-get install
# For audisp-tacplus
libauparse-dev \
auditd \
# For framework container build
libdbus-c++-dev \
# For protobuf
protobuf-compiler \
libprotobuf-dev \
Expand Down Expand Up @@ -750,4 +752,4 @@ RUN mkdir -p /.cargo && $RUST_ROOT/bin/rustup target add armv7-unknown-linux-gnu
RUN mkdir -p /.cargo && $RUST_ROOT/bin/rustup target add aarch64-unknown-linux-gnu && echo "[target.aarch64-unknown-linux-gnu]\nlinker = \"aarch64-linux-gnu-gcc\"" >> /.cargo/config.toml
{% endif -%}
ENV RUSTUP_HOME $RUST_ROOT
ENV PATH $PATH:$RUST_ROOT/bin
ENV PATH $PATH:$RUST_ROOT/bin
3 changes: 1 addition & 2 deletions src/sonic-framework/rebootbackend/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ DBGFLAGS = -g
endif

rebootbackend_SOURCES = rebootbackend.cpp rebootbe.cpp interfaces.cpp \
reboot_thread.cpp redis_utils.cpp \
reboot_common.cpp \
reboot_thread.cpp \
system/system.pb.cc types/types.pb.cc \
common/common.pb.cc

Expand Down
4 changes: 2 additions & 2 deletions src/sonic-framework/rebootbackend/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ constexpr char kContainerShutdownPath[] = "/org/SONiC/HostService/gnoi_container

// DBus::BusDispatcher dispatcher;
DBus::Connection& HostServiceDbus::getConnection(void) {
static DBus::Connection* ConnPtr = nullptr;
if (ConnPtr == nullptr) {
static DBus::Connection* connPtr = nullptr;
if (connPtr == nullptr) {
static DBus::BusDispatcher dispatcher;
DBus::default_dispatcher = &dispatcher;

Expand Down
10 changes: 10 additions & 0 deletions src/sonic-framework/rebootbackend/interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#include "gnoi_reboot_dbus.h" // auto generated gnoi_reboot_proxy
#include "reboot_interfaces.h"

/* Reboot is a request to the reboot sonic host service to request a reboot
from the platform. This takes as an argument a string based json formatted
Reboot request from system.proto.’https://github.com/openconfig/gnoi/blob/73a1e7675c5f963e7810bd3828203f2758eb47e8/system/system.proto#L107 */

class GnoiDbusReboot : public org::SONiC::HostService::gnoi_reboot_proxy,
public DBus::IntrospectableProxy,
public DBus::ObjectProxy {
Expand All @@ -15,6 +19,12 @@ class GnoiDbusReboot : public org::SONiC::HostService::gnoi_reboot_proxy,
: DBus::ObjectProxy(connection, dbus_obj_name_p, dbus_bus_name_p) {}
};

/* DbusResponse consists of STATUS: success/fail: i.e. was the dbus request
successful DbusResponse.json_string: string based json formatted RebootResponse
defined here:
https://github.com/openconfig/gnoi/blob/73a1e7675c5f963e7810bd3828203f2758eb47e8/system/system.proto#L119 */


class HostServiceDbus : public DbusInterface {
public:
DbusInterface::DbusResponse Reboot(
Expand Down
4 changes: 1 addition & 3 deletions src/sonic-framework/rebootbackend/reboot_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

namespace rebootbackend {

//extern bool sigterm_requested;
bool sigterm_requested = false;

extern bool sigterm_requested;
struct NotificationResponse {
swss::StatusCode status;
std::string json_string;
Expand Down
5 changes: 2 additions & 3 deletions src/sonic-framework/rebootbackend/reboot_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "notificationproducer.h"
#include "reboot_common.h"
#include "reboot_interfaces.h"
#include "redis_utils.h"
#include "select.h"
#include "selectableevent.h"
#include "selectabletimer.h"
Expand All @@ -19,10 +18,10 @@ namespace rebootbackend {
using namespace ::gnoi::system;
using steady_clock = std::chrono::steady_clock;
using Progress = ::rebootbackend::RebootThread::Progress;
//using WarmBootStage = ::swss::WarmStart::WarmBootStage;
using WarmStartState = ::swss::WarmStart::WarmStartState;
namespace gpu = ::google::protobuf::util;

bool sigterm_requested = false;

RebootThread::RebootThread(DbusInterface &dbus_interface,
swss::SelectableEvent &m_finished)
: m_db("STATE_DB", 0),
Expand Down
1 change: 0 additions & 1 deletion src/sonic-framework/rebootbackend/reboot_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "notificationproducer.h"
#include "reboot_common.h"
#include "reboot_interfaces.h"
#include "redis_utils.h"
#include "select.h"
#include "selectableevent.h"
#include "selectabletimer.h"
Expand Down
5 changes: 1 addition & 4 deletions src/sonic-framework/rebootbackend/rebootbackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
#include "reboot_interfaces.h"
#include "rebootbe.h"

using namespace ::rebootbackend::HostServiceDbus;
using namespace ::rebootbackend::RebootBE;

int main(int argc, char** argv) {
HostServiceDbus dbus_interface;
RebootBE rebootbe(dbus_interface);
::rebootbackend::RebootBE rebootbe(dbus_interface);
rebootbe.Start();
return 0;
}
11 changes: 3 additions & 8 deletions src/sonic-framework/rebootbackend/rebootbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ void RebootBE::Start() {
SWSS_LOG_ENTER();
SWSS_LOG_NOTICE("--- Starting rebootbackend ---");

swss::WarmStart::initialize("rebootbackend", "sonic-framework");
swss::WarmStart::checkWarmStart("rebootbackend", "sonic-framework",
/*incr_restore_cnt=*/false);

swss::Select s;
s.addSelectable(&m_NotificationConsumer);
s.addSelectable(&m_Done);
Expand Down Expand Up @@ -85,15 +81,15 @@ bool RebootBE::RetrieveNotificationData(
SWSS_LOG_ENTER();

request.op = "";
request.ret_string = "";
request.retString = "";

std::string data;
std::vector<swss::FieldValueTuple> values;
consumer.pop(request.op, data, values);

for (auto &fv : values) {
if (DATA_TUPLE_KEY == fvField(fv)) {
request.ret_string = fvValue(fv);
request.retString = fvValue(fv);
return true;
}
}
Expand All @@ -118,8 +114,7 @@ void RebootBE::SendNotificationResponse(const std::string key,

NotificationResponse RebootBE::HandleRebootRequest(
const std::string &jsonRebootRequest) {
// using namespace google::protobuf::util;
using namespace gpu::;
using namespace gpu;

SWSS_LOG_ENTER();

Expand Down
12 changes: 6 additions & 6 deletions src/sonic-framework/rebootbackend/rebootbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

namespace rebootbackend {

#define REBOOT_REQUEST_NOTIFICATION_CHANNEL "Reboot_Request_Channel"
#define REBOOT_RESPONSE_NOTIFICATION_CHANNEL "Reboot_Response_Channel"
#define REBOOT_KEY "Reboot"
#define REBOOT_STATUS_KEY "RebootStatus"
#define CANCEL_REBOOT_KEY "CancelReboot"
#define DATA_TUPLE_KEY "MESSAGE"
constexpr char REBOOT_REQUEST_NOTIFICATION_CHANNEL[] = "Reboot_Request_Channel";
constexpr char REBOOT_RESPONSE_NOTIFICATION_CHANNEL[] = "Reboot_Response_Channel";
constexpr char REBOOT_KEY[] = "Reboot";
constexpr char REBOOT_STATUS_KEY[] = "RebootStatus";
constexpr char CANCEL_REBOOT_KEY[] = "CancelReboot";
constexpr char DATA_TUPLE_KEY[] = "MESSAGE";

class RebootBE {
public:
Expand Down
Loading

0 comments on commit 624101c

Please sign in to comment.