Skip to content

Commit

Permalink
Add test case to vlan break-trough (#7686)
Browse files Browse the repository at this point in the history
Different applications connecting to the same NS and using
the the same VLAN. These NSCs now can run on the same node.

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>

Signed-off-by: Laszlo Kiraly <laszlo.kiraly@est.tech>
  • Loading branch information
ljkiraly authored Nov 29, 2022
1 parent df5fe1e commit 6db2c74
Showing 1 changed file with 33 additions and 11 deletions.
44 changes: 33 additions & 11 deletions examples/use-cases/Kernel2RVlanMultiNS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ spec:
- name: NSM_CONNECT_TO
value: "registry.nsm-system:5002"
- name: NSM_SERVICES
value: "blue-bridge.ns-kernel2vlan-multins-2 { vlan: 300; via: gw1 }, green-bridge.ns-kernel2vlan-multins-2 { vlan: 400; via: gw1 }"
value: "blue-bridge.ns-kernel2vlan-multins-2 { vlan: 300; via: gw1 }, green-bridge.ns-kernel2vlan-multins-2 { vlan: 300; via: gw1 }"
- name: NSM_CIDR_PREFIX
value: 172.10.2.0/24
EOF
Expand Down Expand Up @@ -294,7 +294,7 @@ EOF
Deploy the last client

```bash
kubectl apply -n nsm-system -f client.yaml
kubectl apply -n nsm-system -f client.yaml
```

Wait for applications ready:
Expand Down Expand Up @@ -329,7 +329,7 @@ Create a docker image for test external connections:
cat > Dockerfile <<EOF
FROM alpine:3.15.0
RUN apk add ethtool
RUN apk add ethtool tcpdump iproute2
ENTRYPOINT [ "tail", "-f", "/dev/null" ]
EOF
Expand All @@ -343,12 +343,10 @@ docker run --cap-add=NET_ADMIN --rm -d --network bridge-2 --name rvm-tester rvm-
docker exec rvm-tester ip link set eth0 down
docker exec rvm-tester ip link add link eth0 name eth0.100 type vlan id 100
docker exec rvm-tester ip link add link eth0 name eth0.300 type vlan id 300
docker exec rvm-tester ip link add link eth0 name eth0.400 type vlan id 400
docker exec rvm-tester ip link set eth0 up
docker exec rvm-tester ip addr add 172.10.0.254/24 dev eth0.100
docker exec rvm-tester ip addr add 172.10.1.254/24 dev eth0
docker exec rvm-tester ip addr add 172.10.2.254/24 dev eth0.300
docker exec rvm-tester ip addr add 172.10.2.253/24 dev eth0.400
docker exec rvm-tester ethtool -K eth0 tx off
```

Expand All @@ -374,7 +372,7 @@ Check first vlan from tester container:
status=0
for nsc in "${NSCS[@]}"
do
for vlan_if_name in eth0.100 eth0.300 eth0.400
for vlan_if_name in eth0.100 eth0.300
do
docker exec rvm-tester ping -w 1 -c 1 ${IP_ADDR[$nsc]} -I ${vlan_if_name}
if test $? -eq 0
Expand Down Expand Up @@ -416,13 +414,13 @@ do
done
```

Check vlan (300 and 400) from tester container:
Check vlan (300) from tester container:

```bash
status=0
for nsc in "${NSCS_BLUE[@]}"
do
for vlan_if_name in eth0.100 eth0 eth0.400
for vlan_if_name in eth0.100 eth0
do
docker exec rvm-tester ping -w 1 -c 1 ${IP_ADDR_BLUE[$nsc]} -I ${vlan_if_name}
if test $? -eq 0
Expand All @@ -438,15 +436,39 @@ do
done
for nsc in "${NSCS_GREEN[@]}"
do
for vlan_if_name in eth0.100 eth0 eth0.300
for vlan_if_name in eth0.100 eth0
do
docker exec rvm-tester ping -w 1 -c 1 ${IP_ADDR_GREEN[$nsc]} -I ${vlan_if_name}
if test $? -eq 0
then
status=2
fi
done
docker exec rvm-tester ping -c 1 ${IP_ADDR_GREEN[$nsc]} -I eth0.400
docker exec rvm-tester ping -c 1 ${IP_ADDR_GREEN[$nsc]} -I eth0.300
if test $? -ne 0
then
status=1
fi
done
if test ${status} -eq 1
then
false
fi
```

Delete the NSCs connected to blue-bridge network service:

```bash
kubectl delete deployment alpine-2-bg -n ns-kernel2vlan-multins-2
```

Check vlan (300) from tester container:

```bash
status=0
for nsc in "${NSCS_GREEN[@]}"
do
docker exec rvm-tester ping -c 1 ${IP_ADDR_GREEN[$nsc]} -I eth0.300
if test $? -ne 0
then
status=1
Expand Down Expand Up @@ -480,7 +502,7 @@ Check first vlan from tester container:
status=0
for nsc in "${NSCS[@]}"
do
for vlan_if_name in eth0 eth0.300 eth0.400
for vlan_if_name in eth0 eth0.300
do
docker exec rvm-tester ping -w 1 -c 1 ${IP_ADDR[$nsc]} -I ${vlan_if_name}
if test $? -eq 0
Expand Down

0 comments on commit 6db2c74

Please sign in to comment.