diff --git a/dockers/docker-framework/Dockerfile.j2 b/dockers/docker-framework/Dockerfile.j2 index c9c71d402e84..9e38da9ce4c6 100644 --- a/dockers/docker-framework/Dockerfile.j2 +++ b/dockers/docker-framework/Dockerfile.j2 @@ -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 diff --git a/files/build/versions/dockers/docker-framework/versions-deb-bullseye b/files/build/versions/dockers/docker-framework/versions-deb-bookworm similarity index 100% rename from files/build/versions/dockers/docker-framework/versions-deb-bullseye rename to files/build/versions/dockers/docker-framework/versions-deb-bookworm diff --git a/files/build/versions/dockers/docker-framework/versions-mirror b/files/build/versions/dockers/docker-framework/versions-mirror deleted file mode 100644 index 82426ebf9828..000000000000 --- a/files/build/versions/dockers/docker-framework/versions-mirror +++ /dev/null @@ -1,3 +0,0 @@ -debian-archive.trafficmanager.net_debian-security_dists_bullseye-security==2024-05-10T08:02:59Z -debian-archive.trafficmanager.net_debian_dists_bullseye-backports==2024-05-10T02:16:16Z -debian-archive.trafficmanager.net_debian_dists_bullseye-updates==2024-05-10T02:16:16Z diff --git a/files/build/versions/dockers/docker-sonic-vs/versions-deb-bookworm b/files/build/versions/dockers/docker-sonic-vs/versions-deb-bookworm new file mode 100644 index 000000000000..3567db934fff --- /dev/null +++ b/files/build/versions/dockers/docker-sonic-vs/versions-deb-bookworm @@ -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 diff --git a/rules/docker-framework.mk b/rules/docker-framework.mk index 9b3fda63a2df..9da73a1bb118 100644 --- a/rules/docker-framework.mk +++ b/rules/docker-framework.mk @@ -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 @@ -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) diff --git a/sonic-slave-bookworm/Dockerfile.j2 b/sonic-slave-bookworm/Dockerfile.j2 index 92a15eaf9972..331cde5db200 100644 --- a/sonic-slave-bookworm/Dockerfile.j2 +++ b/sonic-slave-bookworm/Dockerfile.j2 @@ -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 \ @@ -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 \ No newline at end of file +ENV PATH $PATH:$RUST_ROOT/bin diff --git a/src/sonic-framework/rebootbackend/Makefile.am b/src/sonic-framework/rebootbackend/Makefile.am index 205c879802f2..7d6faf283c02 100644 --- a/src/sonic-framework/rebootbackend/Makefile.am +++ b/src/sonic-framework/rebootbackend/Makefile.am @@ -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 diff --git a/src/sonic-framework/rebootbackend/interfaces.cpp b/src/sonic-framework/rebootbackend/interfaces.cpp index 3a54d5d42ea8..2b61542a2dd9 100644 --- a/src/sonic-framework/rebootbackend/interfaces.cpp +++ b/src/sonic-framework/rebootbackend/interfaces.cpp @@ -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; diff --git a/src/sonic-framework/rebootbackend/interfaces.h b/src/sonic-framework/rebootbackend/interfaces.h index 977d3518ead0..aa0081dd8080 100644 --- a/src/sonic-framework/rebootbackend/interfaces.h +++ b/src/sonic-framework/rebootbackend/interfaces.h @@ -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 { @@ -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( diff --git a/src/sonic-framework/rebootbackend/reboot_common.h b/src/sonic-framework/rebootbackend/reboot_common.h index 3c9b55be767c..a67b92cad6a3 100644 --- a/src/sonic-framework/rebootbackend/reboot_common.h +++ b/src/sonic-framework/rebootbackend/reboot_common.h @@ -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; diff --git a/src/sonic-framework/rebootbackend/reboot_thread.cpp b/src/sonic-framework/rebootbackend/reboot_thread.cpp index a57a241e302f..5c0e122be5c0 100644 --- a/src/sonic-framework/rebootbackend/reboot_thread.cpp +++ b/src/sonic-framework/rebootbackend/reboot_thread.cpp @@ -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" @@ -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), diff --git a/src/sonic-framework/rebootbackend/reboot_thread.h b/src/sonic-framework/rebootbackend/reboot_thread.h index 6655069a61c7..8ca3b7c73805 100644 --- a/src/sonic-framework/rebootbackend/reboot_thread.h +++ b/src/sonic-framework/rebootbackend/reboot_thread.h @@ -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" diff --git a/src/sonic-framework/rebootbackend/rebootbackend.cpp b/src/sonic-framework/rebootbackend/rebootbackend.cpp index 3864eea3e37c..d0962f63869b 100644 --- a/src/sonic-framework/rebootbackend/rebootbackend.cpp +++ b/src/sonic-framework/rebootbackend/rebootbackend.cpp @@ -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; } diff --git a/src/sonic-framework/rebootbackend/rebootbe.cpp b/src/sonic-framework/rebootbackend/rebootbe.cpp index 62c6ccc3cf06..1c3b1c2fe014 100644 --- a/src/sonic-framework/rebootbackend/rebootbe.cpp +++ b/src/sonic-framework/rebootbackend/rebootbe.cpp @@ -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); @@ -85,7 +81,7 @@ bool RebootBE::RetrieveNotificationData( SWSS_LOG_ENTER(); request.op = ""; - request.ret_string = ""; + request.retString = ""; std::string data; std::vector values; @@ -93,7 +89,7 @@ bool RebootBE::RetrieveNotificationData( for (auto &fv : values) { if (DATA_TUPLE_KEY == fvField(fv)) { - request.ret_string = fvValue(fv); + request.retString = fvValue(fv); return true; } } @@ -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(); diff --git a/src/sonic-framework/rebootbackend/rebootbe.h b/src/sonic-framework/rebootbackend/rebootbe.h index 97a6c227e45a..59f8734026f7 100644 --- a/src/sonic-framework/rebootbackend/rebootbe.h +++ b/src/sonic-framework/rebootbackend/rebootbe.h @@ -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: diff --git a/src/sonic-framework/rebootbackend/redis_utils.cpp b/src/sonic-framework/rebootbackend/redis_utils.cpp deleted file mode 100644 index 4010e99d423a..000000000000 --- a/src/sonic-framework/rebootbackend/redis_utils.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include "redis_utils.h" - -#include -#include -#include -#include - -#include "dbconnector.h" -#include "notificationproducer.h" -//#include "stateverification.h" -#include "table.h" -#include "timestamp.h" -#include "warm_restart.h" - -namespace rebootbackend { - -using WarmStartState = ::swss::WarmStart::WarmStartState; - - -void init_warm_reboot_states(const swss::DBConnector &db) { - swss::Table table(&db, STATE_WARM_RESTART_TABLE_NAME); - std::vector keys; - - table.getKeys(keys); - for (auto &key : keys) { - table.hdel(key, "state"); - table.hdel(key, "timestamp"); - } -} - -void set_warm_restart_enable(const swss::DBConnector &db, bool enabled) { - swss::Table table(&db, STATE_WARM_RESTART_ENABLE_TABLE_NAME); - table.hset("system", "enable", enabled ? "true" : "false"); -} - -bool is_valid_key(const std::string &key, const std::string &separator) { - if (separator.empty()) { - return false; - } - - size_t pos = key.find(separator); - // The separator must exist in the string, and cannot be the first or last - // character. - return !(pos == std::string::npos || pos == 0 || pos == key.size() - 1); -} - -bool get_docker_app_from_key(const std::string &key, - const std::string &separator, std::string &docker, - std::string &app) { - SWSS_LOG_ENTER(); - - size_t pos = key.find(separator); - - if (separator.empty()) { - SWSS_LOG_ERROR("separator [%s] shouldn't be empty", separator.c_str()); - return false; - } - - if (pos == std::string::npos) { - SWSS_LOG_ERROR("key [%s] should contain separator [%s]", key.c_str(), - separator.c_str()); - return false; - } - - docker = key.substr(0, pos); - app = key.substr(pos + separator.length(), std::string::npos); - - if (docker.empty()) { - SWSS_LOG_ERROR("docker name shouldn't be empty, key = %s", key.c_str()); - return false; - } - - if (app.empty()) { - SWSS_LOG_ERROR("app name shouldn't be empty, key = %s", key.c_str()); - return false; - } - return true; -} - -} // namespace rebootbackend diff --git a/src/sonic-framework/rebootbackend/redis_utils.h b/src/sonic-framework/rebootbackend/redis_utils.h deleted file mode 100644 index 05d87c2aef1c..000000000000 --- a/src/sonic-framework/rebootbackend/redis_utils.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once -#include -#include -#include - -#include "dbconnector.h" -#include "notificationconsumer.h" -#include "notificationproducer.h" -#include "selectableevent.h" -#include "status_code_util.h" -#include "warm_restart.h" - -namespace rebootbackend { - -// Return string corresponding to state -std::string get_warm_start_state_name( - const swss::WarmStart::WarmStartState state); - -void init_warm_reboot_states(const swss::DBConnector &db); - -// Set the system warm start state to a new enabled/disabled state. -// STATE_WARM_RESTART_TABLE_NAME -// key = system, field = enable, value = "true"/"false" -void set_warm_restart_enable(const swss::DBConnector &db, bool enabled); - -// Returns true if key is in the formm "texttext", and false -// otherwise. -bool is_valid_key(const std::string &key, const std::string &separator); - -// Helper function: given key of form "docker|app" -// extract docker and app. (separator = | in this case) -// return false if docker or app are empty or separator -// isn't present, else true. -// key and separator are inputs -// docker and app are outputs -bool get_docker_app_from_key(const std::string &key, - const std::string &separator, std::string &docker, - std::string &app); - -} // namespace rebootbackend diff --git a/src/sonic-framework/tests/Makefile.am b/src/sonic-framework/tests/Makefile.am index 7ff27a79ca33..f26c7a7191f3 100644 --- a/src/sonic-framework/tests/Makefile.am +++ b/src/sonic-framework/tests/Makefile.am @@ -31,8 +31,6 @@ tests_SOURCES = test_utils_common.cpp \ $(top_srcdir)/rebootbackend/system/system.pb.cc \ $(top_srcdir)/rebootbackend/types/types.pb.cc \ $(top_srcdir)/rebootbackend/common/common.pb.cc \ - redis_utils_test.cpp \ - $(top_srcdir)/rebootbackend/redis_utils.cpp \ test_main.cpp tests_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_GTEST) $(CFLAGS_COVERAGE) $(CFLAGS_SAI) diff --git a/src/sonic-framework/tests/reboot_thread_test.cpp b/src/sonic-framework/tests/reboot_thread_test.cpp index 35778ff864a1..fd9f23186c98 100644 --- a/src/sonic-framework/tests/reboot_thread_test.cpp +++ b/src/sonic-framework/tests/reboot_thread_test.cpp @@ -12,7 +12,6 @@ #include "mock_reboot_interfaces.h" #include "reboot_common.h" #include "reboot_interfaces.h" -#include "redis_utils.h" #include "select.h" #include "selectableevent.h" #include "status_code_util.h" @@ -97,7 +96,6 @@ class RebootThreadTest : public ::testing::Test { m_config_db("CONFIG_DB", 0), m_reboot_thread(m_dbus_interface, m_finished) { - swss::WarmStart::initialize("app1", "docker1"); sigterm_requested = false; } diff --git a/src/sonic-framework/tests/rebootbe_test.cpp b/src/sonic-framework/tests/rebootbe_test.cpp index 7c23f996bad3..b786c919bcab 100644 --- a/src/sonic-framework/tests/rebootbe_test.cpp +++ b/src/sonic-framework/tests/rebootbe_test.cpp @@ -27,6 +27,7 @@ namespace rebootbackend { #define ONE_SECOND_MS (1000) #define FIFTEEN_HUNDRED_MS (1500) #define TWO_SECONDS_MS (2000) +#define SELECT_TIMEOUT_250_MS (250) namespace gpu = ::google::protobuf::util; using namespace gnoi::system; @@ -75,20 +76,6 @@ class RebootBETestWithoutStop : public ::testing::Test { } virtual ~RebootBETestWithoutStop() = default; - gnoi::system::RebootStatusResponse default_not_started_status() { - InitThreadStatus status; - return status.get_response(); - } - - gnoi::system::RebootStatusResponse default_done_status() { - InitThreadStatus status; - // We can't edit the status without it being active. - status.set_start_status(); - status.set_success(); - status.set_inactive(); - return status.get_response(); - } - void start_rebootbe() { m_rebootbe_thread = @@ -102,11 +89,11 @@ class RebootBETestWithoutStop : public ::testing::Test { } void overwrite_reboot_timeout(uint32_t timeout_seconds) { - m_rebootbe.m_reboot_thread.m_reboot_timeout = timeout_seconds; + m_rebootbe.m_RebootThread.m_reboot_timeout = timeout_seconds; } - void send_stop_reboot_thread() { m_rebootbe.m_reboot_thread.Stop(); } + void send_stop_reboot_thread() { m_rebootbe.m_RebootThread.Stop(); } void SendRebootRequest(const std::string &op, const std::string &data, const std::string &field, const std::string &value) { @@ -188,7 +175,7 @@ class RebootBETestWithoutStop : public ::testing::Test { } NotificationResponse handle_reboot_request(std::string &json_request) { - return m_rebootbe.handle_reboot_request(json_request); + return m_rebootbe.HandleRebootRequest(json_request); } diff --git a/src/sonic-framework/tests/redis_utils_test.cpp b/src/sonic-framework/tests/redis_utils_test.cpp deleted file mode 100644 index 00864059a21e..000000000000 --- a/src/sonic-framework/tests/redis_utils_test.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "redis_utils.h" - -#include -#include -#include - -#include -#include -#include - -#include "select.h" -#include "table.h" -#include "test_utils_common.h" -#include "timestamp.h" - -namespace rebootbackend { - -using ::testing::AllOf; -using ::testing::HasSubstr; -using ::testing::StrEq; - - -} // namespace rebootbackend diff --git a/src/sonic-framework/tests/test_utils_common.cpp b/src/sonic-framework/tests/test_utils_common.cpp index ef0088b7bf05..ff7c93aee928 100644 --- a/src/sonic-framework/tests/test_utils_common.cpp +++ b/src/sonic-framework/tests/test_utils_common.cpp @@ -8,7 +8,6 @@ #include "dbconnector.h" #include "notificationconsumer.h" -#include "redis_utils.h" #include "select.h" #include "selectableevent.h" #include "table.h"