Acknowledged
Created: Apr 26, 2023
Updated: Jul 24, 2023
Found In Version: 10.23.30.1
Severity: Standard
Applicable for: Wind River Linux LTS 23
Component/s: Userspace
Build openvswitch into the image and configure the system with the following steps. Note that the built-in mirroring related self test cases are all passed.
1. prepare guest image
copy guest kernel and image(qemux86 image) under /exports/guest1 , as below
root@intel-x86-64:/exports/guest1# ls -l
total 7095864
-rw-r--r-- 1 root root 9142176 Jan 16 19:37 kernel
-rw-r--r-- 1 root root 7257013248 Jan 16 19:38 wrlinux-image-std-qemux86.ext4
root@intel-x86-64:/exports/guest1#
root@intel-x86-64:/exports/guest1# dd if=/dev/zero of=/exports/guest1/test.img bs=1024 count=2
2+0 records in
2+0 records out
2048 bytes (2.0 kB, 2.0 KiB) copied, 8.3352e-05 s, 24.6 MB/s
root@intel-x86-64:/exports/guest1# ls -l
total 7095864
-rw-r--r-- 1 root root 9142176 Jan 16 19:37 kernel
-rw-r--r-- 1 root root 2048 Jan 17 02:32 test.img
-rw-r--r-- 1 root root 7257013248 Jan 16 19:38 wrlinux-image-std-qemux86.ext4
root@intel-x86-64:~#
2. start up guest
root@intel-x86-64:~# cat vm0.xml
<domain type='kvm'>
<name>guest1</name>
<memory>512000</memory>
<currentMemory>512000</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='hd' />
<kernel>/exports/guest1/kernel</kernel>
<cmdline>console=ttyS0 root=/dev/vda rw ip=dhcp</cmdline>
</os>
<devices>
<disk type='file' device='disk'>
<source file='/exports/guest1/wrlinux-image-std-qemux86.ext4' />
<target dev='vda' bus='virtio' />
</disk>
<disk type='file' device='disk'>
<source file='/exports/guest1/test.img' />
<target dev='vdb' bus='virtio' />
</disk>
<serial type='pty'>
<source path='/dev/pts/0'/>
<target port='0'/>
</serial>
<console type='pty' tty='/dev/pts/0'>
<source path='/dev/pts/0'/>
<target port='0'/>
</console>
<interface type='bridge'>
<model type='virtio'/>
<source bridge='br-ovp'/>
<virtualport type='openvswitch'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>
root@intel-x86-64:~#
root@intel-x86-64:~#
root@intel-x86-64:~# cat >> /tmp/ovs_dnsmasq.conf <<-EOF
> interface=br-ovp
> dhcp-range=br-ovp,10.0.11.10,10.0.11.100
> EOF
root@intel-x86-64:~#
root@intel-x86-64:~# ovs-vsctl add-br br-ovp
root@intel-x86-64:~# ifconfig br-ovp 10.0.11.1 up netmask 255.255.255.0
root@intel-x86-64:~# ip route add 10.0.11.0/24 via 10.0.11.1 dev br-ovp
RTNETLINK answers: File exists
root@intel-x86-64:~#
root@intel-x86-64:~#
root@intel-x86-64:~# pkill dnsmasq
root@intel-x86-64:~# dnsmasq --conf-file=/tmp/ovs_dnsmasq.conf -l /tmp/dnsmasq.leases -p 0
root@intel-x86-64:~#
root@intel-x86-64:~#
2. start guest image
root@intel-x86-64:~# virsh create vm0.xml --console
...................
root@qemux86:~# ip addr show | grep 10.0.11
inet 10.0.11.34/24 brd 10.0.11.255 scope global dynamic eth0
root@qemux86:~# Ctrl+]
root@intel-x86-64:~# ping 10.0.11.34
PING 10.0.11.34 (10.0.11.34) 56(84) bytes of data.
64 bytes from 10.0.11.34: icmp_seq=1 ttl=64 time=0.313 ms
^C
--- 10.0.11.34 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.313/0.313/0.313/0.000 ms
3. create openvswitch mirror
root@intel-x86-64:~# modprobe dummy numdummies=1 num_vfs=1
root@intel-x86-64:~# ip link set up dummy0
root@intel-x86-64:~# ovs-vsctl add-port br-ovp dummy0
root@intel-x86-64:~# ovs-vsctl clear Bridge br-ovp mirrors
root@intel-x86-64:~#
root@intel-x86-64:~# ovs-vsctl list port
_uuid : daaac4b1-fc45-452d-9aaf-2582ed3bef50
bond_active_slave : ]
bond_downdelay : 0
bond_fake_iface : false
bond_mode : []
bond_updelay : 0
cvlans : []
external_ids : {}
fake_bridge : false
interfaces : [98894fc1-122e-47e9-a055-e2a5b84ffc4e]
lacp : []
mac : []
name : dummy0
other_config : {}
protected : false
qos : []
rstp_statistics : {}
rstp_status : {}
statistics : {}
status : {}
tag : []
trunks : []
vlan_mode : []
_uuid : bc6f7155-0d31-4e95-b297-f8557fddf73d
bond_active_slave : []
bond_downdelay : 0
bond_fake_iface : false
bond_mode : []
bond_updelay : 0
cvlans : []
external_ids : {}
fake_bridge : false
interfaces : [f3d30f95-34b9-4ccc-ab26-96dfac32cada]
lacp : []
mac : []
name : vnet1
other_config : {}
protected : false
qos : []
rstp_statistics : {}
rstp_status : {}
statistics : {}
status : {}
tag : []
trunks : []
vlan_mode : []
_uuid : 8a36c4a2-7ed5-44e7-868b-d0fc72f28686
bond_active_slave : []
bond_downdelay : 0
bond_fake_iface : false
bond_mode : []
bond_updelay : 0
cvlans : []
external_ids : {}
fake_bridge : false
interfaces : [fd50a22c-240f-4383-a147-37a7a76bb88d]
lacp : []
mac : []
name : br-ovp
other_config : {}
protected : false
qos : []
rstp_statistics : {}
rstp_status : {}
statistics : {}
status : {}
tag : []
trunks : []
vlan_mode : []
root@intel-x86-64:~# ovs-vsctl list port dummy0 ( head -1 | awk '{print $3}'
daaac4b1-fc45-452d-9aaf-2582ed3bef50
root@intel-x86-64:~# ovs-vsctl list port vnet1 | head -1 | awk '{print $3}'
bc6f7155-0d31-4e95-b297-f8557fddf73d
root@intel-x86-64:~#
root@intel-x86-64:~# ovs-vsctl list mirror
root@intel-x86-64:~#
root@intel-x86-64:~# ovs-vsctl -- --id=@m create mirror name=mirror0 -- add bridge br-ovp mirrors @m
cc9d273e-f8e0-440a-a52e-099b98bbca66
root@intel-x86-64:~# ovs-vsctl list mirror
_uuid : cc9d273e-f8e0-440a-a52e-099b98bbca66
external_ids : {}
name : mirror0
output_port : [)
output_vlan : []
select_all : false
select_dst_port : []
select_src_port : []
select_vlan : []
snaplen : []
statistics : {tx_bytes=0, tx_packets=0}
root@intel-x86-64:~#
4. set mirror select_all=1, output_port=dummy0, test passed
root@intel-x86-64:~# ovs-vsctl set mirror mirror0 select_all=1
root@intel-x86-64:~# ovs-vsctl set mirror mirror0 output_port=daaac4b1-fc45-452d-9aaf-2582ed3bef50
root@intel-x86-64:~# ovs-vsctl list mirror
_uuid : cc9d273e-f8e0-440a-a52e-099b98bbca66
external_ids : {}
name : mirror0
output_port : daaac4b1-fc45-452d-9aaf-2582ed3bef50
output_vlan : []
select_all : true
select_dst_port : []
select_src_port : []
select_vlan : []
snaplen : []
statistics : {tx_bytes=168, tx_packets=4}
root@intel-x86-64:~# tcpdump -ni dummy0 -vnn icmp >3.log 2>&1 &
[1] 1532
root@intel-x86-64:~# tcpdump -ni vnet1 -vnn icmp >4.log 2>&1 &
[2] 1533
root@intel-x86-64:~#
root@intel-x86-64:~# ping 10.0.11.34 &
[3] 1534
root@intel-x86-64:~# PING 10.0.11.34 (10.0.11.34) 56(84) bytes of data.
64 bytes from 10.0.11.34: icmp_seq=1 ttl=64 time=0.401 ms
64 bytes from 10.0.11.34: icmp_seq=2 ttl=64 time=0.196 ms
64 bytes from 10.0.11.34: icmp_seq=3 ttl=64 time=0.213 ms
64 bytes from 10.0.11.34: icmp_seq=4 ttl=64 time=0.218 ms
64 bytes from 10.0.11.34: icmp_seq=5 ttl=64 time=0.196 ms
root@intel-x86-64:~# pkill ping
[3]+ Terminated ping 10.0.11.34
root@intel-x86-64:~# pkill tcpdump
root@intel-x86-64:~#
[1]- Done tcpdump -ni dummy0 -vnn icmp > 3.log 2>&1
[2]+ Done tcpdump -ni vnet1 -vnn icmp > 4.log 2>&1
root@intel-x86-64:~#
root@intel-x86-64:~#
root@intel-x86-64:~# tail 3.log
03:39:16.463069 IP (tos 0x0, ttl 64, id 48236, offset 0, flags [DF], proto ICMP (1), length 84)
10.0.11.1 > 10.0.11.34: ICMP echo request, id 3, seq 3, length 64
03:39:17.487090 IP (tos 0x0, ttl 64, id 49170, offset 0, flags [DF], proto ICMP (1), length 84)
10.0.11.1 > 10.0.11.34: ICMP echo request, id 3, seq 4, length 64
03:39:18.511070 IP (tos 0x0, ttl 64, id 50001, offset 0, flags [DF], proto ICMP (1), length 84)
10.0.11.1 > 10.0.11.34: ICMP echo request, id 3, seq 5, length 64
5 packets captured
5 packets received by filter
0 packets dropped by kernel
root@intel-x86-64:~# tail 4.log
03:39:17.487220 IP (tos 0x0, ttl 64, id 58046, offset 0, flags [none], proto ICMP (1), length 84)
10.0.11.34 > 10.0.11.1: ICMP echo reply, id 3, seq 4, length 64
03:39:18.511074 IP (tos 0x0, ttl 64, id 50001, offset 0, flags [DF], proto ICMP (1), length 84)
10.0.11.1 > 10.0.11.34: ICMP echo request, id 3, seq 5, length 64
03:39:18.511195 IP (tos 0x0, ttl 64, id 58671, offset 0, flags [none], proto ICMP (1), length 84)
10.0.11.34 > 10.0.11.1: ICMP echo reply, id 3, seq 5, length 64
10 packets captured
10 packets received by filter
0 packets dropped by kernel
5. set mirror select_all=0, output_port=dummy0,src_port=vnet1, test failed
root@intel-x86-64:~# ovs-vsctl set mirror mirror0 select_all=0
root@intel-x86-64:~# ovs-vsctl set mirror mirror0 select_src_port=bc6f7155-0d31-4e95-b297-f8557fddf73d
root@intel-x86-64:~# ovs-vsctl list mirror
_uuid : cc9d273e-f8e0-440a-a52e-099b98bbca66
external_ids : {}
name : mirror0
output_port : daaac4b1-fc45-452d-9aaf-2582ed3bef50
output_vlan : []
select_all : false
select_dst_port : []
select_src_port : [bc6f7155-0d31-4e95-b297-f8557fddf73d]
select_vlan : []
snaplen : []
statistics : {tx_bytes=0, tx_packets=0}
root@intel-x86-64:~# tcpdump -ni dummy0 -vnn icmp >1.log 2>&1 &
[1] 1492
root@intel-x86-64:~# tcpdump -ni vnet1 -vnn icmp >2.log 2>&1 &
[2] 1493
root@intel-x86-64:~# ping 10.0.11.34 &
[3] 1495
root@intel-x86-64:~# PING 10.0.11.34 (10.0.11.34) 56(84) bytes of data.
64 bytes from 10.0.11.34: icmp_seq=1 ttl=64 time=0.368 ms
64 bytes from 10.0.11.34: icmp_seq=2 ttl=64 time=0.229 ms
64 bytes from 10.0.11.34: icmp_seq=3 ttl=64 time=0.192 ms
64 bytes from 10.0.11.34: icmp_seq=4 ttl=64 time=0.214 ms
64 bytes from 10.0.11.34: icmp_seq=5 ttl=64 time=0.173 ms
pkill ping
[3]+ Terminated ping 10.0.11.34
root@intel-x86-64:~# pkill tcpdump
root@intel-x86-64:~#
[1]- Done tcpdump -ni dummy0 -vnn icmp > 1.log 2>&1
[2]+ Done tcpdump -ni vnet1 -vnn icmp > 2.log 2>&1
root@intel-x86-64:~#
root@intel-x86-64:~# tail 1.log
tcpdump: listening on dummy0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
root@intel-x86-64:~# tail 2.log
03:37:09.615212 IP (tos 0x0, ttl 64, id 11675, offset 0, flags [none], proto ICMP (1), length 84)
10.0.11.34 > 10.0.11.1: ICMP echo reply, id 2, seq 4, length 64
03:37:10.639076 IP (tos 0x0, ttl 64, id 49301, offset 0, flags [DF], proto ICMP (1), length 84)
10.0.11.1 > 10.0.11.34: ICMP echo request, id 2, seq 5, length 64
03:37:10.639179 IP (tos 0x0, ttl 64, id 12280, offset 0, flags [none], proto ICMP (1), length 84)
10.0.11.34 > 10.0.11.1: ICMP echo reply, id 2, seq 5, length 64
10 packets captured
10 packets received by filter
0 packets dropped by kernel
root@intel-x86-64:~#
1. bitbake
[HOST]
1) setup.sh
/lpg-build/cdc/fast_prod/WRLINUX_MASTER_WR/MASTER_WR_GIT/wrlinux-10/setup.sh --machines intel-x86-64 --templates feature/libvirt feature/virt-host --distro wrlinux --dl-layers=1 --accept-eula=yes
2)
source environment-setup-x86_64-wrlinuxsdk-linux
source oe-init-build-env build
3). bitbake-layers add-layer /path/to/local/testlayer/wr-testing/virtualization
4). prepare test_plan
cat << EOF >> customized_test_plan.ini
[Test_Case]
openvswitch_mirror
[Test_HW]
openvswitch = "qemux86 qemux86-64 intel-x86-64"
EOF
5). modify conf/local.conf
echo 'PREFERRED_PROVIDER_virtual/kernel = "linux-yocto-rt"' >> conf/local.conf
echo 'require templates/feature/virtualization/template.conf' >> conf/local.conf
echo 'IMAGE_FSTYPES += " tar.bz2 ext4"' >> conf/local.conf
echo 'BB_NO_NETWORK:pn-lmbench = "0"' >> conf/local.conf
echo 'ACTIVE_PLAN = "customized_test_plan.ini"' >> conf/local.conf
echo 'IMAGE_FSTYPES:remove = " live hddimg iso"' >> conf/local.conf
echo 'IMAGE_ROOTFS_EXTRA_SPACE = "5242880"' >> conf/local.conf
echo 'KERNEL_FEATURES:append = " features/usb/serial-all.scc"' >> conf/local.conf
6). bitbake wrlinux-image-std
[GUEST]
1) setup
/lpg-build/cdc/fast_prod/WRLINUX_MASTER_WR/MASTER_WR_GIT/wrlinux-10/setup.sh --machines qemux86 --templates feature/libvirt --distro wrlinux --dl-layers=1 --accept-eula=yes
2)
source environment-setup-x86_64-wrlinuxsdk-linux
source oe-init-build-env build
3) bitbake-layers add-layer /path/to/local/testlayer/wr-testing/virtualization
4) prepare test_plan
cat << EOF >> customized_test_plan.ini
[Test_Case]
openvswitch_mirror
[Test_HW]
openvswitch = "qemux86 qemux86-64 intel-x86-64"
EOF
5) modify conf/local.conf
echo 'PREFERRED_PROVIDER_virtual/kernel = "linux-yocto-rt"' >> conf/local.conf
echo 'require templates/feature/virtualization/template.conf' >> conf/local.conf
echo 'IMAGE_FSTYPES += " tar.bz2"' >> conf/local.conf
echo 'BB_NO_NETWORK:pn-lmbench = "0"' >> conf/local.conf
echo 'ACTIVE_PLAN = "customized_test_plan.ini"' >> conf/local.conf
echo 'IMAGE_FSTYPES:remove = " live hddimg iso"' >> conf/local.conf
echo 'IMAGE_ROOTFS_EXTRA_SPACE = "5242880"' >> conf/local.conf
6) bitbake wrlinux-image-std
2.
boot the target with host image