#!/bin/bash

ip_netns_a=2.2.2.1
ip_netns_b=2.2.2.2

source $(dirname $0)/generic-functions

clean_start

for type in ipvpn evpn; do
	echo
	echo "---------------------- $type --------------------"
	echo
	netnsa="tst${type}a"
	netnsb="tst${type}b"
	r_a ip netns delete $netnsa
	r_a bagpipe-rest-attach --attach --port netns --network-type $type --vpn-instance-id $netnsa --ip $ip_netns_a
	r_b ip netns delete $netnsb
	r_b bagpipe-rest-attach --attach --port netns --network-type $type --vpn-instance-id $netnsb --ip $ip_netns_b
	wait_ready
	r_a ip netns exec $netnsa ping -c 3 -W 4 $ip_netns_b
#	r_a bagpipe-rest-attach --detach --port netns --network-type $type --vpn-instance-id $netnsa --ip $ip_netns_a
#	r_b bagpipe-rest-attach --detach --port netns --network-type $type --vpn-instance-id $netnsb --ip $ip_netns_b
done

echo
echo "---------------------- logs --------------------"
echo
r_both bagpipe-looking-glass logs

clean_stop

