Skip to content

Commit

Permalink
Add support for PoE feature
Browse files Browse the repository at this point in the history
Add target for poesyncd container
Add poe_vs hwsku
Add yang models

Signed-off-by: Serhiy Boiko <[email protected]>
  • Loading branch information
SerhiyBoikoPLV committed Jul 18, 2024
1 parent c8d1c1d commit 8861f70
Show file tree
Hide file tree
Showing 25 changed files with 676 additions and 2 deletions.
20 changes: 20 additions & 0 deletions device/virtual/x86_64-kvm_x86_64-r0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The format of default_sku is a single line:
| ------ | ------ |
| Force10-S6000 | Dell Force10 S6000|
| brcm_gearbox_vs | Similar to Force10-S6000, but implements a virtual BRCM81724 Gearbox Phy |
| poe_vs | Similar to Force10-S6000, but implements PoE |

## Allowable values for default_preset

Expand Down Expand Up @@ -86,3 +87,22 @@ swss docker).

The commands "show gearbox interfaces status" and "show gearbox phys status" can be
used to verify the virtual gearbox phy has been created. See https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md#gearbox for details.

## poe_vs

This sku simulates a device with PoE capabilites. To enable, set default_sku to:


```
poe_vs t1
```

To build (same as Force-10-S6000):

```
make init
make configure PLATFORM=vs
make target/sonic-vs.img.gz
```

See https://github.com/sonic-net/sonic-utilities/blob/master/doc/Command-Reference.md#power-over-ethernet for details.
38 changes: 38 additions & 0 deletions device/virtual/x86_64-kvm_x86_64-r0/poe_vs/context_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"CONTEXTS": [
{
"guid" : 0,
"name" : "sw0",
"dbAsic" : "ASIC_DB",
"dbCounters" : "COUNTERS_DB",
"dbFlex": "FLEX_COUNTER_DB",
"dbState" : "STATE_DB",
"zmq_enable": false,
"zmq_endpoint": "tcp://127.0.0.1:5555",
"zmq_ntf_endpoint": "tcp://127.0.0.1:5556",
"switches": [
{
"index" : 0,
"hwinfo" : ""
}
]
},
{
"guid" : 1,
"name" : "poe1",
"dbAsic" : "POE_ASIC_DB",
"dbCounters" : "POE_COUNTERS_DB",
"dbFlex": "POE_FLEX_COUNTER_DB",
"dbState" : "STATE_DB",
"zmq_enable": false,
"zmq_endpoint": "tcp://127.0.0.1:5575",
"zmq_ntf_endpoint": "tcp://127.0.0.1:5576",
"switches": [
{
"index" : 1,
"hwinfo": ""
}
]
}
]
}
5 changes: 5 additions & 0 deletions device/virtual/x86_64-kvm_x86_64-r0/poe_vs/poe.profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_POE_VS
SAI_VS_SAI_SWITCH_TYPE=SAI_SWITCH_TYPE_POE
SAI_VS_HOSTIF_USE_TAP_DEVICE=false
SAI_VS_USE_BCMSIM_LINK_MON=true
SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini
192 changes: 192 additions & 0 deletions device/virtual/x86_64-kvm_x86_64-r0/poe_vs/poe_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
[{
"hw_info": "mcu1",
"power_limit_mode": "port",
"pse_list": [
{
"pse_index": 0
},
{
"pse_index": 1
}
],
"port_mapping_list": [
{
"interface": "Ethernet0",
"front_panel_index": 1,
"power_priority": "crit"
},
{
"interface": "Ethernet4",
"front_panel_index": 2,
"power_priority": "crit"
},
{
"interface": "Ethernet8",
"front_panel_index": 3,
"power_priority": "low"
},
{
"interface": "Ethernet12",
"front_panel_index": 4,
"power_priority": "low"
},
{
"interface": "Ethernet16",
"front_panel_index": 5,
"power_priority": "high"
},
{
"interface": "Ethernet20",
"front_panel_index": 6,
"power_priority": "high"
},
{
"interface": "Ethernet24",
"front_panel_index": 7,
"power_priority": "high"
},
{
"interface": "Ethernet28",
"front_panel_index": 8,
"power_priority": "high"
},
{
"interface": "Ethernet32",
"front_panel_index": 9,
"power_priority": "high"
},
{
"interface": "Ethernet36",
"front_panel_index": 10,
"power_priority": "high"
},
{
"interface": "Ethernet40",
"front_panel_index": 11,
"power_priority": "high"
},
{
"interface": "Ethernet44",
"front_panel_index": 12,
"power_priority": "high"
},
{
"interface": "Ethernet48",
"front_panel_index": 13,
"power_priority": "high"
},
{
"interface": "Ethernet52",
"front_panel_index": 14,
"power_priority": "high"
},
{
"interface": "Ethernet56",
"front_panel_index": 15,
"power_priority": "high"
},
{
"interface": "Ethernet60",
"front_panel_index": 16,
"power_priority": "high"
}
]
},
{
"hw_info": "mcu2",
"pse_list": [
{
"pse_index": 2
},
{
"pse_index": 3
}
],
"port_mapping_list": [
{
"interface": "Ethernet64",
"front_panel_index": 17,
"power_priority": "crit"
},
{
"interface": "Ethernet68",
"front_panel_index": 18,
"power_priority": "crit"
},
{
"interface": "Ethernet72",
"front_panel_index": 19,
"power_priority": "low"
},
{
"interface": "Ethernet76",
"front_panel_index": 20,
"power_priority": "low"
},
{
"interface": "Ethernet80",
"front_panel_index": 21,
"power_priority": "high"
},
{
"interface": "Ethernet84",
"front_panel_index": 22,
"power_priority": "high"
},
{
"interface": "Ethernet88",
"front_panel_index": 23,
"power_priority": "high"
},
{
"interface": "Ethernet92",
"front_panel_index": 24,
"power_priority": "high"
},
{
"interface": "Ethernet96",
"front_panel_index": 25,
"power_priority": "high"
},
{
"interface": "Ethernet100",
"front_panel_index": 26,
"power_priority": "high"
},
{
"interface": "Ethernet104",
"front_panel_index": 27,
"power_priority": "high"
},
{
"interface": "Ethernet108",
"front_panel_index": 28,
"power_priority": "high"
},
{
"interface": "Ethernet112",
"front_panel_index": 29,
"power_priority": "high"
},
{
"interface": "Ethernet116",
"front_panel_index": 30,
"power_priority": "high"
},
{
"interface": "Ethernet120",
"front_panel_index": 31,
"power_priority": "high"
},
{
"interface": "Ethernet124",
"front_panel_index": 32,
"power_priority": "high"
}
]
},
{
"hw_info": "mcu3",
"pse_list": [],
"port_mapping_list": []
}]
3 changes: 3 additions & 0 deletions device/virtual/x86_64-kvm_x86_64-r0/poe_vs/sai.profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SAI_VS_SWITCH_TYPE=SAI_VS_SWITCH_TYPE_BCM56850
SAI_VS_HOSTIF_USE_TAP_DEVICE=true
SAI_VS_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini
18 changes: 16 additions & 2 deletions dockers/docker-database/database_config.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@
"id" : 14,
"separator": ":",
"instance" : "redis"
}
},
{% if DATABASE_TYPE is defined and DATABASE_TYPE == "dpudb" %}
,
"DPU_APPL_DB" : {
"id" : 15,
"separator": ":",
Expand All @@ -130,6 +129,21 @@
"instance" : {% if include_remote_db %} "remote_redis" {% else %} "redis" {% endif %}
}
{% endif %}
"POE_ASIC_DB" : {
"id" : 21,
"separator": ":",
"instance" : "redis"
},
"POE_COUNTERS_DB" : {
"id" : 22,
"separator": ":",
"instance" : "redis"
},
"POE_FLEX_COUNTER_DB" : {
"id" : 23,
"separator": ":",
"instance" : "redis"
}
},
"VERSION" : "1.0"
}
1 change: 1 addition & 0 deletions dockers/docker-orchagent/critical_processes.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ program:portsyncd
program:neighsyncd
program:fdbsyncd
program:vlanmgrd
program:poemgrd
program:intfmgrd
program:portmgrd
program:fabricmgrd
Expand Down
32 changes: 32 additions & 0 deletions dockers/docker-orchagent/supervisord.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,23 @@ environment=ASAN_OPTIONS="log_path=/var/log/asan/gearsyncd-asan.log{{ asan_extra
{% endif %}
{%- endif %}

{% if is_fabric_asic == 0 %}
[program:poesyncd]
command=/usr/bin/poesyncd -p /usr/share/sonic/hwsku/poe_config.json
priority=3
autostart=false
autorestart=false
startsecs=0
startretries=0
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=rsyslogd:running
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/poesyncd-asan.log{{ asan_extra_options }}"
{% endif %}
{%- endif %}

{% if is_fabric_asic == 0 %}
[program:portsyncd]
command=/usr/bin/portsyncd
Expand Down Expand Up @@ -190,6 +207,21 @@ environment=ASAN_OPTIONS="log_path=/var/log/asan/portmgrd-asan.log{{ asan_extra_
{% endif %}
{%- endif %}

{% if is_fabric_asic == 0 %}
[program:poemgrd]
command=/usr/bin/poemgrd
priority=10
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
dependent_startup=true
dependent_startup_wait_for=swssconfig:exited
{% if ENABLE_ASAN == "y" %}
environment=ASAN_OPTIONS="log_path=/var/log/asan/poemgrd-asan.log{{ asan_extra_options }}"
{% endif %}
{%- endif %}

[program:fabricmgrd]
command=/usr/bin/fabricmgrd
priority=10
Expand Down
1 change: 1 addition & 0 deletions files/build_templates/init_cfg.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
{% 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")) %}
{%- if include_dhcp_server == "y" %}{% do features.append(("dhcp_server", "disabled", false, "enabled")) %}{% endif %}
{%- if sonic_asic_platform == "vs" %}{% do features.append(("gbsyncd", "enabled", false, "enabled")) %}{% endif %}
{%- if sonic_asic_platform == "vs" %}{% do features.append(("poesyncd", "enabled", false, "enabled")) %}{% endif %}
{%- if include_iccpd == "y" %}{% do features.append(("iccpd", "disabled", false, "enabled")) %}{% endif %}
{%- if include_mgmt_framework == "y" %}{% do features.append(("mgmt-framework", "enabled", true, "enabled")) %}{% endif %}
{%- if include_mux == "y" %}{% do features.append(("mux", "{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %}enabled{% else %}always_disabled{% endif %}", false, "enabled")) %}{% endif %}
Expand Down
22 changes: 22 additions & 0 deletions files/build_templates/per_namespace/poesyncd.service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[Unit]
Description={{docker_container_name}} service
Requires=database{% if multi_instance == 'true' %}@%i{% endif %}.service config-setup.service
After=database{% if multi_instance == 'true' %}@%i{% endif %}.service config-setup.service
After=interfaces-config.service
After=swss{% if multi_instance == 'true' %}@%i{% endif %}.service
BindsTo=sonic.target
After=sonic.target

[Service]
User={{ sonicadmin_user }}
Environment=sonic_asic_platform={{ sonic_asic_platform }}
Environment=poesyncd_platform={{ docker_container_name }}
ExecCondition=/usr/bin/{{docker_container_name}}-platform.sh
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start{% if multi_instance == 'true' %} %i{% endif %}
ExecStart=/usr/bin/{{docker_container_name}}.sh wait{% if multi_instance == 'true' %} %i{% endif %}
ExecStop=/usr/bin/{{docker_container_name}}.sh stop{% if multi_instance == 'true' %} %i{% endif %}
Restart=always
RestartSec=30

[Install]
WantedBy=sonic.target
1 change: 1 addition & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,7 @@ sudo LANG=C cp $SCRIPTS_DIR/syncd.sh $FILESYSTEM_ROOT/usr/local/bin/syncd.sh
sudo LANG=C cp $SCRIPTS_DIR/syncd_common.sh $FILESYSTEM_ROOT/usr/local/bin/syncd_common.sh
sudo LANG=C cp $SCRIPTS_DIR/gbsyncd.sh $FILESYSTEM_ROOT/usr/local/bin/gbsyncd.sh
sudo LANG=C cp $SCRIPTS_DIR/gbsyncd-platform.sh $FILESYSTEM_ROOT/usr/bin/gbsyncd-platform.sh
sudo LANG=C cp $SCRIPTS_DIR/poesyncd-platform.sh $FILESYSTEM_ROOT/usr/bin/poesyncd-platform.sh
sudo LANG=C cp $SCRIPTS_DIR/bgp.sh $FILESYSTEM_ROOT/usr/local/bin/bgp.sh
sudo LANG=C cp $SCRIPTS_DIR/teamd.sh $FILESYSTEM_ROOT/usr/local/bin/teamd.sh
sudo LANG=C cp $SCRIPTS_DIR/lldp.sh $FILESYSTEM_ROOT/usr/local/bin/lldp.sh
Expand Down
Loading

0 comments on commit 8861f70

Please sign in to comment.