0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 mirror_topo_h1_create()
0027 {
0028 simple_if_init $h1 192.0.2.1/28
0029 }
0030
0031 mirror_topo_h1_destroy()
0032 {
0033 simple_if_fini $h1 192.0.2.1/28
0034 }
0035
0036 mirror_topo_h2_create()
0037 {
0038 simple_if_init $h2 192.0.2.2/28
0039 }
0040
0041 mirror_topo_h2_destroy()
0042 {
0043 simple_if_fini $h2 192.0.2.2/28
0044 }
0045
0046 mirror_topo_h3_create()
0047 {
0048 simple_if_init $h3
0049 tc qdisc add dev $h3 clsact
0050 }
0051
0052 mirror_topo_h3_destroy()
0053 {
0054 tc qdisc del dev $h3 clsact
0055 simple_if_fini $h3
0056 }
0057
0058 mirror_topo_switch_create()
0059 {
0060 ip link set dev $swp3 up
0061
0062 ip link add name br1 type bridge vlan_filtering 1
0063 ip link set dev br1 up
0064
0065 ip link set dev $swp1 master br1
0066 ip link set dev $swp1 up
0067
0068 ip link set dev $swp2 master br1
0069 ip link set dev $swp2 up
0070
0071 tc qdisc add dev $swp1 clsact
0072 }
0073
0074 mirror_topo_switch_destroy()
0075 {
0076 tc qdisc del dev $swp1 clsact
0077
0078 ip link set dev $swp1 down
0079 ip link set dev $swp2 down
0080 ip link del dev br1
0081
0082 ip link set dev $swp3 down
0083 }
0084
0085 mirror_topo_create()
0086 {
0087 mirror_topo_h1_create
0088 mirror_topo_h2_create
0089 mirror_topo_h3_create
0090
0091 mirror_topo_switch_create
0092 }
0093
0094 mirror_topo_destroy()
0095 {
0096 mirror_topo_switch_destroy
0097
0098 mirror_topo_h3_destroy
0099 mirror_topo_h2_destroy
0100 mirror_topo_h1_destroy
0101 }