9. Supervisor: A Process Control System
- https://github.com/Supervisor/supervisor.git
- Supervisor daemon (dockers/docker-orchagent/supervisord.conf)
- [program:orchagent]
- command=/usr/bin/orchagent.sh
- priority=4
- autostart=false
- autorestart=false
- stdout_logfile=syslog
- stderr_logfile=syslog
- dependent_startup=true
- dependent_startup_wait_for=portsyncd:running
- Critical Process Listener
- files/scripts/supervisor-proc-exit-listener
- configuration: /etc/supervisor/critical_processes
10. Switch State Service (SWSS)
The SWitch State Service (SWSS) is a collection of
software that provides a database interface for
communication with and state representation of
network applications and network switch hardware.
11. sonic-swss-common
- Communication with REDIS
- DBConnector: set up DB connection.
- RedisPipeline: producer to database
- RedisTransactioner: database to subscriber (consumer)
- swss::ProducerStateTable ⇐ TableBase
- Producer Destination table
- swss: SubscriberStateTable ⇐ ConsumerTableBase
- Consumer source table
- NetDispatcher: Register Netlink message and handler
18. SWSS: Config Manger
- Mangers are table consumer and produce netlink message to kernel
- coppmgrd
- vlanmgrd
- intfmgrd
- portmgrd
- vrfmgrd
- nbrmgrd
- vxlanmgrd
- tunnelmgrd
- lldpmgrd (In LLDP Container)
19. SWSS: *syncd
- Direction: Receive Netlink message and push new data to the APPL_DB
- SWSS CNTR: portsyncd, neighsyncd, fdbsyncd
- BGP CNTR: fpmsyncd
- teamd CNTR: teamsyncd
- LLDP: lldp_syncd
20. Switch State Service: Orchagent
● The most critical component in the Swss
subsystem.
● Orchagent contains logic to extract all the
relevant state injected by *syncd
daemons, process and message this
information accordingly, and finally push it
towards its south-bound interface.
● Orchagent operates both as a consumer
(for example for state coming from
APPL_DB), and also as a producer (for
state being pushed into ASIC_DB).
23. orchdaemon.cpp
---------------------------------------------
ret = m_select->select(&s, SELECT_TIMEOUT);
if (ret == Select::ERROR)
{
SWSS_LOG_NOTICE("Error: %s!n", strerror(errno));
continue;
}
if (ret == Select::TIMEOUT)
{
continue;
}
auto *c = (Executor *)s;
c->execute();
select.cpp
--------------------------------------------
int Select::poll_descriptors(Selectable **c, unsigned int timeout)
{
int sz_selectables = static_cast<int>(m_objects.size());
std::vector<struct epoll_event> events(sz_selectables);
int ret;
do
{
ret = ::epoll_wait(m_epoll_fd, events.data(), sz_selectables, timeout);
}
while(ret == -1 && errno == EINTR); // Retry the select if the process was interrupted by a signal
orch.cpp