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

Support centec platform #325

Closed
wants to merge 1 commit 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
1 change: 1 addition & 0 deletions dockers/docker-orchagent-centec
16 changes: 16 additions & 0 deletions platform/centec/docker-orchagent-centec.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# docker image for orchagent

DOCKER_ORCHAGENT_CENTEC = docker-orchagent-centec.gz
$(DOCKER_ORCHAGENT_CENTEC)_PATH = $(DOCKERS_PATH)/docker-orchagent
$(DOCKER_ORCHAGENT_CENTEC)_DEPENDS += $(SWSS) $(REDIS_TOOLS)
$(DOCKER_ORCHAGENT_CENTEC)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
SONIC_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CENTEC)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_ORCHAGENT_CENTEC)

$(DOCKER_ORCHAGENT_CENTEC)_CONTAINER_NAME = swss
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += --net=host --privileged -t
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += --volumes-from database
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces:/etc/network/interfaces:ro
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/network/interfaces.d/:/etc/network/interfaces.d/:ro
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /host/machine.conf:/host/machine.conf
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
16 changes: 16 additions & 0 deletions platform/centec/docker-syncd-centec.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# docker image for centec syncd

DOCKER_SYNCD_CENTEC = docker-syncd-centec.gz
$(DOCKER_SYNCD_CENTEC)_PATH = $(PLATFORM_PATH)/docker-syncd-centec
$(DOCKER_SYNCD_CENTEC)_DEPENDS += $(SYNCD)
$(DOCKER_SYNCD_CENTEC)_LOAD_DOCKERS += $(DOCKER_BASE)
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_CENTEC)

$(DOCKER_SYNCD_CENTEC)_CONTAINER_NAME = syncd
$(DOCKER_SYNCD_CENTEC)_RUN_OPT += --net=host --privileged -t
$(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
$(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /var/run/docker-syncd:/var/run/sswsyncd
$(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /lib/modules:/libmodules
$(DOCKER_SYNCD_CENTEC)_RUN_OPT += --volumes-from database
$(DOCKER_SYNCD_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
32 changes: 32 additions & 0 deletions platform/centec/docker-syncd-centec/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM docker-base

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

RUN apt-get update

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

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

## add kmod into Depends
RUN apt-get install -f kmod
RUN apt-get install -f gcc -y
RUN apt-get install -f gdb -y
RUN apt-get install -f make -y

COPY ["start.sh", "/usr/bin/"]

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

ENTRYPOINT ["/bin/bash"]
CMD ["/usr/bin/start.sh"]
17 changes: 17 additions & 0 deletions platform/centec/docker-syncd-centec/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

function clean_up {
service syncd stop
service rsyslog stop
exit
}

trap clean_up SIGTERM SIGKILL

# FIXME: the script cannot trap SIGTERM signal and it exits without clean_up
# Remove rsyslogd.pid file manually so that to start the rsyslog instantly
[ -e /var/run/rsyslogd.pid ] && rm /var/run/rsyslogd.pid
service rsyslog start
service syncd start

read
7 changes: 7 additions & 0 deletions platform/centec/one-image.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# sonic centec one image installer

SONIC_ONE_IMAGE = sonic-centec.bin
$(SONIC_ONE_IMAGE)_MACHINE = centec
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES)
SONIC_INSTALLERS += $(SONIC_ONE_IMAGE)
Empty file added platform/centec/platform.conf
Empty file.
13 changes: 13 additions & 0 deletions platform/centec/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
include $(PLATFORM_PATH)/sai.mk
include $(PLATFORM_PATH)/docker-orchagent-centec.mk
include $(PLATFORM_PATH)/docker-syncd-centec.mk
include $(PLATFORM_PATH)/one-image.mk


SONIC_ALL += $(SONIC_ONE_IMAGE)

# Inject centec sai into sairedis
$(LIBSAIREDIS)_DEPENDS += $(CENTEC_SAI)

# Runtime dependency on centec sai is set only for syncd
$(SYNCD)_RDEPENDS += $(CENTEC_SAI)
5 changes: 5 additions & 0 deletions platform/centec/sai.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Centec SAI
CENTEC_SAI = libsai_1.0.0.deb
$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/goldengate-sai/lib/libsai_1.0.0.deb

SONIC_ONLINE_DEBS += $(CENTEC_SAI)