| 1 |
#!/bin/bash |
| 2 |
# |
| 3 |
# This script will setup traffic between E-VPN net1 (to which VM1 is attached) |
| 4 |
# and E-VPN net2 (to which VM2 is attached) goes through an IP-VPN: |
| 5 |
# |
| 6 |
# VM1-------net1 <---- IP-VPN ----> net2-------VM2 |
| 7 |
# .1 11.0.0. 12.0.0 .1 |
| 8 |
# |
| 9 |
# Route targets: |
| 10 |
# |
| 11 |
# net1: :1 |
| 12 |
# net2: :2 |
| 13 |
# IP-VPN: :10 |
| 14 |
|
| 15 |
as=64512 |
| 16 |
|
| 17 |
source $(dirname $0)/generic-functions |
| 18 |
|
| 19 |
clean_start |
| 20 |
|
| 21 |
## |
| 22 |
## VM1: sur A |
| 23 |
## |
| 24 |
|
| 25 |
## attach on E-VPN: |
| 26 |
r_a bagpipe-rest-attach --attach --netns net1vm1 --port netns:to-vm1 --network-type evpn --vpn-instance-id net1vm1_evpn --ip 11.0.0.1 --rt $as:1 |
| 27 |
|
| 28 |
## attach on IP-VPN: |
| 29 |
MAC_VM1=$(r_a ip netns exec net1vm1 cat /sys/class/net/tovpn/address) |
| 30 |
r_a bagpipe-rest-attach --attach --port evpn:net1vm1_evpn --network-type ipvpn --vpn-instance-id net1vm1_ipvpn --ip 11.0.0.1 --mac $MAC_VM1 --rt $as:10 |
| 31 |
|
| 32 |
|
| 33 |
## |
| 34 |
## VM2: sur B |
| 35 |
## |
| 36 |
|
| 37 |
## attach on E-VPN: |
| 38 |
r_b bagpipe-rest-attach --attach --netns net2vm2 --port netns:to-vm2 --network-type evpn --vpn-instance-id net2vm2_evpn --ip 12.0.0.1 --rt $as:2 |
| 39 |
|
| 40 |
## attach on IP-VPN: |
| 41 |
MAC_VM2=$(r_b ip netns exec net2vm2 cat /sys/class/net/tovpn/address) |
| 42 |
r_b bagpipe-rest-attach --attach --port evpn:net2vm2_evpn --network-type ipvpn --vpn-instance-id net2vm2_ipvpn --ip 12.0.0.1 --mac $MAC_VM2 --rt $as:10 |
| 43 |
|
| 44 |
|
| 45 |
# |
| 46 |
# Test |
| 47 |
# |
| 48 |
|
| 49 |
wait_ready |
| 50 |
|
| 51 |
r_a ip netns exec net1vm1 ping 12.0.0.1 -c 3 |
| 52 |
|
| 53 |
|
| 54 |
r_a bagpipe-looking-glass vpns instances net1vm1_ipvpn dataplane flows |
| 55 |
r_b bagpipe-looking-glass vpns instances net2vm2_ipvpn dataplane flows |
| 56 |
|
| 57 |
r_both bagpipe-looking-glass logs |
| 58 |
|
| 59 |
clean_stop |
| 60 |
|