diff --git a/.gitignore b/.gitignore index 9ca9d2ff1a98..c5ed255e62a9 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ dockers/docker-teamd/Dockerfile dockers/docker-sonic-mgmt/Dockerfile platform/*/docker-syncd-*/Dockerfile platform/*/docker-syncd-*-rpc/Dockerfile +platform/vs/docker-sonic-vs/Dockerfile # Installer-related files and directories installer/x86_64/platforms/ diff --git a/README.md b/README.md index 53e8b8ff221a..a85ba7160d30 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ The SONiC installer contains all docker images needed. SONiC uses one image for - PLATFORM=cavium - PLATFORM=centec - PLATFORM=p4 +- PLATFORM=vs For Broadcom ASIC, we build ONIE and EOS image. EOS image is used for Arista devices, ONIE image is used for all other Broadcom ASIC based devices. @@ -92,6 +93,7 @@ This may take a while, but it is a one-time action, so please be patient. - docker-syncd-cavm.gz: docker image for the daemon to sync database and Cavium switch ASIC (gzip tar archive) - docker-syncd-mlnx.gz: docker image for the daemon to sync database and Mellanox switch ASIC (gzip tar archive) - docker-sonic-p4.gz: docker image for all-in-one for p4 software switch (gzip tar archive) + - docker-sonic-vs.gz: docker image for all-in-one for software virtual switch (gzip tar archive) ## Contribution Guide diff --git a/platform/vs/README.md b/platform/vs/README.md index a7ec58856124..52f3f30eac6d 100644 --- a/platform/vs/README.md +++ b/platform/vs/README.md @@ -4,14 +4,72 @@ HOWTO Use Virtual Switch 1. Create a docker with 32 front panel port ``` -docker run -id --name sw debian bash -sudo ./create_vnet.sh sw +$ docker run -id --name sw debian bash +$ sudo ./create_vnet.sh sw +$ ip netns list +sw-srv31 (id: 37) +sw-srv30 (id: 35) +sw-srv29 (id: 34) +sw-srv28 (id: 33) +sw-srv27 (id: 32) +sw-srv26 (id: 31) +sw-srv25 (id: 30) +sw-srv24 (id: 29) +sw-srv23 (id: 28) +sw-srv22 (id: 27) +sw-srv21 (id: 26) +sw-srv20 (id: 25) +sw-srv19 (id: 24) +sw-srv18 (id: 23) +sw-srv17 (id: 22) +sw-srv16 (id: 21) +sw-srv15 (id: 20) +sw-srv14 (id: 19) +sw-srv13 (id: 18) +sw-srv12 (id: 17) +sw-srv11 (id: 16) +sw-srv10 (id: 15) +sw-srv9 (id: 14) +sw-srv8 (id: 13) +sw-srv7 (id: 12) +sw-srv6 (id: 11) +sw-srv5 (id: 10) +sw-srv4 (id: 9) +sw-srv3 (id: 8) +sw-srv2 (id: 7) +sw-srv1 (id: 6) +sw-srv0 (id: 5) ``` -2. Create sonic virtual switch docker +2. Start sonic virtual switch docker ``` -docker run --privileged --network container:sw -d docker-sonic-vs +$ docker run --privileged --network container:sw -d docker-sonic-vs ``` -3. Run test in virtual switch docker (TBD) +3. Setup IP in the virtual switch docker + +``` +$ docker exec -it vs bash +root@2e9b5c2dc2a2:/# ifconfig Ethernet0 10.0.0.0/31 up +root@2e9b5c2dc2a2:/# ifconfig Ethernet4 10.0.0.2/31 up +``` + +4. Setup IP in the server network namespace + +``` +$ sudo ip netns exec sw-srv0 ifconfig eth0 10.0.0.1/31 +$ sudo ip netns exec sw-srv0 ip route add default via 10.0.0.0 +$ sudo ip netns exec sw-srv1 ifconfig eth0 10.0.0.3/31 +$ sudo ip netns exec sw-srv1 ip route add default via 10.0.0.2 +``` + +5. Ping from sw-srv0 to sw-srv1 + +``` +$ sudo ip netns exec sw-srv0 ping 10.0.0.3 +PING 10.0.0.3 (10.0.0.3) 56(84) bytes of data. +64 bytes from 10.0.0.3: icmp_seq=1 ttl=63 time=0.137 ms +64 bytes from 10.0.0.3: icmp_seq=2 ttl=63 time=0.148 ms +64 bytes from 10.0.0.3: icmp_seq=3 ttl=63 time=0.149 ms +``` diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index b52965787149..e9d23db493db 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -2,7 +2,7 @@ DOCKER_SONIC_VS = docker-sonic-vs.gz $(DOCKER_SONIC_VS)_PATH = $(PLATFORM_PATH)/docker-sonic-vs -$(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) $(SYNCD_VS) $(REDIS_SERVER) $(REDIS_TOOLS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_DEVICE_DATA) +$(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) $(SYNCD_VS) $(REDIS_SERVER) $(REDIS_TOOLS) $(PYTHON_SWSSCOMMON) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(SONIC_DEVICE_DATA) ifeq ($(SONIC_ROUTING_STACK), quagga) $(DOCKER_SONIC_VS)_DEPENDS += $(QUAGGA) diff --git a/platform/vs/docker-sonic-vs/Dockerfile b/platform/vs/docker-sonic-vs/Dockerfile deleted file mode 100644 index 2a75868cd99d..000000000000 --- a/platform/vs/docker-sonic-vs/Dockerfile +++ /dev/null @@ -1,51 +0,0 @@ -FROM docker-config-engine - -## Make apt-get non-interactive -ENV DEBIAN_FRONTEND=noninteractive - -RUN apt-get update - -RUN apt-get install -y net-tools \ - ethtool \ - tcpdump \ - ifupdown \ - bridge-utils \ - python-ply \ - libqt5core5a \ - libqt5network5 \ - libboost-program-options1.55.0 \ - libboost-system1.55.0 \ - libboost-thread1.55.0 \ - libgmp10 \ - libjudydebian1 \ - libnanomsg0 \ - libdaemon0 \ - libjansson4 \ - libjemalloc1 \ - openssh-client \ - openssh-server \ - libc-ares2 \ - iproute - -COPY \ -debs/libnl-route-3-200_3.2.27-1_amd64.deb debs/libnl-genl-3-200_3.2.27-1_amd64.deb debs/libnl-nf-3-200_3.2.27-1_amd64.deb debs/libhiredis0.13_0.13.3-2_amd64.deb debs/libnl-3-200_3.2.27-1_amd64.deb debs/libnl-cli-3-200_3.2.27-1_amd64.deb debs/libswsscommon_1.0.0_amd64.deb debs/libsairedis_1.0.0_amd64.deb debs/libsaimetadata_1.0.0_amd64.deb debs/libteam5_1.26-1_amd64.deb debs/libsaivs_1.0.0_amd64.deb debs/swss_1.0.0_amd64.deb debs/syncd-vs_1.0.0_amd64.deb debs/redis-server_3.2.4-1~bpo8+1_amd64.deb debs/redis-tools_3.2.4-1~bpo8+1_amd64.deb debs/libteamdctl0_1.26-1_amd64.deb debs/libteam-utils_1.26-1_amd64.deb debs/sonic-device-data_1.0-1_all.deb debs/quagga_0.99.24.1-2.1_amd64.deb debs/ - -RUN dpkg -i \ -debs/libnl-route-3-200_3.2.27-1_amd64.deb debs/libnl-genl-3-200_3.2.27-1_amd64.deb debs/libnl-nf-3-200_3.2.27-1_amd64.deb debs/libhiredis0.13_0.13.3-2_amd64.deb debs/libnl-3-200_3.2.27-1_amd64.deb debs/libnl-cli-3-200_3.2.27-1_amd64.deb debs/libswsscommon_1.0.0_amd64.deb debs/libsairedis_1.0.0_amd64.deb debs/libsaimetadata_1.0.0_amd64.deb debs/libteam5_1.26-1_amd64.deb debs/libsaivs_1.0.0_amd64.deb debs/swss_1.0.0_amd64.deb debs/syncd-vs_1.0.0_amd64.deb debs/redis-server_3.2.4-1~bpo8+1_amd64.deb debs/redis-tools_3.2.4-1~bpo8+1_amd64.deb debs/libteamdctl0_1.26-1_amd64.deb debs/libteam-utils_1.26-1_amd64.deb debs/sonic-device-data_1.0-1_all.deb debs/quagga_0.99.24.1-2.1_amd64.deb - -## Clean up -RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y -RUN rm -rf /debs - -RUN sed -ri 's/^daemonize yes$/daemonize no/; \ - s/^logfile .*$/logfile ""/; \ - s/^# syslog-enabled no$/syslog-enabled no/; \ - s/^# unixsocket/unixsocket/ \ - ' /etc/redis/redis.conf - -COPY ["50-default.conf", "/etc/rsyslog.d/"] -COPY ["start.sh", "orchagent.sh", "/usr/bin/"] -COPY ["brcm.profile.ini", "/usr/share/sonic/device/vswitch/"] -COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] - -ENTRYPOINT ["/usr/bin/supervisord"] \ No newline at end of file diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index f6e784017f78..32b91e8cf44a 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -25,7 +25,8 @@ RUN apt-get install -y net-tools \ openssh-client \ openssh-server \ libc-ares2 \ - iproute + iproute \ + libpython2.7 COPY \ {% for deb in docker_sonic_vs_debs.split(' ') -%} diff --git a/platform/vs/docker-sonic-vs/start.sh b/platform/vs/docker-sonic-vs/start.sh index 26633c24a70b..07d0fb7a0426 100755 --- a/platform/vs/docker-sonic-vs/start.sh +++ b/platform/vs/docker-sonic-vs/start.sh @@ -26,6 +26,8 @@ supervisorctl start intfsyncd supervisorctl start neighsyncd +supervisorctl start teamsyncd + # Start arp_update when VLAN exists # VLAN=`sonic-cfggen -d -v 'VLAN.keys() | join(" ") if VLAN'` # if [ "$VLAN" != "" ]; then diff --git a/platform/vs/docker-sonic-vs/supervisord.conf b/platform/vs/docker-sonic-vs/supervisord.conf index 35c56420b463..c6fefef1415a 100644 --- a/platform/vs/docker-sonic-vs/supervisord.conf +++ b/platform/vs/docker-sonic-vs/supervisord.conf @@ -66,3 +66,11 @@ autostart=false autorestart=false stdout_logfile=syslog stderr_logfile=syslog + +[program:teamsyncd] +command=/usr/bin/teamsyncd +priority=9 +autostart=false +autorestart=false +stdout_logfile=syslog +stderr_logfile=syslog diff --git a/rules/swss-common.mk b/rules/swss-common.mk index a4ccdafc2376..623410d4cdab 100644 --- a/rules/swss-common.mk +++ b/rules/swss-common.mk @@ -12,6 +12,9 @@ SONIC_DPKG_DEBS += $(LIBSWSSCOMMON) LIBSWSSCOMMON_DEV = libswsscommon-dev_1.0.0_amd64.deb $(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(LIBSWSSCOMMON_DEV))) +PYTHON_SWSSCOMMON = python-swsscommon_1.0.0_amd64.deb +$(eval $(call add_derived_package,$(LIBSWSSCOMMON),$(PYTHON_SWSSCOMMON))) + LIBSWSSCOMMON_DBG = libswsscommon-dbg_1.0.0_amd64.deb $(LIBSWSSCOMMON_DBG)_DEPENDS += $(LIBSWSSCOMMON) $(LIBSWSSCOMMON_DBG)_RDEPENDS += $(LIBSWSSCOMMON) diff --git a/src/sonic-swss-common b/src/sonic-swss-common index 2e94b54e3626..a6f74b67a580 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit 2e94b54e3626a4acd73bb3edb2f94d61793ee0e4 +Subproject commit a6f74b67a58074439d8f3dbf84fa8ecc0a2e06a6