Skip to content

Commit

Permalink
[vs] add teamsyncd into vs docker (#1112)
Browse files Browse the repository at this point in the history
* [vs] add teamsyncd into vs docker

* add build badge for virtual switch
  • Loading branch information
lguohan authored Nov 4, 2017
1 parent 4e1fb68 commit 875bdf6
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 61 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ Broadcom: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/broad
Cavium: [![Cavium](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/cavium/job/buildimage-cavm-all/)
Centec: [![Centec](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/centec/job/buildimage-centec-all/)
Mellanox: [![Mellanox](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/mellanox/job/buildimage-mlnx-all)
P4: [![Broadcom](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all)
P4: [![P4](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all)
VS: [![VS](https://sonic-jenkins.westus.cloudapp.azure.com/job/vs/job/buildimage-vs-all/badge/icon)](https://sonic-jenkins.westus.cloudapp.azure.com/job/vs/job/buildimage-vs-all)

# sonic-buildimage

## Build SONiC Switch Images

# Description

Following is the instruction on how to build an [(ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also how to build docker images running inside the NOS. Note that SONiC image are build per ASIC platform. Switches using the same ASIC platform share a common image. For a list of supported switches and ASIC, please refer to this [document](https://sonic-jenkins.westus.cloudapp.azure.com/job/p4/job/buildimage-p4-all).
Following is the instruction on how to build an [(ONIE)](https://github.com/opencomputeproject/onie) compatiable network operating system (NOS) installer image for network switches, and also how to build docker images running inside the NOS. Note that SONiC image are build per ASIC platform. Switches using the same ASIC platform share a common image. For a list of supported switches and ASIC, please refer to this [list](https://github.com/Azure/SONiC/wiki/Supported-Devices-and-Platforms)

# Hardware
Any server can be a build image server. We are using a server with 1T hard disk. The OS is Ubuntu 16.04.
Expand Down Expand Up @@ -47,6 +48,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.

Expand Down Expand Up @@ -92,6 +94,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

Expand Down
68 changes: 63 additions & 5 deletions platform/vs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
2 changes: 1 addition & 1 deletion platform/vs/docker-sonic-vs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
51 changes: 0 additions & 51 deletions platform/vs/docker-sonic-vs/Dockerfile

This file was deleted.

3 changes: 2 additions & 1 deletion platform/vs/docker-sonic-vs/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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(' ') -%}
Expand Down
2 changes: 2 additions & 0 deletions platform/vs/docker-sonic-vs/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions platform/vs/docker-sonic-vs/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions rules/swss-common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-swss-common

0 comments on commit 875bdf6

Please sign in to comment.