Home | History | Annotate | Line # | Download | only in if_vlan
t_vlan.sh revision 1.1.2.2
      1  1.1.2.2  pgoyette #	$NetBSD: t_vlan.sh,v 1.1.2.2 2017/01/07 08:56:56 pgoyette Exp $
      2  1.1.2.2  pgoyette #
      3  1.1.2.2  pgoyette # Copyright (c) 2016 Internet Initiative Japan Inc.
      4  1.1.2.2  pgoyette # All rights reserved.
      5  1.1.2.2  pgoyette #
      6  1.1.2.2  pgoyette # Redistribution and use in source and binary forms, with or without
      7  1.1.2.2  pgoyette # modification, are permitted provided that the following conditions
      8  1.1.2.2  pgoyette # are met:
      9  1.1.2.2  pgoyette # 1. Redistributions of source code must retain the above copyright
     10  1.1.2.2  pgoyette #    notice, this list of conditions and the following disclaimer.
     11  1.1.2.2  pgoyette # 2. Redistributions in binary form must reproduce the above copyright
     12  1.1.2.2  pgoyette #    notice, this list of conditions and the following disclaimer in the
     13  1.1.2.2  pgoyette #    documentation and/or other materials provided with the distribution.
     14  1.1.2.2  pgoyette #
     15  1.1.2.2  pgoyette # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     16  1.1.2.2  pgoyette # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     17  1.1.2.2  pgoyette # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     18  1.1.2.2  pgoyette # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     19  1.1.2.2  pgoyette # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20  1.1.2.2  pgoyette # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21  1.1.2.2  pgoyette # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22  1.1.2.2  pgoyette # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23  1.1.2.2  pgoyette # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24  1.1.2.2  pgoyette # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     25  1.1.2.2  pgoyette # POSSIBILITY OF SUCH DAMAGE.
     26  1.1.2.2  pgoyette #
     27  1.1.2.2  pgoyette 
     28  1.1.2.2  pgoyette BUS=bus
     29  1.1.2.2  pgoyette SOCK_LOCAL=unix://commsock1
     30  1.1.2.2  pgoyette SOCK_REMOTE=unix://commsock2
     31  1.1.2.2  pgoyette IP_LOCAL=10.0.0.1
     32  1.1.2.2  pgoyette IP_REMOTE=10.0.0.2
     33  1.1.2.2  pgoyette 
     34  1.1.2.2  pgoyette DEBUG=${DEBUG:-false}
     35  1.1.2.2  pgoyette 
     36  1.1.2.2  pgoyette atf_test_case vlan_create_destroy cleanup
     37  1.1.2.2  pgoyette vlan_create_destroy_head()
     38  1.1.2.2  pgoyette {
     39  1.1.2.2  pgoyette 
     40  1.1.2.2  pgoyette 	atf_set "descr" "tests of creation and deletion of vlan interface"
     41  1.1.2.2  pgoyette 	atf_set "require.progs" "rump_server"
     42  1.1.2.2  pgoyette }
     43  1.1.2.2  pgoyette 
     44  1.1.2.2  pgoyette vlan_create_destroy_body()
     45  1.1.2.2  pgoyette {
     46  1.1.2.2  pgoyette 
     47  1.1.2.2  pgoyette 	rump_server_start $SOCK_LOCAL vlan
     48  1.1.2.2  pgoyette 
     49  1.1.2.2  pgoyette 	export RUMP_SERVER=${SOCK_LOCAL}
     50  1.1.2.2  pgoyette 
     51  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig vlan0 create
     52  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig vlan0 up
     53  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig vlan0 down
     54  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig vlan0 destroy
     55  1.1.2.2  pgoyette }
     56  1.1.2.2  pgoyette 
     57  1.1.2.2  pgoyette vlan_create_destroy_cleanup()
     58  1.1.2.2  pgoyette {
     59  1.1.2.2  pgoyette 
     60  1.1.2.2  pgoyette 	$DEBUG && dump
     61  1.1.2.2  pgoyette 	cleanup
     62  1.1.2.2  pgoyette }
     63  1.1.2.2  pgoyette 
     64  1.1.2.2  pgoyette atf_test_case vlan_basic cleanup
     65  1.1.2.2  pgoyette vlan_basic_head()
     66  1.1.2.2  pgoyette {
     67  1.1.2.2  pgoyette 
     68  1.1.2.2  pgoyette 	atf_set "descr" "tests of communications over vlan interfaces"
     69  1.1.2.2  pgoyette 	atf_set "require.progs" "rump_server"
     70  1.1.2.2  pgoyette }
     71  1.1.2.2  pgoyette 
     72  1.1.2.2  pgoyette vlan_basic_body()
     73  1.1.2.2  pgoyette {
     74  1.1.2.2  pgoyette 
     75  1.1.2.2  pgoyette 	rump_server_start $SOCK_LOCAL vlan
     76  1.1.2.2  pgoyette 	rump_server_add_iface $SOCK_LOCAL shmif0 $BUS
     77  1.1.2.2  pgoyette 	rump_server_start $SOCK_REMOTE vlan
     78  1.1.2.2  pgoyette 	rump_server_add_iface $SOCK_REMOTE shmif0 $BUS
     79  1.1.2.2  pgoyette 
     80  1.1.2.2  pgoyette 	export RUMP_SERVER=$SOCK_LOCAL
     81  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig shmif0 up
     82  1.1.2.2  pgoyette 	export RUMP_SERVER=$SOCK_REMOTE
     83  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig shmif0 up
     84  1.1.2.2  pgoyette 
     85  1.1.2.2  pgoyette 	export RUMP_SERVER=$SOCK_LOCAL
     86  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig vlan0 create
     87  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
     88  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig vlan0 $IP_LOCAL/24
     89  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig vlan0 up
     90  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig -w 10
     91  1.1.2.2  pgoyette 
     92  1.1.2.2  pgoyette 	export RUMP_SERVER=$SOCK_REMOTE
     93  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig vlan0 create
     94  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
     95  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig vlan0 $IP_REMOTE/24
     96  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig vlan0 up
     97  1.1.2.2  pgoyette 	atf_check -s exit:0 rump.ifconfig -w 10
     98  1.1.2.2  pgoyette 
     99  1.1.2.2  pgoyette 	export RUMP_SERVER=$SOCK_LOCAL
    100  1.1.2.2  pgoyette 	atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP_REMOTE
    101  1.1.2.2  pgoyette }
    102  1.1.2.2  pgoyette 
    103  1.1.2.2  pgoyette vlan_basic_cleanup()
    104  1.1.2.2  pgoyette {
    105  1.1.2.2  pgoyette 
    106  1.1.2.2  pgoyette 	$DEBUG && dump
    107  1.1.2.2  pgoyette 	cleanup
    108  1.1.2.2  pgoyette }
    109  1.1.2.2  pgoyette 
    110  1.1.2.2  pgoyette atf_init_test_cases()
    111  1.1.2.2  pgoyette {
    112  1.1.2.2  pgoyette 
    113  1.1.2.2  pgoyette 	atf_add_test_case vlan_create_destroy
    114  1.1.2.2  pgoyette 	atf_add_test_case vlan_basic
    115  1.1.2.2  pgoyette }
    116