Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brcm poc #3068

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@
[submodule "platform/mellanox/mlnx-sai/SAI-Implementation"]
path = platform/mellanox/mlnx-sai/SAI-Implementation
url = https://github.com/Mellanox/SAI-Implementation
[submodule "src/sonic-mgmt-framework"]
path = src/sonic-mgmt-framework
url = https://github.com/project-arlo/sonic-mgmt-framework.git
34 changes: 34 additions & 0 deletions dockers/docker-sonic-mgmt-framework/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM {{ docker_sonic_mgmt_framework_load_image }}

ARG docker_container_name
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf

## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update

#RUN apt-get install -f -y libdbus-1-3 libdaemon0 libjansson4

## Install redis-tools dependencies
## TODO: implicitly install dependencies
RUN apt-get -y install libjemalloc1

COPY \
{% for deb in docker_sonic_mgmt_framework_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor -%}
debs/

RUN dpkg -i \
{% for deb in docker_sonic_mgmt_framework_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor %}

COPY ["start.sh", "rest-server.sh", "/usr/bin/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]

RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs

ENTRYPOINT ["/usr/bin/supervisord"]
12 changes: 12 additions & 0 deletions dockers/docker-sonic-mgmt-framework/rest-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

REST_SERVER_ARGS=" -ui /rest_ui -port=80 -logtostderr"

#export LIBYANG_EXTENSIONS_PLUGINS_DIR
export CVL_SCHEMA_PATH=/usr/sbin/schema
export LIBYANG_EXTENSIONS_PLUGINS_DIR=/usr/sbin/lib
export LIBYANG_USER_TYPES_PLUGINS_DIR=/usr/sbin/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PATH:/usr/sbin/lib

exec /usr/sbin/rest_server ${REST_SERVER_ARGS}
#while [ true ]; do sleep 1; done
10 changes: 10 additions & 0 deletions dockers/docker-sonic-mgmt-framework/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status

rm -f /var/run/rsyslogd.pid

supervisorctl start rsyslogd

supervisorctl start rest-server
28 changes: 28 additions & 0 deletions dockers/docker-sonic-mgmt-framework/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[supervisord]
logfile_maxbytes=1MB
logfile_backups=2
nodaemon=true

[program:start.sh]
command=/usr/bin/start.sh
priority=1
autostart=true
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog

[program:rsyslogd]
command=/usr/sbin/rsyslogd -n
priority=2
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog

[program:rest-server]
command=/usr/bin/rest-server.sh
priority=3
autostart=false
autorestart=true
stdout_logfile=syslog
stderr_logfile=syslog
14 changes: 14 additions & 0 deletions files/build_templates/mgmt-framework.service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Management Framework container
Requires=swss.service
After=swss.service
Before=ntp-config.service

[Service]
User={{ sonicadmin_user }}
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
ExecStart=/usr/bin/{{docker_container_name}}.sh wait
ExecStop=/usr/bin/{{docker_container_name}}.sh stop

[Install]
WantedBy=multi-user.target
22 changes: 22 additions & 0 deletions rules/docker-sonic-mgmt-framework.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# docker image for mgmt-framework

DOCKER_MGMT-FRAMEWORK_STEM = docker-sonic-mgmt-framework
DOCKER_MGMT-FRAMEWORK = $(DOCKER_MGMT-FRAMEWORK_STEM).gz
DOCKER_MGMT-FRAMEWORK_DBG = $(DOCKER_MGMT-FRAMEWORK_STEM)-$(DBG_IMAGE_MARK).gz

$(DOCKER_MGMT-FRAMEWORK)_PATH = $(DOCKERS_PATH)/$(DOCKER_MGMT-FRAMEWORK_STEM)

$(DOCKER_MGMT-FRAMEWORK)_DEPENDS += $(REDIS_TOOLS) $(SONIC_MGMT-FRAMEWORK)
#$(DOCKER_MGMT-FRAMEWORK)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS)

SONIC_DOCKER_IMAGES += $(DOCKER_MGMT-FRAMEWORK)
$(DOCKER_MGMT-FRAMEWORK)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)
#$(DOCKER_MGMT-FRAMEWORK)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES)

SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_MGMT-FRAMEWORK)
SONIC_STRETCH_DOCKERS += $(DOCKER_MGMT-FRAMEWORK)

$(DOCKER_MGMT-FRAMEWORK)_CONTAINER_NAME = mgmt-framework
$(DOCKER_MGMT-FRAMEWORK)_RUN_OPT += --net=host --privileged -t
$(DOCKER_MGMT-FRAMEWORK)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro

5 changes: 5 additions & 0 deletions rules/sonic-mgmt-framework.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SONiC mgmt-framework package

SONIC_MGMT-FRAMEWORK = sonic-mgmt-framework_1.0-01_amd64.deb
$(SONIC_MGMT-FRAMEWORK)_SRC_PATH = $(SRC_PATH)/sonic-mgmt-framework
SONIC_DPKG_DEBS += $(SONIC_MGMT-FRAMEWORK)
1 change: 1 addition & 0 deletions src/sonic-mgmt-framework
Submodule sonic-mgmt-framework added at 13c9cf