1 # $NetBSD: t_mpls_fw6.sh,v 1.2 2015/08/07 00:50:12 ozaki-r Exp $
3 # Copyright (c) 2015 The NetBSD Foundation, Inc.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 # POSSIBILITY OF SUCH DAMAGE.
28 # Test MPLS encap/decap and forwarding using INET6 as encapsulated protocol
29 # Setup four routers connected like this: R1---R2---R3---R4--
30 # Goal is to be able to ping from R1 the outermost interface of R4
31 # Disable net.inet6.ip6.forwarding, enable net.mpls.forwarding
32 # Add route on R1 in order to encapsulate into MPLS the IP6 packets with
33 # destination equal to R4 right hand side interface
34 # Add MPLS routes on R2 in order to forward frames belonging to that FEC to R3
35 # Add MPLS "POP" route on R3 for that FEC, pointing to R4
36 # Do the same for the reverse direction (R4 to R1)
37 # ping6 from R1 to R4 right hand side interface
39 # redo the test using IPv6 explicit null label
41 RUMP_SERVER1
=unix
://.
/r1
42 RUMP_SERVER2
=unix
://.
/r2
43 RUMP_SERVER3
=unix
://.
/r3
44 RUMP_SERVER4
=unix
://.
/r4
47 "-lrumpnet -lrumpnet_net -lrumpnet_netmpls -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif"
49 atf_test_case mplsfw6 cleanup
53 atf_set
"descr" "IP6/MPLS forwarding test using PHP"
54 atf_set
"require.progs" "rump_server"
61 atf_check
-s exit:0 rump_server
${RUMP_FLAGS6} ${RUMP_SERVER1}
62 atf_check
-s exit:0 rump_server
${RUMP_FLAGS6} ${RUMP_SERVER2}
63 atf_check
-s exit:0 rump_server
${RUMP_FLAGS6} ${RUMP_SERVER3}
64 atf_check
-s exit:0 rump_server
${RUMP_FLAGS6} ${RUMP_SERVER4}
70 # Setup the first server
71 export RUMP_SERVER
=${RUMP_SERVER1}
72 atf_check
-s exit:0 rump.ifconfig shmif0 create
73 atf_check
-s exit:0 rump.ifconfig shmif0 linkstr .
/shdom1
74 atf_check
-s exit:0 rump.ifconfig shmif0 inet6 fd00
:1234::1/64 alias
75 atf_check
-s exit:0 rump.ifconfig mpls0 create up
76 atf_check
-s exit:0 rump.sysctl
-q -w net.mpls.accept
=1
77 atf_check
-s exit:0 rump.sysctl
-q -w net.inet6.ip6.forwarding
=0
78 atf_check
-s exit:0 rump.route
-q add
-inet6 fd00
:1234:0:3::/64 \
80 -ifp mpls0
-tag 25 -inet6 fd00
:1234::2
82 # Setup the second server
83 export RUMP_SERVER
=${RUMP_SERVER2}
84 atf_check
-s exit:0 rump.ifconfig shmif0 create
85 atf_check
-s exit:0 rump.ifconfig shmif0 linkstr .
/shdom1
86 atf_check
-s exit:0 rump.ifconfig shmif0 inet6 fd00
:1234::2/64 alias
87 atf_check
-s exit:0 rump.ifconfig shmif1 create
88 atf_check
-s exit:0 rump.ifconfig shmif1 linkstr .
/shdom2
89 atf_check
-s exit:0 rump.ifconfig shmif1 inet6 fd00
:1234:0:1::1/64 alias
90 atf_check
-s exit:0 rump.ifconfig mpls0 create up
91 atf_check
-s exit:0 rump.sysctl
-q -w net.mpls.accept
=1
92 atf_check
-s exit:0 rump.sysctl
-q -w net.mpls.forwarding
=1
93 atf_check
-s exit:0 rump.sysctl
-q -w net.inet6.ip6.forwarding
=0
94 atf_check
-s exit:0 rump.route
-q add
-mpls 25 -tag 30 \
95 -inet6 fd00
:1234:0:1::2
96 atf_check
-s exit:0 rump.route
-q add
-mpls 27 -tag ${1} -inet6 \
99 # Setup the third server
100 export RUMP_SERVER
=${RUMP_SERVER3}
101 atf_check
-s exit:0 rump.ifconfig shmif0 create
102 atf_check
-s exit:0 rump.ifconfig shmif0 linkstr .
/shdom2
103 atf_check
-s exit:0 rump.ifconfig shmif0 inet6 fd00
:1234:0:1::2/64 alias
104 atf_check
-s exit:0 rump.ifconfig shmif1 create
105 atf_check
-s exit:0 rump.ifconfig shmif1 linkstr .
/shdom3
106 atf_check
-s exit:0 rump.ifconfig shmif1 inet6 fd00
:1234:0:2::1/64 alias
107 atf_check
-s exit:0 rump.ifconfig mpls0 create up
108 atf_check
-s exit:0 rump.sysctl
-q -w net.mpls.accept
=1
109 atf_check
-s exit:0 rump.sysctl
-q -w net.mpls.forwarding
=1
110 atf_check
-s exit:0 rump.sysctl
-q -w net.inet6.ip6.forwarding
=0
111 atf_check
-s exit:0 rump.route
-q add
-mpls 30 -tag ${1} \
112 -inet6 fd00
:1234:0:2::2
113 atf_check
-s exit:0 rump.route
-q add
-mpls 26 -tag 27 \
114 -inet6 fd00
:1234:0:1::1
116 # Setup the fourth server
117 export RUMP_SERVER
=${RUMP_SERVER4}
118 atf_check
-s exit:0 rump.ifconfig shmif0 create
119 atf_check
-s exit:0 rump.ifconfig shmif0 linkstr .
/shdom3
120 atf_check
-s exit:0 rump.ifconfig shmif0 inet6 fd00
:1234:0:2::2/64 alias
121 atf_check
-s exit:0 rump.ifconfig shmif1 create
122 atf_check
-s exit:0 rump.ifconfig shmif1 linkstr .
/shdom4
123 atf_check
-s exit:0 rump.ifconfig shmif1 inet6 fd00
:1234:0:3::1/64 alias
124 atf_check
-s exit:0 rump.ifconfig mpls0 create up
125 atf_check
-s exit:0 rump.sysctl
-q -w net.mpls.accept
=1
126 atf_check
-s exit:0 rump.sysctl
-q -w net.inet6.ip6.forwarding
=0
127 atf_check
-s exit:0 rump.route
-q add
-inet6 fd00
:1234::/64 \
128 -ifa fd00
:1234:0:2::2 \
129 -ifp mpls0
-tag 26 -inet6 fd00
:1234:0:2::1
137 export RUMP_SERVER
=${RUMP_SERVER1}
138 atf_check
-s exit:0 \
139 -o match
:" bytes from fd00:1234::2, icmp_seq=" \
140 rump.ping6
-n -o -X 2 fd00
:1234::2
141 export RUMP_SERVER
=${RUMP_SERVER2}
142 atf_check
-s exit:0 \
143 -o match
:" bytes from fd00:1234:0:1::2, icmp_seq=" \
144 rump.ping6
-n -o -X 2 fd00
:1234:0:1::2
145 export RUMP_SERVER
=${RUMP_SERVER3}
146 atf_check
-s exit:0 \
147 -o match
:" bytes from fd00:1234:0:2::2, icmp_seq=" \
148 rump.ping6
-n -o -X 2 fd00
:1234:0:2::2
149 export RUMP_SERVER
=${RUMP_SERVER1}
150 atf_check
-s exit:0 \
151 -o match
:" bytes from fd00:1234:0:3::1, icmp_seq=" \
152 rump.ping6
-n -o -X 2 fd00
:1234:0:3::1
159 export RUMP_SERVER
=${RUMP_SERVER1}
160 atf_check
-s exit:0 \
161 -o match
:"^fd00:1234:0:3::/64.+fd00:1234::2.+25.+mpls0" \
169 RUMP_SERVER
=${RUMP_SERVER1} rump.halt
170 RUMP_SERVER
=${RUMP_SERVER2} rump.halt
171 RUMP_SERVER
=${RUMP_SERVER3} rump.halt
172 RUMP_SERVER
=${RUMP_SERVER4} rump.halt
191 atf_test_case mplsfw6_expl cleanup
195 atf_set
"descr" "IP6/MPLS forwarding test using explicit NULL labels"
196 atf_set
"require.progs" "rump_server"
208 mplsfw6_expl_cleanup
()
215 atf_init_test_cases
()
218 atf_add_test_case mplsfw6
219 atf_add_test_case mplsfw6_expl