Skip to content

Commit

Permalink
run otss and syncd-ot services on otn platform
Browse files Browse the repository at this point in the history
  • Loading branch information
sonic-otn committed Nov 8, 2023
1 parent bec6c5d commit 38d604a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 16 deletions.
21 changes: 15 additions & 6 deletions build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ fi

IMAGE_VERSION="${SONIC_IMAGE_VERSION}"

if [[ $TARGET_MACHINE = ot-* ]]
then
DEVICE_ROOT=ot-device
PLATFORM_ROOT=ot-platform
else
DEVICE_ROOT=device
PLATFORM_ROOT=platform
fi

generate_kvm_image()
{
NUM_ASIC=$1
Expand Down Expand Up @@ -73,10 +82,10 @@ generate_onie_installer_image()
# Copy platform-specific ONIE installer config files where onie-mk-demo.sh expects them
rm -rf ./installer/platforms/
mkdir -p ./installer/platforms/
for VENDOR in `ls ./device`; do
for PLATFORM in `ls ./device/$VENDOR | grep ^${TARGET_PLATFORM}`; do
if [ -f ./device/$VENDOR/$PLATFORM/installer.conf ]; then
cp ./device/$VENDOR/$PLATFORM/installer.conf ./installer/platforms/$PLATFORM
for VENDOR in `ls ./$DEVICE_ROOT`; do
for PLATFORM in `ls ./$DEVICE_ROOT/$VENDOR | grep ^${TARGET_PLATFORM}`; do
if [ -f ./$DEVICE_ROOT/$VENDOR/$PLATFORM/installer.conf ]; then
cp ./$DEVICE_ROOT/$VENDOR/$PLATFORM/installer.conf ./installer/platforms/$PLATFORM
fi

done
Expand All @@ -85,7 +94,7 @@ generate_onie_installer_image()
## Generate an ONIE installer image
## Note: Don't leave blank between lines. It is single line command.
./onie-mk-demo.sh $CONFIGURED_ARCH $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \
installer platform/$TARGET_MACHINE/platform.conf $output_file OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \
installer $PALTFORM_ROOT/$TARGET_MACHINE/platform.conf $output_file OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \
$ONIE_INSTALLER_PAYLOAD $SECURE_UPGRADE_SIGNING_CERT $SECURE_UPGRADE_DEV_SIGNING_KEY
}

Expand All @@ -97,7 +106,7 @@ generate_device_list()
# Create an empty function, and later append to it
echo -n > $platforms_asic

for d in `find -L ./device -maxdepth 2 -mindepth 2 -type d`; do
for d in `find -L ./$DEVICE_ROOT -maxdepth 2 -mindepth 2 -type d`; do
if [ -f $d/platform_asic ]; then
if [ "$TARGET_MACHINE" = "generic" ] || grep -Fxq "$TARGET_MACHINE" $d/platform_asic; then
echo "${d##*/}" >> "$platforms_asic";
Expand Down
2 changes: 2 additions & 0 deletions dockers/docker-ot-orchagent/docker-init.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ CFGGEN_PARAMS=" \
-t /usr/share/sonic/templates/supervisord.conf.j2,/etc/supervisor/conf.d/supervisord.conf
"

sonic-cfggen $CFGGEN_PARAMS

# Executed platform specific initialization tasks.
if [ -x /usr/share/sonic/platform/platform-init ]; then
/usr/share/sonic/platform/platform-init
Expand Down
15 changes: 12 additions & 3 deletions files/build_templates/init_cfg.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,21 @@
("database", "always_enabled", false, "always_enabled"),
("lldp", "enabled", true, "enabled"),
("pmon", "enabled", true, "enabled"),
("snmp", "enabled", true, "enabled"),
("eventd", "enabled", false, "enabled"),
{%- if sonic_asic_platform.startswith('ot-') %}
("snmp", "disabled", true, "enabled"),
("swss", "disabled", false, "enabled"),
("syncd", "disabled", false, "enabled"),
("otss", "enabled", false, "enabled"),
("syncd-ot", "enabled", false, "enabled")
{% else %}
("snmp", "enabled", true, "enabled"),
("swss", "enabled", false, "enabled"),
("syncd", "enabled", false, "enabled"),
("otss", "enabled", false, "enabled"),
("syncd-ot", "enabled", false, "enabled")] %}
("otss", "disabled", false, "enabled"),
("syncd-ot", "disabled", false, "enabled")
{% endif %}
] %}
{%- if include_router_advertiser == "y" %}{% do features.append(("radv", "enabled", false, "enabled")) %}{% endif %}
{%- if include_teamd == "y" %}{% do features.append(("teamd", "{% if not DEVICE_RUNTIME_METADATA['ETHERNET_PORTS_PRESENT'] %}disabled{% else %}enabled{% endif %}", false, "enabled")) %}{% endif %}
{% do features.append(("dhcp_relay", "{% if not (DEVICE_METADATA is defined and DEVICE_METADATA['localhost'] is defined and DEVICE_METADATA['localhost']['type'] is defined and DEVICE_METADATA['localhost']['type'] is not in ['ToRRouter', 'EPMS', 'MgmtTsToR', 'MgmtToRRouter', 'BmcMgmtToRRouter']) %}enabled{% else %}disabled{% endif %}", false, "enabled")) %}
Expand Down
8 changes: 4 additions & 4 deletions files/build_templates/per_namespace/otss.service.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Unit]
Description=switch state service
Description=optical transport state service
Requires=database{% if multi_instance == 'true' %}@%i{% endif %}.service
After=database{% if multi_instance == 'true' %}@%i{% endif %}.service
Requires=updategraph.service
Expand All @@ -13,9 +13,9 @@ StartLimitBurst=3
[Service]
User=root
Environment=sonic_asic_platform={{ sonic_asic_platform }}
ExecStartPre=/usr/local/bin/swss.sh start{% if multi_instance == 'true' %} %i{% endif %}
ExecStart=/usr/local/bin/swss.sh wait{% if multi_instance == 'true' %} %i{% endif %}
ExecStop=/usr/local/bin/swss.sh stop{% if multi_instance == 'true' %} %i{% endif %}
ExecStartPre=/usr/local/bin/otss.sh start{% if multi_instance == 'true' %} %i{% endif %}
ExecStart=/usr/local/bin/otss.sh wait{% if multi_instance == 'true' %} %i{% endif %}
ExecStop=/usr/local/bin/otss.sh stop{% if multi_instance == 'true' %} %i{% endif %}
RestartSec=30

[Install]
Expand Down
6 changes: 3 additions & 3 deletions files/build_templates/per_namespace/syncd-ot.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ StartLimitBurst=3
[Service]
User=root
Environment=sonic_asic_platform={{ sonic_asic_platform }}
ExecStartPre=/usr/local/bin/syncd.sh start{% if multi_instance == 'true' %} %i{% endif %}
ExecStart=/usr/local/bin/syncd.sh wait{% if multi_instance == 'true' %} %i{% endif %}
ExecStop=/usr/local/bin/syncd.sh stop{% if multi_instance == 'true' %} %i{% endif %}
ExecStartPre=/usr/local/bin/syncd-ot.sh start{% if multi_instance == 'true' %} %i{% endif %}
ExecStart=/usr/local/bin/syncd-ot.sh wait{% if multi_instance == 'true' %} %i{% endif %}
ExecStop=/usr/local/bin/syncd-ot.sh stop{% if multi_instance == 'true' %} %i{% endif %}
Restart=always
RestartSec=30

Expand Down

0 comments on commit 38d604a

Please sign in to comment.