├── platform.conf ├── saivpp ├── debian │ ├── compat │ ├── libsaivpp.dirs │ ├── libsaivpp.install │ ├── libsaivpp-dev.dirs │ ├── libsaivpp-dev.install │ ├── libsaivpp-dev.links │ ├── changelog │ ├── control │ └── rules ├── src │ ├── README.md │ ├── .gitignore │ ├── SaiInternal.h │ ├── EventPayload.h │ ├── WarmBootState.h │ ├── Signal.cpp │ ├── Context.h │ ├── IpVrfInfo.h │ ├── Context.cpp │ ├── Signal.h │ ├── SelectableFd.cpp │ ├── MACsecEgressFilter.h │ ├── MACsecIngressFilter.h │ ├── vppxlate │ │ ├── SaiAclStats.h │ │ ├── SaiVppStats.h │ │ └── Makefile │ ├── Event.cpp │ ├── MACsecFilterStateGuard.h │ ├── SwitchStateBaseNexthop.h │ ├── MACsecFilterStateGuard.cpp │ ├── Buffer.h │ ├── Buffer.cpp │ ├── SelectableFd.h │ ├── ContextConfig.cpp │ ├── SwitchStateBaseAcl.h │ ├── EventQueue.h │ ├── EventPayloadNotification.cpp │ ├── ContextConfig.h │ ├── MACsecIngressFilter.cpp │ ├── TrafficFilter.h │ ├── ResourceLimiterContainer.h │ ├── Event.h │ ├── TrafficForwarder.h │ ├── EventPayloadNotification.h │ ├── LaneMapContainer.h │ ├── EventPayloadPacket.cpp │ ├── TrafficFilterPipes.h │ ├── SwitchConfigContainer.h │ ├── EventPayloadPacket.h │ ├── ResourceLimiter.h │ ├── MACsecForwarder.h │ ├── ContextConfigContainer.h │ └── CorePortIndexMapContainer.h ├── Makefile.am ├── autogen.sh └── sai.profile ├── sonic-platform-modules-vpp ├── debian │ ├── compat │ ├── changelog │ ├── control │ └── rules └── files │ └── service │ └── vpp-port-config.service ├── docker-sonic-vpp ├── buildinfo │ ├── versions │ │ └── versions-deb │ ├── config │ │ └── buildinfo.config │ └── sonic-build-hooks_1.0_all.deb ├── hostname.j2 ├── default_chassis_cfg.json ├── frr │ ├── frr │ │ ├── bgpd │ │ │ ├── templates │ │ │ │ ├── dynamic │ │ │ │ │ ├── peer-group.conf.j2 │ │ │ │ │ ├── policies.conf.j2 │ │ │ │ │ └── instance.conf.j2 │ │ │ │ ├── sentinels │ │ │ │ │ ├── peer-group.conf.j2 │ │ │ │ │ ├── policies.conf.j2 │ │ │ │ │ └── instance.conf.j2 │ │ │ │ ├── monitors │ │ │ │ │ ├── policies.conf.j2 │ │ │ │ │ ├── instance.conf.j2 │ │ │ │ │ └── peer-group.conf.j2 │ │ │ │ ├── general │ │ │ │ │ └── peer-group.conf.j2 │ │ │ │ ├── voq_chassis │ │ │ │ │ ├── peer-group.conf.j2 │ │ │ │ │ ├── instance.conf.j2 │ │ │ │ │ └── policies.conf.j2 │ │ │ │ └── internal │ │ │ │ │ ├── instance.conf.j2 │ │ │ │ │ └── peer-group.conf.j2 │ │ │ ├── gen_bgpd.conf.j2 │ │ │ ├── tsa │ │ │ │ ├── bgpd.tsa.unisolate.conf.j2 │ │ │ │ └── bgpd.tsa.isolate.conf.j2 │ │ │ └── bgpd.conf.j2 │ │ ├── zebra │ │ │ ├── zebra.set_src.conf.j2 │ │ │ ├── zebra.conf.j2 │ │ │ └── zebra.interfaces.conf.j2 │ │ ├── gen_frr.conf.j2 │ │ ├── staticd │ │ │ ├── gen_staticd.conf.j2 │ │ │ ├── staticd.conf.j2 │ │ │ └── staticd.loopback_route.conf.j2 │ │ ├── supervisord │ │ │ └── critical_processes.j2 │ │ ├── common │ │ │ ├── daemons.common.conf.j2 │ │ │ └── functions.conf.j2 │ │ ├── frr_vars.j2 │ │ ├── frr.conf.j2 │ │ ├── unisolate.j2 │ │ └── isolate.j2 │ ├── TSC │ ├── rvtysh │ ├── zsocket.sh │ ├── TSB │ ├── TSA │ └── TS ├── asic_table.json ├── conf │ ├── sai.profile │ ├── vpp_init.conf │ ├── init_cfg.json.j2 │ └── vpp_template.json ├── buffermgrd.sh ├── manifest.json ├── orchagent.sh ├── zero_profiles.json └── port_breakout_config_db.json ├── docker-syncd-vpp ├── critical_processes ├── conf │ └── vpp_init.conf ├── start.sh ├── Dockerfile.j2 └── supervisord.conf ├── tests ├── misc │ ├── dvslib │ ├── conftest.py │ ├── README.md │ ├── bgp │ │ ├── files │ │ │ ├── default_route │ │ │ │ ├── bgpd.conf │ │ │ │ └── default_route.conf │ │ │ ├── no_export │ │ │ │ ├── exabgp2.conf │ │ │ │ ├── bgpd.conf │ │ │ │ └── exabgp1.conf │ │ │ ├── gr_livelock │ │ │ │ ├── exabgp2.conf │ │ │ │ ├── bgpd.conf │ │ │ │ ├── exabgp1.conf │ │ │ │ └── exabgp1.graceful.conf │ │ │ └── invalid_nexthop │ │ │ │ ├── bgpd.conf │ │ │ │ └── invalid_nexthop.conf │ │ ├── test_invalid_nexthop.py │ │ ├── test_no_export.py │ │ └── test_default_route.py │ └── teamd │ │ └── test_portchannel.py ├── vxlan-configs │ └── vnet_tunnel.json.j2 ├── inventory-t0t1.j2 ├── inventory-vm.j2 └── inventory.j2 ├── platform ├── mkrules │ ├── src │ │ ├── sonic-sairedis │ │ │ ├── debian │ │ │ │ ├── compat │ │ │ │ ├── syncd-rpc.dirs │ │ │ │ ├── syncd-rpc.init │ │ │ │ ├── syncd-vpp.dirs │ │ │ │ ├── syncd-vpp.init │ │ │ │ ├── syncd.dirs │ │ │ │ ├── libsairedis.dirs │ │ │ │ ├── libsaivpp.dirs │ │ │ │ ├── syncd-rpc.install │ │ │ │ ├── syncd-vpp.install │ │ │ │ ├── libsaimetadata.dirs │ │ │ │ ├── python-pysairedis.dirs │ │ │ │ ├── python3-pysairedis.dirs │ │ │ │ ├── libsairedis-dev.dirs │ │ │ │ ├── libsaivpp-dev.dirs │ │ │ │ ├── libsaivpp.install │ │ │ │ ├── libsaimetadata-dev.dirs │ │ │ │ ├── libsairedis.install │ │ │ │ ├── python-pysairedis.install │ │ │ │ ├── python3-pysairedis.install │ │ │ │ ├── libsaimetadata.install │ │ │ │ ├── libsairedis-dev.install │ │ │ │ ├── libsaivpp-dev.install │ │ │ │ ├── libsairedis-dev.links │ │ │ │ ├── syncd.install │ │ │ │ ├── libsaimetadata-dev.install │ │ │ │ ├── libsaimetadata-dev.links │ │ │ │ ├── changelog │ │ │ │ ├── files │ │ │ │ └── syncd.init │ │ │ ├── unittest │ │ │ │ └── Makefile.am │ │ │ ├── saisdkdump │ │ │ │ └── Makefile.am │ │ │ └── saidiscovery │ │ │ │ └── Makefile.am │ │ └── sonic-vppcfgd │ │ │ ├── pytest.ini │ │ │ ├── setup.cfg │ │ │ ├── .gitignore │ │ │ ├── vppcfgd │ │ │ ├── __init__.py │ │ │ ├── __main__.py │ │ │ ├── vars.py │ │ │ └── vpp.py │ │ │ └── setup.py │ ├── files │ │ └── build_templates │ │ │ ├── vppcfg.service.j2 │ │ │ ├── vpp_template.json │ │ │ ├── docker_image_ctl.j2.patch │ │ │ └── per_namespace │ │ │ └── syncd.service.j2.patch │ ├── dockers │ │ └── docker-swss-layer-buster │ │ │ └── Dockerfile.j2 │ ├── build_debian.sh.patch │ └── rules │ │ └── swss.mk └── vpp │ ├── vppbld │ └── plugins │ │ └── tunterm_acl │ │ └── docs │ │ └── tunterm_acl.png │ └── docker-sonic-vpp │ └── frr │ └── frr │ └── bgpd │ ├── idf_isolate │ ├── idf_unisolate.conf.j2 │ └── idf_isolate.conf.j2 │ └── wcmp │ └── bgpd.wcmp.conf.j2 ├── docker-gbsyncd-vpp ├── critical_processes ├── start.sh ├── Dockerfile.j2 └── supervisord.conf ├── vppbld ├── vpp_version ├── plugins │ └── tunterm_acl │ │ ├── docs │ │ └── tunterm_acl.png │ │ ├── FEATURE.yaml │ │ ├── CMakeLists.txt │ │ ├── tunterm_acl_redirect.h │ │ └── tunterm_acl_api.h └── README.md ├── sonic-version ├── sonic_version.yml.j2 ├── Makefile └── build_sonic_version.sh ├── docs ├── HLD │ ├── Arch.png │ ├── Perf-topo.png │ ├── sonic-acl.png │ ├── Simple-topo.png │ ├── single-host.png │ ├── acl-counters.png │ ├── vlan-bridge-callflow.png │ └── vpp-acl.md ├── vlan-bridge-topo.png ├── LAG-Dot1q-Bridging-Topo.png ├── 8021Q-Bridge-Routing-Topo.png ├── test_2rules.json ├── README.snmp.md ├── README.telemetry.md └── port_stats.md ├── rules ├── platform-modules-vpp.mk ├── vppcfgd.dep ├── platform-modules-vpp.dep ├── kvm-image.dep ├── one-image.dep ├── onie.dep ├── raw-image.dep ├── sonic-version.dep ├── vppcfgd.mk ├── docker-ptf.mk ├── raw-image.mk ├── docker-ptf-sai.mk ├── docker-ptf.dep ├── docker-ptf-sai.dep ├── syncd-vpp.mk ├── sonic-version.mk ├── docker-gbsyncd-vpp.dep ├── one-image.mk ├── docker-gbsyncd-vpp.mk ├── kvm-image.mk ├── onie.mk ├── libsaithrift-dev.dep ├── libsaithrift-dev.mk └── docker-sonic-vpp.dep ├── .gitignore ├── rules.dep ├── rules.mk ├── CONTRIBUTING.md └── scripts └── telemetry_cert.gen.sh /platform.conf: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /saivpp/debian/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /saivpp/debian/libsaivpp.dirs: -------------------------------------------------------------------------------- 1 | usr/lib -------------------------------------------------------------------------------- /saivpp/src/README.md: -------------------------------------------------------------------------------- 1 | # sonic-vpplib -------------------------------------------------------------------------------- /sonic-platform-modules-vpp/debian/compat: -------------------------------------------------------------------------------- 1 | 10 -------------------------------------------------------------------------------- /docker-sonic-vpp/buildinfo/versions/versions-deb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docker-syncd-vpp/critical_processes: -------------------------------------------------------------------------------- 1 | program:syncd 2 | -------------------------------------------------------------------------------- /saivpp/debian/libsaivpp.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libsai.so.* -------------------------------------------------------------------------------- /tests/misc/dvslib: -------------------------------------------------------------------------------- 1 | ../../../src/sonic-swss/tests/dvslib -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/compat: -------------------------------------------------------------------------------- 1 | 12 2 | -------------------------------------------------------------------------------- /docker-gbsyncd-vpp/critical_processes: -------------------------------------------------------------------------------- 1 | program:gbsyncdmgrd 2 | -------------------------------------------------------------------------------- /saivpp/debian/libsaivpp-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/include 3 | -------------------------------------------------------------------------------- /saivpp/debian/libsaivpp-dev.install: -------------------------------------------------------------------------------- 1 | src/saivpp.h usr/include -------------------------------------------------------------------------------- /tests/misc/conftest.py: -------------------------------------------------------------------------------- 1 | ../../../src/sonic-swss/tests/conftest.py -------------------------------------------------------------------------------- /vppbld/vpp_version: -------------------------------------------------------------------------------- 1 | 435fda042e68ef90734ef5b3530c0a5b911a3bf8 2 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/syncd-rpc.dirs: -------------------------------------------------------------------------------- 1 | syncd.dirs -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/syncd-rpc.init: -------------------------------------------------------------------------------- 1 | syncd.init -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/syncd-vpp.dirs: -------------------------------------------------------------------------------- 1 | syncd.dirs -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/syncd-vpp.init: -------------------------------------------------------------------------------- 1 | syncd.init -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/syncd.dirs: -------------------------------------------------------------------------------- 1 | usr/bin 2 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsairedis.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsaivpp.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/syncd-rpc.install: -------------------------------------------------------------------------------- 1 | syncd.install -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/syncd-vpp.install: -------------------------------------------------------------------------------- 1 | syncd.install -------------------------------------------------------------------------------- /saivpp/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | 3 | ACLOCAL_AMFLAGS = -I m4 4 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsaimetadata.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/python-pysairedis.dirs: -------------------------------------------------------------------------------- 1 | usr/lib/python2.7 2 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/python3-pysairedis.dirs: -------------------------------------------------------------------------------- 1 | usr/lib/python3 2 | -------------------------------------------------------------------------------- /sonic-version/sonic_version.yml.j2: -------------------------------------------------------------------------------- 1 | ../../../files/build_templates/sonic_version.yml.j2 -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsairedis-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/include 3 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsaivpp-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/include 3 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsaivpp.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libsaivpp.so.* 2 | -------------------------------------------------------------------------------- /docs/HLD/Arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/docs/HLD/Arch.png -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsaimetadata-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/include 3 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsairedis.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libsairedis*.so.* 2 | -------------------------------------------------------------------------------- /docs/HLD/Perf-topo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/docs/HLD/Perf-topo.png -------------------------------------------------------------------------------- /docs/HLD/sonic-acl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/docs/HLD/sonic-acl.png -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-vppcfgd/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | addopts = --cov=bgpcfgd --cov-report term 3 | -------------------------------------------------------------------------------- /tests/misc/README.md: -------------------------------------------------------------------------------- 1 | Requirements: 2 | 3 | - Enable IPv6 for docker engine 4 | - pip install exabgp 5 | -------------------------------------------------------------------------------- /docs/HLD/Simple-topo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/docs/HLD/Simple-topo.png -------------------------------------------------------------------------------- /docs/HLD/single-host.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/docs/HLD/single-host.png -------------------------------------------------------------------------------- /docs/HLD/acl-counters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/docs/HLD/acl-counters.png -------------------------------------------------------------------------------- /docs/vlan-bridge-topo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/docs/vlan-bridge-topo.png -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/python-pysairedis.install: -------------------------------------------------------------------------------- 1 | usr/lib/python2.7/dist-packages/sairedis/* 2 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/python3-pysairedis.install: -------------------------------------------------------------------------------- 1 | usr/lib/python3/dist-packages/sairedis/* 2 | -------------------------------------------------------------------------------- /docs/LAG-Dot1q-Bridging-Topo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/docs/LAG-Dot1q-Bridging-Topo.png -------------------------------------------------------------------------------- /docs/8021Q-Bridge-Routing-Topo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/docs/8021Q-Bridge-Routing-Topo.png -------------------------------------------------------------------------------- /docs/HLD/vlan-bridge-callflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/docs/HLD/vlan-bridge-callflow.png -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsaimetadata.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libsaimetadata.so.* 2 | usr/lib/*/libsaimeta.so.* 3 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsairedis-dev.install: -------------------------------------------------------------------------------- 1 | lib/sairedis.h usr/include/sai 2 | usr/lib/*/libsairedis.so 3 | -------------------------------------------------------------------------------- /saivpp/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | libtoolize --force --copy && 4 | autoreconf --force --install -I m4 5 | rm -Rf autom4te.cache 6 | 7 | -------------------------------------------------------------------------------- /saivpp/debian/libsaivpp-dev.links: -------------------------------------------------------------------------------- 1 | #! /usr/bin/dh-exec 2 | /usr/lib/${DEB_HOST_MULTIARCH}/libsai.so.0 /usr/lib/${DEB_HOST_MULTIARCH}/libsai.so 3 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-vppcfgd/setup.cfg: -------------------------------------------------------------------------------- 1 | #[aliases] 2 | #test=pytest 3 | #[tool:pytest] 4 | #addopts = --verbose 5 | #python_files = tests/*.py 6 | -------------------------------------------------------------------------------- /vppbld/plugins/tunterm_acl/docs/tunterm_acl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/vppbld/plugins/tunterm_acl/docs/tunterm_acl.png -------------------------------------------------------------------------------- /docker-sonic-vpp/buildinfo/config/buildinfo.config: -------------------------------------------------------------------------------- 1 | PACKAGE_URL_PREFIX=https://packages.trafficmanager.net/public/packages 2 | SONIC_VERSION_CONTROL_COMPONENTS=none 3 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsaivpp-dev.install: -------------------------------------------------------------------------------- 1 | SAI/inc/sai*.h usr/include/sai/ 2 | SAI/experimental/sai*.h usr/include/sai/ 3 | vpplib/saivpp.h 4 | -------------------------------------------------------------------------------- /saivpp/debian/changelog: -------------------------------------------------------------------------------- 1 | sonic (1.0.0) stable; urgency=medium 2 | 3 | * Initial release. 4 | 5 | -- Yue Gao Thu, 12 Sep 2024 12:00:00 -0800 6 | -------------------------------------------------------------------------------- /tests/misc/bgp/files/default_route/bgpd.conf: -------------------------------------------------------------------------------- 1 | router bgp 65501 2 | bgp router-id 1.1.1.1 3 | no bgp ebgp-requires-policy 4 | neighbor 10.10.10.1 remote-as 65502 5 | -------------------------------------------------------------------------------- /docker-sonic-vpp/buildinfo/sonic-build-hooks_1.0_all.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/docker-sonic-vpp/buildinfo/sonic-build-hooks_1.0_all.deb -------------------------------------------------------------------------------- /docker-sonic-vpp/hostname.j2: -------------------------------------------------------------------------------- 1 | {% if DEVICE_METADATA.localhost.chassis_db_address %} 2 | {{ DEVICE_METADATA.localhost.chassis_db_address }} redis_chassis.server 3 | {% endif %} 4 | -------------------------------------------------------------------------------- /docker-sonic-vpp/default_chassis_cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "DEVICE_METADATA": { 3 | "localhost": { 4 | "chassis_db_address" : "10.8.1.200" 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsairedis-dev.links: -------------------------------------------------------------------------------- 1 | #! /usr/bin/dh-exec 2 | /usr/lib/${DEB_HOST_MULTIARCH}/libsairedis.so.0 /usr/lib/${DEB_HOST_MULTIARCH}/libsairedis.so 3 | -------------------------------------------------------------------------------- /platform/vpp/vppbld/plugins/tunterm_acl/docs/tunterm_acl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sonic-net/sonic-platform-vpp/HEAD/platform/vpp/vppbld/plugins/tunterm_acl/docs/tunterm_acl.png -------------------------------------------------------------------------------- /sonic-platform-modules-vpp/debian/changelog: -------------------------------------------------------------------------------- 1 | sonic-platform-modules-vpp (1.0.0) stable; urgency=medium 2 | 3 | * Initial release. 4 | 5 | -- Yue Gao Fri, 20 Sep 2024 12:00:00 -0800 -------------------------------------------------------------------------------- /docker-syncd-vpp/conf/vpp_init.conf: -------------------------------------------------------------------------------- 1 | [program:vpp_init.sh] 2 | command=/usr/local/bin/vpp_init.sh 3 | priority=1 4 | autostart=true 5 | autorestart=true 6 | stdout_logfile=syslog 7 | stderr_logfile=syslog 8 | -------------------------------------------------------------------------------- /tests/vxlan-configs/vnet_tunnel.json.j2: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "VNET_ROUTE_TUNNEL_TABLE:Vnet1:{{ sonic_t0_prefix }}": { 4 | "endpoint": "{{ sonic_vm_ethernet }}" 5 | }, 6 | "OP": "SET" 7 | } 8 | ] -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/syncd.install: -------------------------------------------------------------------------------- 1 | usr/bin/saidump 2 | usr/bin/saiplayer 3 | usr/bin/saisdkdump 4 | usr/bin/saidiscovery 5 | usr/bin/saiasiccmp 6 | usr/bin/syncd* 7 | syncd/scripts/* usr/bin 8 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsaimetadata-dev.install: -------------------------------------------------------------------------------- 1 | meta/sai*.h usr/include/sai 2 | meta/Sai*.h usr/include/sai 3 | SAI/meta/sai*.h usr/include/sai 4 | usr/lib/*/libsaimetadata.so 5 | usr/lib/*/libsaimeta.so 6 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/dynamic/peer-group.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/BGP_SPEAKER/peer-group.conf.j2 3 | ! 4 | ! nothing is here 5 | ! 6 | ! end of template: bgpd/templates/BGP_SPEAKER/peer-group.conf.j2 7 | ! 8 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/sentinels/peer-group.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/sentinels/peer-group.conf.j2 3 | ! 4 | ! nothing is here 5 | ! 6 | ! end of template: bgpd/templates/sentinels/peer-group.conf.j2 7 | ! 8 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-vppcfgd/.gitignore: -------------------------------------------------------------------------------- 1 | .eggs/ 2 | build/ 3 | dist/ 4 | *.egg-info/ 5 | bgpcfgd/*.pyc 6 | tests/*.pyc 7 | tests/__pycache__/ 8 | .idea 9 | .coverage 10 | bgpcfgd/__pycache__/ 11 | venv 12 | tests/.coverage* 13 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/zebra/zebra.set_src.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! Set ip source to loopback for bgp learned routes 3 | ! 4 | route-map {{ rm_name }} permit 10 5 | set src {{ lo_ip }} 6 | ! 7 | ip{{ ip_proto }} protocol bgp route-map {{ rm_name }} 8 | ! 9 | -------------------------------------------------------------------------------- /sonic-version/Makefile: -------------------------------------------------------------------------------- 1 | .ONESHELL: 2 | SHELL = /bin/bash 3 | .SHELLFLAGS += -e 4 | 5 | MAIN_TARGET = sonic_version.yml 6 | 7 | $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : 8 | ./build_sonic_version.sh $(MAIN_TARGET) 9 | 10 | mv $(MAIN_TARGET) $(DEST)/ 11 | -------------------------------------------------------------------------------- /tests/misc/bgp/files/no_export/exabgp2.conf: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.2 { 2 | router-id 1.1.1.3; 3 | local-address 10.0.0.3; 4 | local-as 65503; 5 | peer-as 65501; 6 | group-updates false; 7 | 8 | family { 9 | ipv4 unicast; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/misc/bgp/files/gr_livelock/exabgp2.conf: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.2 { 2 | router-id 1.1.1.3; 3 | local-address 10.0.0.3; 4 | local-as 65503; 5 | peer-as 65501; 6 | group-updates false; 7 | 8 | family { 9 | ipv4 unicast; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/misc/bgp/files/invalid_nexthop/bgpd.conf: -------------------------------------------------------------------------------- 1 | router bgp 65501 2 | bgp router-id 1.1.1.1 3 | no bgp default ipv4-unicast 4 | no bgp ebgp-requires-policy 5 | neighbor fc00::2 remote-as 65502 6 | address-family ipv6 7 | neighbor fc00::2 activate 8 | exit-address-family 9 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/monitors/policies.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/BGPMON/policies.conf.j2 3 | ! 4 | route-map FROM_BGPMON deny 10 5 | ! 6 | route-map TO_BGPMON permit 10 7 | ! 8 | ! end of template: bgpd/templates/BGPMON/policies.conf.j2 9 | ! 10 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/libsaimetadata-dev.links: -------------------------------------------------------------------------------- 1 | #! /usr/bin/dh-exec 2 | /usr/lib/${DEB_HOST_MULTIARCH}/libsaimetadata.so.0 /usr/lib/${DEB_HOST_MULTIARCH}/libsaimetadata.so 3 | /usr/lib/${DEB_HOST_MULTIARCH}/libsaimeta.so.0 /usr/lib/${DEB_HOST_MULTIARCH}/libsaimeta.so 4 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/dynamic/policies.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/BGP_SPEAKER/policies.conf.j2 3 | ! 4 | route-map FROM_BGP_SPEAKER permit 10 5 | ! 6 | route-map TO_BGP_SPEAKER deny 1 7 | ! 8 | ! end of template: bgpd/templates/BGP_SPEAKER/policies.conf.j2 9 | ! 10 | -------------------------------------------------------------------------------- /docker-sonic-vpp/asic_table.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ASIC_TABLE:VS-ASIC": { 4 | "cell_size": "128", 5 | "pipeline_latency": "18", 6 | "mac_phy_delay": "0.8", 7 | "peer_response_time": "3.8" 8 | }, 9 | "OP": "SET" 10 | } 11 | ] 12 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/gen_frr.conf.j2: -------------------------------------------------------------------------------- 1 | {% if DEVICE_METADATA.localhost.frr_mgmt_framework_config is defined and DEVICE_METADATA.localhost.frr_mgmt_framework_config == "true" %} 2 | {% include "/usr/local/sonic/frrcfgd/frr.conf.j2" %} 3 | {% else %} 4 | {% include "/usr/share/sonic/templates/frr.conf.j2" %} 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /platform/vpp/docker-sonic-vpp/frr/frr/bgpd/idf_isolate/idf_unisolate.conf.j2: -------------------------------------------------------------------------------- 1 | no route-map CHECK_IDF_ISOLATION permit 1 2 | no route-map CHECK_IDF_ISOLATION permit 2 3 | no route-map CHECK_IDF_ISOLATION permit 3 4 | no route-map CHECK_IDF_ISOLATION deny 4 5 | route-map CHECK_IDF_ISOLATION permit 10 6 | no set community no-export additive 7 | -------------------------------------------------------------------------------- /rules/platform-modules-vpp.mk: -------------------------------------------------------------------------------- 1 | VPP_PLATFORM_MODULE_VERSION = 1.0.0 2 | VPP_PLATFORM_MODULE = platform-modules-vpp_$(VPP_PLATFORM_MODULE_VERSION)_amd64.deb 3 | VPP_PLATFORM_MODULE_REL_PATH = sonic-platform-modules-vpp 4 | $(VPP_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/$(VPP_PLATFORM_MODULE_REL_PATH) 5 | SONIC_DPKG_DEBS += $(VPP_PLATFORM_MODULE) -------------------------------------------------------------------------------- /saivpp/sai.profile: -------------------------------------------------------------------------------- 1 | SAI_VPP_SWITCH_TYPE=SAI_VPP_SWITCH_TYPE_BCM56850 2 | SAI_VPP_HOSTIF_USE_TAP_DEVICE=true 3 | SAI_VPP_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini 4 | SAI_VPP_CORE_PORT_INDEX_MAP_FILE=/usr/share/sonic/hwsku/coreportindexmap.ini 5 | SAI_VPP_INTERFACE_FABRIC_LANE_MAP_FILE=/usr/share/sonic/hwsku/fabriclanemap.ini 6 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/gen_bgpd.conf.j2: -------------------------------------------------------------------------------- 1 | {% if DEVICE_METADATA.localhost.frr_mgmt_framework_config is defined and DEVICE_METADATA.localhost.frr_mgmt_framework_config == "true" %} 2 | {% include "/usr/local/sonic/frrcfgd/bgpd.conf.j2" %} 3 | {% else %} 4 | {% include "/usr/share/sonic/templates/bgpd/bgpd.conf.j2" %} 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /sonic-platform-modules-vpp/debian/control: -------------------------------------------------------------------------------- 1 | Source: sonic-platform-modules-vpp 2 | Section: main 3 | Priority: extra 4 | Maintainer: Yue Gao 5 | Build-Depends: debhelper (>= 9), bzip2 6 | Standards-Version: 3.9.3 7 | 8 | Package: platform-modules-vpp 9 | Architecture: amd64 10 | Description: kernel modules for platform devices -------------------------------------------------------------------------------- /docker-sonic-vpp/conf/sai.profile: -------------------------------------------------------------------------------- 1 | SAI_VPP_SWITCH_TYPE=SAI_VPP_SWITCH_TYPE_BCM56850 2 | SAI_VPP_HOSTIF_USE_TAP_DEVICE=true 3 | SAI_VPP_INTERFACE_LANE_MAP_FILE=/usr/share/sonic/hwsku/lanemap.ini 4 | SAI_VPP_CORE_PORT_INDEX_MAP_FILE=/usr/share/sonic/hwsku/coreportindexmap.ini 5 | SAI_VPP_INTERFACE_FABRIC_LANE_MAP_FILE=/usr/share/sonic/hwsku/fabriclanemap.ini 6 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/tsa/bgpd.tsa.unisolate.conf.j2: -------------------------------------------------------------------------------- 1 | {%- if internal_route_map == '1' -%} 2 | no route-map {{ route_map_name }} permit 20 3 | {# #} 4 | {%- else -%} 5 | no route-map {{ route_map_name }} permit 20 6 | no route-map {{ route_map_name }} permit 30 7 | no route-map {{ route_map_name }} deny 40 8 | {# #} 9 | {%- endif -%} 10 | ! 11 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/staticd/gen_staticd.conf.j2: -------------------------------------------------------------------------------- 1 | {% if DEVICE_METADATA.localhost.frr_mgmt_framework_config is defined and DEVICE_METADATA.localhost.frr_mgmt_framework_config == "true" %} 2 | {% include "/usr/local/sonic/frrcfgd/staticd.conf.j2" %} 3 | {% else %} 4 | {% include "/usr/share/sonic/templates/staticd/staticd.conf.j2" %} 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/changelog: -------------------------------------------------------------------------------- 1 | sonic (1.0.0) stable; urgency=medium 2 | 3 | * syncd-rpc is added 4 | 5 | -- Pavel Shirshov Wed, 12 Apr 2017 12:00:00 -0800 6 | 7 | sonic (1.0.0) stable; urgency=medium 8 | 9 | * Initial release. 10 | 11 | -- Kamil Cudnik Wed, 23 Mar 2016 12:00:00 -0800 12 | -------------------------------------------------------------------------------- /tests/misc/bgp/files/default_route/default_route.conf: -------------------------------------------------------------------------------- 1 | neighbor 10.10.10.0 { 2 | router-id 1.2.3.4; 3 | local-address 10.10.10.1; 4 | local-as 65502; 5 | peer-as 65501; 6 | group-updates false; 7 | 8 | family { 9 | ipv4 unicast; 10 | } 11 | 12 | static { 13 | route 0.0.0.0/0 { 14 | next-hop 10.10.10.1; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/supervisord/critical_processes.j2: -------------------------------------------------------------------------------- 1 | program:zebra 2 | program:staticd 3 | program:bgpd 4 | program:fpmsyncd 5 | {% if DEVICE_METADATA.localhost.frr_mgmt_framework_config is defined and DEVICE_METADATA.localhost.frr_mgmt_framework_config == "true" %} 6 | program:bfdd 7 | program:ospfd 8 | program:pimd 9 | program:frrcfgd 10 | {%- else %} 11 | program:bgpcfgd 12 | {%- endif %} 13 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/staticd/staticd.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | {% block banner %} 3 | ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== 4 | ! generated by templates/frr/staticd.conf.j2 using config DB data 5 | ! file: staticd.conf 6 | ! 7 | {% endblock banner %} 8 | ! 9 | {% include "common/daemons.common.conf.j2" %} 10 | ! 11 | {% include "staticd.loopback_route.conf.j2" %} 12 | ! 13 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/common/daemons.common.conf.j2: -------------------------------------------------------------------------------- 1 | ! template: common/daemons.common.conf.j2 2 | ! 3 | {% block sys_init %} 4 | hostname {{ DEVICE_METADATA['localhost']['hostname'] }} 5 | password zebra 6 | enable password zebra 7 | {% endblock sys_init %} 8 | ! 9 | {% block logging %} 10 | log syslog informational 11 | log facility local4 12 | {% endblock logging %} 13 | ! 14 | ! end of template: common/daemons.common.conf.j2 15 | -------------------------------------------------------------------------------- /saivpp/src/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /sonic-platform-modules-vpp/files/service/vpp-port-config.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=VPP Data Port Setup Service 3 | ConditionPathExists=/usr/bin/vpp_ports_setup.sh 4 | After=config-setup.service 5 | Before=syncd.service 6 | DefaultDependencies=no 7 | 8 | [Service] 9 | Type=oneshot 10 | ExecStart=/usr/bin/vpp_ports_setup.sh start 11 | StandardOutput=journal 12 | StandardError=journal 13 | 14 | [Install] 15 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /docker-syncd-vpp/start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | HWSKU_DIR=/usr/share/sonic/hwsku 4 | 5 | mkdir -p /etc/sai.d/ 6 | 7 | # Create/Copy the sai.profile to /etc/sai.d/sai.profile 8 | if [ -f $HWSKU_DIR/sai.profile.j2 ]; then 9 | sonic-cfggen -d -t $HWSKU_DIR/sai.profile.j2 > /etc/sai.d/sai.profile 10 | else 11 | if [ -f $HWSKU_DIR/sai.profile ]; then 12 | cp $HWSKU_DIR/sai.profile /etc/sai.d/sai.profile 13 | fi 14 | fi 15 | -------------------------------------------------------------------------------- /sonic-version/build_sonic_version.sh: -------------------------------------------------------------------------------- 1 | export build_version="${sonic_version}" 2 | export debian_version="" 3 | export kernel_version="" 4 | export asic_type="${sonic_asic_platform}" 5 | export commit_id="$(git rev-parse --short HEAD)" 6 | export branch="$(git rev-parse --abbrev-ref HEAD)" 7 | export build_date="$(date -u)" 8 | export build_number="${BUILD_NUMBER:-0}" 9 | export built_by="$USER@$BUILD_HOSTNAME" 10 | j2 sonic_version.yml.j2 > $1 11 | -------------------------------------------------------------------------------- /tests/misc/bgp/files/invalid_nexthop/invalid_nexthop.conf: -------------------------------------------------------------------------------- 1 | neighbor fc00::1 { 2 | router-id 1.2.3.4; 3 | local-address fc00::2; 4 | local-as 65502; 5 | peer-as 65501; 6 | group-updates false; 7 | 8 | family { 9 | ipv4 unicast; 10 | ipv6 unicast; 11 | } 12 | 13 | static { 14 | route 3333::0/64 { 15 | next-hop 0.0.0.0; 16 | next-hop fc00::2; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vppbld/plugins/tunterm_acl/FEATURE.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Tunnel Termination ACL 3 | maintainer: Akeel Ali 4 | features: 5 | - Applies ACL after Tunnel Decap 6 | - Current support is limited to a specific use-case 7 | - IPv4 VxLAN Tunnel Termination (Tunnel) 8 | - DST IPv4/6 Classification (Field) 9 | - Redirect (Action) 10 | description: "Tunnel Termination ACL plugin" 11 | state: experimental 12 | properties: [CLI, API] 13 | -------------------------------------------------------------------------------- /rules/vppcfgd.dep: -------------------------------------------------------------------------------- 1 | 2 | SPATH := $($(SONIC_VPPCFGD)_SRC_PATH) 3 | DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/sonic_vppcfgd.mk $(PLATFORM_RULES)/sonic_vppcfgd.dep 4 | DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) 5 | DEP_FILES += $(shell git ls-files $(SPATH)) 6 | 7 | $(SONIC_VPPCFGD)_CACHE_MODE := GIT_CONTENT_SHA 8 | $(SONIC_VPPCFGD)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) 9 | $(SONIC_VPPCFGD)_DEP_FILES := $(DEP_FILES) 10 | 11 | -------------------------------------------------------------------------------- /tests/misc/bgp/files/no_export/bgpd.conf: -------------------------------------------------------------------------------- 1 | router bgp 65501 2 | bgp router-id 1.1.1.1 3 | no bgp default ipv4-unicast 4 | no bgp ebgp-requires-policy 5 | neighbor 10.0.0.1 remote-as 65502 6 | address-family ipv4 7 | neighbor 10.0.0.1 activate 8 | maximum-paths 64 9 | exit-address-family 10 | neighbor 10.0.0.3 remote-as 65503 11 | address-family ipv4 12 | neighbor 10.0.0.3 activate 13 | maximum-paths 64 14 | exit-address-family 15 | -------------------------------------------------------------------------------- /tests/inventory-t0t1.j2: -------------------------------------------------------------------------------- 1 | clusters: 2 | hosts: 3 | cluster1: 4 | ansible_user: {{ username }} 5 | ansible_ssh_pass: {{ password }} 6 | ansible_ssh_common_args: '-o StrictHostKeyChecking=no' 7 | #ansible_become: yes 8 | ansible_become_method: sudo 9 | ansible_become_password: {{ password }} 10 | ansible_host: {{ host }} 11 | 12 | dut_password: password 13 | topology: {{ topology }} 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/misc/bgp/files/gr_livelock/bgpd.conf: -------------------------------------------------------------------------------- 1 | router bgp 65501 2 | bgp router-id 1.1.1.1 3 | no bgp ebgp-requires-policy 4 | bgp graceful-restart restart-time 180 5 | bgp graceful-restart 6 | neighbor 10.0.0.1 remote-as 65502 7 | address-family ipv4 8 | neighbor 10.0.0.1 activate 9 | maximum-paths 64 10 | exit-address-family 11 | neighbor 10.0.0.3 remote-as 65503 12 | address-family ipv4 13 | neighbor 10.0.0.3 activate 14 | maximum-paths 64 15 | exit-address-family 16 | -------------------------------------------------------------------------------- /tests/misc/bgp/files/gr_livelock/exabgp1.conf: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.0 { 2 | router-id 1.1.1.2; 3 | local-address 10.0.0.1; 4 | local-as 65502; 5 | peer-as 65501; 6 | group-updates false; 7 | 8 | family{ 9 | ipv4 unicast; 10 | } 11 | 12 | static { 13 | route 1.1.1.1/32{ 14 | next-hop 10.0.0.1; 15 | community no-export; 16 | } 17 | route 2.2.2.2/32{ 18 | next-hop 10.0.0.1; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/misc/bgp/files/no_export/exabgp1.conf: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.0 { 2 | router-id 1.1.1.2; 3 | local-address 10.0.0.1; 4 | local-as 65502; 5 | peer-as 65501; 6 | group-updates false; 7 | 8 | family{ 9 | ipv4 unicast; 10 | } 11 | 12 | static { 13 | route 1.1.1.1/32{ 14 | next-hop 10.0.0.1; 15 | community no-export; 16 | } 17 | route 2.2.2.2/32{ 18 | next-hop 10.0.0.1; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /rules/platform-modules-vpp.dep: -------------------------------------------------------------------------------- 1 | DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/platform-modules-vpp.mk $(PLATFORM_RULES)/platform-modules-vpp.dep 2 | DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) 3 | DEP_FILES += $(addprefix $(PLATFORM_PATH)/,$(shell cd $(PLATFORM_PATH) && git ls-files $(VPP_PLATFORM_MODULE_REL_PATH))) 4 | 5 | $(CISCO_8000_PLATFORM_MODULE)_CACHE_MODE := GIT_CONTENT_SHA 6 | $(CISCO_8000_PLATFORM_MODULE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) 7 | $(CISCO_8000_PLATFORM_MODULE)_DEP_FILES := $(DEP_FILES) -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/monitors/instance.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/monitors/instance.conf.j2 3 | ! 4 | neighbor {{ neighbor_addr }} remote-as {{ bgp_asn }} 5 | neighbor {{ neighbor_addr }} peer-group BGPMON 6 | neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} 7 | neighbor {{ neighbor_addr }} activate 8 | address-family ipv6 9 | neighbor {{ neighbor_addr }} activate 10 | exit-address-family 11 | ! 12 | ! end of template: bgpd/templates/BGPMON/instance.conf.j2 13 | ! 14 | -------------------------------------------------------------------------------- /docker-sonic-vpp/conf/vpp_init.conf: -------------------------------------------------------------------------------- 1 | [program:vppcfgd] 2 | command=/usr/local/bin/vppcfgd 3 | priority=1 4 | autostart=false 5 | autorestart=false 6 | startsecs=0 7 | stdout_logfile=syslog 8 | stderr_logfile=syslog 9 | dependent_startup=true 10 | dependent_startup_wait_for=redis-server:running 11 | 12 | [program:vpp_init.sh] 13 | command=/usr/local/bin/vpp_init.sh 14 | priority=1 15 | autostart=true 16 | autorestart=true 17 | stdout_logfile=syslog 18 | stderr_logfile=syslog 19 | dependent_startup=true 20 | dependent_startup_wait_for=vppcfgd:running 21 | -------------------------------------------------------------------------------- /docs/test_2rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "ACL_RULE": { 3 | "TEST_IPV4|ALLOW": { 4 | "priority" : "85", 5 | "SRC_IP" : "172.16.1.0/24", 6 | "DST_IP" : "172.16.2.0/24", 7 | "L4_SRC_PORT_RANGE": "1024-65535", 8 | "L4_DST_PORT": "22", 9 | "IP_PROTOCOL": "6", 10 | "PACKET_ACTION" : "FORWARD" 11 | }, 12 | "TEST_IPV4|TheDrop": { 13 | "priority" : "80", 14 | "IP_TYPE" : "IPv4ANY", 15 | "PACKET_ACTION" : "DROP" 16 | } 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/TSC: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Load the common functions 4 | source /usr/bin/TS 5 | 6 | find_num_routemap 7 | routemap_count=$? 8 | check_not_installed 9 | not_installed=$? 10 | 11 | check_installed 12 | installed=$? 13 | 14 | if [[ $routemap_count -eq 0 ]]; 15 | then 16 | echo "System Mode: No external neighbors" 17 | elif [[ $installed -eq 0 ]]; 18 | then 19 | echo "System Mode: Normal" 20 | elif [[ $not_installed -eq 0 ]]; 21 | then 22 | echo "System Mode: Maintenance" 23 | else 24 | echo "System Mode: Not consistent" 25 | fi 26 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/sentinels/policies.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/sentinels/policies.conf.j2 3 | ! 4 | {% if constants.bgp.sentinel_community is defined %} 5 | bgp community-list standard sentinel_community permit {{ constants.bgp.sentinel_community }} no-export 6 | ! 7 | route-map FROM_BGP_SENTINEL permit 100 8 | match community sentinel_community 9 | {% endif %} 10 | ! 11 | route-map FROM_BGP_SENTINEL deny 200 12 | ! 13 | route-map TO_BGP_SENTINEL permit 100 14 | ! 15 | ! end of template: bgpd/templates/sentinels/policies.conf.j2 16 | ! 17 | -------------------------------------------------------------------------------- /saivpp/debian/control: -------------------------------------------------------------------------------- 1 | Source: sonic 2 | Maintainer: Yue Gao 3 | Section: net 4 | Priority: optional 5 | Build-Depends: debhelper (>= 10), autotools-dev 6 | Standards-Version: 1.0.0 7 | 8 | Package: libsaivpp 9 | Architecture: any 10 | Depends: ${shlibs:Depends}, ${misc:Pre-Depends} 11 | Section: libs 12 | Description: This package contains VPP SAI implementation for SONiC project. 13 | 14 | Package: libsaivpp-dev 15 | Architecture: any 16 | Depends: libsaivpp (= ${binary:Version}) 17 | Section: libdevel 18 | Description: This package contains development files for SAI-VPP. -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/frr_vars.j2: -------------------------------------------------------------------------------- 1 | { 2 | "frr_mgmt_framework_config": 3 | {% if "frr_mgmt_framework_config" in DEVICE_METADATA["localhost"].keys() %} 4 | "{{ DEVICE_METADATA["localhost"]["frr_mgmt_framework_config"] }}" 5 | {% else %} 6 | "" 7 | {% endif %}, 8 | "docker_routing_config_mode": 9 | {% if "docker_routing_config_mode" in DEVICE_METADATA["localhost"].keys() %} 10 | "{{ DEVICE_METADATA["localhost"]["docker_routing_config_mode"] }}" 11 | {% else %} 12 | "" 13 | {% endif %} 14 | } 15 | -------------------------------------------------------------------------------- /platform/vpp/docker-sonic-vpp/frr/frr/bgpd/wcmp/bgpd.wcmp.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/wcmp/bgpd.wcmp.conf.j2 3 | ! 4 | route-map TO_BGP_PEER_V4 permit 100 5 | {%- if wcmp_enabled == 'true' %} 6 | set extcommunity bandwidth num-multipaths 7 | {%- else %} 8 | no set extcommunity bandwidth 9 | {%- endif %} 10 | exit 11 | ! 12 | route-map TO_BGP_PEER_V6 permit 100 13 | {%- if wcmp_enabled == 'true' %} 14 | set extcommunity bandwidth num-multipaths 15 | {%- else %} 16 | no set extcommunity bandwidth 17 | {%- endif %} 18 | exit 19 | ! 20 | ! end of template: bgpd/wcmp/bgpd.wcmp.conf.j2 21 | ! 22 | -------------------------------------------------------------------------------- /docs/README.snmp.md: -------------------------------------------------------------------------------- 1 | # SONiC-VPP SNMP Howto use 2 | SNMP is only supported in the SONiC-VPP VM qemu-kvm image. It is enabled by default. The default configuration of SNMP lets readonly access of system mibs. All that user has to do is install snmp manager on a host and run query to the SONIC-VPP VM. In the below commands 10.0.0.1 is the address of the SONiC-VPP VM running SNMP. 3 | 4 | ``` 5 | sudo apt-get install -y snmp 6 | snmpwalk -Os -c public -v 1 10.0.0.1 7 | ``` 8 | 9 | More configuration details of SNMP are found [here](https://github.com/sonic-net/sonic-utilities/blob/master/doc/Command-Reference.md#snmp). -------------------------------------------------------------------------------- /tests/misc/bgp/files/gr_livelock/exabgp1.graceful.conf: -------------------------------------------------------------------------------- 1 | neighbor 10.0.0.0 { 2 | router-id 1.1.1.2; 3 | local-address 10.0.0.1; 4 | local-as 65502; 5 | peer-as 65501; 6 | group-updates false; 7 | manual-eor true; 8 | 9 | family{ 10 | ipv4 unicast; 11 | } 12 | 13 | capability { 14 | graceful-restart 360; 15 | } 16 | 17 | static { 18 | route 1.1.1.1/32{ 19 | next-hop 10.0.0.1; 20 | community no-export; 21 | } 22 | route 2.2.2.2/32{ 23 | next-hop 10.0.0.1; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/frr.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | {% block banner %} 3 | ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== 4 | ! generated by templates/frr.conf.j2 with config DB data 5 | ! file: frr.conf 6 | ! 7 | {% endblock banner %} 8 | ! 9 | {% include "common/daemons.common.conf.j2" %} 10 | {% from "common/functions.conf.j2" import get_ipv4_loopback_address, get_ipv6_loopback_address %} 11 | ! 12 | agentx 13 | ! 14 | {% include "zebra/zebra.interfaces.conf.j2" %} 15 | ! 16 | {% include "staticd/staticd.loopback_route.conf.j2" %} 17 | ! 18 | {% include "bgpd/bgpd.main.conf.j2" %} 19 | ! 20 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/zebra/zebra.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | {% block banner %} 3 | ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== 4 | ! generated by templates/zebra/zebra.conf.j2 using config DB data 5 | ! file: zebra.conf 6 | ! 7 | {% endblock banner %} 8 | ! 9 | {% block fpm %} 10 | ! Uses the old known FPM behavior of including next hop information in the route (e.g. RTM_NEWROUTE) messages 11 | no fpm use-next-hop-groups 12 | ! 13 | fpm address 127.0.0.1 14 | {% endblock fpm %} 15 | ! 16 | {% include "common/daemons.common.conf.j2" %} 17 | ! 18 | {% include "zebra.interfaces.conf.j2" %} 19 | ! 20 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/tsa/bgpd.tsa.isolate.conf.j2: -------------------------------------------------------------------------------- 1 | {%- if internal_route_map == '1' -%} 2 | route-map {{ route_map_name }} permit 20 3 | set community no-export additive 4 | {# #} 5 | {%- else -%} 6 | route-map {{ route_map_name }} permit 20 7 | match {{ ip_protocol }} address prefix-list PL_Loopback{{ ip_version }} 8 | set community {{ constants.bgp.traffic_shift_community }} 9 | route-map {{ route_map_name }} permit 30 10 | match tag {{ constants.bgp.internal_community_match_tag }} 11 | set community {{ constants.bgp.traffic_shift_community }} 12 | route-map {{ route_map_name }} deny 40 13 | {# #} 14 | {%- endif -%} 15 | ! 16 | -------------------------------------------------------------------------------- /vppbld/README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | vppbld Makefile tries to download the specified vpp debian packages from buildkite. If it is not found there, it then builds it locally by pulling source code and applying vpp.patch. 3 | 4 | The version of vpp packages is specified in sonic-buildimage/rules/vpp.mk. When we build target/sonic-vpp.img.gz or libvppinfra, for example target/debs/bookworm/libvppinfra_2506-0.2+b1sonic1_amd64.deb, it will trigger above Makefile. 5 | 6 | If we need to create a new vpp debian packages, either we have a new patch or we are upgrading vpp base version, we can specify a new version in sonic-buildimage/rules/vpp.mk then run one of the above make target. -------------------------------------------------------------------------------- /docker-gbsyncd-vpp/start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | HWSKU_DIR=/usr/share/sonic/hwsku 4 | 5 | mkdir -p /etc/sai.d/ 6 | 7 | # Create/Copy the pai.profile to /etc/sai.d/pai.profile 8 | if [ -f $HWSKU_DIR/pai.profile.j2 ]; then 9 | sonic-cfggen -d -t $HWSKU_DIR/pai.profile.j2 > /etc/sai.d/pai.profile 10 | else 11 | if [ -f $HWSKU_DIR/pai.profile ]; then 12 | cp $HWSKU_DIR/pai.profile /etc/sai.d/pai.profile 13 | fi 14 | fi 15 | 16 | # Create/Copy the gearbox configs to /etc/sai.d 17 | if [[ x"$sonic_asic_platform" == x"broadcom" ]]; then 18 | if [ -d $HWSKU_DIR/gearbox ]; then 19 | cp $HWSKU_DIR/gearbox/*.bcm /etc/sai.d/. 20 | fi 21 | fi 22 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/files: -------------------------------------------------------------------------------- 1 | libsaimetadata-dbg_1.0.0_amd64.deb debug extra 2 | libsaimetadata-dev_1.0.0_amd64.deb libdevel optional 3 | libsaimetadata_1.0.0_amd64.deb libs optional 4 | libsairedis-dbg_1.0.0_amd64.deb debug extra 5 | libsairedis-dev_1.0.0_amd64.deb libdevel optional 6 | libsairedis_1.0.0_amd64.deb libs optional 7 | libsaivpp-dbg_1.0.0_amd64.deb debug extra 8 | libsaivpp-dev_1.0.0_amd64.deb libdevel optional 9 | libsaivpp_1.0.0_amd64.deb libs optional 10 | python-pysairedis_1.0.0_amd64.deb libs optional 11 | python3-pysairedis_1.0.0_amd64.deb libs optional 12 | syncd-vpp-dbg_1.0.0_amd64.deb debug extra 13 | syncd-vpp_1.0.0_amd64.deb net optional 14 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-vppcfgd/vppcfgd/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 Cisco and/or its affiliates. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at: 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/zebra/zebra.interfaces.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | {% block vrf %} 3 | {% if VNET is defined %} 4 | {% for vnet_name, vnet_metadata in VNET.items() %} 5 | vrf {{ vnet_name }} 6 | vni {{ vnet_metadata['vni'] }} 7 | ! 8 | {% endfor %} 9 | {% endif %} 10 | {% endblock vrf %} 11 | ! 12 | {% block interfaces %} 13 | ! Enable nht through default route 14 | ip nht resolve-via-default 15 | ! Enable link-detect (default disabled) 16 | {% for (name, prefix) in INTERFACE|pfx_filter %} 17 | interface {{ name }} 18 | link-detect 19 | ! 20 | {% endfor %} 21 | {% for pc in PORTCHANNEL %} 22 | interface {{ pc }} 23 | link-detect 24 | ! 25 | {% endfor %} 26 | {% endblock interfaces %} 27 | ! 28 | -------------------------------------------------------------------------------- /docker-sonic-vpp/buffermgrd.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | BUFFER_CALCULATION_MODE=$(redis-cli -n 4 hget "DEVICE_METADATA|localhost" buffer_model) 4 | export ASIC_VENDOR=vs 5 | 6 | if [ "$BUFFER_CALCULATION_MODE" == "dynamic" ]; then 7 | BUFFERMGRD_ARGS="-a /etc/sonic/asic_table.json" 8 | 9 | if [ -f /etc/sonic/zero_profiles.json ]; then 10 | BUFFERMGRD_ZERO_PROFILE_ARGS=" -z /etc/sonic/zero_profiles.json" 11 | fi 12 | else 13 | # Should we use the fallback MAC in case it is not found in Device.Metadata 14 | BUFFERMGRD_ARGS="-l /usr/share/sonic/hwsku/pg_profile_lookup.ini" 15 | fi 16 | 17 | exec /usr/bin/buffermgrd ${BUFFERMGRD_ARGS} ${BUFFERMGRD_ZERO_PROFILE_ARGS} 18 | -------------------------------------------------------------------------------- /platform/mkrules/files/build_templates/vppcfg.service.j2: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=VPP configuration daemon 3 | Requires=database{% if multi_instance == 'true' %}@%i{% endif %}.service 4 | After=database{% if multi_instance == 'true' %}@%i{% endif %}.service 5 | 6 | Requires=config-setup.service 7 | After=config-setup.service 8 | 9 | Requires=updategraph.service 10 | After=updategraph.service 11 | 12 | BindsTo=sonic.target 13 | After=sonic.target 14 | Before=syncd.service 15 | 16 | [Service] 17 | EnvironmentFile=/etc/sonic/vpp/syncd_vpp_env 18 | ExecStartPre=/usr/local/bin/vppcfg_load.py 19 | ExecStart=/usr/local/bin/vppcfgd 20 | 21 | RestartSec=3 22 | 23 | [Install] 24 | WantedBy=sonic.target 25 | -------------------------------------------------------------------------------- /docker-sonic-vpp/conf/init_cfg.json.j2: -------------------------------------------------------------------------------- 1 | { 2 | "DEVICE_METADATA": { 3 | "localhost": { 4 | "mac": "{{ system_mac }}", 5 | "buffer_model": "traditional" 6 | } 7 | }, 8 | "FLEX_COUNTER_TABLE": { 9 | "PORT": { 10 | "FLEX_COUNTER_STATUS": "enable" 11 | }, 12 | "RIF": { 13 | "FLEX_COUNTER_STATUS": "enable" 14 | } 15 | }, 16 | {% set features = ["swss", "bgp", "teamd", "nat", "database", "lldp", "dhcp_relay", "macsec"] %} 17 | "FEATURE": { 18 | {% for feature in features %} 19 | "{{ feature }}": { 20 | "state": "enabled" 21 | }{% if not loop.last %},{% endif %} 22 | {% endfor %} 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/bgpd.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/bgpd.conf.j2 3 | ! 4 | {% from "common/functions.conf.j2" import get_ipv4_loopback_address, get_ipv6_loopback_address %} 5 | ! 6 | {% block banner %} 7 | ! =========== Managed by sonic-cfggen DO NOT edit manually! ==================== 8 | ! generated by templates/quagga/bgpd.conf.j2 with config DB data 9 | ! file: bgpd.conf 10 | ! 11 | {% endblock banner %} 12 | ! 13 | {% include "common/daemons.common.conf.j2" %} 14 | ! 15 | agentx 16 | ! 17 | {% if DEVICE_METADATA['localhost']['type'] == "SpineChassisFrontendRouter" %} 18 | {% include "bgpd.spine_chassis_frontend_router.conf.j2" %} 19 | {% endif %} 20 | ! 21 | {% include "bgpd.main.conf.j2" %} 22 | ! 23 | ! end of template: bgpd/bgpd.conf.j2 24 | ! 25 | -------------------------------------------------------------------------------- /rules/kvm-image.dep: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #DPKG FRK 16 | $(SONIC_KVM_IMAGE)_CACHE_MODE := none 17 | -------------------------------------------------------------------------------- /rules/one-image.dep: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #DPKG FRK 16 | $(SONIC_ONE_IMAGE)_CACHE_MODE := none 17 | -------------------------------------------------------------------------------- /rules/onie.dep: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #DPKG FRK 16 | $(ONIE_RECOVERY_IMAGE)_CACHE_MODE := none 17 | -------------------------------------------------------------------------------- /rules/raw-image.dep: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #DPKG FRK 16 | $(SONIC_RAW_IMAGE)_CACHE_MODE := none 17 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/unittest/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | SUBDIRS = meta lib 16 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-vppcfgd/vppcfgd/__main__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 Cisco and/or its affiliates. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at: 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | from .main import main 15 | 16 | if __name__ == '__main__': 17 | main() 18 | -------------------------------------------------------------------------------- /rules/sonic-version.dep: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #DPKG FRK 16 | $(SONIC_VERSION)_CACHE_MODE := none 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # http://www.gnu.org/software/automake 2 | 3 | Makefile.in 4 | /ar-lib 5 | /mdate-sh 6 | /py-compile 7 | /test-driver 8 | /ylwrap 9 | 10 | # http://www.gnu.org/software/autoconf 11 | 12 | autom4te.cache 13 | /autoscan.log 14 | /autoscan-*.log 15 | /aclocal.m4 16 | /compile 17 | /config.guess 18 | /config.h.in 19 | /config.log 20 | /config.status 21 | /config.sub 22 | /configure 23 | /configure.scan 24 | /depcomp 25 | /install-sh 26 | /missing 27 | /stamp-h1 28 | 29 | # https://www.gnu.org/software/libtool/ 30 | 31 | /ltmain.sh 32 | 33 | # http://www.gnu.org/software/texinfo 34 | 35 | /texinfo.tex 36 | 37 | # http://www.gnu.org/software/m4/ 38 | 39 | m4/libtool.m4 40 | m4/ltoptions.m4 41 | m4/ltsugar.m4 42 | m4/ltversion.m4 43 | m4/lt~obsolete.m4 44 | 45 | build/ -------------------------------------------------------------------------------- /sonic-platform-modules-vpp/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # This file is a makefile used by debhelper to build the package 3 | DESTDIR := debian/platform-modules-vpp 4 | INSTALL_SERVICE_DIR := /lib/systemd/system 5 | # Use the minimal debhelper version 6 | %: 7 | dh $@ 8 | 9 | # Override the install step to copy the custom file 10 | override_dh_install: 11 | dh_install 12 | dh_installdirs $(INSTALL_SERVICE_DIR) 13 | cp files/service/*.service $(DESTDIR)$(INSTALL_SERVICE_DIR)/. 14 | install -D -m 755 files/etc/config-setup/factory-default-hooks.d/10-01-vpp-cfg-init $(DESTDIR)/etc/config-setup/factory-default-hooks.d/10-01-vpp-cfg-init 15 | install -D -m 755 files/usr/bin/vpp_ports_setup.sh $(DESTDIR)/usr/bin/vpp_ports_setup.sh 16 | install -D -m 755 files/usr/bin/vppcfg_load.py $(DESTDIR)/usr/bin/vppcfg_load.py 17 | -------------------------------------------------------------------------------- /saivpp/src/SaiInternal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #define MUTEX() std::lock_guard _lock(m_apimutex) 19 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/rvtysh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # The command rvtysh can be run as root priviledge by any user without password, only allow to execute readonly commands. 4 | 5 | # The options in the show command cannot contains any charactors to run multiple sub-commands potentially, such as "\n", "\r", "|", "&", "$" and ";". 6 | if printf -- "$*" | grep -qPz '[\n\r|&$;]'; then 7 | echo "Not allow to run the command, please use the comand 'sudo vtysh' instead." 1>&2 8 | exit 1 9 | fi 10 | 11 | # The sub commands must start with "show" 12 | LAST_PARAM= 13 | for param in "$@" 14 | do 15 | if [ "$LAST_PARAM" == "-c" ] && [[ "$param" != show* ]]; then 16 | echo "Not allow to run the command '$param', please use the comand 'sudo vtysh' instead." 1>&2 17 | exit 1 18 | fi 19 | LAST_PARAM=$param 20 | done 21 | 22 | vtysh "$@" 23 | -------------------------------------------------------------------------------- /docker-sonic-vpp/manifest.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "version": "1.0.0", 4 | "package": { 5 | "version": "", 6 | "depends": [], 7 | "name": "" 8 | }, 9 | "service": { 10 | "name": "", 11 | "requires": [], 12 | "after": [], 13 | "before": [], 14 | "dependent-of": [], 15 | "asic-service": false, 16 | "host-service": false, 17 | "warm-shutdown": { 18 | "after": [], 19 | "before": [] 20 | }, 21 | "fast-shutdown": { 22 | "after": [], 23 | "before": [] 24 | } 25 | }, 26 | "container": { 27 | "privileged": false, 28 | "volumes": [], 29 | "tmpfs": [] 30 | }, 31 | "cli": { 32 | "config": "", 33 | "show": "", 34 | "clear": "" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/unisolate.j2: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## vtysh only accepts script in stdin, so cannot be directly used in shebang 3 | ## Cut the tail of this script and feed vtysh stdin 4 | sed -n -e '9,$p' < "$0" | vtysh "$@" 5 | ## Exit with vtysh return code 6 | exit $? 7 | 8 | ## vtysh script start from next line, which line number MUST equal in 'sed' command above 9 | 10 | configure terminal 11 | router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} 12 | {% for neighbor_ip in BGP_NEIGHBOR %} 13 | {% if neighbor_ip | ipv4 %} 14 | no neighbor {{ neighbor_ip }} route-map ISOLATE out 15 | {% else %} 16 | address-family ipv6 17 | no neighbor {{ neighbor_ip }} route-map ISOLATE out 18 | exit-address-family 19 | {% endif %} 20 | {% endfor %} 21 | exit 22 | exit 23 | 24 | {% for neighbor_ip in BGP_NEIGHBOR %} 25 | clear ip bgp {{ neighbor_ip }} soft out 26 | {% endfor %} 27 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/isolate.j2: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## vtysh only accepts script in stdin, so cannot be directly used in shebang 3 | ## Cut the tail of this script and feed vtysh stdin 4 | sed -n -e '9,$p' < "$0" | vtysh "$@" 5 | ## Exit with vtysh return code 6 | exit $? 7 | 8 | ## vtysh script start from next line, which line number MUST equal in 'sed' command above 9 | 10 | configure terminal 11 | router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }} 12 | {% for neighbor_addr in BGP_NEIGHBOR %} 13 | {% if neighbor_addr | ipv4 %} 14 | neighbor {{ neighbor_addr }} route-map ISOLATE out 15 | {% else %} 16 | address-family ipv6 17 | neighbor {{ neighbor_addr }} route-map ISOLATE out 18 | exit-address-family 19 | {% endif %} 20 | {% endfor %} 21 | exit 22 | exit 23 | 24 | {% for neighbor_addr in BGP_NEIGHBOR %} 25 | clear ip bgp {{ neighbor_addr }} soft out 26 | {% endfor %} 27 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/debian/syncd.init: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ### BEGIN INIT INFO 4 | # Provides: syncd 5 | # Required-Start: 6 | # Required-Stop: 7 | # Default-Start: S 8 | # Default-Stop: 0 6 9 | # Short-Description: SONiC sync daemon 10 | # Description: Enable service syncd. 11 | ### END INIT INFO 12 | 13 | # Source the file that holds common code for systemd and supervisord 14 | . /usr/bin/syncd_init_common.sh 15 | 16 | # When starting as a service, we want our process to run as a daemon, in the background 17 | if [ $CMD == $CMD_DSSERVE ]; then 18 | CMD_ARGS="-d $CMD_ARGS" 19 | fi 20 | 21 | case "$1" in 22 | start) 23 | config_syncd 24 | start-stop-daemon --start --quiet --exec $CMD -- $CMD_ARGS 25 | ;; 26 | stop) 27 | start-stop-daemon --stop --quiet --exec $CMD 28 | ;; 29 | *) 30 | echo "Usage: service syncd {start|stop}" 31 | exit 1 32 | ;; 33 | esac 34 | 35 | exit 0 36 | 37 | -------------------------------------------------------------------------------- /saivpp/src/EventPayload.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | namespace saivpp 19 | { 20 | class EventPayload 21 | { 22 | public: 23 | 24 | EventPayload() = default; 25 | 26 | virtual ~EventPayload() = default; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /platform/mkrules/dockers/docker-swss-layer-buster/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} 2 | FROM docker-config-engine-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} 3 | 4 | ## Make apt-get non-interactive 5 | ENV DEBIAN_FRONTEND=noninteractive 6 | ENV VPP_INSTALL_SKIP_SYSCTL=1 7 | 8 | RUN apt-get update 9 | 10 | RUN apt-get install iputils-ping 11 | 12 | {% if docker_swss_layer_buster_debs.strip() -%} 13 | # Copy locally-built Debian package dependencies 14 | {{ copy_files("debs/", docker_swss_layer_buster_debs.split(' '), "/debs/") }} 15 | 16 | # Install locally-built Debian packages and implicitly install their dependencies 17 | {{ install_debian_packages(docker_swss_layer_buster_debs.split(' ')) }} 18 | {%- endif %} 19 | 20 | RUN apt-get clean -y && \ 21 | apt-get autoclean -y && \ 22 | apt-get autoremove -y && \ 23 | rm -rf /debs 24 | 25 | ENTRYPOINT ["/usr/local/bin/supervisord"] 26 | -------------------------------------------------------------------------------- /tests/misc/bgp/test_invalid_nexthop.py: -------------------------------------------------------------------------------- 1 | from swsscommon import swsscommon 2 | import os 3 | import re 4 | import time 5 | import json 6 | import pytest 7 | 8 | def test_InvalidNexthop(dvs, testlog): 9 | 10 | dvs.copy_file("/etc/frr/", "bgp/files/invalid_nexthop/bgpd.conf") 11 | dvs.runcmd("supervisorctl start bgpd") 12 | dvs.runcmd("ip addr add fc00::1/126 dev Ethernet0") 13 | dvs.runcmd("config interface startup Ethernet0") 14 | 15 | dvs.servers[0].runcmd("ip addr add fc00::2/126 dev eth0") 16 | dvs.servers[0].runcmd("ifconfig eth0 up") 17 | 18 | time.sleep(5) 19 | 20 | print(dvs.runcmd("supervisorctl status")) 21 | 22 | p = dvs.servers[0].runcmd_async("exabgp -d bgp/files/invalid_nexthop/invalid_nexthop.conf") 23 | 24 | time.sleep(10) 25 | 26 | (exit_code, output) = dvs.runcmd(["vtysh", "-c", "show bgp ipv6"]) 27 | 28 | p.terminate() 29 | p = p.wait() 30 | 31 | print(exit_code, output) 32 | 33 | assert "3333::/64" in output 34 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/zsocket.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | addr="127.0.0.1" 4 | port=2601 5 | 6 | function help() 7 | { 8 | echo "This script aims to ensure zebra is ready to accept connections" 9 | echo "Usage: $0 [options]" 10 | echo "Options:" 11 | echo " -a Zebra address" 12 | echo " -o Zebra port" 13 | exit 1 14 | } 15 | 16 | while getopts ":a:o:h" opt; do 17 | case "${opt}" in 18 | h) help 19 | ;; 20 | a) addr=${OPTARG} 21 | ;; 22 | o) port=${OPTARG} 23 | ;; 24 | esac 25 | done 26 | 27 | start=$(date +%s.%N) 28 | timeout 5s bash -c -- "until "$TSB_FILE" 30 | vtysh -f "$TSB_FILE" 31 | rm -f "$TSB_FILE" 32 | done 33 | echo "System Mode: Maintenance -> Normal" 34 | else 35 | echo "System is already in Normal mode" 36 | fi 37 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-vppcfgd/vppcfgd/vars.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | g_debug = True # FIXME: read from env variable, or from constants 16 | g_dev_debug = True 17 | 18 | INDENT=' ' 19 | VPP_CONFIG_JSON_PATH='/etc/sonic/vpp/startup.json' 20 | VPP_CFG_STARTUP_PATH='/etc/sonic/vpp/startup.conf' 21 | VPP_BOOTUP_CFG_PATH='/etc/sonic/vpp/bootup.conf' 22 | -------------------------------------------------------------------------------- /rules/vppcfgd.mk: -------------------------------------------------------------------------------- 1 | # sonic-vppcfgd package 2 | 3 | SONIC_VPPCFGD = sonic_vppcfgd-1.0-py3-none-any.whl 4 | $(SONIC_VPPCFGD)_SRC_PATH = $(SRC_PATH)/sonic-vppcfgd 5 | # These dependencies are only needed because they are dependencies 6 | # of sonic-config-engine and vppcfgd explicitly calls sonic-cfggen 7 | # as part of its unit tests. 8 | # TODO: Refactor unit tests so that these dependencies are not needed 9 | 10 | $(SONIC_VPPCFGD)_DEPENDS += $(SONIC_CONFIG_ENGINE_PY3) \ 11 | $(SONIC_YANG_MGMT_PY3) \ 12 | $(SONIC_YANG_MODELS_PY3) 13 | $(SONIC_VPPCFGD)_DEBS_DEPENDS += $(LIBYANG) \ 14 | $(LIBYANG_CPP) \ 15 | $(LIBYANG_PY3) \ 16 | $(PYTHON3_SWSSCOMMON) 17 | $(SONIC_VPPCFGD)_PYTHON_VERSION = 3 18 | $(SONIC_VPPCFGD)_TEST = n 19 | SONIC_PYTHON_WHEELS += $(SONIC_VPPCFGD) 20 | 21 | export vpp_platform_vppcfgd_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_VPPCFGD))" 22 | -------------------------------------------------------------------------------- /docs/README.telemetry.md: -------------------------------------------------------------------------------- 1 | # SONiC-VPP telemetry 2 | Telemetry is only supported in sonic-vpp qemu-kvm VM image. The telemetry implementation details are [here](https://github.com/sonic-net/sonic-gnmi). 3 | configuration parameters for telemetry are documented [here](https://github.com/sonic-net/sonic-utilities/blob/master/doc/Command-Reference.md). 4 | 5 | telemetry configuration requires TLS certificates for its operation. To generate the require certificates follow below procedure. 6 | 7 | Download the script [telemetry_cert.gen.sh](https://github.com/sonic-net/sonic-platform-vpp/scripts/telemetry_cert.gen.sh) 8 | the running SONiC-VPP VM and generate private keys and certificates for telemetry. 9 | 10 | ``` 11 | chmod +x telemetry_cert.gen.sh 12 | sudo DNS_NAME=your-sonic-vpp-vm-dns-name ./telemetry_cert.gen.sh 13 | ``` 14 | 15 | Now restart the telemetry container 16 | ``` 17 | sudo systemctl restart telemetry 18 | ``` 19 | 20 | Check telemetry process is running 21 | ``` 22 | show feature status 23 | 24 | ps -ax | grep telemetry 25 | ``` -------------------------------------------------------------------------------- /rules/docker-ptf.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # docker image for docker-ptf 16 | 17 | DOCKER_PTF = docker-ptf.gz 18 | $(DOCKER_PTF)_PYTHON_WHEELS += $(PTF_PY3) 19 | $(DOCKER_PTF)_PATH = $(DOCKERS_PATH)/docker-ptf 20 | $(DOCKER_PTF)_DEPENDS += $(LIBTHRIFT) $(PYTHON_THRIFT) $(PTF) $(PYTHON_SAITHRIFT) 21 | SONIC_DOCKER_IMAGES += $(DOCKER_PTF) 22 | SONIC_BUSTER_DOCKERS += $(DOCKER_PTF) 23 | -------------------------------------------------------------------------------- /vppbld/plugins/tunterm_acl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2024 Cisco and/or its affiliates. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at: 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | include_directories(${CMAKE_SOURCE_DIR}) 15 | 16 | # for generated API headers: 17 | include_directories(${CMAKE_BINARY_DIR}) 18 | 19 | add_vpp_plugin(tunterm_acl 20 | SOURCES 21 | tunterm_acl_api.c 22 | tunterm_acl_cli.c 23 | tunterm_acl_decap.c 24 | tunterm_acl_redirect.c 25 | tunterm_acl_node.c 26 | 27 | API_FILES 28 | tunterm_acl.api 29 | ) 30 | -------------------------------------------------------------------------------- /rules/raw-image.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # sonic vpp raw image installer 16 | 17 | SONIC_RAW_IMAGE = sonic-vpp.raw 18 | $(SONIC_RAW_IMAGE)_MACHINE = vpp 19 | $(SONIC_RAW_IMAGE)_IMAGE_TYPE = raw 20 | $(SONIC_RAW_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) $(VPP_PLATFORM_MODULE) 21 | $(SONIC_RAW_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) 22 | SONIC_INSTALLERS += $(SONIC_RAW_IMAGE) 23 | -------------------------------------------------------------------------------- /docker-gbsyncd-vpp/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} 2 | 3 | ARG docker_container_name 4 | 5 | RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf 6 | 7 | ## Make apt-get non-interactive 8 | ENV DEBIAN_FRONTEND=noninteractive 9 | ENV VPP_INSTALL_SKIP_SYSCTL=1 10 | 11 | RUN apt-get update 12 | 13 | RUN apt-get install -f -y iproute2 libcap2-bin libunwind8 14 | 15 | COPY \ 16 | {% for deb in docker_gbsyncd_vpp_debs.split(' ') -%} 17 | debs/{{ deb }}{{' '}} 18 | {%- endfor -%} 19 | debs/ 20 | 21 | RUN dpkg -i \ 22 | {% for deb in docker_gbsyncd_vpp_debs.split(' ') -%} 23 | debs/{{ deb }}{{' '}} 24 | {%- endfor %} || apt-get install -f -y 25 | 26 | COPY ["start.sh", "/usr/bin/"] 27 | 28 | COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] 29 | COPY ["critical_processes", "/etc/supervisor/"] 30 | 31 | ## Clean up 32 | RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y 33 | RUN rm -rf /debs 34 | 35 | ENTRYPOINT ["/usr/local/bin/supervisord"] 36 | -------------------------------------------------------------------------------- /saivpp/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # See debhelper(7) (uncomment to enable) 3 | # output every command that modifies files on the build system. 4 | #export DH_VERBOSE = 1 5 | 6 | # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/* 7 | DPKG_EXPORT_BUILDFLAGS = 1 8 | include /usr/share/dpkg/default.mk 9 | 10 | # see FEATURE AREAS in dpkg-buildflags(1) 11 | export DEB_BUILD_MAINT_OPTIONS = hardening=+all 12 | 13 | # see ENVIRONMENT in dpkg-buildflags(1) 14 | # package maintainers to append CFLAGS 15 | #export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic 16 | # package maintainers to append LDFLAGS 17 | #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed 18 | 19 | 20 | # main packaging script based on dh7 syntax 21 | %: 22 | dh $@ 23 | 24 | configure_opts = 25 | ifeq ($(ENABLE_ASAN), y) 26 | configure_opts += --enable-asan 27 | endif 28 | 29 | ifeq ($(ENABLE_GCOV), y) 30 | configure_opts += --enable-gcov --enable-code-coverage CFLAGS="-g -O0" CXXFLAGS="-g -O0" 31 | endif 32 | 33 | override_dh_auto_configure: 34 | dh_auto_configure -- $(configure_opts) 35 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-vppcfgd/vppcfgd/vpp.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 Cisco and/or its affiliates. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at: 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | import json 15 | 16 | class VppMgr(object): 17 | """ The class represents vpp configuration template in json""" 18 | def __init__(self, template): 19 | self.vpp_config = {} 20 | with open(template, "r") as flp: 21 | self.vpp_config = json.load(flp) 22 | print("Template {}".format(self.vpp_config)) 23 | 24 | def get_config(self): 25 | return self.vpp_config 26 | -------------------------------------------------------------------------------- /rules/docker-ptf-sai.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # docker image for docker-ptf-sai 16 | 17 | DOCKER_PTF_SAI = docker-ptf-sai.gz 18 | DOCKER_PTF_BASE = docker-ptf.gz 19 | $(DOCKER_PTF_SAI)_PATH = $(DOCKERS_PATH)/docker-ptf-sai 20 | $(DOCKER_PTF_SAI)_DEPENDS += $(LIBTHRIFT_2) $(PYTHON3_THRIFT_2) 21 | $(DOCKER_PTF_SAI)_LOAD_DOCKERS += $(DOCKER_PTF_BASE) 22 | SONIC_DOCKER_IMAGES += $(DOCKER_PTF_SAI) 23 | SONIC_BUSTER_DOCKERS += $(DOCKER_PTF_SAI) 24 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/monitors/peer-group.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/BGPMON/peer-group.conf.j2 3 | ! 4 | neighbor BGPMON peer-group 5 | {% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'SpineRouter' %} 6 | neighbor BGPMON update-source Loopback4096 7 | {% elif loopback0_ipv4 %} 8 | neighbor BGPMON update-source {{ loopback0_ipv4 | ip }} 9 | {% endif %} 10 | 11 | address-family ipv4 12 | neighbor BGPMON activate 13 | neighbor BGPMON route-map FROM_BGPMON in 14 | neighbor BGPMON route-map TO_BGPMON out 15 | neighbor BGPMON send-community 16 | neighbor BGPMON maximum-prefix 1 17 | exit-address-family 18 | 19 | {% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'SpineRouter' %} 20 | address-family ipv6 21 | neighbor BGPMON activate 22 | neighbor BGPMON route-map FROM_BGPMON in 23 | neighbor BGPMON route-map TO_BGPMON out 24 | neighbor BGPMON send-community 25 | neighbor BGPMON maximum-prefix 1 26 | exit-address-family 27 | {% endif %} 28 | ! 29 | ! end of template: bgpd/templates/BGPMON/peer-group.conf.j2 30 | ! 31 | 32 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/common/functions.conf.j2: -------------------------------------------------------------------------------- 1 | {% macro get_ipv4_loopback_address(interfaces, loopbackname) -%} 2 | {% set L = namespace(ip=None) %} 3 | {% for name, prefix in interfaces|pfx_filter %} 4 | {% if name == loopbackname %} 5 | {% if prefix | ipv4 %} 6 | {% set L.ip = prefix %} 7 | {% endif %} 8 | {% endif %} 9 | {% endfor %} 10 | {{ L.ip }} 11 | {%- endmacro %} 12 | 13 | {% macro get_ipv6_loopback_address(interfaces, loopbackname) -%} 14 | {% set L = namespace(ip=None) %} 15 | {% for name, prefix in interfaces|pfx_filter %} 16 | {% if name == loopbackname %} 17 | {% if prefix | ipv6 %} 18 | {% set L.ip = prefix %} 19 | {% endif %} 20 | {% endif %} 21 | {% endfor %} 22 | {{ L.ip }} 23 | {%- endmacro %} 24 | 25 | {% macro get_vnet_interfaces(interfaces) -%} 26 | {% set L = namespace(intfs=[]) %} 27 | {% set vnet_intfs = [] %} 28 | {% for (key, metadata) in interfaces.items() %} 29 | {% if "vnet_name" in metadata %} 30 | {% set vnet_intfs = vnet_intfs.append(key) %} 31 | {% endif %} 32 | {% endfor %} 33 | {% set L.intfs = vnet_intfs %} 34 | {{ L.intfs }} 35 | {%- endmacro %} 36 | -------------------------------------------------------------------------------- /rules/docker-ptf.dep: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | DPATH := $($(DOCKER_PTF)_PATH) 17 | DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/docker-ptf.mk $(PLATFORM_RULES)/docker-ptf.dep 18 | DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) 19 | DEP_FILES += $(shell git ls-files $(DPATH)) 20 | 21 | $(DOCKER_PTF)_CACHE_MODE := GIT_CONTENT_SHA 22 | $(DOCKER_PTF)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) 23 | $(DOCKER_PTF)_DEP_FILES := $(DEP_FILES) 24 | 25 | -------------------------------------------------------------------------------- /rules/docker-ptf-sai.dep: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | DPATH := $($(DOCKER_PTF_SAI)_PATH) 16 | DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/docker-ptf-sai.mk $(PLATFORM_RULES)/docker-ptf-sai.dep 17 | DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) 18 | DEP_FILES += $(shell git ls-files $(DPATH)) 19 | 20 | $(DOCKER_PTF_SAI)_CACHE_MODE := GIT_CONTENT_SHA 21 | $(DOCKER_PTF_SAI)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) 22 | $(DOCKER_PTF_SAI)_DEP_FILES := $(DEP_FILES) 23 | -------------------------------------------------------------------------------- /saivpp/src/WarmBootState.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | extern "C" { 19 | #include "sai.h" 20 | } 21 | 22 | #include "SwitchState.h" 23 | #include "FdbInfo.h" 24 | 25 | #include 26 | 27 | namespace saivpp 28 | { 29 | class WarmBootState 30 | { 31 | public: 32 | 33 | sai_object_id_t m_switchId; 34 | 35 | std::set m_fdbInfoSet; 36 | 37 | SwitchState::ObjectHash m_objectHash; 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /platform/vpp/docker-sonic-vpp/frr/frr/bgpd/idf_isolate/idf_isolate.conf.j2: -------------------------------------------------------------------------------- 1 | route-map CHECK_IDF_ISOLATION permit 1 2 | match ip address prefix-list PL_LoopbackV4 3 | set community {{ constants.bgp.traffic_shift_community }} 4 | route-map CHECK_IDF_ISOLATION permit 2 5 | match ipv6 address prefix-list PL_LoopbackV6 6 | set community {{ constants.bgp.traffic_shift_community }} 7 | route-map CHECK_IDF_ISOLATION permit 3 8 | match tag {{ constants.bgp.internal_community_match_tag }} 9 | set community {{ constants.bgp.traffic_shift_community }} 10 | {# #} 11 | {%- if isolation_status == "isolated_withdraw_all" -%} 12 | route-map CHECK_IDF_ISOLATION deny 4 13 | route-map CHECK_IDF_ISOLATION permit 10 14 | no set community no-export additive{# Added to clean up state, in case of transition from isolated_no_export (not expected) #} 15 | {%- elif isolation_status == "isolated_no_export" -%} 16 | route-map CHECK_IDF_ISOLATION permit 10 17 | set community no-export additive 18 | no route-map CHECK_IDF_ISOLATION deny 4{# Added to clean up state, in case of transition from isolated_withdraw_all (not expected) #} 19 | {# #} 20 | {%- endif -%} -------------------------------------------------------------------------------- /rules/syncd-vpp.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | $(LIBSAIREDIS)_DEB_BUILD_PROFILES += syncd vs 16 | 17 | SYNCD_VS = syncd-vs_1.0.0_$(CONFIGURED_ARCH).deb 18 | $(SYNCD_VS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBSAIVS) 19 | 20 | $(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_VS))) 21 | 22 | SYNCD_VS_DBG = syncd-vs-dbgsym_1.0.0_$(CONFIGURED_ARCH).deb 23 | $(SYNCD_VS_DBG)_DEPENDS += $(SYNCD_VS) 24 | $(SYNCD_VS_DBG)_RDEPENDS += $(SYNCD_VS) 25 | $(eval $(call add_derived_package,$(LIBSAIREDIS),$(SYNCD_VS_DBG))) 26 | -------------------------------------------------------------------------------- /rules/sonic-version.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # sonic version yml file 16 | 17 | sonic_version=$(SONIC_GET_VERSION) 18 | sonic_asic_platform=$(CONFIGURED_PLATFORM) 19 | sonic_os_version=$(SONIC_OS_VERSION) 20 | 21 | export sonic_version 22 | export sonic_asic_platform 23 | export sonic_os_version 24 | 25 | SONIC_VERSION = sonic_version.yml 26 | $(SONIC_VERSION)_SRC_PATH = $(PLATFORM_PATH)/sonic-version 27 | SONIC_MAKE_FILES += $(SONIC_VERSION) 28 | 29 | SONIC_PHONY_TARGETS += $(addprefix $(FILES_PATH)/, $(SONIC_VERSION)) 30 | -------------------------------------------------------------------------------- /saivpp/src/Signal.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "Signal.h" 17 | 18 | #include "swss/logger.h" 19 | 20 | using namespace saivpp; 21 | 22 | void Signal::notifyAll() 23 | { 24 | SWSS_LOG_ENTER(); 25 | 26 | m_cv.notify_all(); 27 | } 28 | 29 | void Signal::notifyOne() 30 | { 31 | SWSS_LOG_ENTER(); 32 | 33 | m_cv.notify_one(); 34 | } 35 | 36 | void Signal::wait() 37 | { 38 | SWSS_LOG_ENTER(); 39 | 40 | std::unique_lock lock(m_mutex); 41 | 42 | m_cv.wait(lock); 43 | } 44 | -------------------------------------------------------------------------------- /platform/mkrules/files/build_templates/vpp_template.json: -------------------------------------------------------------------------------- 1 | { 2 | "unix": { 3 | "nodaemon": "", 4 | "log": "/var/log/vpp.log", 5 | "full-coredump": "", 6 | "cli-listen": "/run/vpp/cli.sock", 7 | "gid": "vpp", 8 | "startup-config": "/etc/sonic/vpp/bootup.conf" 9 | }, 10 | "api-trace": { 11 | "on": "" 12 | }, 13 | "api-segment": { 14 | "gid": "vpp" 15 | }, 16 | 17 | "socksvr": { 18 | "default": "" 19 | }, 20 | "memory": { 21 | "main-heap-size": "1G" 22 | }, 23 | "cpu": { 24 | "main-core": "1", 25 | "workers": "2" 26 | }, 27 | "buffers": { 28 | "page-size": "default-hugepage" 29 | }, 30 | "dpdk": { 31 | "dev": { 32 | "default": { 33 | "num-rx-queues": "2", 34 | "num-tx-queues": "2" 35 | } 36 | } 37 | }, 38 | "plugins": { 39 | "plugin": { 40 | "default": "disable", 41 | "af_packet_plugin.so": "enable", 42 | "dpdk_plugin.so": "enable", 43 | "linux_cp_plugin.so": "enable", 44 | "linux_nl_plugin.so": "enable" 45 | } 46 | }, 47 | "logging": { 48 | "default-log-level": "notice", 49 | "default-syslog-log-level": "info" 50 | }, 51 | "linux-cp": { 52 | "lcp-auto-subint": "" 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/TSA: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Load the common functions 4 | source /usr/bin/TS 5 | 6 | find_num_routemap 7 | routemap_count=$? 8 | check_not_installed 9 | not_installed=$? 10 | 11 | if [[ $routemap_count -eq 0 ]]; 12 | then 13 | echo "System Mode: No external neighbors" 14 | elif [[ $not_installed -ne 0 ]]; 15 | then 16 | TSA_FILE=$(mktemp) 17 | for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | uniq); 18 | do 19 | is_internal_route_map $route_map_name && continue 20 | case "$route_map_name" in 21 | *V4*) 22 | ip_version=V4 23 | ip_protocol=ip 24 | ;; 25 | *V6*) 26 | ip_version=V6 27 | ip_protocol=ipv6 28 | ;; 29 | *) 30 | continue 31 | ;; 32 | esac 33 | sonic-cfggen -d -a "{\"route_map_name\":\"$route_map_name\", \"ip_version\": \"$ip_version\", \"ip_protocol\": \"$ip_protocol\"}" -y /etc/sonic/constants.yml -t /usr/share/sonic/templates/bgpd/tsa/bgpd.tsa.isolate.conf.j2 > "$TSA_FILE" 34 | vtysh -f "$TSA_FILE" 35 | rm -f "$TSA_FILE" 36 | done 37 | echo "System Mode: Normal -> Maintenance" 38 | else 39 | echo "System is already in Maintenance mode" 40 | fi 41 | -------------------------------------------------------------------------------- /docker-sonic-vpp/conf/vpp_template.json: -------------------------------------------------------------------------------- 1 | { 2 | "unix": { 3 | "nodaemon": "", 4 | "log": "/var/log/vpp.log", 5 | "full-coredump": "", 6 | "cli-listen": "/run/vpp/cli.sock", 7 | "gid": "vpp", 8 | "startup-config": "/etc/sonic/vpp/bootup.conf" 9 | }, 10 | "api-trace": { 11 | "on": "" 12 | }, 13 | "api-segment": { 14 | "gid": "vpp" 15 | }, 16 | 17 | "socksvr": { 18 | "default": "" 19 | }, 20 | "memory": { 21 | "main-heap-size": "256M" 22 | }, 23 | "cpu": { 24 | "main-core": "1", 25 | "workers": "2" 26 | }, 27 | "buffers": { 28 | "page-size": "default-hugepage" 29 | }, 30 | "dpdk": { 31 | "dev": { 32 | "default": { 33 | "num-rx-queues": "1", 34 | "num-tx-queues": "1" 35 | } 36 | }, 37 | "uio-driver": "vfio-pci" 38 | }, 39 | "plugins": { 40 | "plugin": { 41 | "default": "disable", 42 | "af_packet_plugin.so": "enable", 43 | "dpdk_plugin.so": "enable", 44 | "linux_cp_plugin.so": "enable", 45 | "linux_nl_plugin.so": "enable" 46 | } 47 | }, 48 | "logging": { 49 | "default-log-level": "notice", 50 | "default-syslog-log-level": "info" 51 | }, 52 | "linux-cp": { 53 | "lcp-auto-subint": "" 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /saivpp/src/Context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "ContextConfig.h" 19 | 20 | namespace saivpp 21 | { 22 | class Context 23 | { 24 | public: 25 | 26 | Context( 27 | _In_ std::shared_ptr contextConfig); 28 | 29 | virtual ~Context(); 30 | 31 | public: 32 | 33 | std::shared_ptr getContextConfig() const; 34 | 35 | private: 36 | 37 | std::shared_ptr m_contextConfig; 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /docker-syncd-vpp/Dockerfile.j2: -------------------------------------------------------------------------------- 1 | FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} 2 | 3 | ARG docker_container_name 4 | 5 | RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf 6 | 7 | ## Make apt-get non-interactive 8 | ENV DEBIAN_FRONTEND=noninteractive 9 | ENV VPP_INSTALL_SKIP_SYSCTL=1 10 | 11 | RUN apt-get update 12 | 13 | RUN apt-get install -f -y libcap2-bin libunwind8 14 | 15 | COPY \ 16 | {% for deb in docker_syncd_vpp_debs.split(' ') -%} 17 | debs/{{ deb }}{{' '}} 18 | {%- endfor -%} 19 | debs/ 20 | 21 | RUN dpkg -i \ 22 | {% for deb in docker_syncd_vpp_debs.split(' ') -%} 23 | debs/{{ deb }}{{' '}} 24 | {%- endfor %} || apt-get install -f -y 25 | 26 | COPY ["start.sh", "/usr/bin/"] 27 | 28 | COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] 29 | COPY ["critical_processes", "/etc/supervisor/"] 30 | 31 | COPY scripts/vpp_hostif.sh /usr/local/bin/ 32 | COPY scripts/vpp_init.sh /usr/local/bin/ 33 | 34 | COPY conf/vpp_init.conf /etc/supervisor/conf.d/ 35 | COPY conf/startup.conf.tmpl /etc/vpp/ 36 | 37 | ## Clean up 38 | RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y 39 | RUN rm -rf /debs 40 | 41 | ENTRYPOINT ["/usr/local/bin/supervisord"] 42 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/saisdkdump/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | AM_CXXFLAGS = $(SAIINC) 16 | 17 | bin_PROGRAMS = saisdkdump 18 | 19 | if SAIVPP 20 | SAILIB=-L$(top_srcdir)/vpplib/.libs -lsaivpp 21 | else 22 | SAILIB=-lsai 23 | endif 24 | 25 | saisdkdump_SOURCES = saisdkdump.cpp 26 | saisdkdump_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) 27 | saisdkdump_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS) 28 | saisdkdump_LDADD = -lhiredis -lswsscommon $(SAILIB) -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) 29 | -------------------------------------------------------------------------------- /docker-sonic-vpp/orchagent.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #This is required since we have platform based checks in orchagent 4 | 5 | if [ "$HWSKU" == "Mellanox-SN2700" ]; then 6 | export platform="mellanox" 7 | else 8 | export platform=vs 9 | fi 10 | 11 | SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2 12 | 13 | # Retrieve SWSS vars from sonic-cfggen 14 | SWSS_VARS=$(sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE) || exit 1 15 | 16 | MAC_ADDRESS=$(echo $SWSS_VARS | jq -r '.mac') 17 | if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then 18 | MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}') 19 | logger "Mac address not found in Device Metadata, Falling back to eth0" 20 | fi 21 | 22 | # Create a folder for SwSS record files 23 | mkdir -p /var/log/swss 24 | ORCHAGENT_ARGS="-d /var/log/swss " 25 | 26 | # Set orchagent pop batch size to 8192 27 | ORCHAGENT_ARGS+="-b 8192 " 28 | 29 | # Set synchronous mode if it is enabled in CONFIG_DB 30 | SYNC_MODE=$(echo $SWSS_VARS | jq -r '.synchronous_mode') 31 | if [ "$SYNC_MODE" == "enable" ]; then 32 | ORCHAGENT_ARGS+="-s " 33 | fi 34 | 35 | # Set mac address 36 | ORCHAGENT_ARGS+="-m $MAC_ADDRESS" 37 | 38 | exec /usr/bin/orchagent ${ORCHAGENT_ARGS} 39 | -------------------------------------------------------------------------------- /rules.dep: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | include $(PLATFORM_RULES)/syncd-vpp.dep 15 | include $(PLATFORM_RULES)/sonic-version.dep 16 | include $(PLATFORM_RULES)/platform-modules-vpp.dep 17 | include $(PLATFORM_RULES)/docker-syncd-vpp.dep 18 | include $(PLATFORM_RULES)/docker-gbsyncd-vpp.dep 19 | include $(PLATFORM_RULES)/docker-ptf.dep 20 | include $(PLATFORM_RULES)/docker-ptf-sai.dep 21 | include $(PLATFORM_RULES)/libsaithrift-dev.dep 22 | include $(PLATFORM_RULES)/one-image.dep 23 | include $(PLATFORM_RULES)/onie.dep 24 | include $(PLATFORM_RULES)/kvm-image.dep 25 | include $(PLATFORM_RULES)/raw-image.dep 26 | -------------------------------------------------------------------------------- /saivpp/src/IpVrfInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | extern "C" { 19 | #include "sai.h" 20 | } 21 | 22 | namespace saivpp 23 | { 24 | class IpVrfInfo 25 | { 26 | public: 27 | IpVrfInfo( 28 | _In_ sai_object_id_t obj_id, 29 | _In_ uint32_t vrf_id, 30 | _In_ std::string &vrf_name, 31 | bool is_ipv6); 32 | 33 | virtual ~IpVrfInfo(); 34 | 35 | public: 36 | sai_object_id_t m_obj_id; 37 | uint32_t m_vrf_id; 38 | std::string m_vrf_name; 39 | bool m_is_ipv6; 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /saivpp/src/Context.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "Context.h" 17 | 18 | #include "swss/logger.h" 19 | 20 | using namespace saivpp; 21 | 22 | Context::Context( 23 | _In_ std::shared_ptr contextConfig): 24 | m_contextConfig(contextConfig) 25 | { 26 | SWSS_LOG_ENTER(); 27 | 28 | // empty 29 | } 30 | 31 | Context::~Context() 32 | { 33 | SWSS_LOG_ENTER(); 34 | 35 | // empty 36 | } 37 | 38 | std::shared_ptr Context::getContextConfig() const 39 | { 40 | SWSS_LOG_ENTER(); 41 | 42 | return m_contextConfig; 43 | } 44 | -------------------------------------------------------------------------------- /saivpp/src/Signal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include 19 | #include 20 | 21 | namespace saivpp 22 | { 23 | class Signal 24 | { 25 | public: 26 | 27 | Signal() = default; 28 | 29 | virtual ~Signal() = default; 30 | 31 | public: 32 | 33 | void notifyAll(); 34 | 35 | void notifyOne(); 36 | 37 | void wait(); 38 | 39 | private: 40 | 41 | std::condition_variable m_cv; 42 | 43 | std::mutex m_mutex; 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /rules/docker-gbsyncd-vpp.dep: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #DPKG FRK 16 | DPATH := $($(DOCKER_GBSYNCD_BASE)_PATH) 17 | DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/docker-gbsyncd-vpp.mk $(PLATFORM_RULES)/docker-gbsyncd-vpp.dep 18 | DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) 19 | DEP_FILES += $(shell git ls-files $(DPATH)) 20 | 21 | $(DOCKER_GBSYNCD_BASE)_CACHE_MODE := GIT_CONTENT_SHA 22 | $(DOCKER_GBSYNCD_BASE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) 23 | $(DOCKER_GBSYNCD_BASE)_DEP_FILES := $(DEP_FILES) 24 | 25 | $(eval $(call add_dbg_docker,$(DOCKER_GBSYNCD_BASE),$(DOCKER_GBSYNCD_BASE_DBG))) 26 | -------------------------------------------------------------------------------- /saivpp/src/SelectableFd.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "SelectableFd.h" 17 | 18 | #include "swss/logger.h" 19 | 20 | using namespace saivpp; 21 | 22 | SelectableFd::SelectableFd( 23 | _In_ int fd) 24 | { 25 | SWSS_LOG_ENTER(); 26 | 27 | if (fd < 0) 28 | { 29 | SWSS_LOG_THROW("invalid file descriptor: %d", fd); 30 | } 31 | 32 | m_fd = fd; 33 | } 34 | 35 | int SelectableFd::getFd() 36 | { 37 | SWSS_LOG_ENTER(); 38 | 39 | return m_fd; 40 | } 41 | 42 | uint64_t SelectableFd::readData() 43 | { 44 | SWSS_LOG_ENTER(); 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /tests/misc/teamd/test_portchannel.py: -------------------------------------------------------------------------------- 1 | from swsscommon import swsscommon 2 | import time 3 | import re 4 | import json 5 | 6 | def test_PortChannel(dvs, testlog): 7 | appldb = swsscommon.DBConnector(0, dvs.redis_sock, 0) 8 | statdb = swsscommon.DBConnector(6, dvs.redis_sock, 0) 9 | 10 | # create the lag 11 | dvs.runcmd("config portchannel add PortChannel0001") 12 | time.sleep(1) 13 | 14 | # test lag table in appl db 15 | tbl = swsscommon.Table(appldb, "LAG_TABLE") 16 | (status, fvs) = tbl.get("PortChannel0001") 17 | assert status == True 18 | 19 | # test lag table in state db 20 | tbl = swsscommon.Table(statdb, "LAG_TABLE") 21 | (status, fvs) = tbl.get("PortChannel0001") 22 | assert status == True 23 | 24 | # create the lag member 25 | dvs.runcmd("config portchannel member add PortChannel0001 Ethernet112") 26 | time.sleep(1) 27 | 28 | # test lag member table in appl db 29 | tbl = swsscommon.Table(appldb, "LAG_MEMBER_TABLE") 30 | (status, fvs) = tbl.get("PortChannel0001:Ethernet112") 31 | assert status == True 32 | 33 | # remove the lag member 34 | dvs.runcmd("config portchannel member del PortChannel0001 Ethernet112") 35 | 36 | # remove the lag 37 | dvs.runcmd("config portchannel del PortChannel0001") 38 | -------------------------------------------------------------------------------- /saivpp/src/MACsecEgressFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "MACsecFilter.h" 19 | 20 | namespace saivpp 21 | { 22 | class MACsecEgressFilter: 23 | public MACsecFilter 24 | { 25 | public: 26 | 27 | MACsecEgressFilter( 28 | _In_ const std::string &macsecInterfaceName); 29 | 30 | virtual ~MACsecEgressFilter() = default; 31 | 32 | protected: 33 | 34 | virtual FilterStatus forward( 35 | _In_ const void *buffer, 36 | _In_ size_t length) override; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /saivpp/src/MACsecIngressFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "MACsecFilter.h" 19 | 20 | namespace saivpp 21 | { 22 | class MACsecIngressFilter : 23 | public MACsecFilter 24 | { 25 | public: 26 | 27 | MACsecIngressFilter( 28 | _In_ const std::string &macsecInterfaceName); 29 | 30 | virtual ~MACsecIngressFilter() = default; 31 | 32 | protected: 33 | 34 | virtual FilterStatus forward( 35 | _In_ const void *buffer, 36 | _In_ size_t length) override; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /saivpp/src/vppxlate/SaiAclStats.h: -------------------------------------------------------------------------------- 1 | /* 2 | *------------------------------------------------------------------ 3 | * SaiAclStats.h 4 | * 5 | * Copyright (c) 2023 Cisco and/or its affiliates. 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | *------------------------------------------------------------------ 18 | */ 19 | 20 | #ifndef _SAIACLSTATS_H_ 21 | #define _SAIACLSTATS_H_ 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | typedef struct vpp_ace_stats_ { 28 | uint64_t packets; 29 | uint64_t bytes; 30 | uint32_t ace_index; 31 | } vpp_ace_stats_t; 32 | 33 | int vpp_acl_ace_stats_query(uint32_t acl_index, uint32_t ace_index, 34 | vpp_ace_stats_t *stats); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /docker-syncd-vpp/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | logfile_maxbytes=1MB 3 | logfile_backups=2 4 | nodaemon=true 5 | 6 | [eventlistener:dependent-startup] 7 | command=python3 -m supervisord_dependent_startup 8 | autostart=true 9 | autorestart=unexpected 10 | startretries=0 11 | exitcodes=0,3 12 | events=PROCESS_STATE 13 | buffer_size=1024 14 | 15 | [eventlistener:supervisor-proc-exit-listener] 16 | command=/usr/local/bin/supervisor-proc-exit-listener --container-name syncd 17 | events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING 18 | autostart=true 19 | autorestart=unexpected 20 | buffer_size=1024 21 | 22 | [program:rsyslogd] 23 | command=/usr/sbin/rsyslogd -n -iNONE 24 | priority=1 25 | autostart=false 26 | autorestart=unexpected 27 | stdout_logfile=syslog 28 | stderr_logfile=syslog 29 | dependent_startup=true 30 | 31 | [program:start] 32 | command=/usr/bin/start.sh 33 | priority=2 34 | autostart=false 35 | autorestart=false 36 | startsecs=0 37 | stdout_logfile=syslog 38 | stderr_logfile=syslog 39 | dependent_startup=true 40 | dependent_startup_wait_for=rsyslogd:running 41 | 42 | [program:syncd] 43 | command=/usr/bin/syncd_start.sh 44 | priority=3 45 | autostart=false 46 | autorestart=false 47 | stdout_logfile=syslog 48 | stderr_logfile=syslog 49 | dependent_startup=true 50 | dependent_startup_wait_for=start:exited 51 | -------------------------------------------------------------------------------- /docker-gbsyncd-vpp/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | logfile_maxbytes=1MB 3 | logfile_backups=2 4 | nodaemon=true 5 | 6 | [eventlistener:dependent-startup] 7 | command=python3 -m supervisord_dependent_startup 8 | autostart=true 9 | autorestart=unexpected 10 | startretries=0 11 | exitcodes=0,3 12 | events=PROCESS_STATE 13 | buffer_size=1024 14 | 15 | [eventlistener:supervisor-proc-exit-listener] 16 | command=/usr/local/bin/supervisor-proc-exit-listener --container-name gbsyncd 17 | events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING 18 | autostart=true 19 | autorestart=unexpected 20 | buffer_size=1024 21 | 22 | [program:rsyslogd] 23 | command=/usr/sbin/rsyslogd -n -iNONE 24 | priority=1 25 | autostart=false 26 | autorestart=unexpected 27 | stdout_logfile=syslog 28 | stderr_logfile=syslog 29 | dependent_startup=true 30 | 31 | [program:start] 32 | command=/usr/bin/start.sh 33 | priority=2 34 | autostart=false 35 | autorestart=false 36 | startsecs=0 37 | stdout_logfile=syslog 38 | stderr_logfile=syslog 39 | dependent_startup=true 40 | dependent_startup_wait_for=rsyslogd:running 41 | 42 | [program:gbsyncdmgrd] 43 | command=/usr/bin/gbsyncdmgrd 44 | priority=3 45 | autostart=false 46 | autorestart=false 47 | stdout_logfile=syslog 48 | stderr_logfile=syslog 49 | dependent_startup=true 50 | dependent_startup_wait_for=start:exited 51 | -------------------------------------------------------------------------------- /saivpp/src/Event.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "Event.h" 17 | 18 | #include "swss/logger.h" 19 | 20 | using namespace saivpp; 21 | 22 | Event::Event( 23 | _In_ EventType eventType, 24 | _In_ std::shared_ptr payload): 25 | m_eventType(eventType), 26 | m_payload(payload) 27 | { 28 | SWSS_LOG_ENTER(); 29 | 30 | // empty 31 | } 32 | 33 | EventType Event::getType() const 34 | { 35 | SWSS_LOG_ENTER(); 36 | 37 | return m_eventType; 38 | } 39 | 40 | std::shared_ptr Event::getPayload() const 41 | { 42 | SWSS_LOG_ENTER(); 43 | 44 | return m_payload; 45 | } 46 | -------------------------------------------------------------------------------- /docs/port_stats.md: -------------------------------------------------------------------------------- 1 | ## Is stats collection for ports enabled ? 2 | 3 | Two things are required 4 | * You should be running the latest sonic-platform-vpp code since port stats support for sonic-vpp code got committed recently. 5 | 6 | * Enable stats collection if not already enabled in the configuration. 7 | 8 | The port counters are not enabled by default in the SONiC configuration. If you do not see below configuration in the "show runningconfig all" of SONiC then the fetching of port(interface) counters in SONiC control plane is not enabled. 9 | ``` 10 | { 11 | "FLEX_COUNTER_TABLE": { 12 | "PORT": { 13 | "FLEX_COUNTER_STATUS": "enable" 14 | }, 15 | ... 16 | } 17 | } 18 | ``` 19 | 20 | ## How to enable the stats for ports in configuration ? 21 | 22 | Create a simple configuration file with FLEX_COUNTER_TABLE having PORT enabled with counter as below 23 | 24 | ``` 25 | cat > CNTR.json 26 | { 27 | "FLEX_COUNTER_TABLE": { 28 | "PORT": { 29 | "FLEX_COUNTER_STATUS": "enable", 30 | "POLL_INTERVAL": "20000" 31 | } 32 | } 33 | } 34 | Ctrl-D 35 | ``` 36 | 37 | Load the above cntr.json file using config load command 38 | ``` 39 | sudo config load -y cntr.json 40 | ``` 41 | 42 | Now run "show interface counter" few times to see the updated counters. -------------------------------------------------------------------------------- /rules/one-image.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # sonic vpp one image installer 16 | 17 | SONIC_ONE_IMAGE = sonic-vpp.bin 18 | $(SONIC_ONE_IMAGE)_MACHINE = vpp 19 | $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie 20 | $(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) $(VPP_PLATFORM_MODULE) 21 | ifeq ($(INSTALL_DEBUG_TOOLS),y) 22 | $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) 23 | $(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) 24 | else 25 | $(SONIC_ONE_IMAGE)_DOCKERS = $(SONIC_INSTALL_DOCKER_IMAGES) 26 | endif 27 | SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) 28 | -------------------------------------------------------------------------------- /saivpp/src/MACsecFilterStateGuard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "MACsecFilter.h" 19 | 20 | namespace saivpp 21 | { 22 | class MACsecFilterStateGuard 23 | { 24 | public: 25 | 26 | MACsecFilterStateGuard( 27 | _Inout_ MACsecFilter::MACsecFilterState &guarded_state, 28 | _In_ MACsecFilter::MACsecFilterState target_state); 29 | 30 | ~MACsecFilterStateGuard(); 31 | 32 | private: 33 | 34 | MACsecFilter::MACsecFilterState m_old_state; 35 | MACsecFilter::MACsecFilterState &m_guarded_state; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /saivpp/src/SwitchStateBaseNexthop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 Cisco and/or its affiliates. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at: 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | #ifndef _SWITCHSTATEBASENEXTHOP_H_ 16 | #define _SWITCHSTATEBASENEXTHOP_H_ 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | typedef struct nexthop_grp_member_ { 23 | sai_ip_address_t addr; 24 | sai_object_id_t rif_oid; 25 | uint32_t weight; 26 | uint32_t seq_id; 27 | uint32_t sw_if_index; 28 | } nexthop_grp_member_t; 29 | 30 | typedef struct nexthop_grp_config_ { 31 | int32_t grp_type; 32 | uint32_t nmembers; 33 | 34 | /* Must be the last variable */ 35 | nexthop_grp_member_t grp_members[0]; 36 | } nexthop_grp_config_t; 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /platform/mkrules/build_debian.sh.patch: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 Cisco and/or its affiliates. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at: 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | diff --git a/build_debian.sh b/build_debian.sh 15 | index af9fcc7ae..18d3b41ae 100755 16 | --- a/build_debian.sh 17 | +++ b/build_debian.sh 18 | @@ -533,6 +533,7 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'setup 19 | sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'wheel==0.35.1' 20 | 21 | # docker Python API package is needed by Ansible docker module as well as some SONiC applications 22 | +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'urllib3==1.26.15' 23 | sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'docker==5.0.3' 24 | 25 | # Install scapy 26 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/general/peer-group.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/general/peer-group.conf.j2 3 | ! 4 | neighbor PEER_V4 peer-group 5 | neighbor PEER_V6 peer-group 6 | address-family ipv4 7 | {% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} 8 | neighbor PEER_V4 allowas-in 1 9 | {% elif CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'LeafRouter' %} 10 | {% if CONFIG_DB__BGP_BBR['status'] == 'enabled' %} 11 | neighbor PEER_V4 allowas-in 1 12 | {% endif %} 13 | {% endif %} 14 | neighbor PEER_V4 soft-reconfiguration inbound 15 | neighbor PEER_V4 route-map FROM_BGP_PEER_V4 in 16 | neighbor PEER_V4 route-map TO_BGP_PEER_V4 out 17 | exit-address-family 18 | address-family ipv6 19 | {% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} 20 | neighbor PEER_V6 allowas-in 1 21 | {% elif CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'LeafRouter' %} 22 | {% if CONFIG_DB__BGP_BBR['status'] == 'enabled' %} 23 | neighbor PEER_V6 allowas-in 1 24 | {% endif %} 25 | {% endif %} 26 | neighbor PEER_V6 soft-reconfiguration inbound 27 | neighbor PEER_V6 route-map FROM_BGP_PEER_V6 in 28 | neighbor PEER_V6 route-map TO_BGP_PEER_V6 out 29 | exit-address-family 30 | ! 31 | ! end of template: bgpd/templates/general/peer-group.conf.j2 32 | ! 33 | -------------------------------------------------------------------------------- /saivpp/src/MACsecFilterStateGuard.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "MACsecFilterStateGuard.h" 17 | 18 | #include 19 | 20 | using namespace saivpp; 21 | 22 | MACsecFilterStateGuard::MACsecFilterStateGuard( 23 | _Inout_ MACsecFilter::MACsecFilterState &guarded_state, 24 | _In_ MACsecFilter::MACsecFilterState target_state): 25 | m_guarded_state(guarded_state) 26 | { 27 | SWSS_LOG_ENTER(); 28 | 29 | m_old_state = m_guarded_state; 30 | m_guarded_state = target_state; 31 | } 32 | 33 | MACsecFilterStateGuard::~MACsecFilterStateGuard() 34 | { 35 | SWSS_LOG_ENTER(); 36 | 37 | m_guarded_state = m_old_state; 38 | } 39 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-sairedis/saidiscovery/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/meta -I$(top_srcdir)/lib 16 | 17 | bin_PROGRAMS = saidiscovery 18 | 19 | if SAIVPP 20 | SAILIB=-L$(top_srcdir)/vpplib/.libs -lsaivpp 21 | else 22 | SAILIB=-lsai 23 | endif 24 | 25 | saidiscovery_SOURCES = saidiscovery.cpp 26 | 27 | saidiscovery_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) 28 | saidiscovery_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS) 29 | saidiscovery_LDADD = -lhiredis -lswsscommon $(top_srcdir)/syncd/libSyncd.a $(SAILIB) -lpthread \ 30 | -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) 31 | -------------------------------------------------------------------------------- /saivpp/src/vppxlate/SaiVppStats.h: -------------------------------------------------------------------------------- 1 | /* 2 | *------------------------------------------------------------------ 3 | * SaiVppStats.h 4 | * 5 | * Copyright (c) 2023 Cisco and/or its affiliates. 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at: 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | *------------------------------------------------------------------ 18 | */ 19 | 20 | #ifndef _SAI_VPP_STATS_H_ 21 | #define _SAI_VPP_STATS_H_ 22 | 23 | typedef void (*vpp_stat_one)(const char *, uint32_t index, uint64_t, void *); 24 | typedef void (*vpp_stat_two)(const char *, uint32_t index, uint64_t, uint64_t, void *); 25 | 26 | int vpp_stats_dump(const char *query_path, vpp_stat_one one, vpp_stat_two two, void *data); 27 | 28 | #define SAIVPP_STAT_DBG(format,args...) {} 29 | // #define SAIVPP_STAT_DBG clib_warning 30 | #define SAIVPP_STAT_ERR clib_error 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /saivpp/src/Buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "swss/sal.h" 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | 25 | namespace saivpp 26 | { 27 | class Buffer 28 | { 29 | public: 30 | 31 | Buffer( 32 | _In_ const uint8_t* data, 33 | _In_ size_t size); 34 | 35 | virtual ~Buffer() = default; 36 | 37 | public: 38 | 39 | const uint8_t* getData() const; 40 | 41 | size_t getSize() const; 42 | 43 | private: 44 | 45 | std::vector m_data; 46 | 47 | size_t m_size; 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /saivpp/src/Buffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "Buffer.h" 17 | 18 | #include "swss/logger.h" 19 | 20 | #include 21 | 22 | using namespace saivpp; 23 | 24 | Buffer::Buffer( 25 | _In_ const uint8_t* data, 26 | _In_ size_t size) 27 | { 28 | SWSS_LOG_ENTER(); 29 | 30 | if (!data) 31 | { 32 | SWSS_LOG_THROW("data is NULL!"); 33 | } 34 | 35 | m_data = std::vector(data, data + size); 36 | } 37 | 38 | const uint8_t* Buffer::getData() const 39 | { 40 | SWSS_LOG_ENTER(); 41 | 42 | return m_data.data(); 43 | } 44 | 45 | size_t Buffer::getSize() const 46 | { 47 | SWSS_LOG_ENTER(); 48 | 49 | return m_data.size(); 50 | } 51 | -------------------------------------------------------------------------------- /rules.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | PLATFORM_RULES := $(PLATFORM_PATH)/rules 15 | export PLATFORM_RULES 16 | include $(PLATFORM_RULES)/syncd-vpp.mk 17 | include $(PLATFORM_RULES)/sonic-version.mk 18 | include $(PLATFORM_RULES)/platform-modules-vpp.mk 19 | include $(PLATFORM_RULES)/docker-syncd-vpp.mk 20 | include $(PLATFORM_RULES)/docker-gbsyncd-vpp.mk 21 | include $(PLATFORM_RULES)/docker-ptf.mk 22 | include $(PLATFORM_RULES)/docker-ptf-sai.mk 23 | include $(PLATFORM_RULES)/libsaithrift-dev.mk 24 | include $(PLATFORM_RULES)/one-image.mk 25 | include $(PLATFORM_RULES)/onie.mk 26 | include $(PLATFORM_RULES)/kvm-image.mk 27 | include $(PLATFORM_RULES)/raw-image.mk 28 | 29 | SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_KVM_IMAGE) $(DOCKER_SONIC_VPP) $(SONIC_RAW_IMAGE) 30 | -------------------------------------------------------------------------------- /saivpp/src/SelectableFd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "swss/sal.h" 19 | #include "swss/selectable.h" 20 | 21 | namespace saivpp 22 | { 23 | class SelectableFd: 24 | public swss::Selectable 25 | { 26 | private: 27 | 28 | SelectableFd(const SelectableFd&) = delete; 29 | SelectableFd& operator=(const SelectableFd&) = delete; 30 | 31 | public: 32 | 33 | SelectableFd( 34 | _In_ int fd); 35 | 36 | virtual ~SelectableFd() = default; 37 | 38 | int getFd() override; 39 | 40 | uint64_t readData() override; 41 | 42 | private: 43 | 44 | int m_fd; 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/voq_chassis/peer-group.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/voq_chassis/peer-group.conf.j2 3 | ! 4 | neighbor VOQ_CHASSIS_V4_PEER peer-group 5 | neighbor VOQ_CHASSIS_V6_PEER peer-group 6 | address-family ipv4 7 | {% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} 8 | neighbor VOQ_CHASSIS_V4_PEER allowas-in 1 9 | {% endif %} 10 | neighbor VOQ_CHASSIS_V4_PEER activate 11 | neighbor VOQ_CHASSIS_V4_PEER addpath-tx-all-paths 12 | neighbor VOQ_CHASSIS_V4_PEER soft-reconfiguration inbound 13 | neighbor VOQ_CHASSIS_V4_PEER route-map FROM_VOQ_CHASSIS_V4_PEER in 14 | neighbor VOQ_CHASSIS_V4_PEER route-map TO_VOQ_CHASSIS_V4_PEER out 15 | neighbor VOQ_CHASSIS_V4_PEER send-community 16 | exit-address-family 17 | address-family ipv6 18 | {% if CONFIG_DB__DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %} 19 | neighbor VOQ_CHASSIS_V6_PEER allowas-in 1 20 | {% endif %} 21 | neighbor VOQ_CHASSIS_V6_PEER activate 22 | neighbor VOQ_CHASSIS_V6_PEER addpath-tx-all-paths 23 | neighbor VOQ_CHASSIS_V6_PEER soft-reconfiguration inbound 24 | neighbor VOQ_CHASSIS_V6_PEER route-map FROM_VOQ_CHASSIS_V6_PEER in 25 | neighbor VOQ_CHASSIS_V6_PEER route-map TO_VOQ_CHASSIS_V6_PEER out 26 | neighbor VOQ_CHASSIS_V6_PEER send-community 27 | exit-address-family 28 | ! 29 | ! end of template: bgpd/templates/voq_chassis/peer-group.conf.j2 30 | ! 31 | -------------------------------------------------------------------------------- /rules/docker-gbsyncd-vpp.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # docker image for vpp gbsyncd 16 | 17 | DOCKER_GBSYNCD_PLATFORM_CODE = vpp 18 | include $(PLATFORM_PATH)/../template/docker-gbsyncd-bookworm.mk 19 | 20 | $(DOCKER_GBSYNCD_BASE)_DEPENDS += $(LIBSAIVS) \ 21 | $(SYNCD_VS) 22 | 23 | $(DOCKER_GBSYNCD_BASE)_DBG_DEPENDS += $(SYNCD_VS_DBG) \ 24 | $(LIBSWSSCOMMON_DBG) \ 25 | $(LIBSAIMETADATA_DBG) \ 26 | $(LIBSAIREDIS_DBG) \ 27 | $(LIBSAIVS_DBG) 28 | 29 | $(DOCKER_GBSYNCD_BASE)_VERSION = 1.0.0 30 | $(DOCKER_GBSYNCD_BASE)_PACKAGE_NAME = gbsyncd 31 | 32 | $(DOCKER_GBSYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot 33 | -------------------------------------------------------------------------------- /rules/kvm-image.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # sonic kvm image 16 | 17 | SONIC_KVM_IMAGE = sonic-vpp.img.gz 18 | $(SONIC_KVM_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) $(VPP_PLATFORM_MODULE) 19 | $(SONIC_KVM_IMAGE)_MACHINE = vpp 20 | $(SONIC_KVM_IMAGE)_IMAGE_TYPE = kvm 21 | ifeq ($(INSTALL_DEBUG_TOOLS),y) 22 | $(SONIC_KVM_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) 23 | $(SONIC_KVM_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) 24 | else 25 | $(SONIC_KVM_IMAGE)_DOCKERS = $(SONIC_INSTALL_DOCKER_IMAGES) 26 | endif 27 | $(SONIC_KVM_IMAGE)_FILES = $(ONIE_RECOVERY_IMAGE) $(ONIE_RECOVERY_KVM_4ASIC_IMAGE) $(ONIE_RECOVERY_KVM_6ASIC_IMAGE) 28 | SONIC_INSTALLERS += $(SONIC_KVM_IMAGE) 29 | -------------------------------------------------------------------------------- /vppbld/plugins/tunterm_acl/tunterm_acl_redirect.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2024 Cisco and/or its affiliates. 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at: 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. */ 13 | 14 | #ifndef TUNTERM_ACL_REDIRECT_H_ 15 | #define TUNTERM_ACL_REDIRECT_H_ 16 | 17 | #include 18 | 19 | clib_error_t *tunterm_acl_redirect_init (vlib_main_t *vm); 20 | 21 | int tunterm_acl_redirect_add (vlib_main_t *vm, u32 table_index, 22 | u32 opaque_index, dpo_proto_t proto, 23 | const u8 *match, const fib_route_path_t *rpaths); 24 | 25 | int tunterm_acl_redirect_del (vlib_main_t *vm, u32 table_index, 26 | const u8 *match); 27 | 28 | int tunterm_acl_redirect_clear (vlib_main_t *vm, u32 table_index); 29 | 30 | #endif /* TUNTERM_ACL_REDIRECT_H_ */ 31 | 32 | /* 33 | * fd.io coding-style-patch-verification: ON 34 | * 35 | * Local Variables: 36 | * eval: (c-set-style "gnu") 37 | * End: 38 | */ 39 | -------------------------------------------------------------------------------- /saivpp/src/ContextConfig.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "ContextConfig.h" 17 | 18 | #include "swss/logger.h" 19 | 20 | using namespace saivpp; 21 | 22 | ContextConfig::ContextConfig( 23 | _In_ uint32_t guid, 24 | _In_ const std::string& name, 25 | _In_ const std::string& dbAsic): 26 | m_guid(guid), 27 | m_name(name), 28 | m_dbAsic(dbAsic) 29 | { 30 | SWSS_LOG_ENTER(); 31 | 32 | m_scc = std::make_shared(); 33 | } 34 | 35 | ContextConfig::~ContextConfig() 36 | { 37 | SWSS_LOG_ENTER(); 38 | 39 | // empty 40 | } 41 | 42 | void ContextConfig::insert( 43 | _In_ std::shared_ptr config) 44 | { 45 | SWSS_LOG_ENTER(); 46 | 47 | m_scc->insert(config); 48 | } 49 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/internal/instance.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/internal/instance.conf.j2 3 | ! 4 | neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} 5 | neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} 6 | neighbor {{ neighbor_addr }} timers 3 10 7 | neighbor {{ neighbor_addr }} timers connect 10 8 | ! 9 | {% if neighbor_addr | ipv4 %} 10 | address-family ipv4 11 | neighbor {{ neighbor_addr }} peer-group INTERNAL_PEER_V4 12 | ! 13 | {% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' or CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} 14 | neighbor {{ neighbor_addr }} next-hop-self force 15 | {% endif %} 16 | ! 17 | {% elif neighbor_addr | ipv6 %} 18 | address-family ipv6 19 | neighbor {{ neighbor_addr }} peer-group INTERNAL_PEER_V6 20 | ! 21 | {% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' or CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} 22 | neighbor {{ neighbor_addr }} next-hop-self force 23 | {% endif %} 24 | {% endif %} 25 | ! 26 | {% if 'rrclient' in bgp_session and bgp_session['rrclient'] | int != 0 %} 27 | neighbor {{ neighbor_addr }} route-reflector-client 28 | {% endif %} 29 | ! 30 | ! 31 | neighbor {{ neighbor_addr }} activate 32 | exit-address-family 33 | ! 34 | ! end of template: bgpd/templates/internal/instance.conf.j2 35 | ! 36 | -------------------------------------------------------------------------------- /rules/onie.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ONIE_RECOVERY_IMAGE = onie-recovery-x86_64-kvm_x86_64-r0.iso 16 | $(ONIE_RECOVERY_IMAGE)_URL = "https://packages.trafficmanager.net/public/onie/onie-recovery-x86_64-kvm_x86_64-r0.iso" 17 | 18 | ONIE_RECOVERY_KVM_4ASIC_IMAGE = onie-recovery-x86_64-kvm_x86_64_4_asic-r0.iso 19 | $(ONIE_RECOVERY_KVM_4ASIC_IMAGE)_URL = "https://packages.trafficmanager.net/public/onie/onie-recovery-x86_64-kvm_x86_64_4_asic-r0.iso" 20 | 21 | ONIE_RECOVERY_KVM_6ASIC_IMAGE = onie-recovery-x86_64-kvm_x86_64_6_asic-r0.iso 22 | $(ONIE_RECOVERY_KVM_6ASIC_IMAGE)_URL = "https://packages.trafficmanager.net/public/onie/onie-recovery-x86_64-kvm_x86_64_6_asic-r0.iso" 23 | 24 | SONIC_ONLINE_FILES += $(ONIE_RECOVERY_IMAGE) $(ONIE_RECOVERY_KVM_4ASIC_IMAGE) $(ONIE_RECOVERY_KVM_6ASIC_IMAGE) 25 | -------------------------------------------------------------------------------- /platform/mkrules/files/build_templates/docker_image_ctl.j2.patch: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 Cisco and/or its affiliates. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at: 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 15 | index f0208d32f..b0872d12e 100644 16 | --- a/files/build_templates/docker_image_ctl.j2 17 | +++ b/files/build_templates/docker_image_ctl.j2 18 | @@ -670,6 +670,11 @@ start() { 19 | --env "CONTAINER_NAME"=$DOCKERNAME \ 20 | --env "SYSLOG_TARGET_IP"=$SYSLOG_TARGET_IP \ 21 | --env "PLATFORM"=$PLATFORM \ 22 | +{%- if sonic_asic_platform == "vpp" %} 23 | +{%- if docker_container_name == "syncd" %} 24 | + --env-file /etc/sonic/vpp/syncd_vpp_env \ 25 | +{%- endif %} 26 | +{%- endif %} 27 | --name=$DOCKERNAME \ 28 | {%- if docker_container_name == "gbsyncd" %} 29 | -v /var/run/docker-syncd$DEV:/var/run/sswsyncd \ 30 | -------------------------------------------------------------------------------- /tests/inventory-vm.j2: -------------------------------------------------------------------------------- 1 | clusters: 2 | hosts: 3 | cluster1: 4 | ansible_user: {{ username }} 5 | ansible_ssh_pass: {{ password }} 6 | ansible_ssh_common_args: '-o StrictHostKeyChecking=no' 7 | ansible_become: yes 8 | ansible_become_method: sudo 9 | ansible_become_password: {{ password }} 10 | ansible_host: {{ host }} 11 | 12 | sonic_vm1_Loopback0: 20.0.4.1 13 | sonic_vm1_ethernet0: 20.0.1.1 14 | sonic_vm1_ethernet1: 20.0.3.1 15 | sonic_vm1_ethernet0_vxlan: 30.0.1.1 16 | sonic_vm1_ethernet1_vxlan: 40.0.1.1 17 | 18 | sonic_vm2_Loopback0: 20.0.4.2 19 | sonic_vm2_ethernet0: 20.0.2.1 20 | sonic_vm2_ethernet1: 20.0.3.2 21 | sonic_vm2_ethernet0_vxlan: 30.0.2.1 22 | sonic_vm2_ethernet1_vxlan: 40.0.2.1 23 | 24 | sonic_host_tap_1: 20.0.1.2 25 | sonic_host_tap_2: 20.0.2.2 26 | sonic_host_vxlan_t0_tap_1: 40.0.1.2 27 | sonic_host_vxlan_t0_tap_2: 40.0.2.2 28 | sonic_host_vxlan_tap1: 30.0.1.2 29 | sonic_host_vxlan_tap2: 30.0.2.2 30 | sonic_host_1_prefix: 20.0.1.0/24 31 | sonic_host_2_prefix: 20.0.2.0/24 32 | sonic_host_1_vxlan_t0_prefix: 40.0.1.0/24 33 | sonic_host_2_vxlan_t0_prefix: 40.0.2.0/24 34 | sonic_host_1_vxlan_prefix: 30.0.1.0/24 35 | sonic_host_2_vxlan_prefix: 30.0.2.0/24 36 | sonic_vpp_prefix: 20.0.3.0/24 37 | 38 | bgp_as: 65100 39 | sonic_vm_password: YourPaSsWoRd 40 | 41 | 42 | -------------------------------------------------------------------------------- /saivpp/src/SwitchStateBaseAcl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Cisco and/or its affiliates. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at: 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | #ifndef _SWITCHSTATEBASEACL_H_ 16 | #define _SWITCHSTATEBASEACL_H_ 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #define MAX_ACL_ATTRS 12 23 | 24 | typedef struct _acl_tbl_entries_ { 25 | uint32_t priority; 26 | 27 | sai_attribute_t attr_range; 28 | sai_object_id_t range_objid_list[2]; 29 | 30 | sai_u32_range_t range_limit[2]; 31 | sai_acl_range_type_t range_type[2]; 32 | uint32_t range_count; 33 | sai_attribute_t attrs[MAX_ACL_ATTRS]; 34 | uint32_t attrs_count; 35 | } acl_tbl_entries_t; 36 | 37 | typedef struct ordered_ace_list_ { 38 | uint32_t index; 39 | uint32_t priority; 40 | sai_object_id_t ace_oid; 41 | bool is_tunterm; 42 | } ordered_ace_list_t; 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /rules/libsaithrift-dev.dep: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #DPKG FRK 16 | SPATH := $($(LIBSAITHRIFT_DEV)_SRC_PATH) 17 | DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/libsaithrift-dev.mk $(PLATFORM_RULES)/libsaithrift-dev.dep 18 | DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) 19 | SMDEP_PATHS := $(SPATH) $(SPATH)/test/ptf $(SPATH)/test/saithrift/ctypesgen 20 | $(foreach path, $(SMDEP_PATHS), $(eval $(path) :=$(filter-out $(SMDEP_PATHS),$(addprefix $(path)/, $(shell cd $(path) && git ls-files | grep -Ev " " ))))) 21 | 22 | $(LIBSAITHRIFT_DEV)_CACHE_MODE := GIT_CONTENT_SHA 23 | $(LIBSAITHRIFT_DEV)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) 24 | $(LIBSAITHRIFT_DEV)_DEP_FILES := $(DEP_FILES) 25 | $(LIBSAITHRIFT_DEV)_SMDEP_FILES := $(foreach path, $(SMDEP_PATHS), $($(path))) 26 | $(LIBSAITHRIFT_DEV)_SMDEP_PATHS := $(SMDEP_PATHS) 27 | 28 | -------------------------------------------------------------------------------- /platform/mkrules/src/sonic-vppcfgd/setup.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 Cisco and/or its affiliates. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at: 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | import setuptools 15 | 16 | setuptools.setup( 17 | name = 'sonic-vppcfgd', 18 | version = '1.0', 19 | description = 'Utility to configure vpp startup config based on vpp cfg in config_db', 20 | author = 'Shashidhar Patil', 21 | author_email = 'shaship@cisco.com', 22 | url = 'https://github.com/sonic-net/sonic-platform-vpp', 23 | packages = setuptools.find_packages(), 24 | entry_points = { 25 | 'console_scripts': [ 26 | 'vppcfgd = vppcfgd.main:main', 27 | ] 28 | }, 29 | install_requires = [ 30 | 'jinja2>=2.10', 31 | 'pyyaml>=5.4.1', 32 | ], 33 | setup_requires = [ 34 | 'pytest-runner', 35 | 'wheel' 36 | ], 37 | tests_require = [ 38 | 'pytest', 39 | 'pytest-cov', 40 | 'sonic-config-engine' 41 | ] 42 | ) 43 | -------------------------------------------------------------------------------- /saivpp/src/EventQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "Event.h" 19 | #include "Signal.h" 20 | 21 | #include 22 | #include 23 | 24 | namespace saivpp 25 | { 26 | class EventQueue 27 | { 28 | public: 29 | 30 | EventQueue( 31 | _In_ std::shared_ptr signal); 32 | 33 | virtual ~EventQueue() = default; 34 | 35 | public: 36 | 37 | void enqueue( 38 | _In_ std::shared_ptr event); 39 | 40 | std::shared_ptr dequeue(); 41 | 42 | size_t size(); 43 | 44 | private: 45 | 46 | std::shared_ptr m_signal; 47 | 48 | std::mutex m_mutex; 49 | 50 | std::deque> m_queue; 51 | }; 52 | } 53 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/sentinels/instance.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/sentinels/instance.conf.j2 3 | ! 4 | neighbor {{ bgp_session['name'] }} peer-group 5 | neighbor {{ bgp_session['name'] }} remote-as {{ bgp_asn }} 6 | {% if bgp_session['src_address'] is defined %} 7 | neighbor {{ bgp_session['name'] }} update-source {{ bgp_session['src_address'] | ip }} 8 | {% endif %} 9 | {% for ip_range in bgp_session['ip_range'].split(',') %} 10 | bgp listen range {{ ip_range }} peer-group {{ bgp_session['name'] }} 11 | {% endfor %} 12 | ! 13 | address-family ipv4 14 | neighbor {{ bgp_session['name'] }} activate 15 | neighbor {{ bgp_session['name'] }} addpath-tx-all-paths 16 | neighbor {{ bgp_session['name'] }} soft-reconfiguration inbound 17 | neighbor {{ bgp_session['name'] }} route-map FROM_BGP_SENTINEL in 18 | neighbor {{ bgp_session['name'] }} route-map TO_BGP_SENTINEL out 19 | neighbor {{ bgp_session['name'] }} maximum-prefix 200 20 | exit-address-family 21 | address-family ipv6 22 | neighbor {{ bgp_session['name'] }} activate 23 | neighbor {{ bgp_session['name'] }} addpath-tx-all-paths 24 | neighbor {{ bgp_session['name'] }} soft-reconfiguration inbound 25 | neighbor {{ bgp_session['name'] }} route-map FROM_BGP_SENTINEL in 26 | neighbor {{ bgp_session['name'] }} route-map TO_BGP_SENTINEL out 27 | neighbor {{ bgp_session['name'] }} maximum-prefix 200 28 | exit-address-family 29 | ! 30 | ! end of template: bgpd/templates/sentinels/instance.conf.j2 31 | ! 32 | -------------------------------------------------------------------------------- /vppbld/plugins/tunterm_acl/tunterm_acl_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Cisco and/or its affiliates. 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at: 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | #ifndef __included_tunterm_acl_api_h__ 16 | #define __included_tunterm_acl_api_h__ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | typedef struct 27 | { 28 | /* API message ID base */ 29 | u16 msg_id_base; 30 | 31 | /* convenience */ 32 | vnet_main_t *vnet_main; 33 | 34 | u32 *classify_table_index_by_sw_if_index_v4; 35 | u32 *classify_table_index_by_sw_if_index_v6; 36 | bool *classify_table_index_is_v6; 37 | } tunterm_acl_main_t; 38 | 39 | extern tunterm_acl_main_t tunterm_acl_main; 40 | 41 | extern vlib_node_registration_t tunterm_acl_node; 42 | 43 | #define TUNTERM_ACL_PLUGIN_BUILD_VER "1.0" 44 | 45 | #endif /* __included_tunterm_acl_api_h__ */ 46 | -------------------------------------------------------------------------------- /saivpp/src/EventPayloadNotification.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "EventPayloadNotification.h" 17 | 18 | #include "swss/logger.h" 19 | 20 | using namespace saivpp; 21 | 22 | EventPayloadNotification::EventPayloadNotification( 23 | _In_ std::shared_ptr ntf, 24 | _In_ const sai_switch_notifications_t& switchNotifications): 25 | m_ntf(ntf), 26 | m_switchNotifications(switchNotifications) 27 | { 28 | SWSS_LOG_ENTER(); 29 | 30 | // empty 31 | } 32 | 33 | std::shared_ptr EventPayloadNotification::getNotification() const 34 | { 35 | SWSS_LOG_ENTER(); 36 | 37 | return m_ntf; 38 | } 39 | 40 | const sai_switch_notifications_t& EventPayloadNotification::getSwitchNotifications() const 41 | { 42 | SWSS_LOG_ENTER(); 43 | 44 | return m_switchNotifications; 45 | } 46 | -------------------------------------------------------------------------------- /saivpp/src/ContextConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "SwitchConfigContainer.h" 19 | 20 | namespace saivpp 21 | { 22 | class ContextConfig 23 | { 24 | public: 25 | 26 | ContextConfig( 27 | _In_ uint32_t guid, 28 | _In_ const std::string& name, 29 | _In_ const std::string& dbAsic); 30 | 31 | virtual ~ContextConfig(); 32 | 33 | public: 34 | 35 | void insert( 36 | _In_ std::shared_ptr config); 37 | 38 | 39 | public: // TODO to private 40 | 41 | uint32_t m_guid; 42 | 43 | std::string m_name; 44 | 45 | std::string m_dbAsic; // unit tests channel 46 | 47 | std::shared_ptr m_scc; 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /saivpp/src/MACsecIngressFilter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "MACsecIngressFilter.h" 17 | 18 | #include "swss/logger.h" 19 | 20 | #include 21 | #include 22 | 23 | using namespace saivpp; 24 | 25 | MACsecIngressFilter::MACsecIngressFilter( 26 | _In_ const std::string &macsecInterfaceName) : 27 | MACsecFilter(macsecInterfaceName) 28 | { 29 | SWSS_LOG_ENTER(); 30 | 31 | // empty intentionally 32 | } 33 | 34 | TrafficFilter::FilterStatus MACsecIngressFilter::forward( 35 | _In_ const void *buffer, 36 | _In_ size_t length) 37 | { 38 | SWSS_LOG_ENTER(); 39 | 40 | // MACsec interface will automatically forward ingress MACsec traffic 41 | // by Linux Kernel. 42 | // So this filter just need to drop all ingress MACsec traffic directly 43 | 44 | return TrafficFilter::TERMINATE; 45 | } 46 | -------------------------------------------------------------------------------- /saivpp/src/TrafficFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "swss/sal.h" 19 | 20 | #include 21 | 22 | namespace saivpp 23 | { 24 | typedef enum _FilterPriority 25 | { 26 | MACSEC_FILTER, 27 | 28 | } FilterPriority; 29 | 30 | class TrafficFilter 31 | { 32 | public: 33 | 34 | typedef enum _FilterStatus 35 | { 36 | CONTINUE, 37 | 38 | TERMINATE, 39 | 40 | ERROR, 41 | 42 | } FilterStatus; 43 | 44 | public: 45 | 46 | TrafficFilter() = default; 47 | 48 | virtual ~TrafficFilter() = default; 49 | 50 | public: 51 | 52 | virtual FilterStatus execute( 53 | _Inout_ void *buffer, 54 | _Inout_ size_t &length) = 0; 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/voq_chassis/instance.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/voq_chassis/instance.conf.j2 3 | ! 4 | bgp bestpath as-path multipath-relax 5 | bgp bestpath peer-type multipath-relax 6 | ! 7 | {% if neighbor_addr | ipv4 %} 8 | neighbor {{ neighbor_addr }} peer-group VOQ_CHASSIS_V4_PEER 9 | {% elif neighbor_addr | ipv6 %} 10 | neighbor {{ neighbor_addr }} peer-group VOQ_CHASSIS_V6_PEER 11 | {% endif %} 12 | neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }} 13 | neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }} 14 | neighbor {{ neighbor_addr }} timers 2 7 15 | neighbor {{ neighbor_addr }} timers connect 10 16 | ! 17 | {% if 'admin_status' in bgp_session and bgp_session['admin_status'] == 'down' or 'admin_status' not in bgp_session and 'default_bgp_status' in CONFIG_DB__DEVICE_METADATA['localhost'] and CONFIG_DB__DEVICE_METADATA['localhost']['default_bgp_status'] == 'down' %} 18 | neighbor {{ neighbor_addr }} shutdown 19 | {% endif %} 20 | ! 21 | address-family ipv4 22 | {% if constants.bgp.maximum_paths.enabled is defined and constants.bgp.maximum_paths.enabled %} 23 | maximum-paths ibgp {{ constants.bgp.maximum_paths.ipv4 | default(64) }} 24 | {% endif %} 25 | ! 26 | exit-address-family 27 | ! 28 | address-family ipv6 29 | {% if constants.bgp.maximum_paths.enabled is defined and constants.bgp.maximum_paths.enabled %} 30 | maximum-paths ibgp {{ constants.bgp.maximum_paths.ipv6 | default(64) }} 31 | {% endif %} 32 | ! 33 | exit-address-family 34 | ! 35 | ! end of template: bgpd/templates/voq_chassis/instance.conf.j2 36 | ! 37 | -------------------------------------------------------------------------------- /tests/misc/bgp/test_no_export.py: -------------------------------------------------------------------------------- 1 | from swsscommon import swsscommon 2 | import os 3 | import re 4 | import time 5 | import json 6 | 7 | def test_bounce(dvs, testlog): 8 | dvs.copy_file("/etc/frr/", "bgp/files/no_export/bgpd.conf") 9 | dvs.runcmd("supervisorctl start bgpd") 10 | dvs.runcmd("ip addr add 10.0.0.0/31 dev Ethernet0") 11 | dvs.runcmd("config interface startup Ethernet0") 12 | 13 | dvs.runcmd("ip addr add 10.0.0.2/31 dev Ethernet4") 14 | dvs.runcmd("config interface startup Ethernet4") 15 | 16 | dvs.servers[0].runcmd("ip addr add 10.0.0.1/31 dev eth0") 17 | dvs.servers[0].runcmd("ifconfig eth0 up") 18 | 19 | dvs.servers[1].runcmd("ip addr add 10.0.0.3/31 dev eth0") 20 | dvs.servers[1].runcmd("ifconfig eth0 up") 21 | 22 | time.sleep(5) 23 | 24 | p1 = dvs.servers[0].runcmd_async("exabgp -d bgp/files/no_export/exabgp1.conf") 25 | p2 = dvs.servers[1].runcmd_async("exabgp -d bgp/files/no_export/exabgp2.conf") 26 | 27 | time.sleep(60) 28 | 29 | (exit_code, sum_res) = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"]) 30 | (exit_code, all_route) = dvs.runcmd(["vtysh", "-c", "show ip bgp"]) 31 | (exit_code, announce_route) = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"]) 32 | 33 | p1.terminate() 34 | p1 = p1.wait() 35 | 36 | p2.terminate() 37 | p2 = p2.wait() 38 | 39 | print(sum_res) 40 | print(announce_route) 41 | assert "1.1.1.1/32" in all_route 42 | assert "1.1.1.1/32" not in announce_route 43 | assert "2.2.2.2/32" in all_route 44 | assert "2.2.2.2/32" in announce_route 45 | -------------------------------------------------------------------------------- /tests/misc/bgp/test_default_route.py: -------------------------------------------------------------------------------- 1 | from swsscommon import swsscommon 2 | import os 3 | import re 4 | import time 5 | import json 6 | import pytest 7 | 8 | def test_DefaultRoute(dvs, testlog): 9 | 10 | dvs.copy_file("/etc/frr/", "bgp/files/default_route/bgpd.conf") 11 | dvs.runcmd("supervisorctl start bgpd") 12 | dvs.runcmd("ip addr add 10.10.10.0/31 dev Ethernet0") 13 | dvs.runcmd("config interface startup Ethernet0") 14 | dvs.runcmd("ip route del 0.0.0.0/0") 15 | dvs.runcmd("vtysh -c \"confgure terminal\" -c \"ip route 0.0.0.0/0 via 172.17.0.1 200\"") 16 | 17 | dvs.servers[0].runcmd("ip addr add 10.10.10.1/31 dev eth0") 18 | dvs.servers[0].runcmd("ifconfig eth0 up") 19 | 20 | time.sleep(5) 21 | 22 | print(dvs.runcmd("supervisorctl status")) 23 | 24 | p = dvs.servers[0].runcmd_async("exabgp -d bgp/files/default_route/default_route.conf") 25 | 26 | time.sleep(10) 27 | 28 | (exit_code, output) = dvs.runcmd(["redis-cli", "hgetall", "ROUTE_TABLE:0.0.0.0/0"]) 29 | print(exit_code, output) 30 | 31 | # make sure 10.10.10.1 is the correct next hop for default route 32 | assert "10.10.10.1" in output 33 | 34 | # insert default route for table default 35 | dvs.runcmd("ip route add default via 172.17.0.1 table default") 36 | 37 | (exit_code, output) = dvs.runcmd(["redis-cli", "hgetall", "ROUTE_TABLE:0.0.0.0/0"]) 38 | print(exit_code, output) 39 | 40 | time.sleep(10) 41 | # make sure 10.10.10.1 is still the correct next hop for default route 42 | assert "10.10.10.1" in output 43 | 44 | p.terminate() 45 | p = p.wait() 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /saivpp/src/ResourceLimiterContainer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "ResourceLimiter.h" 19 | 20 | #include 21 | 22 | namespace saivpp 23 | { 24 | class ResourceLimiterContainer 25 | { 26 | public: 27 | 28 | ResourceLimiterContainer() = default; 29 | 30 | virtual ~ResourceLimiterContainer() = default; 31 | 32 | public: 33 | 34 | void insert( 35 | _In_ uint32_t switchIndex, 36 | _In_ std::shared_ptr rl); 37 | 38 | void remove( 39 | _In_ uint32_t switchIndex); 40 | 41 | std::shared_ptr getResourceLimiter( 42 | _In_ uint32_t switchIndex) const; 43 | 44 | void clear(); 45 | 46 | private: 47 | 48 | std::map> m_container; 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /tests/inventory.j2: -------------------------------------------------------------------------------- 1 | clusters: 2 | hosts: 3 | cluster1: 4 | ansible_user: {{ username }} 5 | ansible_ssh_pass: {{ password }} 6 | ansible_ssh_common_args: '-o StrictHostKeyChecking=no' 7 | ansible_become: yes 8 | ansible_become_method: sudo 9 | ansible_become_password: {{ password }} 10 | ansible_host: {{ host }} 11 | 12 | host_1_0_prefix: {{ subnet }}.1.0/24 13 | host_1_0_ip1: {{ subnet }}.1.2 14 | host_1_0_route_1: {{ subnet }}.2.0 15 | host_1_0_gw1: {{ subnet }}.1.1 16 | 17 | host_1_0_ipv6_1: {{ ipv6_subnet }}:85a3::0370:7334 18 | host_1_0_route_v6_1: {{ ipv6_subnet }}:85a4::0370:7335 19 | host_1_0_gw_v6_1: {{ ipv6_subnet }}:85a3::0370:7335 20 | 21 | host_2_0_prefix: {{ subnet }}.2.0/24 22 | host_2_0_ip1: {{ subnet }}.2.2 23 | host_2_0_route1: {{ subnet }}.1.0 24 | host_2_0_gw1: {{ subnet }}.2.1 25 | 26 | host_2_0_ipv6_1: {{ ipv6_subnet }}:85a4::0370:7335 27 | host_2_0_route_v6_1: {{ ipv6_subnet }}:85a3::0370:7334 28 | host_2_0_gw_v6_1: {{ ipv6_subnet }}:85a4::0370:7334 29 | 30 | sonic_vpp1_3_0: {{ subnet }}.3.1 31 | sonic_vpp1_gw: {{ subnet }}.3.2 32 | 33 | sonic_vpp1_Loopback0: {{ subnet }}.4.1 34 | sonic_vpp2_Loopback0: {{ subnet }}.4.2 35 | 36 | bgp_as: 65100 37 | no_linux_nl: {{ no_linux_nl }} 38 | 39 | host_1_0_ip: {{ subnet }}.1.1 40 | host_2_0_ip: {{ subnet }}.2.1 41 | host_3_0_ip: {{ subnet }}.3.1 42 | host_4_0_ip: {{ subnet }}.1.2 43 | host_5_0_ip: {{ subnet }}.2.2 44 | host_6_0_ip: {{ subnet }}.3.2 45 | 46 | -------------------------------------------------------------------------------- /docker-sonic-vpp/zero_profiles.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "BUFFER_POOL_TABLE:ingress_zero_pool": { 4 | "mode": "static", 5 | "type": "ingress", 6 | "size": "0" 7 | }, 8 | "OP": "SET" 9 | }, 10 | { 11 | "BUFFER_PROFILE_TABLE:ingress_lossy_pg_zero_profile" : { 12 | "pool":"ingress_zero_pool", 13 | "size":"0", 14 | "static_th":"0" 15 | }, 16 | "OP": "SET" 17 | }, 18 | { 19 | "BUFFER_PROFILE_TABLE:ingress_lossy_zero_profile" : { 20 | "pool":"ingress_lossless_pool", 21 | "size":"0", 22 | "dynamic_th":"-8" 23 | }, 24 | "OP": "SET" 25 | }, 26 | { 27 | "BUFFER_PROFILE_TABLE:ingress_lossless_zero_profile" : { 28 | "pool":"ingress_lossless_pool", 29 | "size":"0", 30 | "dynamic_th":"-8" 31 | }, 32 | "OP": "SET" 33 | }, 34 | { 35 | "BUFFER_PROFILE_TABLE:egress_lossy_zero_profile" : { 36 | "pool":"egress_lossy_pool", 37 | "size":"0", 38 | "dynamic_th":"-8" 39 | }, 40 | "OP": "SET" 41 | }, 42 | { 43 | "BUFFER_PROFILE_TABLE:egress_lossless_zero_profile" : { 44 | "pool":"egress_lossless_pool", 45 | "size":"0", 46 | "static_th":"0" 47 | }, 48 | "OP": "SET" 49 | }, 50 | { 51 | "control_fields" : { 52 | "pgs_to_apply_zero_profile":"0", 53 | "ingress_zero_profile":"ingress_lossy_pg_zero_profile" 54 | }, 55 | "OP": "SET" 56 | } 57 | ] 58 | -------------------------------------------------------------------------------- /saivpp/src/Event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "EventPayload.h" 19 | 20 | #include "swss/sal.h" 21 | 22 | #include 23 | 24 | namespace saivpp 25 | { 26 | typedef enum _EventType 27 | { 28 | EVENT_TYPE_END_THREAD, 29 | 30 | EVENT_TYPE_NET_LINK_MSG, 31 | 32 | EVENT_TYPE_PACKET, 33 | 34 | EVENT_TYPE_NOTIFICATION, 35 | 36 | } EventType; 37 | 38 | class Event 39 | { 40 | public: 41 | 42 | Event( 43 | _In_ EventType eventType, 44 | _In_ std::shared_ptr payload); 45 | 46 | virtual ~Event() = default; 47 | 48 | public: 49 | 50 | EventType getType() const; 51 | 52 | std::shared_ptr getPayload() const; 53 | 54 | private: 55 | 56 | EventType m_eventType; 57 | 58 | std::shared_ptr m_payload; 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /saivpp/src/TrafficForwarder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "swss/sal.h" 19 | 20 | #include 21 | #include 22 | 23 | namespace saivpp 24 | { 25 | static constexpr size_t ETH_FRAME_BUFFER_SIZE = 0x4000; 26 | static constexpr size_t CONTROL_MESSAGE_BUFFER_SIZE = 0x1000; 27 | 28 | class TrafficForwarder 29 | { 30 | public: 31 | 32 | virtual ~TrafficForwarder() = default; 33 | 34 | protected: 35 | 36 | TrafficForwarder() = default; 37 | 38 | public: 39 | 40 | static bool addVlanTag( 41 | _Inout_ unsigned char *buffer, 42 | _Inout_ size_t &length, 43 | _Inout_ struct msghdr &msg); 44 | 45 | virtual bool sendTo( 46 | _In_ int fd, 47 | _In_ const unsigned char *buffer, 48 | _In_ size_t length) const; 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /docs/HLD/vpp-acl.md: -------------------------------------------------------------------------------- 1 | # SONiC-VPP saivpp ACL provisioning 2 | 3 | ## ACL configuration in SONiC 4 | The ACL configuration requires first to create a table using ACL cli and update the ACL with rules. The ACL rules are supposed to be in a file in SONiC json format. 5 | 6 | Create an ACL and bind it to a port 7 | ``` 8 | config acl add table TEST_IPV4 L3 -p Ethernet0 -s ingress 9 | ``` 10 | The above command triggers a flurry of ACL related objects getting created in orchagent and then passed to syncd via SAI API. These SAI API objects represent the ACL in forward engine. 11 | 12 | - ACL_TABLE 13 | - ACL_TABLE_ENTRY 14 | - TABLE_GROUP 15 | - TABLE_GROUP_MEMBER 16 | - PORT 17 | 18 | ACL_TABLE represents broader ACL and one or more ACL_TABLE_ENTRY objects point to ACL_TABLE. 19 | There is an indirection to ACL_TABLE from one of the TABLE_GROUP_MEMBER. Now PORT object does not refer directly to either ACL_TABLE or ACL_GROUP_MEMBER, instead PORT object has binding with TABLE_GROUP. The TABLE_GROUP in turn has GROU_MEMBERs pointing back. 20 | 21 | This object relation model makes it little difficult to implement the binding of ACL to a PORT. The relation of these objects are detailed in the figure below. This is the reason for multiple maps being used to track and configure ACL in saivpp layer. 22 | 23 | SONIC-VPP SAI ACL Objects 24 | 25 | ## VPP ACL support 26 | VPP supports MAC, IPv4, IPv6 ACLs. One set of APIs for configuring ACLs and other set for binding the created ACLs to an interface. 27 | VPP return an ACL index for an ACL configured in VPP. This ACL index should be used for future updates(replace or delete). 28 | 29 | -------------------------------------------------------------------------------- /saivpp/src/EventPayloadNotification.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | extern "C"{ 19 | #include "saimetadata.h" 20 | } 21 | 22 | #include "EventPayload.h" 23 | 24 | #include "Notification.h" 25 | 26 | namespace saivpp 27 | { 28 | class EventPayloadNotification: 29 | public EventPayload 30 | { 31 | public: 32 | 33 | EventPayloadNotification( 34 | _In_ std::shared_ptr ntf, 35 | _In_ const sai_switch_notifications_t& switchNotifications); 36 | 37 | virtual ~EventPayloadNotification() = default; 38 | 39 | public: 40 | 41 | std::shared_ptr getNotification() const; 42 | 43 | const sai_switch_notifications_t& getSwitchNotifications() const; 44 | 45 | private: 46 | 47 | std::shared_ptr m_ntf; 48 | 49 | sai_switch_notifications_t m_switchNotifications; 50 | }; 51 | } 52 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/dynamic/instance.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/dynamic/instance.conf.j2 3 | ! 4 | {% from "common/functions.conf.j2" import get_ipv4_loopback_address %} 5 | ! 6 | neighbor {{ bgp_session['name'] }} peer-group 7 | neighbor {{ bgp_session['name'] }} passive 8 | neighbor {{ bgp_session['name'] }} ebgp-multihop 255 9 | neighbor {{ bgp_session['name'] }} soft-reconfiguration inbound 10 | neighbor {{ bgp_session['name'] }} route-map FROM_BGP_SPEAKER in 11 | neighbor {{ bgp_session['name'] }} route-map TO_BGP_SPEAKER out 12 | ! 13 | {% if bgp_session['peer_asn'] is defined %} 14 | neighbor {{ bgp_session['name'] }} remote-as {{ bgp_session['peer_asn'] }} 15 | {% else %} 16 | neighbor {{ bgp_session['name'] }} remote-as {{ constants.deployment_id_asn_map[CONFIG_DB__DEVICE_METADATA['localhost']['deployment_id']] }} 17 | {% endif %} 18 | ! 19 | {# FIXME: bgp_session['ip_range'] check the type #} 20 | {% for ip_range in bgp_session['ip_range'].split(',') %} 21 | bgp listen range {{ ip_range }} peer-group {{ bgp_session['name'] }} 22 | {% endfor %} 23 | ! 24 | {% if bgp_session['src_address'] is defined %} 25 | neighbor {{ bgp_session['name'] }} update-source {{ bgp_session['src_address'] | ip }} 26 | {% else %} 27 | neighbor {{ bgp_session['name'] }} update-source {{ get_ipv4_loopback_address(CONFIG_DB__LOOPBACK_INTERFACE, "Loopback1") | ip }} 28 | {% endif %} 29 | ! 30 | address-family ipv4 31 | neighbor {{ bgp_session['name'] }} activate 32 | exit-address-family 33 | address-family ipv6 34 | neighbor {{ bgp_session['name'] }} activate 35 | exit-address-family 36 | ! 37 | ! end of template: bgpd/templates/dynamic/instance.conf.j2 38 | ! 39 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/voq_chassis/policies.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/voq_chassis/policies.conf.j2 3 | ! 4 | bgp community-list standard DEVICE_INTERNAL_COMMUNITY permit {{ constants.bgp.internal_community }} 5 | bgp community-list standard NO_EXPORT permit no-export 6 | ! 7 | route-map FROM_VOQ_CHASSIS_V4_PEER permit 1 8 | match community DEVICE_INTERNAL_COMMUNITY 9 | set comm-list DEVICE_INTERNAL_COMMUNITY delete 10 | set tag {{ constants.bgp.internal_community_match_tag }} 11 | ! 12 | route-map FROM_VOQ_CHASSIS_V4_PEER permit 2 13 | match community NO_EXPORT 14 | set local-preference 80 15 | ! 16 | route-map FROM_VOQ_CHASSIS_V4_PEER permit 100 17 | ! 18 | route-map TO_VOQ_CHASSIS_V4_PEER permit 1 19 | match ip address prefix-list PL_LoopbackV4 20 | set community {{ constants.bgp.internal_community }} 21 | ! 22 | route-map TO_VOQ_CHASSIS_V4_PEER permit 100 23 | ! 24 | ! 25 | route-map FROM_VOQ_CHASSIS_V6_PEER permit 1 26 | set ipv6 next-hop prefer-global 27 | on-match next 28 | ! 29 | route-map FROM_VOQ_CHASSIS_V6_PEER permit 2 30 | match community DEVICE_INTERNAL_COMMUNITY 31 | set comm-list DEVICE_INTERNAL_COMMUNITY delete 32 | set tag {{ constants.bgp.internal_community_match_tag }} 33 | ! 34 | route-map FROM_VOQ_CHASSIS_V6_PEER permit 3 35 | match community NO_EXPORT 36 | set local-preference 80 37 | ! 38 | route-map FROM_VOQ_CHASSIS_V6_PEER permit 100 39 | ! 40 | route-map TO_VOQ_CHASSIS_V6_PEER permit 1 41 | match ipv6 address prefix-list PL_LoopbackV6 42 | set community {{ constants.bgp.internal_community }} 43 | ! 44 | route-map TO_VOQ_CHASSIS_V6_PEER permit 100 45 | ! 46 | ! end of template: bgpd/templates/voq_chassis/policies.conf.j2 47 | ! 48 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/TS: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | switch_type=`sonic-cfggen -d -v "DEVICE_METADATA['localhost']['switch_type']"` 4 | # Check whether the routemap is for internal BGP sessions. 5 | function is_internal_route_map() 6 | { 7 | [[ "$1" =~ .*"_INTERNAL_".* && $switch_type != "chassis-packet" ]] 8 | } 9 | 10 | function check_not_installed() 11 | { 12 | c=0 13 | config=$(vtysh -c "show run") 14 | for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6' | uniq); 15 | do 16 | is_internal_route_map $route_map_name && continue 17 | echo "$config" | egrep -q "^route-map $route_map_name permit 20$" 18 | c=$((c+$?)) 19 | echo "$config" | egrep -q "^route-map $route_map_name deny 30$" 20 | c=$((c+$?)) 21 | done 22 | return $c 23 | } 24 | 25 | function check_installed() 26 | { 27 | c=0 28 | e=0 29 | config=$(vtysh -c "show run") 30 | for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6' | uniq); 31 | do 32 | is_internal_route_map $route_map_name && continue 33 | echo "$config" | egrep -q "^route-map $route_map_name permit 20$" 34 | c=$((c+$?)) 35 | e=$((e+1)) 36 | echo "$config" | egrep -q "^route-map $route_map_name deny 30$" 37 | c=$((c+$?)) 38 | e=$((e+1)) 39 | done 40 | return $((e-c)) 41 | } 42 | 43 | function find_num_routemap() 44 | { 45 | c=0 46 | config=$(vtysh -c "show run") 47 | for route_map_name in $(echo "$config" | sed -ne 's/ neighbor \S* route-map \(\S*\) out/\1/p' | egrep 'V4|V6' | uniq); 48 | do 49 | is_internal_route_map $route_map_name && continue 50 | c=$((c+1)) 51 | done 52 | return $c 53 | } 54 | -------------------------------------------------------------------------------- /saivpp/src/LaneMapContainer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "LaneMap.h" 19 | 20 | #include 21 | #include 22 | 23 | namespace saivpp 24 | { 25 | class LaneMapContainer 26 | { 27 | public: 28 | 29 | LaneMapContainer() = default; 30 | 31 | virtual ~LaneMapContainer() = default; 32 | 33 | public: 34 | 35 | bool insert( 36 | _In_ std::shared_ptr laneMap); 37 | 38 | bool remove( 39 | _In_ uint32_t switchIndex); 40 | 41 | std::shared_ptr getLaneMap( 42 | _In_ uint32_t switchIndex) const; 43 | 44 | void clear(); 45 | 46 | bool hasLaneMap( 47 | _In_ uint32_t switchIndex) const; 48 | 49 | size_t size() const; 50 | 51 | void removeEmptyLaneMaps(); 52 | 53 | private: 54 | 55 | std::map> m_map; 56 | }; 57 | } 58 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## How to contribute 2 | 3 | Contributions are welcome. 4 | 5 | You have to build and install SONiC-VPP as explained in the [README.md](https://wwwin-github.cisco.com/shaship/sonic-platform-vpp/README.md) before raising feature requests or issues. 6 | 7 | Please explain what functionality you like to add and why. Create an issue and discuss possible approaches there. 8 | Pull requests can be then connected with such issues. 9 | 10 | Please follow the [SONiC contribution](https://github.com/sonic-net/SONiC/blob/master/CONTRIBUTING.md) guidelines. 11 | 12 | ## Reporting issues 13 | 14 | ### Bugs 15 | 16 | Please get and install the current development code, and check that the bug still exists before 17 | submitting an issue. 18 | 19 | If you're not sure whether a behavior is a bug or not, submit an issue 20 | and ask in [issue tracker](https://wwwin-github.cisco.com/shaship/sonic-platform-vpp/issues). 21 | 22 | ### Enhancements / feature requests 23 | 24 | If you want a feature in SONiC-VPP please open an [issue](https://wwwin-github.cisco.com/shaship/sonic-platform-vpp/issues) and include 25 | "enhancement" in the title. 26 | 27 | Explain the design elements, APIs, flow of functionality, interaction with existing modules etc. 28 | A simple diagram to exaplin the design may help. 29 | 30 | ### Tests 31 | 32 | Please consider adding tests for your new features or that trigger the 33 | bug you are fixing. This will prevent a regression from being 34 | unnoticed. 35 | 36 | 37 | ### Code review 38 | 39 | Please be patient with code review process. Developers may take more time some 40 | times because of various reasons. The review comments are given in accordance with 41 | design goals of the project. 42 | 43 | -------------------------------------------------------------------------------- /docker-sonic-vpp/frr/frr/bgpd/templates/internal/peer-group.conf.j2: -------------------------------------------------------------------------------- 1 | ! 2 | ! template: bgpd/templates/internal/peer-group.conf.j2 3 | ! 4 | neighbor INTERNAL_PEER_V4 peer-group 5 | neighbor INTERNAL_PEER_V6 peer-group 6 | {% if CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} 7 | neighbor INTERNAL_PEER_V4 update-source Loopback4096 8 | {% endif %} 9 | address-family ipv4 10 | {% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} 11 | neighbor INTERNAL_PEER_V4 route-reflector-client 12 | {% endif %} 13 | neighbor INTERNAL_PEER_V4 soft-reconfiguration inbound 14 | neighbor INTERNAL_PEER_V4 allowas-in 1 15 | neighbor INTERNAL_PEER_V4 route-map FROM_BGP_INTERNAL_PEER_V4 in 16 | neighbor INTERNAL_PEER_V4 route-map TO_BGP_INTERNAL_PEER_V4 out 17 | neighbor INTERNAL_PEER_V4 send-community 18 | neighbor INTERNAL_PEER_V4 ttl-security hops 1 19 | exit-address-family 20 | {% if CONFIG_DB__DEVICE_METADATA['localhost']['switch_type'] == 'chassis-packet' %} 21 | neighbor INTERNAL_PEER_V6 update-source Loopback4096 22 | {% endif %} 23 | address-family ipv6 24 | {% if CONFIG_DB__DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %} 25 | neighbor INTERNAL_PEER_V6 route-reflector-client 26 | {% endif %} 27 | neighbor INTERNAL_PEER_V6 soft-reconfiguration inbound 28 | neighbor INTERNAL_PEER_V6 allowas-in 1 29 | neighbor INTERNAL_PEER_V6 route-map FROM_BGP_INTERNAL_PEER_V6 in 30 | neighbor INTERNAL_PEER_V6 route-map TO_BGP_INTERNAL_PEER_V6 out 31 | neighbor INTERNAL_PEER_V6 send-community 32 | neighbor INTERNAL_PEER_V6 ttl-security hops 1 33 | exit-address-family 34 | ! 35 | ! end of template: bgpd/templates/internal/peer-group.conf.j2 36 | ! 37 | -------------------------------------------------------------------------------- /platform/mkrules/files/build_templates/per_namespace/syncd.service.j2.patch: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 Cisco and/or its affiliates. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at: 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | diff --git a/files/build_templates/per_namespace/syncd.service.j2 b/files/build_templates/per_namespace/syncd.service.j2 15 | index 842eaebc7..edd48c9f9 100644 16 | --- a/files/build_templates/per_namespace/syncd.service.j2 17 | +++ b/files/build_templates/per_namespace/syncd.service.j2 18 | @@ -27,9 +27,15 @@ After=nv-syncd-shared.service 19 | [Service] 20 | User=root 21 | Environment=sonic_asic_platform={{ sonic_asic_platform }} 22 | +{% if sonic_asic_platform == 'vpp' %} 23 | +ExecStartPre=/usr/local/bin/vpp_ports_setup.sh start 24 | +{% endif %} 25 | ExecStartPre=/usr/local/bin/syncd.sh start{% if multi_instance == 'true' %} %i{% endif %} 26 | ExecStart=/usr/local/bin/syncd.sh wait{% if multi_instance == 'true' %} %i{% endif %} 27 | ExecStop=/usr/local/bin/syncd.sh stop{% if multi_instance == 'true' %} %i{% endif %} 28 | +{% if sonic_asic_platform == 'vpp' %} 29 | +ExecStopPost=/usr/local/bin/vpp_ports_setup.sh stop 30 | +{% endif %} 31 | {% if sonic_asic_platform == 'mellanox' %} 32 | TimeoutStartSec=480 33 | {% endif %} 34 | -------------------------------------------------------------------------------- /saivpp/src/vppxlate/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023 Cisco and/or its affiliates. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at: 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | VPP_LIBS = -lvapiclient 15 | VPP_LIBS += -lvppapiclient 16 | VPP_LIBS += -lvlibmemoryclient 17 | VPP_LIBS += -lsvm 18 | VPP_LIBS += -lvppinfra 19 | VPP_LIBS += -lvlib 20 | VPP_LIBS += -lvatplugin 21 | 22 | SaiVppXlate.o: SaiVppXlate.c 23 | $(CC) -g -I/usr/include/vpp_plugins $(AM_CXXFLAGS) -fPIC -o$@ -c SaiVppXlate.c 24 | 25 | SaiVppStats.o: SaiVppStats.c SaiVppStats.h 26 | $(CC) -g -fPIC -o$@ -c SaiVppStats.c 27 | 28 | SaiIntfStats.o: SaiIntfStats.c SaiVppStats.h SaiIntfStats.h 29 | $(CC) -g -fPIC -o$@ -c SaiIntfStats.c 30 | 31 | SaiAclStats.o: SaiAclStats.c SaiVppStats.h SaiAclStats.h 32 | $(CC) -g -fPIC -o$@ -c SaiAclStats.c 33 | 34 | libvppxlate.a: SaiVppXlate.o SaiVppStats.o SaiIntfStats.o SaiAclStats.o 35 | ar rc $@ SaiVppXlate.o SaiVppStats.o SaiIntfStats.o SaiAclStats.o 36 | 37 | vppst: SaiIntfStats.c SaiVppStats.c 38 | $(CC) -DMAIN -g -o$@ $(VPP_LIBS) SaiVppStats.c SaiIntfStats.c 39 | 40 | all: libvppxlate.a 41 | 42 | .PHONY: install clean 43 | 44 | install: 45 | 46 | clean: 47 | rm -f *.o libvppxlate.a 48 | -------------------------------------------------------------------------------- /scripts/telemetry_cert.gen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) 2023 Cisco and/or its affiliates. 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at: 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | mkdir -p /etc/sonic/telemetry 17 | cd /etc/sonic/telemetry 18 | 19 | openssl genrsa -out dsmsroot.key 20 | 21 | openssl req -x509 -subj "/C=IN/CN=sonic-telemetry-ca" -key dsmsroot.key -out dsmsroot.cer -days 1000 22 | 23 | openssl genrsa -out streamingtelemetryserver.key 24 | 25 | DNS_NAME=${DNS_NAME:="telemetry-sonic.cisco.com"} 26 | 27 | openssl req -new -subj "/C=IN/CN=telemetry-sonic" -addext "certificatePolicies = 1.2.3.4" -key streamingtelemetryserver.key -out req.pem 28 | 29 | cat > ssl.cnf <> ssl.cnf 42 | 43 | openssl x509 -req -in req.pem -CA dsmsroot.cer -CAkey dsmsroot.key -CAcreateserial -extfile ./ssl.cnf -extensions v3_req -out streamingtelemetryserver.cer -days 365 44 | 45 | -------------------------------------------------------------------------------- /saivpp/src/EventPayloadPacket.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "EventPayloadPacket.h" 17 | 18 | #include "swss/logger.h" 19 | 20 | using namespace saivpp; 21 | 22 | EventPayloadPacket::EventPayloadPacket( 23 | _In_ sai_object_id_t port, 24 | _In_ int ifIndex, 25 | _In_ const std::string& ifName, 26 | _In_ const Buffer& buffer): 27 | m_port(port), 28 | m_ifIndex(ifIndex), 29 | m_ifName(ifName), 30 | m_buffer(buffer) 31 | { 32 | SWSS_LOG_ENTER(); 33 | 34 | // empty 35 | } 36 | 37 | sai_object_id_t EventPayloadPacket::getPort() const 38 | { 39 | SWSS_LOG_ENTER(); 40 | 41 | return m_port; 42 | } 43 | 44 | 45 | int EventPayloadPacket::getIfIndex() const 46 | { 47 | SWSS_LOG_ENTER(); 48 | 49 | return m_ifIndex; 50 | } 51 | 52 | const std::string& EventPayloadPacket::getIfName() const 53 | { 54 | SWSS_LOG_ENTER(); 55 | 56 | return m_ifName; 57 | } 58 | 59 | const Buffer& EventPayloadPacket::getBuffer() const 60 | { 61 | SWSS_LOG_ENTER(); 62 | 63 | return m_buffer; 64 | } 65 | -------------------------------------------------------------------------------- /platform/mkrules/rules/swss.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # swss package 16 | 17 | SWSS = swss_1.0.0_$(CONFIGURED_ARCH).deb 18 | $(SWSS)_SRC_PATH = $(SRC_PATH)/sonic-swss 19 | $(SWSS)_DEPENDS += $(LIBSAIREDIS_DEV) $(LIBSAIMETADATA_DEV) $(LIBTEAM_DEV) \ 20 | $(LIBTEAMDCTL) $(LIBTEAM_UTILS) $(LIBSWSSCOMMON_DEV) \ 21 | $(LIBSAIVPP) $(LIBSAIVPP_DEV) \ 22 | $(PROTOBUF) $(PROTOBUF_LITE) $(PROTOBUF_DEV) $(LIB_SONIC_DASH_API) 23 | 24 | $(SWSS)_UNINSTALLS = $(LIBSAIVPP_DEV) 25 | 26 | $(SWSS)_RDEPENDS += $(LIBSAIREDIS) $(LIBSAIMETADATA) $(LIBTEAM) \ 27 | $(LIBTEAMDCTL) $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON) \ 28 | $(PROTOBUF) $(PROTOBUF_LITE) $(PYTHON3_PROTOBUF) $(LIB_SONIC_DASH_API) 29 | SONIC_DPKG_DEBS += $(SWSS) 30 | 31 | SWSS_DBG = swss-dbg_1.0.0_$(CONFIGURED_ARCH).deb 32 | $(SWSS_DBG)_DEPENDS += $(SWSS) 33 | $(SWSS_DBG)_RDEPENDS += $(SWSS) 34 | $(eval $(call add_derived_package,$(SWSS),$(SWSS_DBG))) 35 | 36 | # The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list} 37 | # are archived into debug one image to facilitate debugging. 38 | # 39 | DBG_SRC_ARCHIVE += sonic-swss 40 | 41 | -------------------------------------------------------------------------------- /saivpp/src/TrafficFilterPipes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "TrafficFilter.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace saivpp 25 | { 26 | class TrafficFilterPipes 27 | { 28 | public: 29 | 30 | TrafficFilterPipes() = default; 31 | 32 | virtual ~TrafficFilterPipes() = default; 33 | 34 | public: 35 | 36 | bool installFilter( 37 | _In_ int priority, 38 | _In_ std::shared_ptr filter); 39 | 40 | bool uninstallFilter( 41 | _In_ std::shared_ptr filter); 42 | 43 | TrafficFilter::FilterStatus execute( 44 | _Inout_ void *buffer, 45 | _Inout_ size_t &length); 46 | 47 | private: 48 | 49 | typedef std::map > FilterPriorityQueue; 50 | 51 | std::mutex m_mutex; 52 | 53 | FilterPriorityQueue m_filters; 54 | }; 55 | } 56 | -------------------------------------------------------------------------------- /saivpp/src/SwitchConfigContainer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "SwitchConfig.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace saivpp 25 | { 26 | class SwitchConfigContainer 27 | { 28 | public: 29 | 30 | SwitchConfigContainer() = default; 31 | 32 | virtual ~SwitchConfigContainer() = default; 33 | 34 | public: 35 | 36 | void insert( 37 | _In_ std::shared_ptr config); 38 | 39 | std::shared_ptr getConfig( 40 | _In_ uint32_t switchIndex) const; 41 | 42 | std::shared_ptr getConfig( 43 | _In_ const std::string& hardwareInfo) const; 44 | 45 | std::set> getSwitchConfigs() const; 46 | 47 | private: 48 | 49 | std::map> m_indexToConfig; 50 | 51 | std::map> m_hwinfoToConfig; 52 | }; 53 | } 54 | -------------------------------------------------------------------------------- /saivpp/src/EventPayloadPacket.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | extern "C" { 19 | #include "sai.h" 20 | } 21 | 22 | #include "EventPayload.h" 23 | #include "Buffer.h" 24 | 25 | #include 26 | 27 | namespace saivpp 28 | { 29 | class EventPayloadPacket: 30 | public EventPayload 31 | { 32 | public: 33 | 34 | EventPayloadPacket( 35 | _In_ sai_object_id_t port, 36 | _In_ int ifIndex, 37 | _In_ const std::string& ifName, 38 | _In_ const Buffer& buffer); 39 | 40 | virtual ~EventPayloadPacket() = default; 41 | 42 | public: 43 | 44 | sai_object_id_t getPort() const; 45 | 46 | int getIfIndex() const; 47 | 48 | const std::string& getIfName() const; 49 | 50 | const Buffer& getBuffer() const; 51 | 52 | private: 53 | 54 | sai_object_id_t m_port; 55 | 56 | int m_ifIndex; 57 | 58 | std::string m_ifName; 59 | 60 | Buffer m_buffer; 61 | }; 62 | } 63 | -------------------------------------------------------------------------------- /saivpp/src/ResourceLimiter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | extern "C" { 19 | #include "sai.h" 20 | } 21 | 22 | #include 23 | 24 | namespace saivpp 25 | { 26 | class ResourceLimiter 27 | { 28 | public: 29 | 30 | constexpr static uint32_t DEFAULT_SWITCH_INDEX = 0; 31 | 32 | public: 33 | 34 | ResourceLimiter( 35 | _In_ uint32_t switchIndex); 36 | 37 | virtual ~ResourceLimiter() = default; 38 | 39 | public: 40 | 41 | size_t getObjectTypeLimit( 42 | _In_ sai_object_type_t objectType) const; 43 | 44 | void setObjectTypeLimit( 45 | _In_ sai_object_type_t objectType, 46 | _In_ size_t limit); 47 | 48 | void removeObjectTypeLimit( 49 | _In_ sai_object_type_t objectType); 50 | 51 | void clearLimits(); 52 | 53 | private: 54 | 55 | uint32_t m_switchIndex; 56 | 57 | std::map m_objectTypeLimits; 58 | }; 59 | } 60 | -------------------------------------------------------------------------------- /saivpp/src/MACsecForwarder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "HostInterfaceInfo.h" 19 | #include "TrafficForwarder.h" 20 | 21 | #include "swss/sal.h" 22 | #include "swss/selectableevent.h" 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace saivpp 29 | { 30 | class MACsecForwarder : 31 | public TrafficForwarder 32 | { 33 | public: 34 | 35 | MACsecForwarder( 36 | _In_ const std::string &macsecInterfaceName, 37 | _In_ std::shared_ptr info); 38 | 39 | virtual ~MACsecForwarder(); 40 | 41 | int get_macsecfd() const; 42 | 43 | void forward(); 44 | 45 | private: 46 | 47 | int m_macsecfd; 48 | 49 | const std::string m_macsecInterfaceName; 50 | 51 | bool m_runThread; 52 | 53 | swss::SelectableEvent m_exitEvent; 54 | 55 | std::shared_ptr m_forwardThread; 56 | 57 | std::shared_ptr m_info; 58 | }; 59 | } 60 | -------------------------------------------------------------------------------- /rules/libsaithrift-dev.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # libsaithrift-dev package 16 | 17 | SAI_VER = 0.9.4 18 | 19 | LIBSAITHRIFT_DEV = libsaithrift-dev_$(SAI_VER)_$(CONFIGURED_ARCH).deb 20 | $(LIBSAITHRIFT_DEV)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI 21 | $(LIBSAITHRIFT_DEV)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(PYTHON_THRIFT) $(THRIFT_COMPILER) \ 22 | $(LIBSAIVPP) $(LIBSAIVPP_DEV) $(LIBSAIMETADATA) $(LIBSAIMETADATA_DEV) 23 | $(LIBSAITHRIFT_DEV)_RDEPENDS += $(LIBTHRIFT) $(LIBSAIVPP) $(LIBSAIMETADATA) 24 | $(LIBSAITHRIFT_DEV)_BUILD_ENV = platform=vpp 25 | SONIC_DPKG_DEBS += $(LIBSAITHRIFT_DEV) 26 | 27 | PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_$(CONFIGURED_ARCH).deb 28 | $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT))) 29 | 30 | SAISERVER = saiserver_$(SAI_VER)_$(CONFIGURED_ARCH).deb 31 | $(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(LIBSAIVPP) 32 | $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER))) 33 | 34 | SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_$(CONFIGURED_ARCH).deb 35 | $(SAISERVER_DBG)_RDEPENDS += $(SAISERVER) 36 | $(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER_DBG))) 37 | -------------------------------------------------------------------------------- /saivpp/src/ContextConfigContainer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "ContextConfig.h" 19 | 20 | #include "swss/sal.h" 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace saivpp 27 | { 28 | class ContextConfigContainer 29 | { 30 | public: 31 | 32 | ContextConfigContainer(); 33 | 34 | virtual ~ContextConfigContainer(); 35 | 36 | public: 37 | 38 | void insert( 39 | _In_ std::shared_ptr contextConfig); 40 | 41 | std::shared_ptr get( 42 | _In_ uint32_t guid); 43 | 44 | std::set> getAllContextConfigs(); 45 | 46 | public: 47 | 48 | static std::shared_ptr loadFromFile( 49 | _In_ const char* contextConfig); 50 | 51 | static std::shared_ptr getDefault(); 52 | 53 | private: 54 | 55 | std::map> m_map; 56 | 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /saivpp/src/CorePortIndexMapContainer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Microsoft, Inc. 3 | * Modifications copyright (c) 2023 Cisco and/or its affiliates. 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #pragma once 17 | 18 | #include "CorePortIndexMap.h" 19 | 20 | #include 21 | #include 22 | 23 | namespace saivpp 24 | { 25 | class CorePortIndexMapContainer 26 | { 27 | public: 28 | 29 | CorePortIndexMapContainer() = default; 30 | 31 | virtual ~CorePortIndexMapContainer() = default; 32 | 33 | public: 34 | 35 | void insert( 36 | _In_ std::shared_ptr corePortIndexMap); 37 | 38 | void remove( 39 | _In_ uint32_t switchIndex); 40 | 41 | std::shared_ptr getCorePortIndexMap( 42 | _In_ uint32_t switchIndex) const; 43 | 44 | void clear(); 45 | 46 | bool hasCorePortIndexMap( 47 | _In_ uint32_t switchIndex) const; 48 | 49 | size_t size() const; 50 | 51 | void removeEmptyCorePortIndexMaps(); 52 | 53 | private: 54 | 55 | std::map> m_map; 56 | }; 57 | } 58 | -------------------------------------------------------------------------------- /rules/docker-sonic-vpp.dep: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Microsoft, Inc. 2 | # Modifications copyright (c) 2023 Cisco and/or its affiliates. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at: 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Copyright (c) 2023 Cisco and/or its affiliates. 16 | # Licensed under the Apache License, Version 2.0 (the "License"); 17 | # you may not use this file except in compliance with the License. 18 | # You may obtain a copy of the License at: 19 | # 20 | # http://www.apache.org/licenses/LICENSE-2.0 21 | # 22 | # Unless required by applicable law or agreed to in writing, software 23 | # distributed under the License is distributed on an "AS IS" BASIS, 24 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | # See the License for the specific language governing permissions and 26 | # limitations under the License. 27 | 28 | #DPKG FRK 29 | DPATH := $($(DOCKER_SONIC_VPP)_PATH) 30 | DEP_FILES := $(SONIC_COMMON_FILES_LIST) $(PLATFORM_RULES)/docker-sonic-vpp.mk $(PLATFORM_RULES)/docker-sonic-vpp.dep 31 | DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) 32 | DEP_FILES += $(shell git ls-files $(DPATH)) 33 | 34 | $(DOCKER_SONIC_VPP)_CACHE_MODE := GIT_CONTENT_SHA 35 | $(DOCKER_SONIC_VPP)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) 36 | $(DOCKER_SONIC_VPP)_DEP_FILES := $(DEP_FILES) 37 | 38 | -------------------------------------------------------------------------------- /docker-sonic-vpp/port_breakout_config_db.json: -------------------------------------------------------------------------------- 1 | { 2 | "ACL_TABLE": { 3 | "DPB_ACL_TBL_1": { 4 | "policy_desc": "ACL table to test DPB/ACL dependency", 5 | "ports": [ 6 | "Ethernet0", 7 | "Ethernet1", 8 | "Ethernet2", 9 | "Ethernet3", 10 | "Ethernet4", 11 | "Ethernet5" 12 | ], 13 | "type": "L3" 14 | }, 15 | "DPB_ACL_TBL_2": { 16 | "policy_desc": "ACL table to test DPB/ACL dependency", 17 | "ports": [ 18 | "Ethernet0", 19 | "Ethernet1", 20 | "Ethernet2", 21 | "Ethernet3", 22 | "Ethernet6", 23 | "Ethernet7" 24 | ], 25 | "type": "L3" 26 | } 27 | }, 28 | "INTERFACE": { 29 | "Ethernet8": {}, 30 | "Ethernet8|10.0.0.8/31": { 31 | "family": "IPv4", 32 | "scope": "global" 33 | } 34 | }, 35 | "VLAN_MEMBER": { 36 | "Vlan100|Ethernet0": { 37 | "tagging_mode": "untagged" 38 | }, 39 | "Vlan100|Ethernet1": { 40 | "tagging_mode": "untagged" 41 | }, 42 | "Vlan100|Ethernet2": { 43 | "tagging_mode": "untagged" 44 | }, 45 | "Vlan100|Ethernet3": { 46 | "tagging_mode": "untagged" 47 | }, 48 | "Vlan100|Ethernet4": { 49 | "tagging_mode": "untagged" 50 | }, 51 | "Vlan100|Ethernet5": { 52 | "tagging_mode": "untagged" 53 | }, 54 | "Vlan101|Ethernet6": { 55 | "tagging_mode": "tagged" 56 | }, 57 | "Vlan101|Ethernet7": { 58 | "tagging_mode": "tagged" 59 | } 60 | } 61 | } 62 | --------------------------------------------------------------------------------