#!/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
	r_a bagpipe-rest-attach --attach --port netns --network-type $type --vpn-instance-id test$type --ip $ip_netns_a 
	r_b bagpipe-rest-attach --attach --port netns --network-type $type --vpn-instance-id test$type --ip $ip_netns_b 
	wait_ready
	r_a ip netns exec test$type ping -c 3 -W 2 $ip_netns_b 
	r_a bagpipe-rest-attach --detach --port netns --network-type $type --vpn-instance-id test$type --ip $ip_netns_a
	r_b bagpipe-rest-attach --detach --port netns --network-type $type --vpn-instance-id test$type --ip $ip_netns_b
done

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

clean_stop

